Remove RenderBlock::isAnonymousBlockContinuation()
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Nov 2017 05:41:30 +0000 (05:41 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Nov 2017 05:41:30 +0000 (05:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=179403

Non-anonymous blocks don't have continuations so this is the same as simply calling continuation().

Some of these are also really isContinuation() tests. This ends up being the same as calling
continuation() as block continuations always have next continuation too. This patch uses
isContinuation() where appropriate.

Reviewed by Zalan Bujtas.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::nodeForHitTest const):
(WebCore::RenderBlock::absoluteRects const):
(WebCore::RenderBlock::absoluteQuads const):
(WebCore::RenderBlock::rectWithOutlineForRepaint const):
(WebCore::RenderBlock::hoverAncestor const):
(WebCore::RenderBlock::outlineStyleForRepaint const):
* rendering/RenderBlock.h:
(WebCore::RenderBlock::isAnonymousBlockContinuation const): Deleted.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::propagateStyleToAnonymousChildren):
* rendering/RenderInline.cpp:
(WebCore::updateStyleOfAnonymousBlockContinuations):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224563 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderInline.cpp

index 2da39a7..bd337b2 100644 (file)
@@ -1,5 +1,32 @@
 2017-11-07  Antti Koivisto  <antti@apple.com>
 
+        Remove RenderBlock::isAnonymousBlockContinuation()
+        https://bugs.webkit.org/show_bug.cgi?id=179403
+
+        Non-anonymous blocks don't have continuations so this is the same as simply calling continuation().
+
+        Some of these are also really isContinuation() tests. This ends up being the same as calling
+        continuation() as block continuations always have next continuation too. This patch uses
+        isContinuation() where appropriate.
+
+        Reviewed by Zalan Bujtas.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::nodeForHitTest const):
+        (WebCore::RenderBlock::absoluteRects const):
+        (WebCore::RenderBlock::absoluteQuads const):
+        (WebCore::RenderBlock::rectWithOutlineForRepaint const):
+        (WebCore::RenderBlock::hoverAncestor const):
+        (WebCore::RenderBlock::outlineStyleForRepaint const):
+        * rendering/RenderBlock.h:
+        (WebCore::RenderBlock::isAnonymousBlockContinuation const): Deleted.
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::propagateStyleToAnonymousChildren):
+        * rendering/RenderInline.cpp:
+        (WebCore::updateStyleOfAnonymousBlockContinuations):
+
+2017-11-07  Antti Koivisto  <antti@apple.com>
+
         There is no such thing as block element continuation
         https://bugs.webkit.org/show_bug.cgi?id=179400
 
index 2285499..af1e818 100644 (file)
@@ -2381,7 +2381,7 @@ Node* RenderBlock::nodeForHitTest() const
     // that was split. Use the appropriate inner node.
     if (isRenderView())
         return &document();
-    return isAnonymousBlockContinuation() ? continuation()->element() : element();
+    return continuation() ? continuation()->element() : element();
 }
 
 bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
@@ -3160,12 +3160,12 @@ void RenderBlock::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accum
 {
     // For blocks inside inlines, we include margins so that we run right up to the inline boxes
     // above and below us (thus getting merged with them to form a single irregular shape).
-    if (isAnonymousBlockContinuation()) {
+    if (auto* continuation = this->continuation()) {
         // FIXME: This is wrong for block-flows that are horizontal.
         // https://bugs.webkit.org/show_bug.cgi?id=46781
         rects.append(snappedIntRect(accumulatedOffset.x(), accumulatedOffset.y() - collapsedMarginBefore(),
                                 width(), height() + collapsedMarginBefore() + collapsedMarginAfter()));
-        continuation()->absoluteRects(rects, accumulatedOffset - toLayoutSize(location() +
+        continuation->absoluteRects(rects, accumulatedOffset - toLayoutSize(location() +
                 inlineElementContinuation()->containingBlock()->location()));
     } else
         rects.append(snappedIntRect(accumulatedOffset, size()));
@@ -3175,7 +3175,8 @@ void RenderBlock::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
 {
     // For blocks inside inlines, we include margins so that we run right up to the inline boxes
     // above and below us (thus getting merged with them to form a single irregular shape).
-    FloatRect localRect = isAnonymousBlockContinuation() 
+    auto* continuation = this->continuation();
+    FloatRect localRect = continuation
         ? FloatRect(0, -collapsedMarginBefore(), width(), height() + collapsedMarginBefore() + collapsedMarginAfter())
         : FloatRect(0, 0, width(), height());
     
@@ -3185,21 +3186,23 @@ void RenderBlock::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
     if (!fragmentedFlow || !fragmentedFlow->absoluteQuadsForBox(quads, wasFixed, this, localRect.y(), localRect.maxY()))
         quads.append(localToAbsoluteQuad(localRect, UseTransforms, wasFixed));
 
-    if (isAnonymousBlockContinuation())
-        continuation()->absoluteQuads(quads, wasFixed);
+    if (continuation)
+        continuation->absoluteQuads(quads, wasFixed);
 }
 
 LayoutRect RenderBlock::rectWithOutlineForRepaint(const RenderLayerModelObject* repaintContainer, LayoutUnit outlineWidth) const
 {
     LayoutRect r(RenderBox::rectWithOutlineForRepaint(repaintContainer, outlineWidth));
-    if (isAnonymousBlockContinuation())
+    if (isContinuation())
         r.inflateY(collapsedMarginBefore()); // FIXME: This is wrong for block-flows that are horizontal.
     return r;
 }
 
 RenderElement* RenderBlock::hoverAncestor() const
 {
-    return isAnonymousBlockContinuation() ? continuation() : RenderBox::hoverAncestor();
+    if (auto* continuation = this->continuation())
+        return continuation;
+    return RenderBox::hoverAncestor();
 }
 
 void RenderBlock::updateDragState(bool dragOn)
@@ -3211,7 +3214,9 @@ void RenderBlock::updateDragState(bool dragOn)
 
 const RenderStyle& RenderBlock::outlineStyleForRepaint() const
 {
-    return isAnonymousBlockContinuation() ? continuation()->style() : RenderElement::outlineStyleForRepaint();
+    if (auto* continuation = this->continuation())
+        return continuation->style();
+    return RenderElement::outlineStyleForRepaint();
 }
 
 void RenderBlock::childBecameNonInline(RenderElement&)
index 9693774..c0cce91 100644 (file)
@@ -189,7 +189,6 @@ public:
     void addContinuationWithOutline(RenderInline*);
     bool paintsContinuationOutline(RenderInline*);
 
-    bool isAnonymousBlockContinuation() const { return isAnonymousBlock() && continuation(); }
     WEBCORE_EXPORT RenderInline* inlineElementContinuation() const;
 
     static RenderPtr<RenderBlock> createAnonymousWithParentRendererAndDisplay(const RenderBox& parent, EDisplay = BLOCK);
index 92c92ad..2c81780 100644 (file)
@@ -818,7 +818,7 @@ void RenderElement::propagateStyleToAnonymousChildren(StylePropagationType propa
 
         // Preserve the position style of anonymous block continuations as they can have relative or sticky position when
         // they contain block descendants of relative or sticky positioned inlines.
-        if (elementChild.isInFlowPositioned() && downcast<RenderBlock>(elementChild).isAnonymousBlockContinuation())
+        if (elementChild.isInFlowPositioned() && elementChild.isContinuation())
             newStyle.setPosition(elementChild.style().position());
 
         updateAnonymousChildStyle(elementChild, newStyle);
index ace2605..54e4f29 100644 (file)
@@ -155,7 +155,7 @@ static void updateStyleOfAnonymousBlockContinuations(const RenderBlock& block, c
             continue;
 
         RenderBlock& block = downcast<RenderBlock>(*box);
-        if (!block.isAnonymousBlockContinuation())
+        if (!block.isContinuation())
             continue;
         
         // If we are no longer in-flow positioned but our descendant block(s) still have an in-flow positioned ancestor then