Title: [228665] releases/WebKitGTK/webkit-2.20/Source/WebCore
Revision
228665
Author
carlo...@webkit.org
Date
2018-02-19 05:17:03 -0800 (Mon, 19 Feb 2018)

Log Message

Merge r228274 - [RenderTreeBuilder] Move RenderElement::removeAnonymousWrappersForInlinesIfNecessary to RenderTreeBuilder
https://bugs.webkit.org/show_bug.cgi?id=182582
<rdar://problem/37327890>

Reviewed by Antti Koivisto.

Tree mutation -> RenderTreeBuilder.

No change in functionality

* rendering/RenderElement.cpp:
(WebCore::RenderElement::styleDidChange):
(WebCore::RenderElement::removeAnonymousWrappersForInlinesIfNecessary): Deleted.
* rendering/RenderElement.h:
* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::removeAnonymousWrappersForInlinesIfNecessary):
(WebCore::RenderTreeBuilder::childFlowStateChangesAndNoLongerAffectsParentBlock):
(WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
* rendering/updating/RenderTreeBuilder.h:

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog (228664 => 228665)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog	2018-02-19 13:16:58 UTC (rev 228664)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog	2018-02-19 13:17:03 UTC (rev 228665)
@@ -1,3 +1,25 @@
+2018-02-08  Zalan Bujtas  <za...@apple.com>
+
+        [RenderTreeBuilder] Move RenderElement::removeAnonymousWrappersForInlinesIfNecessary to RenderTreeBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=182582
+        <rdar://problem/37327890>
+
+        Reviewed by Antti Koivisto.
+
+        Tree mutation -> RenderTreeBuilder.
+
+        No change in functionality
+
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::styleDidChange):
+        (WebCore::RenderElement::removeAnonymousWrappersForInlinesIfNecessary): Deleted.
+        * rendering/RenderElement.h:
+        * rendering/updating/RenderTreeBuilder.cpp:
+        (WebCore::removeAnonymousWrappersForInlinesIfNecessary):
+        (WebCore::RenderTreeBuilder::childFlowStateChangesAndNoLongerAffectsParentBlock):
+        (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
+        * rendering/updating/RenderTreeBuilder.h:
+
 2018-02-08  Philippe Normand  <pnorm...@igalia.com>
 
         [GStreamer] LayoutTest webaudio/silent-audio-interrupted-in-background.html makes its subsequent test flaky crash

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/RenderElement.cpp (228664 => 228665)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/RenderElement.cpp	2018-02-19 13:16:58 UTC (rev 228664)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/RenderElement.cpp	2018-02-19 13:17:03 UTC (rev 228665)
@@ -915,35 +915,6 @@
         view().frameView().updateExtendBackgroundIfNecessary();
 }
 
-void RenderElement::removeAnonymousWrappersForInlinesIfNecessary()
-{
-    // FIXME: Move to RenderBlock.
-    if (!is<RenderBlock>(*this))
-        return;
-    RenderBlock& thisBlock = downcast<RenderBlock>(*this);
-    if (!thisBlock.canDropAnonymousBlockChild())
-        return;
-
-    // We have changed to floated or out-of-flow positioning so maybe all our parent's
-    // children can be inline now. Bail if there are any block children left on the line,
-    // otherwise we can proceed to stripping solitary anonymous wrappers from the inlines.
-    // FIXME: We should also handle split inlines here - we exclude them at the moment by returning
-    // if we find a continuation.
-    RenderObject* current = firstChild();
-    while (current && ((current->isAnonymousBlock() && !downcast<RenderBlock>(*current).isContinuation()) || current->style().isFloating() || current->style().hasOutOfFlowPosition()))
-        current = current->nextSibling();
-
-    if (current)
-        return;
-
-    RenderObject* next;
-    for (current = firstChild(); current; current = next) {
-        next = current->nextSibling();
-        if (current->isAnonymousBlock())
-            thisBlock.dropAnonymousBoxChild(downcast<RenderBlock>(*current));
-    }
-}
-
 #if !PLATFORM(IOS)
 static bool areNonIdenticalCursorListsEqual(const RenderStyle* a, const RenderStyle* b)
 {
@@ -975,7 +946,7 @@
     }
 
     if (s_noLongerAffectsParentBlock)
