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/RenderObject.h

    r156738 r156816  
    618618
    619619    void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderObject* newRoot = 0);
    620     void setNeedsLayout(bool needsLayout, MarkingBehavior = MarkContainingBlockChain);
    621     void setChildNeedsLayout(bool childNeedsLayout, MarkingBehavior = MarkContainingBlockChain);
    622     void setNeedsPositionedMovementLayout(const RenderStyle* oldStyle);
    623     void setNeedsSimplifiedNormalFlowLayout();
     620    void setNeedsLayout(MarkingBehavior = MarkContainingBlockChain);
     621    void clearNeedsLayout();
    624622    void setPreferredLogicalWidthsDirty(bool, MarkingBehavior = MarkContainingBlockChain);
    625623    void invalidateContainerPreferredLogicalWidths();
     
    627625    void setNeedsLayoutAndPrefWidthsRecalc()
    628626    {
    629         setNeedsLayout(true);
     627        setNeedsLayout();
    630628        setPreferredLogicalWidthsDirty(true);
    631629    }
     
    941939
    942940    void setDocumentForAnonymous(Document& document) { ASSERT(isAnonymous()); m_node = &document; }
     941
     942    void setNeedsPositionedMovementLayoutBit(bool b) { m_bitfields.setNeedsPositionedMovementLayout(b); }
     943    void setNormalChildNeedsLayoutBit(bool b) { m_bitfields.setNormalChildNeedsLayout(b); }
     944    void setPosChildNeedsLayoutBit(bool b) { m_bitfields.setPosChildNeedsLayout(b); }
     945    void setNeedsSimplifiedNormalFlowLayoutBit(bool b) { m_bitfields.setNeedsSimplifiedNormalFlowLayout(b); }
    943946
    944947private:
     
    10781081    RenderObjectBitfields m_bitfields;
    10791082
    1080     void setNeedsPositionedMovementLayout(bool b) { m_bitfields.setNeedsPositionedMovementLayout(b); }
    1081     void setNormalChildNeedsLayout(bool b) { m_bitfields.setNormalChildNeedsLayout(b); }
    1082     void setPosChildNeedsLayout(bool b) { m_bitfields.setPosChildNeedsLayout(b); }
    1083     void setNeedsSimplifiedNormalFlowLayout(bool b) { m_bitfields.setNeedsSimplifiedNormalFlowLayout(b); }
    10841083    void setIsDragging(bool b) { m_bitfields.setIsDragging(b); }
    10851084    void setEverHadLayout(bool b) { m_bitfields.setEverHadLayout(b); }
     
    11161115}
    11171116
    1118 inline void RenderObject::setChildNeedsLayout(bool childNeedsLayout, MarkingBehavior markParents)
    1119 {
    1120     bool alreadyNeededLayout = normalChildNeedsLayout();
    1121     setNormalChildNeedsLayout(childNeedsLayout);
    1122     if (childNeedsLayout) {
    1123         ASSERT(!isSetNeedsLayoutForbidden());
    1124         if (!alreadyNeededLayout && markParents == MarkContainingBlockChain)
    1125             markContainingBlocksForLayout();
    1126     } else {
    1127         setPosChildNeedsLayout(false);
    1128         setNeedsSimplifiedNormalFlowLayout(false);
    1129         setNormalChildNeedsLayout(false);
    1130         setNeedsPositionedMovementLayout(false);
    1131     }
    1132 }
    1133 
    1134 inline void RenderObject::setNeedsPositionedMovementLayout(const RenderStyle* oldStyle)
    1135 {
    1136     bool alreadyNeededLayout = needsPositionedMovementLayout();
    1137     setNeedsPositionedMovementLayout(true);
     1117inline void RenderObject::setNeedsLayout(MarkingBehavior markParents)
     1118{
    11381119    ASSERT(!isSetNeedsLayoutForbidden());
    1139     if (!alreadyNeededLayout) {
     1120    if (m_bitfields.needsLayout())
     1121        return;
     1122    m_bitfields.setNeedsLayout(true);
     1123    if (markParents == MarkContainingBlockChain)
    11401124        markContainingBlocksForLayout();
    1141         if (hasLayer()) {
    1142             if (oldStyle && style()->diffRequiresRepaint(oldStyle))
    1143                 setLayerNeedsFullRepaint();
    1144             else
    1145                 setLayerNeedsFullRepaintForPositionedMovementLayout();
    1146         }
    1147     }
    1148 }
    1149 
    1150 inline void RenderObject::setNeedsSimplifiedNormalFlowLayout()
    1151 {
    1152     bool alreadyNeededLayout = needsSimplifiedNormalFlowLayout();
    1153     setNeedsSimplifiedNormalFlowLayout(true);
    1154     ASSERT(!isSetNeedsLayoutForbidden());
    1155     if (!alreadyNeededLayout) {
    1156         markContainingBlocksForLayout();
    1157         if (hasLayer())
    1158             setLayerNeedsFullRepaint();
    1159     }
     1125    if (hasLayer())
     1126        setLayerNeedsFullRepaint();
    11601127}
    11611128
Note: See TracChangeset for help on using the changeset viewer.