Changeset 156639 in webkit


Ignore:
Timestamp:
Sep 30, 2013, 1:21:34 AM (11 years ago)
Author:
Antti Koivisto
Message:

Get rid of static map for marking ancestor line boxes dirty
https://bugs.webkit.org/show_bug.cgi?id=122080

Reviewed by Andreas Kling.

This is ugly and shows up in profiles too. Use a bit in RenderElement instead.

  • rendering/RenderBlock.h:
  • rendering/RenderBlockFlow.h:


Move dirtyLinesFromChangedChild down to RenderBlockFlow. It wouldn't do anything on other RenderBlocks.

  • rendering/RenderElement.cpp:

(WebCore::RenderElement::RenderElement):

  • rendering/RenderElement.h:


Add m_ancestorLineBoxDirty bit. We have 32 unused bits here on 64bit systems.

(WebCore::RenderElement::dirtyLinesFromChangedChild):
(WebCore::RenderElement::ancestorLineBoxDirty):
(WebCore::RenderElement::setAncestorLineBoxDirty):
(WebCore::RenderObject::setNeedsLayout):

  • rendering/RenderInline.h:
  • rendering/RenderLineBoxList.cpp:

(WebCore::RenderLineBoxList::dirtyLinesFromChangedChild):

Tighten the interface.

  • rendering/RenderLineBoxList.h:
  • rendering/RenderObject.cpp:

(WebCore::RenderObject::willBeDestroyed):

  • rendering/RenderObject.h:


Remove the static map.

