Ignore:
Timestamp:
Oct 2, 2013, 7:26:52 PM (12 years ago)
Author:
Antti Koivisto
Message:

Move setting of some layout bits to RenderElement
https://bugs.webkit.org/show_bug.cgi?id=122256

Reviewed by Andreas Kling.

These bits never apply to RenderText nodes:

normalChildNeedsLayout
posChildNeedsLayout
needsSimplifiedNormalFlowLayout
normalChildNeedsLayout
positionedMovementLayout

The code for setting them can be moved to RenderElement.

Also separated the code paths for setting and clearing the bits and uninlined
everything that is not massively popular.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r156767 r156816  
    14011401    // Propagate layout markers only up to the child, as we are still in the middle
    14021402    // of a layout pass
    1403     child->setNormalChildNeedsLayout(true);
     1403    child->setNormalChildNeedsLayoutBit(true);
    14041404    child->markShapeInsideDescendantsForLayout();
    14051405    child->layoutIfNeeded();
     
    14731473        return;
    14741474    if (childrenInline()) {
    1475         setNeedsLayout(true);
     1475        setNeedsLayout();
    14761476        return;
    14771477    }
     
    15931593{
    15941594    ASSERT_NOT_REACHED();
    1595     setNeedsLayout(false);
     1595    clearNeedsLayout();
    15961596}
    15971597
     
    19411941    // an auto value. Add a method to determine this, so that we can avoid the relayout.
    19421942    if (relayoutChildren || (child->hasRelativeLogicalHeight() && !isRenderView()) || child->hasViewportPercentageLogicalHeight())
    1943         child->setChildNeedsLayout(true, MarkOnlyThis);
     1943        child->setChildNeedsLayout(MarkOnlyThis);
    19441944
    19451945    // If relayoutChildren is set and the child has percentage padding or an embedded content box, we also need to invalidate the childs pref widths.
     
    19631963            if (box->normalChildNeedsLayout())
    19641964                break;
    1965             box->setChildNeedsLayout(true, MarkOnlyThis);
     1965            box->setChildNeedsLayout(MarkOnlyThis);
    19661966           
    19671967            // If the width of an image is affected by the height of a child (e.g., an image with an aspect ratio),
     
    19901990                    lineBoxes.add(&toRenderBox(o)->inlineBoxWrapper()->root());
    19911991            } else if (o->isText() || (o->isRenderInline() && !walker.atEndOfInline()))
    1992                 o->setNeedsLayout(false);
     1992                o->clearNeedsLayout();
    19931993        }
    19941994
     
    20522052    updateScrollInfoAfterLayout();
    20532053
    2054     setNeedsLayout(false);
     2054    clearNeedsLayout();
    20552055    return true;
    20562056}
     
    20782078        LayoutUnit newLeft = computedValues.m_position;
    20792079        if (newLeft != box->logicalLeft())
    2080             child->setChildNeedsLayout(true, MarkOnlyThis);
     2080            box->setChildNeedsLayout(MarkOnlyThis);
    20812081    } else if (hasStaticBlockPosition) {
    20822082        LayoutUnit oldTop = box->logicalTop();
    20832083        box->updateLogicalHeight();
    20842084        if (box->logicalTop() != oldTop)
    2085             child->setChildNeedsLayout(true, MarkOnlyThis);
     2085            box->setChildNeedsLayout(MarkOnlyThis);
    20862086    }
    20872087}
     
    21172117        // positioned explicitly) this should not incur a performance penalty.
    21182118        if (relayoutChildren || (r->style()->hasStaticBlockPosition(isHorizontalWritingMode()) && r->parent() != this))
    2119             r->setChildNeedsLayout(true, MarkOnlyThis);
     2119            r->setChildNeedsLayout(MarkOnlyThis);
    21202120           
    21212121        // If relayoutChildren is set and the child has percentage padding or an embedded content box, we also need to invalidate the childs pref widths.
     
    21292129        // and we hit the available width constraint, the layoutIfNeeded() will catch it and do a full layout.
    21302130        if (r->needsPositionedMovementLayoutOnly() && r->tryLayoutDoingPositionedMovementOnly())
    2131             r->setNeedsLayout(false);
     2131            r->clearNeedsLayout();
    21322132           
    21332133        // If we are paginated or in a line grid, go ahead and compute a vertical position for our object now.
     
    21472147        // Lay out again if our estimate was wrong.
    21482148        if (needsBlockDirectionLocationSetBeforeLayout && logicalTopForChild(r) != oldLogicalTop) {
    2149             r->setChildNeedsLayout(true, MarkOnlyThis);
     2149            r->setChildNeedsLayout(MarkOnlyThis);
    21502150            r->layoutIfNeeded();
    21512151        }
    21522152
    21532153        if (updateRegionRangeForBoxChild(r)) {
    2154             r->setNeedsLayout(true, MarkOnlyThis);
     2154            r->setNeedsLayout(MarkOnlyThis);
    21552155            r->layoutIfNeeded();
    21562156        }
     
    21692169        for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(); it != end; ++it) {
    21702170            r = *it;
    2171             r->setChildNeedsLayout(true);
     2171            r->setChildNeedsLayout();
    21722172        }
    21732173    }
     
    21812181
    21822182    if (view().layoutState()->pageLogicalHeightChanged() || (view().layoutState()->pageLogicalHeight() && view().layoutState()->pageLogicalOffset(this, logicalTop()) != pageLogicalOffset()))
    2183         setChildNeedsLayout(true, MarkOnlyThis);
     2183        setChildNeedsLayout(MarkOnlyThis);
    21842184}
    21852185
     
    32393239        if (!o || r->isDescendantOf(o)) {
    32403240            if (containingBlockState == NewContainingBlock)
    3241                 r->setChildNeedsLayout(true, MarkOnlyThis);
     3241                r->setChildNeedsLayout(MarkOnlyThis);
    32423242           
    32433243            // It is parent blocks job to add positioned child to positioned objects list of its containing block
    32443244            // Parent layout needs to be invalidated to ensure this happens.
    3245             RenderObject* p = r->parent();
     3245            RenderElement* p = r->parent();
    32463246            while (p && !p->isRenderBlock())
    32473247                p = p->parent();
    32483248            if (p)
    3249                 p->setChildNeedsLayout(true);
     3249                p->setChildNeedsLayout();
    32503250           
    32513251            deadObjects.append(r);
     
    32883288    bool isChildRenderBlock = o->isRenderBlock();
    32893289    if (isChildRenderBlock && !o->needsLayout() && view().layoutState()->pageLogicalHeightChanged())
    3290         o->setChildNeedsLayout(true, MarkOnlyThis);
     3290        o->setChildNeedsLayout(MarkOnlyThis);
    32913291           
    32923292    bool needsBlockDirectionLocationSetBeforeLayout = isChildRenderBlock && view().layoutState()->needsBlockDirectionLocationSetBeforeLayout();
     
    35243524       
    35253525                if (childBlock)
    3526                     childBlock->setChildNeedsLayout(true, MarkOnlyThis);
     3526                    childBlock->setChildNeedsLayout(MarkOnlyThis);
    35273527                childBox->layoutIfNeeded();
    35283528            }
    35293529
    35303530            if (updateRegionRangeForBoxChild(childBox)) {
    3531                 childBox->setNeedsLayout(true, MarkOnlyThis);
     3531                childBox->setNeedsLayout(MarkOnlyThis);
    35323532                childBox->layoutIfNeeded();
    35333533            }
     
    39323932
    39333933    MarkingBehavior markParents = inLayout ? MarkOnlyThis : MarkContainingBlockChain;
    3934     setChildNeedsLayout(true, markParents);
     3934    setChildNeedsLayout(markParents);
    39353935 
    39363936    if (floatToRemove)
     
    40304030                // from previous siblings when negative margins exist on a child (see the addOverhangingFloats call at the end of collapseMargins).
    40314031                if (childLogicalWidthAtOldLogicalTopOffset != childLogicalWidthAtNewLogicalTopOffset)
    4032                     child->setChildNeedsLayout(true, MarkOnlyThis);
     4032                    child->setChildNeedsLayout(MarkOnlyThis);
    40334033                return newLogicalTop - logicalTop;
    40344034            }
Note: See TracChangeset for help on using the changeset viewer.