Title: [204768] releases/WebKitGTK/webkit-2.12/Source/WebCore
Revision
204768
Author
carlo...@webkit.org
Date
2016-08-22 23:59:19 -0700 (Mon, 22 Aug 2016)

Log Message

Merge r201985 - Cleanup RenderBlock::removePositionedObjects
https://bugs.webkit.org/show_bug.cgi?id=158670

Reviewed by Simon Fraser.

No change in functionality.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::insertPositionedObject):
(WebCore::RenderBlock::removePositionedObject):
(WebCore::RenderBlock::removePositionedObjects):
* rendering/RenderBlock.h:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog (204767 => 204768)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog	2016-08-23 06:52:44 UTC (rev 204767)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog	2016-08-23 06:59:19 UTC (rev 204768)
@@ -1,5 +1,20 @@
 2016-06-12  Zalan Bujtas  <za...@apple.com>
 
+        Cleanup RenderBlock::removePositionedObjects
+        https://bugs.webkit.org/show_bug.cgi?id=158670
+
+        Reviewed by Simon Fraser.
+
+        No change in functionality.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::insertPositionedObject):
+        (WebCore::RenderBlock::removePositionedObject):
+        (WebCore::RenderBlock::removePositionedObjects):
+        * rendering/RenderBlock.h:
+
+2016-06-12  Zalan Bujtas  <za...@apple.com>
+
         Remove positioned descendants when RenderBlock is no longer a containing block.
         https://bugs.webkit.org/show_bug.cgi?id=158655
         <rdar://problem/26510032>

Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderBlock.cpp (204767 => 204768)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderBlock.cpp	2016-08-23 06:52:44 UTC (rev 204767)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderBlock.cpp	2016-08-23 06:59:19 UTC (rev 204768)
@@ -2183,49 +2183,44 @@
     return nullptr;
 }
 
-void RenderBlock::insertPositionedObject(RenderBox& o)
+void RenderBlock::insertPositionedObject(RenderBox& positioned)
 {
     ASSERT(!isAnonymousBlock());
 
-    if (o.isRenderFlowThread())
+    if (positioned.isRenderFlowThread())
         return;
     
-    insertIntoTrackedRendererMaps(o, gPositionedDescendantsMap, gPositionedContainerMap, isRenderView());
+    insertIntoTrackedRendererMaps(positioned, gPositionedDescendantsMap, gPositionedContainerMap, isRenderView());
 }
 
-void RenderBlock::removePositionedObject(RenderBox& o)
+void RenderBlock::removePositionedObject(RenderBox& rendererToRemove)
 {
-    removeFromTrackedRendererMaps(o, gPositionedDescendantsMap, gPositionedContainerMap);
+    removeFromTrackedRendererMaps(rendererToRemove, gPositionedDescendantsMap, gPositionedContainerMap);
 }
 
-void RenderBlock::removePositionedObjects(RenderBlock* o, ContainingBlockState containingBlockState)
+void RenderBlock::removePositionedObjects(const RenderBlock* newContainingBlockCandidate, ContainingBlockState containingBlockState)
 {
-    TrackedRendererListHashSet* positionedDescendants = positionedObjects();
+    auto* positionedDescendants = positionedObjects();
     if (!positionedDescendants)
         return;
     
-    Vector<RenderBox*, 16> deadObjects;
-
-    for (auto it = positionedDescendants->begin(), end = positionedDescendants->end(); it != end; ++it) {
-        RenderBox* r = *it;
-        if (!o || r->isDescendantOf(o)) {
-            if (containingBlockState == NewContainingBlock)
-                r->setChildNeedsLayout(MarkOnlyThis);
-            
-            // It is parent blocks job to add positioned child to positioned objects list of its containing block
-            // Parent layout needs to be invalidated to ensure this happens.
-            RenderElement* p = r->parent();
-            while (p && !p->isRenderBlock())
-                p = p->parent();
-            if (p)
-                p->setChildNeedsLayout();
-            
-            deadObjects.append(r);
-        }
+    Vector<RenderBox*, 16> renderersToRemove;
+    for (auto* renderer : *positionedDescendants) {
+        if (newContainingBlockCandidate && !renderer->isDescendantOf(newContainingBlockCandidate))
+            continue;
+        renderersToRemove.append(renderer);
+        if (containingBlockState == NewContainingBlock)
+            renderer->setChildNeedsLayout(MarkOnlyThis);
+        // It is the parent block's job to add positioned children to positioned objects list of its containing block.
+        // Dirty the parent to ensure this happens.
+        auto* parent = renderer->parent();
+        while (parent && !parent->isRenderBlock())
+            parent = parent->parent();
+        if (parent)
+            parent->setChildNeedsLayout();
     }
-    
-    for (unsigned i = 0; i < deadObjects.size(); i++)
-        removePositionedObject(*deadObjects.at(i));
+    for (auto* renderer : renderersToRemove)
+        removePositionedObject(*renderer);
 }
 
 void RenderBlock::addPercentHeightDescendant(RenderBox& descendant)

Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderBlock.h (204767 => 204768)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderBlock.h	2016-08-23 06:52:44 UTC (rev 204767)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderBlock.h	2016-08-23 06:59:19 UTC (rev 204768)
@@ -84,7 +84,7 @@
 
     void insertPositionedObject(RenderBox&);
     static void removePositionedObject(RenderBox&);
-    void removePositionedObjects(RenderBlock*, ContainingBlockState = SameContainingBlock);
+    void removePositionedObjects(const RenderBlock*, ContainingBlockState = SameContainingBlock);
 
     TrackedRendererListHashSet* positionedObjects() const;
     bool hasPositionedObjects() const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to