Location:
trunk/Source/WebCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r156638 r156639  
     12013-09-30  Antti Koivisto  <antti@apple.com>
     2
     3        Get rid of static map for marking ancestor line boxes dirty
     4        https://bugs.webkit.org/show_bug.cgi?id=122080
     5
     6        Reviewed by Andreas Kling.
     7       
     8        This is ugly and shows up in profiles too. Use a bit in RenderElement instead.
     9
     10        * rendering/RenderBlock.h:
     11        * rendering/RenderBlockFlow.h:
     12       
     13            Move dirtyLinesFromChangedChild down to RenderBlockFlow. It wouldn't do anything on other RenderBlocks.
     14
     15        * rendering/RenderElement.cpp:
     16        (WebCore::RenderElement::RenderElement):
     17        * rendering/RenderElement.h:
     18       
     19            Add m_ancestorLineBoxDirty bit. We have 32 unused bits here on 64bit systems.
     20
     21        (WebCore::RenderElement::dirtyLinesFromChangedChild):
     22        (WebCore::RenderElement::ancestorLineBoxDirty):
     23        (WebCore::RenderElement::setAncestorLineBoxDirty):
     24        (WebCore::RenderObject::setNeedsLayout):
     25        * rendering/RenderInline.h:
     26        * rendering/RenderLineBoxList.cpp:
     27        (WebCore::RenderLineBoxList::dirtyLinesFromChangedChild):
     28           
     29            Tighten the interface.
     30
     31        * rendering/RenderLineBoxList.h:
     32        * rendering/RenderObject.cpp:
     33        (WebCore::RenderObject::willBeDestroyed):
     34        * rendering/RenderObject.h:
     35       
     36            Remove the static map.
     37
    1382013-09-18  Sergio Villar Senin  <svillar@igalia.com>
    239
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r156613 r156639  
    562562    void moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, bool fullRemoveInsert);
    563563
    564     virtual void dirtyLinesFromChangedChild(RenderObject* child) OVERRIDE FINAL { m_lineBoxes.dirtyLinesFromChangedChild(this, child); }
    565 
    566564    void addChildToContinuation(RenderObject* newChild, RenderObject* beforeChild);
    567565    void addChildIgnoringContinuation(RenderObject* newChild, RenderObject* beforeChild);
  • trunk/Source/WebCore/rendering/RenderBlockFlow.h

    r156557 r156639  
    5555    virtual LayoutUnit collapsedMarginAfter() const OVERRIDE FINAL { return maxPositiveMarginAfter() - maxNegativeMarginAfter(); }
    5656
     57    virtual void dirtyLinesFromChangedChild(RenderObject* child) OVERRIDE FINAL { lineBoxes().dirtyLinesFromChangedChild(this, child); }
     58
    5759public:
    5860    class MarginValues {
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r156622 r156639  
    6767RenderElement::RenderElement(Element* element)
    6868    : RenderObject(element)
     69    , m_ancestorLineBoxDirty(false)
    6970    , m_firstChild(nullptr)
    7071    , m_lastChild(nullptr)
  • trunk/Source/WebCore/rendering/RenderElement.h

    r156622 r156639  
    7070    virtual RenderElement* hoverAncestor() const;
    7171
     72    virtual void dirtyLinesFromChangedChild(RenderObject*) { }
     73
     74    bool ancestorLineBoxDirty() const { return m_ancestorLineBoxDirty; }
     75    void setAncestorLineBoxDirty(bool f = true);
     76
    7277    // Return the renderer whose background style is used to paint the root background. Should only be called on the renderer for which isRoot() is true.
    7378    RenderElement* rendererForRootBackground();
     
    125130    RenderStyle* cachedFirstLineStyle() const;
    126131
     132    bool m_ancestorLineBoxDirty : 1;
     133
    127134    RenderObject* m_firstChild;
    128135    RenderObject* m_lastChild;
     
    141148}
    142149
     150inline void RenderElement::setAncestorLineBoxDirty(bool f)
     151{
     152    m_ancestorLineBoxDirty = f;
     153    if (m_ancestorLineBoxDirty)
     154        setNeedsLayout(true);
     155}
     156
    143157inline LayoutUnit RenderElement::valueForLength(const Length& length, LayoutUnit maximumValue, bool roundPercentages) const
    144158{
     
    193207}
    194208
     209inline void RenderObject::setNeedsLayout(bool needsLayout, MarkingBehavior markParents)
     210{
     211    bool alreadyNeededLayout = m_bitfields.needsLayout();
     212    m_bitfields.setNeedsLayout(needsLayout);
     213    if (needsLayout) {
     214        ASSERT(!isSetNeedsLayoutForbidden());
     215        if (!alreadyNeededLayout) {
     216            if (markParents == MarkContainingBlockChain)
     217                markContainingBlocksForLayout();
     218            if (hasLayer())
     219                setLayerNeedsFullRepaint();
     220        }
     221    } else {
     222        setEverHadLayout(true);
     223        setPosChildNeedsLayout(false);
     224        setNeedsSimplifiedNormalFlowLayout(false);
     225        setNormalChildNeedsLayout(false);
     226        setNeedsPositionedMovementLayout(false);
     227        if (isRenderElement())
     228            toRenderElement(this)->setAncestorLineBoxDirty(false);
     229#ifndef NDEBUG
     230        checkBlockPositionedObjectsNeedLayout();
     231#endif
     232    }
     233}
     234
    195235inline RenderElement* ContainerNode::renderer() const
    196236{
  • trunk/Source/WebCore/rendering/RenderLineBoxList.cpp

    r156054 r156639  
    3434#include "PaintInfo.h"
    3535#include "RenderArena.h"
     36#include "RenderBlockFlow.h"
    3637#include "RenderInline.h"
    3738#include "RenderLineBreak.h"
     
    311312}
    312313
    313 void RenderLineBoxList::dirtyLinesFromChangedChild(RenderObject* container, RenderObject* child)
    314 {
    315     if (!container->parent() || (container->isRenderBlock() && (container->selfNeedsLayout() || !container->isRenderBlockFlow())))
     314void RenderLineBoxList::dirtyLinesFromChangedChild(RenderBoxModelObject* container, RenderObject* child)
     315{
     316    ASSERT(container->isRenderInline() || container->isRenderBlockFlow());
     317    if (!container->parent() || (container->isRenderBlockFlow() && container->selfNeedsLayout()))
    316318        return;
    317319
  • trunk/Source/WebCore/rendering/RenderLineBoxList.h

    r155944 r156639  
    3636
    3737class InlineFlowBox;
     38class RenderBlockFlow;
    3839
    3940class RenderLineBoxList {
     
    6465   
    6566    void dirtyLineBoxes();
    66     void dirtyLinesFromChangedChild(RenderObject* parent, RenderObject* child);
     67    void dirtyLinesFromChangedChild(RenderBoxModelObject* parent, RenderObject* child);
    6768
    6869    void paint(RenderBoxModelObject*, PaintInfo&, const LayoutPoint&) const;
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r156622 r156639  
    102102
    103103COMPILE_ASSERT(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObject_should_stay_small);
    104 
    105 RenderObjectAncestorLineboxDirtySet* RenderObject::s_ancestorLineboxDirtySet = 0;
    106104
    107105void* RenderObject::operator new(size_t sz, RenderArena& renderArena)
     
    14991497}
    15001498
    1501 void RenderObject::dirtyLinesFromChangedChild(RenderObject*)
    1502 {
    1503 }
    1504 
    15051499#ifndef NDEBUG
    15061500
     
    20262020        toRenderLayerModelObject(this)->destroyLayer();
    20272021    }
    2028 
    2029     setAncestorLineBoxDirty(false);
    20302022
    20312023    clearLayoutRootIfNeeded();
  • trunk/Source/WebCore/rendering/RenderObject.h

    r156622 r156639  
    137137#endif
    138138
    139 typedef WTF::HashSet<const RenderObject*> RenderObjectAncestorLineboxDirtySet;
    140 
    141139#ifndef NDEBUG
    142140const int showTreeCharacterOffset = 39;
     
    404402    bool hasColumns() const { return m_bitfields.hasColumns(); }
    405403    void setHasColumns(bool b = true) { m_bitfields.setHasColumns(b); }
    406 
    407     bool ancestorLineBoxDirty() const { return s_ancestorLineboxDirtySet && s_ancestorLineboxDirtySet->contains(this); }
    408     void setAncestorLineBoxDirty(bool b = true)
    409     {
    410         if (b) {
    411             if (!s_ancestorLineboxDirtySet)
    412                 s_ancestorLineboxDirtySet = new RenderObjectAncestorLineboxDirtySet;
    413             s_ancestorLineboxDirtySet->add(this);
    414             setNeedsLayout(true);
    415         } else if (s_ancestorLineboxDirtySet) {
    416             s_ancestorLineboxDirtySet->remove(this);
    417             if (s_ancestorLineboxDirtySet->isEmpty()) {
    418                 delete s_ancestorLineboxDirtySet;
    419                 s_ancestorLineboxDirtySet = 0;
    420             }
    421         }
    422     }
    423404
    424405    enum FlowThreadState {
     
    703684    VisiblePosition createVisiblePosition(const Position&);
    704685
    705     virtual void dirtyLinesFromChangedChild(RenderObject*);
    706 
    707686    // returns the containing block level element for this element.
    708687    RenderBlock* containingBlock() const;
     
    982961    RenderObject* m_previous;
    983962    RenderObject* m_next;
    984 
    985     static RenderObjectAncestorLineboxDirtySet* s_ancestorLineboxDirtySet;
    986963
    987964#ifndef NDEBUG
     
    11381115}
    11391116
    1140 inline void RenderObject::setNeedsLayout(bool needsLayout, MarkingBehavior markParents)
    1141 {
    1142     bool alreadyNeededLayout = m_bitfields.needsLayout();
    1143     m_bitfields.setNeedsLayout(needsLayout);
    1144     if (needsLayout) {
    1145         ASSERT(!isSetNeedsLayoutForbidden());
    1146         if (!alreadyNeededLayout) {
    1147             if (markParents == MarkContainingBlockChain)
    1148                 markContainingBlocksForLayout();
    1149             if (hasLayer())
    1150                 setLayerNeedsFullRepaint();
    1151         }
    1152     } else {
    1153         setEverHadLayout(true);
    1154         setPosChildNeedsLayout(false);
    1155         setNeedsSimplifiedNormalFlowLayout(false);
    1156         setNormalChildNeedsLayout(false);
    1157         setNeedsPositionedMovementLayout(false);
    1158         setAncestorLineBoxDirty(false);
    1159 #ifndef NDEBUG
    1160         checkBlockPositionedObjectsNeedLayout();
    1161 #endif
    1162     }
    1163 }
    1164 
    11651117inline void RenderObject::setChildNeedsLayout(bool childNeedsLayout, MarkingBehavior markParents)
    11661118{
Note: See TracChangeset for help on using the changeset viewer.