Title: [228274] trunk/Source/WebCore
- Revision
- 228274
- Author
- [email protected]
- Date
- 2018-02-08 07:40:21 -0800 (Thu, 08 Feb 2018)
Log Message
[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: trunk/Source/WebCore/ChangeLog (228273 => 228274)
--- trunk/Source/WebCore/ChangeLog 2018-02-08 15:10:57 UTC (rev 228273)
+++ trunk/Source/WebCore/ChangeLog 2018-02-08 15:40:21 UTC (rev 228274)
@@ -1,3 +1,25 @@
+2018-02-08 Zalan Bujtas <[email protected]>
+
+ [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 <[email protected]>
[GStreamer] LayoutTest webaudio/silent-audio-interrupted-in-background.html makes its subsequent test flaky crash
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (228273 => 228274)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2018-02-08 15:10:57 UTC (rev 228273)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2018-02-08 15:40:21 UTC (rev 228274)
@@ -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: trunk/Source/WebCore/rendering/RenderElement.h (228273 => 228274)
--- trunk/Source/WebCore/rendering/RenderElement.h 2018-02-08 15:10:57 UTC (rev 228273)
+++ trunk/Source/WebCore/rendering/RenderElement.h 2018-02-08 15:40:21 UTC (rev 228274)
@@ -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: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (228273 => 228274)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2018-02-08 15:10:57 UTC (rev 228273)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2018-02-08 15:40:21 UTC (rev 228274)
@@ -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: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.h (228273 => 228274)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.h 2018-02-08 15:10:57 UTC (rev 228273)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.h 2018-02-08 15:40:21 UTC (rev 228274)
@@ -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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes