Changeset 228665 in webkit


Ignore:
Timestamp:
Feb 19, 2018 5:17:03 AM (6 years ago)
Author:
Carlos Garcia Campos
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:
Location:
releases/WebKitGTK/webkit-2.20/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog

    r228663 r228665  
     12018-02-08  Zalan Bujtas  <zalan@apple.com>
     2
     3        [RenderTreeBuilder] Move RenderElement::removeAnonymousWrappersForInlinesIfNecessary to RenderTreeBuilder
     4        https://bugs.webkit.org/show_bug.cgi?id=182582
     5        <rdar://problem/37327890>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Tree mutation -> RenderTreeBuilder.
     10
     11        No change in functionality
     12
     13        * rendering/RenderElement.cpp:
     14        (WebCore::RenderElement::styleDidChange):
     15        (WebCore::RenderElement::removeAnonymousWrappersForInlinesIfNecessary): Deleted.
     16        * rendering/RenderElement.h:
     17        * rendering/updating/RenderTreeBuilder.cpp:
     18        (WebCore::removeAnonymousWrappersForInlinesIfNecessary):
     19        (WebCore::RenderTreeBuilder::childFlowStateChangesAndNoLongerAffectsParentBlock):
     20        (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
     21        * rendering/updating/RenderTreeBuilder.h:
     22
    1232018-02-08  Philippe Normand  <pnormand@igalia.com>
    224
  • releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/RenderElement.cpp

    r228655 r228665  
    916916}
    917917
    918 void RenderElement::removeAnonymousWrappersForInlinesIfNecessary()
    919 {
    920     // FIXME: Move to RenderBlock.
    921     if (!is<RenderBlock>(*this))
    922         return;
    923     RenderBlock& thisBlock = downcast<RenderBlock>(*this);
    924     if (!thisBlock.canDropAnonymousBlockChild())
    925         return;
    926 
    927     // We have changed to floated or out-of-flow positioning so maybe all our parent's
    928     // children can be inline now. Bail if there are any block children left on the line,
    929     // otherwise we can proceed to stripping solitary anonymous wrappers from the inlines.
    930     // FIXME: We should also handle split inlines here - we exclude them at the moment by returning
    931     // if we find a continuation.
    932     RenderObject* current = firstChild();
    933     while (current && ((current->isAnonymousBlock() && !downcast<RenderBlock>(*current).isContinuation()) || current->style().isFloating() || current->style().hasOutOfFlowPosition()))
    934         current = current->nextSibling();
    935 
    936     if (current)
    937         return;
    938 
    939     RenderObject* next;
    940     for (current = firstChild(); current; current = next) {
    941         next = current->nextSibling();
    942         if (current->isAnonymousBlock())
    943             thisBlock.dropAnonymousBoxChild(downcast<RenderBlock>(*current));
    944     }
    945 }
    946 
    947918#if !PLATFORM(IOS)
    948919static bool areNonIdenticalCursorListsEqual(const RenderStyle* a, const RenderStyle* b)
     
    976947
    977948    if (s_noLongerAffectsParentBlock)
    978         parent()->removeAnonymousWrappersForInlinesIfNecessary();
     949        RenderTreeBuilder::current()->childFlowStateChangesAndNoLongerAffectsParentBlock(*this);
    979950
    980951    SVGRenderSupport::styleChanged(*this, oldStyle);
  • releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/RenderElement.h

    r228655 r228665  
    221221    virtual void updateAnonymousChildStyle(RenderStyle&) const { };
    222222
    223     void removeAnonymousWrappersForInlinesIfNecessary();
    224 
    225223    bool hasContinuationChainNode() const { return m_hasContinuationChainNode; }
    226224    bool isContinuation() const { return m_isContinuation; }
  • releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp

    r227977 r228665  
    319319}
    320320
     321void RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded(RenderElement& parent)
     322{
     323    if (!is<RenderBlock>(parent))
     324        return;
     325    auto& blockParent = downcast<RenderBlock>(parent);
     326    if (!blockParent.canDropAnonymousBlockChild())
     327        return;
     328
     329    // We have changed to floated or out-of-flow positioning so maybe all our parent's
     330    // children can be inline now. Bail if there are any block children left on the line,
     331    // otherwise we can proceed to stripping solitary anonymous wrappers from the inlines.
     332    // FIXME: We should also handle split inlines here - we exclude them at the moment by returning
     333    // if we find a continuation.
     334    auto* current = blockParent.firstChild();
     335    while (current && ((current->isAnonymousBlock() && !downcast<RenderBlock>(*current).isContinuation()) || current->style().isFloating() || current->style().hasOutOfFlowPosition()))
     336        current = current->nextSibling();
     337
     338    if (current)
     339        return;
     340
     341    RenderObject* next;
     342    for (current = blockParent.firstChild(); current; current = next) {
     343        next = current->nextSibling();
     344        if (current->isAnonymousBlock())
     345            blockParent.dropAnonymousBoxChild(downcast<RenderBlock>(*current));
     346    }
     347}
     348
     349void RenderTreeBuilder::childFlowStateChangesAndNoLongerAffectsParentBlock(RenderElement& child)
     350{
     351    ASSERT(child.parent());
     352    removeAnonymousWrappersForInlineChildrenIfNeeded(*child.parent());
     353}
     354
    321355static bool isAnonymousAndSafeToDelete(RenderElement& element)
    322356{
     
    360394    auto& destroyRootParent = *destroyRoot.parent();
    361395    destroyRootParent.removeAndDestroyChild(*this, destroyRoot);
    362     destroyRootParent.removeAnonymousWrappersForInlinesIfNecessary();
     396    removeAnonymousWrappersForInlineChildrenIfNeeded(destroyRootParent);
    363397
    364398    // Anonymous parent might have become empty, try to delete it too.
  • releases/WebKitGTK/webkit-2.20/Source/WebCore/rendering/updating/RenderTreeBuilder.h

    r227928 r228665  
    7777    void moveRubyChildren(RenderRubyBase& from, RenderRubyBase& to);
    7878    void childFlowStateChangesAndAffectsParentBlock(RenderElement& child);
     79    void childFlowStateChangesAndNoLongerAffectsParentBlock(RenderElement& child);
    7980    RenderObject* resolveMovedChildForMultiColumnFlow(RenderFragmentedFlow& enclosingFragmentedFlow, RenderObject* beforeChild);
    8081    void removeFromParentAndDestroyCleaningUpAnonymousWrappers(RenderObject& child);
     
    9293    class SVG;
    9394    class MathML;
     95
     96    void removeAnonymousWrappersForInlineChildrenIfNeeded(RenderElement& parent);
    9497
    9598    FirstLetter& firstLetterBuilder() { return *m_firstLetterBuilder; }
Note: See TracChangeset for help on using the changeset viewer.