Title: [281244] trunk/Source/WebCore
Revision
281244
Author
simon.fra...@apple.com
Date
2021-08-19 09:26:00 -0700 (Thu, 19 Aug 2021)

Log Message

Avoid DOMRect overhead in VTTRegion
https://bugs.webkit.org/show_bug.cgi?id=229249

Reviewed by Eric Carlson.

Use Element::boundingClientRect() instead of Element::getBoundingClientRect() to
avoid DOMRect overhead. No behavior change.

* html/track/VTTRegion.cpp:
(WebCore::VTTRegion::displayLastTextTrackCueBox):
(WebCore::VTTRegion::willRemoveTextTrackCueBox):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (281243 => 281244)


--- trunk/Source/WebCore/ChangeLog	2021-08-19 16:23:36 UTC (rev 281243)
+++ trunk/Source/WebCore/ChangeLog	2021-08-19 16:26:00 UTC (rev 281244)
@@ -1,3 +1,17 @@
+2021-08-19  Simon Fraser  <simon.fra...@apple.com>
+
+        Avoid DOMRect overhead in VTTRegion
+        https://bugs.webkit.org/show_bug.cgi?id=229249
+
+        Reviewed by Eric Carlson.
+
+        Use Element::boundingClientRect() instead of Element::getBoundingClientRect() to
+        avoid DOMRect overhead. No behavior change.
+
+        * html/track/VTTRegion.cpp:
+        (WebCore::VTTRegion::displayLastTextTrackCueBox):
+        (WebCore::VTTRegion::willRemoveTextTrackCueBox):
+
 2021-08-19  Antti Koivisto  <an...@apple.com>
 
         TextDecorationPainter should not depend on LegacyInlineTextBox

Modified: trunk/Source/WebCore/html/track/VTTRegion.cpp (281243 => 281244)


--- trunk/Source/WebCore/html/track/VTTRegion.cpp	2021-08-19 16:23:36 UTC (rev 281243)
+++ trunk/Source/WebCore/html/track/VTTRegion.cpp	2021-08-19 16:26:00 UTC (rev 281244)
@@ -304,13 +304,13 @@
     if (isScrollingRegion())
         m_cueContainer->classList().add(textTrackCueContainerScrollingClass());
 
-    float regionBottom = m_regionDisplayTree->getBoundingClientRect()->bottom();
+    float regionBottom = m_regionDisplayTree->boundingClientRect().maxY();
 
     // Find first cue that is not entirely displayed and scroll it upwards.
     for (auto& child : childrenOfType<Element>(*m_cueContainer)) {
-        auto rect = child.getBoundingClientRect();
-        float childTop = rect->top();
-        float childBottom = rect->bottom();
+        auto rect = child.boundingClientRect();
+        float childTop = rect.y();
+        float childBottom = rect.maxY();
 
         if (regionBottom >= childBottom)
             continue;
@@ -330,7 +330,7 @@
     LOG(Media, "VTTRegion::willRemoveTextTrackCueBox");
     ASSERT(m_cueContainer->contains(box));
 
-    double boxHeight = box->getBoundingClientRect()->bottom() - box->getBoundingClientRect()->top();
+    double boxHeight = box->boundingClientRect().height();
 
     m_cueContainer->classList().remove(textTrackCueContainerScrollingClass());
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to