Title: [270388] trunk/Source/WebCore
Revision
270388
Author
[email protected]
Date
2020-12-02 23:38:58 -0800 (Wed, 02 Dec 2020)

Log Message

Remove m_reversedOrderIteratorForHitTesting
https://bugs.webkit.org/show_bug.cgi?id=218554

Patch by Rob Buis <[email protected]> on 2020-12-02
Reviewed by Zalan Bujtas.

Remove m_reversedOrderIteratorForHitTesting as
determining it at hit test time should not be very expensive.

* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::hitTestChildren):
(WebCore::RenderFlexibleBox::layoutFlexItems):
* rendering/RenderFlexibleBox.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270387 => 270388)


--- trunk/Source/WebCore/ChangeLog	2020-12-03 05:06:54 UTC (rev 270387)
+++ trunk/Source/WebCore/ChangeLog	2020-12-03 07:38:58 UTC (rev 270388)
@@ -1,3 +1,18 @@
+2020-12-02  Rob Buis  <[email protected]>
+
+        Remove m_reversedOrderIteratorForHitTesting
+        https://bugs.webkit.org/show_bug.cgi?id=218554
+
+        Reviewed by Zalan Bujtas.
+
+        Remove m_reversedOrderIteratorForHitTesting as
+        determining it at hit test time should not be very expensive.
+
+        * rendering/RenderFlexibleBox.cpp:
+        (WebCore::RenderFlexibleBox::hitTestChildren):
+        (WebCore::RenderFlexibleBox::layoutFlexItems):
+        * rendering/RenderFlexibleBox.h:
+
 2020-12-02  Fujii Hironori  <[email protected]>
 
         GraphicsContextGL: Remove unused platformTexture and platformGraphicsContextGL interface

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (270387 => 270388)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2020-12-03 05:06:54 UTC (rev 270387)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp	2020-12-03 07:38:58 UTC (rev 270388)
@@ -239,7 +239,16 @@
 
     LayoutPoint scrolledOffset = hasOverflowClip() ? adjustedLocation - toLayoutSize(scrollPosition()) : adjustedLocation;
 
-    for (auto* child : m_reversedOrderIteratorForHitTesting) {
+    // If collecting the children in reverse order is bad for performance, this Vector could be determined at layout time.
+    Vector<RenderBox*> reversedOrderIteratorForHitTesting;
+    for (auto* child = m_orderIterator.first(); child; child = m_orderIterator.next()) {
+        if (m_orderIterator.shouldSkipChild(*child))
+            continue;
+        reversedOrderIteratorForHitTesting.append(child);
+    }
+    reversedOrderIteratorForHitTesting.reverse();
+
+    for (auto* child : reversedOrderIteratorForHitTesting) {
         if (child->hasSelfPaintingLayer())
             continue;
         auto childPoint = flipForWritingModeForChild(child, scrolledOffset);
@@ -890,9 +899,7 @@
     // Set up our master list of flex items. All of the rest of the algorithm
     // should work off this list of a subset.
     // TODO(cbiesinger): That second part is not yet true.
-    // Also initialize the reversed order iterator that would be eventually used for hit testing.
     Vector<FlexItem> allItems;
-    m_reversedOrderIteratorForHitTesting.clear();
     m_orderIterator.first();
     for (RenderBox* child = m_orderIterator.currentChild(); child; child = m_orderIterator.next()) {
         if (m_orderIterator.shouldSkipChild(*child)) {
@@ -901,10 +908,8 @@
                 prepareChildForPositionedLayout(*child);
             continue;
         }
-        m_reversedOrderIteratorForHitTesting.append(child);
         allItems.append(constructFlexItem(*child, relayoutChildren));
     }
-    m_reversedOrderIteratorForHitTesting.reverse();
 
     // constructFlexItem() might set the override containing block height so any value cached for definiteness might be incorrect.
     m_hasDefiniteHeight = SizeDefiniteness::Unknown;

Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.h (270387 => 270388)


--- trunk/Source/WebCore/rendering/RenderFlexibleBox.h	2020-12-03 05:06:54 UTC (rev 270387)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.h	2020-12-03 07:38:58 UTC (rev 270388)
@@ -212,7 +212,6 @@
     HashSet<const RenderBox*> m_relaidOutChildren;
     
     mutable OrderIterator m_orderIterator { *this };
-    Vector<RenderBox*> m_reversedOrderIteratorForHitTesting;
     int m_numberOfInFlowChildrenOnFirstLine { -1 };
     
     // This is SizeIsUnknown outside of layoutBlock()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to