-        parent()->removeAnonymousWrappersForInlinesIfNecessary();
+        RenderTreeBuilder::current()->childFlowStateChangesAndNoLongerAffectsParentBlock(*this);
 
     SVGRenderSupport::styleChanged(*this, oldStyle);
 

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/RenderElement.h (228664 => 228665)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/RenderElement.h	2018-02-19 13:16:58 UTC (rev 228664)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/RenderElement.h	2018-02-19 13:17:03 UTC (rev 228665)
@@ -220,8 +220,6 @@
     // the child.
     virtual void updateAnonymousChildStyle(RenderStyle&) const { };
 
-    void removeAnonymousWrappersForInlinesIfNecessary();
-
     bool hasContinuationChainNode() const { return m_hasContinuationChainNode; }
     bool isContinuation() const { return m_isContinuation; }
     void setIsContinuation() { m_isContinuation = true; }

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (228664 => 228665)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2018-02-19 13:16:58 UTC (rev 228664)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2018-02-19 13:17:03 UTC (rev 228665)
@@ -318,6 +318,40 @@
     }
 }
 
+void RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded(RenderElement& parent)
+{
+    if (!is<RenderBlock>(parent))
+        return;
+    auto& blockParent = downcast<RenderBlock>(parent);
+    if (!blockParent.canDropAnonymousBlockChild())
+        return;
+
+    // We have changed to floated or out-of-flow positioning so maybe all our parent's
+    // children can be inline now. Bail if there are any block children left on the line,
+    // otherwise we can proceed to stripping solitary anonymous wrappers from the inlines.
+    // FIXME: We should also handle split inlines here - we exclude them at the moment by returning
+    // if we find a continuation.
+    auto* current = blockParent.firstChild();
+    while (current && ((current->isAnonymousBlock() && !downcast<RenderBlock>(*current).isContinuation()) || current->style().isFloating() || current->style().hasOutOfFlowPosition()))
+        current = current->nextSibling();
+
+    if (current)
+        return;
+
+    RenderObject* next;
+    for (current = blockParent.firstChild(); current; current = next) {
+        next = current->nextSibling();
+        if (current->isAnonymousBlock())
+            blockParent.dropAnonymousBoxChild(downcast<RenderBlock>(*current));
+    }
+}
+
+void RenderTreeBuilder::childFlowStateChangesAndNoLongerAffectsParentBlock(RenderElement& child)
+{
+    ASSERT(child.parent());
+    removeAnonymousWrappersForInlineChildrenIfNeeded(*child.parent());
+}
+
 static bool isAnonymousAndSafeToDelete(RenderElement& element)
 {
     if (!element.isAnonymous())
@@ -359,7 +393,7 @@
 
     auto& destroyRootParent = *destroyRoot.parent();
     destroyRootParent.removeAndDestroyChild(*this, destroyRoot);
-    destroyRootParent.removeAnonymousWrappersForInlinesIfNecessary();
+    removeAnonymousWrappersForInlineChildrenIfNeeded(destroyRootParent);
 
     // Anonymous parent might have become empty, try to delete it too.
     if (isAnonymousAndSafeToDelete(destroyRootParent) && !destroyRootParent.firstChild())

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilder.h (228664 => 228665)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilder.h	2018-02-19 13:16:58 UTC (rev 228664)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilder.h	2018-02-19 13:17:03 UTC (rev 228665)
@@ -76,6 +76,7 @@
     RenderObject* splitAnonymousBoxesAroundChild(RenderBox& parent, RenderObject* beforeChild);
     void moveRubyChildren(RenderRubyBase& from, RenderRubyBase& to);
     void childFlowStateChangesAndAffectsParentBlock(RenderElement& child);
+    void childFlowStateChangesAndNoLongerAffectsParentBlock(RenderElement& child);
     RenderObject* resolveMovedChildForMultiColumnFlow(RenderFragmentedFlow& enclosingFragmentedFlow, RenderObject* beforeChild);
     void removeFromParentAndDestroyCleaningUpAnonymousWrappers(RenderObject& child);
 
@@ -92,6 +93,8 @@
     class SVG;
     class MathML;
 
+    void removeAnonymousWrappersForInlineChildrenIfNeeded(RenderElement& parent);
+
     FirstLetter& firstLetterBuilder() { return *m_firstLetterBuilder; }
     List& listBuilder() { return *m_listBuilder; }
     MultiColumn& multiColumnBuilder() { return *m_multiColumnBuilder; }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to