Diff
Modified: trunk/Source/WebCore/ChangeLog (227790 => 227791)
--- trunk/Source/WebCore/ChangeLog 2018-01-30 17:44:41 UTC (rev 227790)
+++ trunk/Source/WebCore/ChangeLog 2018-01-30 18:01:48 UTC (rev 227791)
@@ -1,3 +1,38 @@
+2018-01-30 Zalan Bujtas <[email protected]>
+
+ [RenderTreeBuilder] Move childBecameNonInline to RenderTreeBuilder
+ https://bugs.webkit.org/show_bug.cgi?id=182265
+ <rdar://problem/37004459>
+
+ Reviewed by Antti Koivisto.
+
+ Move the mutation code that wraps/unwraps a child element when its flow state changes
+ from(to) in-flow to(from) floating/out-of-flow.
+
+ No change in functionality.
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::childBecameNonInline): Deleted.
+ * rendering/RenderBlock.h:
+ * rendering/RenderBoxModelObject.h:
+ (WebCore::RenderBoxModelObject::childBecameNonInline): Deleted.
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::styleDidChange):
+ (WebCore::RenderElement::handleDynamicFloatPositionChange): Deleted.
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::childBecameNonInline): Deleted.
+ * rendering/RenderInline.h:
+ * rendering/updating/RenderTreeBuilder.cpp:
+ (WebCore::RenderTreeBuilder::childFlowStateChangesAndAffectsParentBlock):
+ (WebCore::RenderTreeBuilder::splitFlow): Deleted.
+ * rendering/updating/RenderTreeBuilder.h:
+ * rendering/updating/RenderTreeBuilderBlock.cpp:
+ (WebCore::RenderTreeBuilder::Block::childBecameNonInline):
+ * rendering/updating/RenderTreeBuilderBlock.h:
+ * rendering/updating/RenderTreeBuilderInline.cpp:
+ (WebCore::RenderTreeBuilder::Inline::childBecameNonInline):
+ * rendering/updating/RenderTreeBuilderInline.h:
+
2018-01-30 Brent Fulgham <[email protected]>
Add telemetry to track storage access API adoption
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (227790 => 227791)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2018-01-30 17:44:41 UTC (rev 227790)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2018-01-30 18:01:48 UTC (rev 227791)
@@ -2978,14 +2978,6 @@
return RenderElement::outlineStyleForRepaint();
}
-void RenderBlock::childBecameNonInline(RenderElement&)
-{
- RenderTreeBuilder::current()->makeChildrenNonInline(*this);
- if (isAnonymousBlock() && is<RenderBlock>(parent()))
- downcast<RenderBlock>(*parent()).removeLeftoverAnonymousBlock(this);
- // |this| may be dead here
-}
-
void RenderBlock::updateHitTestResult(HitTestResult& result, const LayoutPoint& point)
{
if (result.innerNode())
Modified: trunk/Source/WebCore/rendering/RenderBlock.h (227790 => 227791)
--- trunk/Source/WebCore/rendering/RenderBlock.h 2018-01-30 17:44:41 UTC (rev 227790)
+++ trunk/Source/WebCore/rendering/RenderBlock.h 2018-01-30 18:01:48 UTC (rev 227791)
@@ -466,7 +466,6 @@
RenderElement* hoverAncestor() const final;
void updateDragState(bool dragOn) final;
- void childBecameNonInline(RenderElement&) final;
LayoutRect selectionRectForRepaint(const RenderLayerModelObject* repaintContainer, bool /*clipToVisibleContent*/) final
{
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (227790 => 227791)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h 2018-01-30 17:44:41 UTC (rev 227790)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h 2018-01-30 18:01:48 UTC (rev 227791)
@@ -202,8 +202,6 @@
virtual LayoutUnit containingBlockLogicalWidthForContent() const;
- virtual void childBecameNonInline(RenderElement&) { }
-
void paintBorder(const PaintInfo&, const LayoutRect&, const RenderStyle&, BackgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
bool paintNinePieceImage(GraphicsContext&, const LayoutRect&, const RenderStyle&, const NinePieceImage&, CompositeOperator = CompositeSourceOver);
void paintBoxShadow(const PaintInfo&, const LayoutRect&, const RenderStyle&, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (227790 => 227791)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2018-01-30 17:44:41 UTC (rev 227790)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2018-01-30 18:01:48 UTC (rev 227791)
@@ -902,26 +902,6 @@
view().frameView().updateExtendBackgroundIfNecessary();
}
-void RenderElement::handleDynamicFloatPositionChange()
-{
- // We have gone from not affecting the inline status of the parent flow to suddenly
- // having an impact. See if there is a mismatch between the parent flow's
- // childrenInline() state and our state.
- setInline(style().isDisplayInlineType());
- if (isInline() != parent()->childrenInline()) {
- if (!isInline())
- downcast<RenderBoxModelObject>(*parent()).childBecameNonInline(*this);
- else {
- // An anonymous block must be made to wrap this inline.
- auto newBlock = downcast<RenderBlock>(*parent()).createAnonymousBlock();
- auto& block = *newBlock;
- parent()->insertChildInternal(WTFMove(newBlock), this);
- auto thisToMove = parent()->takeChildInternal(*this);
- block.insertChildInternal(WTFMove(thisToMove), nullptr);
- }
- }
-}
-
void RenderElement::removeAnonymousWrappersForInlinesIfNecessary()
{
// FIXME: Move to RenderBlock.
@@ -972,8 +952,14 @@
updateImage(oldStyle ? oldStyle->maskBoxImage().image() : nullptr, m_style.maskBoxImage().image());
updateShapeImage(oldStyle ? oldStyle->shapeOutside() : nullptr, m_style.shapeOutside());
- if (s_affectsParentBlock)
- handleDynamicFloatPositionChange();
+ if (s_affectsParentBlock) {
+ // We have gone from not affecting the inline status of the parent flow to suddenly
+ // having an impact. See if there is a mismatch between the parent flow's
+ // childrenInline() state and our state.
+ setInline(style().isDisplayInlineType());
+ if (isInline() != parent()->childrenInline())
+ RenderTreeBuilder::current()->childFlowStateChangesAndAffectsParentBlock(*this);
+ }
if (s_noLongerAffectsParentBlock)
parent()->removeAnonymousWrappersForInlinesIfNecessary();
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (227790 => 227791)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2018-01-30 17:44:41 UTC (rev 227790)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2018-01-30 18:01:48 UTC (rev 227791)
@@ -1036,20 +1036,6 @@
continuation->updateDragState(dragOn);
}
-void RenderInline::childBecameNonInline(RenderElement& child)
-{
- // We have to split the parent flow.
- auto newBox = containingBlock()->createAnonymousBlock();
- newBox->setIsContinuation();
- RenderBoxModelObject* oldContinuation = continuation();
- if (oldContinuation)
- oldContinuation->removeFromContinuationChain();
- newBox->insertIntoContinuationChainAfter(*this);
- RenderObject* beforeChild = child.nextSibling();
- auto removedChild = takeChildInternal(child);
- RenderTreeBuilder::current()->splitFlow(*this, beforeChild, WTFMove(newBox), WTFMove(removedChild), oldContinuation);
-}
-
void RenderInline::updateHitTestResult(HitTestResult& result, const LayoutPoint& point)
{
if (result.innerNode())
Modified: trunk/Source/WebCore/rendering/RenderInline.h (227790 => 227791)
--- trunk/Source/WebCore/rendering/RenderInline.h 2018-01-30 17:44:41 UTC (rev 227790)
+++ trunk/Source/WebCore/rendering/RenderInline.h 2018-01-30 18:01:48 UTC (rev 227791)
@@ -149,8 +149,6 @@
LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const final;
int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const final;
- void childBecameNonInline(RenderElement&) final;
-
void updateHitTestResult(HitTestResult&, const LayoutPoint&) final;
void imageChanged(WrappedImagePtr, const IntRect* = 0) final;
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (227790 => 227791)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2018-01-30 17:44:41 UTC (rev 227790)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp 2018-01-30 18:01:48 UTC (rev 227791)
@@ -300,6 +300,24 @@
return beforeChild;
}
+void RenderTreeBuilder::childFlowStateChangesAndAffectsParentBlock(RenderElement& child)
+{
+ auto* parent = child.parent();
+ if (!child.isInline()) {
+ if (is<RenderBlock>(parent))
+ blockBuilder().childBecameNonInline(downcast<RenderBlock>(*parent), child);
+ else if (is<RenderInline>(*parent))
+ inlineBuilder().childBecameNonInline(downcast<RenderInline>(*parent), child);
+ } else {
+ // An anonymous block must be made to wrap this inline.
+ auto newBlock = downcast<RenderBlock>(*parent).createAnonymousBlock();
+ auto& block = *newBlock;
+ parent->insertChildInternal(WTFMove(newBlock), &child);
+ auto thisToMove = parent->takeChildInternal(child);
+ block.insertChildInternal(WTFMove(thisToMove), nullptr);
+ }
+}
+
void RenderTreeBuilder::insertChildToRenderInline(RenderInline& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild)
{
inlineBuilder().insertChild(parent, WTFMove(child), beforeChild);
@@ -345,11 +363,6 @@
tableBuilder().insertChild(parent, WTFMove(child), beforeChild);
}
-void RenderTreeBuilder::splitFlow(RenderInline& parent, RenderObject* beforeChild, RenderPtr<RenderBlock> newBlockBox, RenderPtr<RenderObject> child, RenderBoxModelObject* oldCont)
-{
- inlineBuilder().splitFlow(parent, beforeChild, WTFMove(newBlockBox), WTFMove(child), oldCont);
-}
-
void RenderTreeBuilder::moveRubyChildren(RenderRubyBase& from, RenderRubyBase& to)
{
rubyBuilder().moveChildren(from, to);
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.h (227790 => 227791)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.h 2018-01-30 17:44:41 UTC (rev 227790)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.h 2018-01-30 18:01:48 UTC (rev 227791)
@@ -74,8 +74,8 @@
bool childRequiresTable(const RenderElement& parent, const RenderObject& child);
void makeChildrenNonInline(RenderBlock& parent, RenderObject* insertionPoint = nullptr);
RenderObject* splitAnonymousBoxesAroundChild(RenderBox& parent, RenderObject* beforeChild);
- void splitFlow(RenderInline& parent, RenderObject* beforeChild, RenderPtr<RenderBlock> newBlockBox, RenderPtr<RenderObject> child, RenderBoxModelObject* oldCont);
void moveRubyChildren(RenderRubyBase& from, RenderRubyBase& to);
+ void childFlowStateChangesAndAffectsParentBlock(RenderElement& child);
private:
class FirstLetter;
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlock.cpp (227790 => 227791)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlock.cpp 2018-01-30 17:44:41 UTC (rev 227790)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlock.cpp 2018-01-30 18:01:48 UTC (rev 227791)
@@ -197,4 +197,12 @@
// parent object may be dead here
}
+void RenderTreeBuilder::Block::childBecameNonInline(RenderBlock& parent, RenderElement&)
+{
+ m_builder.makeChildrenNonInline(parent);
+ if (parent.isAnonymousBlock() && is<RenderBlock>(parent.parent()))
+ downcast<RenderBlock>(*parent.parent()).removeLeftoverAnonymousBlock(&parent);
+ // parent may be dead here
}
+
+}
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlock.h (227790 => 227791)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlock.h 2018-01-30 17:44:41 UTC (rev 227790)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlock.h 2018-01-30 18:01:48 UTC (rev 227791)
@@ -36,6 +36,8 @@
void insertChild(RenderBlock& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild);
void insertChildIgnoringContinuation(RenderBlock& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild);
+ void childBecameNonInline(RenderBlock& parent, RenderElement& child);
+
private:
void insertChildToContinuation(RenderBlock& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild);
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderInline.cpp (227790 => 227791)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderInline.cpp 2018-01-30 17:44:41 UTC (rev 227790)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderInline.cpp 2018-01-30 18:01:48 UTC (rev 227791)
@@ -379,4 +379,18 @@
return child.isInline() || (m_builder.tableBuilder().childRequiresTable(parent, child) && parent.style().display() == INLINE);
}
+void RenderTreeBuilder::Inline::childBecameNonInline(RenderInline& parent, RenderElement& child)
+{
+ // We have to split the parent flow.
+ auto newBox = parent.containingBlock()->createAnonymousBlock();
+ newBox->setIsContinuation();
+ auto* oldContinuation = parent.continuation();
+ if (oldContinuation)
+ oldContinuation->removeFromContinuationChain();
+ newBox->insertIntoContinuationChainAfter(parent);
+ auto* beforeChild = child.nextSibling();
+ auto removedChild = parent.takeChildInternal(child);
+ splitFlow(parent, beforeChild, WTFMove(newBox), WTFMove(removedChild), oldContinuation);
}
+
+}
Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderInline.h (227790 => 227791)
--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderInline.h 2018-01-30 17:44:41 UTC (rev 227790)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderInline.h 2018-01-30 18:01:48 UTC (rev 227791)
@@ -37,12 +37,13 @@
void insertChildIgnoringContinuation(RenderInline& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild);
// Make this private once all the mutation code is in RenderTreeBuilder.
- void splitFlow(RenderInline& parent, RenderObject* beforeChild, RenderPtr<RenderBlock> newBlockBox, RenderPtr<RenderObject> child, RenderBoxModelObject* oldCont);
+ void childBecameNonInline(RenderInline& parent, RenderElement& child);
private:
void insertChildToContinuation(RenderInline& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild);
void splitInlines(RenderInline& parent, RenderBlock* fromBlock, RenderBlock* toBlock, RenderBlock* middleBlock, RenderObject* beforeChild, RenderBoxModelObject* oldCont);
bool newChildIsInline(const RenderInline& parent, const RenderObject& child);
+ void splitFlow(RenderInline& parent, RenderObject* beforeChild, RenderPtr<RenderBlock> newBlockBox, RenderPtr<RenderObject> child, RenderBoxModelObject* oldCont);
RenderTreeBuilder& m_builder;
};