Commit 8f71118f authored by antti@apple.com's avatar antti@apple.com

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.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156639 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a2871019
2013-09-30 Antti Koivisto <antti@apple.com>
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.
2013-09-18 Sergio Villar Senin <svillar@igalia.com>
[CSS Grid Layout] Implement the grid-area shorthand
......@@ -561,8 +561,6 @@ private:
void moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, bool fullRemoveInsert);
virtual void dirtyLinesFromChangedChild(RenderObject* child) OVERRIDE FINAL { m_lineBoxes.dirtyLinesFromChangedChild(this, child); }
void addChildToContinuation(RenderObject* newChild, RenderObject* beforeChild);
void addChildIgnoringContinuation(RenderObject* newChild, RenderObject* beforeChild);
void addChildToAnonymousColumnBlocks(RenderObject* newChild, RenderObject* beforeChild);
......
......@@ -54,6 +54,8 @@ protected:
virtual LayoutUnit collapsedMarginBefore() const OVERRIDE FINAL { return maxPositiveMarginBefore() - maxNegativeMarginBefore(); }
virtual LayoutUnit collapsedMarginAfter() const OVERRIDE FINAL { return maxPositiveMarginAfter() - maxNegativeMarginAfter(); }
virtual void dirtyLinesFromChangedChild(RenderObject* child) OVERRIDE FINAL { lineBoxes().dirtyLinesFromChangedChild(this, child); }
public:
class MarginValues {
public:
......
......@@ -66,6 +66,7 @@ bool RenderElement::s_noLongerAffectsParentBlock = false;
RenderElement::RenderElement(Element* element)
: RenderObject(element)
, m_ancestorLineBoxDirty(false)
, m_firstChild(nullptr)
, m_lastChild(nullptr)
, m_style(0)
......
......@@ -69,6 +69,11 @@ public:
virtual RenderElement* hoverAncestor() const;
virtual void dirtyLinesFromChangedChild(RenderObject*) { }
bool ancestorLineBoxDirty() const { return m_ancestorLineBoxDirty; }
void setAncestorLineBoxDirty(bool f = true);
// 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.
RenderElement* rendererForRootBackground();
......@@ -124,6 +129,8 @@ private:
StyleDifference adjustStyleDifference(StyleDifference, unsigned contextSensitiveProperties) const;
RenderStyle* cachedFirstLineStyle() const;
bool m_ancestorLineBoxDirty : 1;
RenderObject* m_firstChild;
RenderObject* m_lastChild;
......@@ -140,6 +147,13 @@ inline RenderStyle* RenderElement::firstLineStyle() const
return document().styleSheetCollection().usesFirstLineRules() ? cachedFirstLineStyle() : style();
}
inline void RenderElement::setAncestorLineBoxDirty(bool f)
{
m_ancestorLineBoxDirty = f;
if (m_ancestorLineBoxDirty)
setNeedsLayout(true);
}
inline LayoutUnit RenderElement::valueForLength(const Length& length, LayoutUnit maximumValue, bool roundPercentages) const
{
return WebCore::valueForLength(length, maximumValue, &view(), roundPercentages);
......@@ -192,6 +206,32 @@ inline RenderStyle* RenderObject::firstLineStyle() const
return toRenderElement(this)->firstLineStyle();
}
inline void RenderObject::setNeedsLayout(bool needsLayout, MarkingBehavior markParents)
{
bool alreadyNeededLayout = m_bitfields.needsLayout();
m_bitfields.setNeedsLayout(needsLayout);
if (needsLayout) {
ASSERT(!isSetNeedsLayoutForbidden());
if (!alreadyNeededLayout) {
if (markParents == MarkContainingBlockChain)
markContainingBlocksForLayout();
if (hasLayer())
setLayerNeedsFullRepaint();
}
} else {
setEverHadLayout(true);
setPosChildNeedsLayout(false);
setNeedsSimplifiedNormalFlowLayout(false);
setNormalChildNeedsLayout(false);
setNeedsPositionedMovementLayout(false);
if (isRenderElement())
toRenderElement(this)->setAncestorLineBoxDirty(false);
#ifndef NDEBUG
checkBlockPositionedObjectsNeedLayout();
#endif
}
}
inline RenderElement* ContainerNode::renderer() const
{
return toRenderElement(Node::renderer());
......
......@@ -33,6 +33,7 @@
#include "InlineTextBox.h"
#include "PaintInfo.h"
#include "RenderArena.h"
#include "RenderBlockFlow.h"
#include "RenderInline.h"
#include "RenderLineBreak.h"
#include "RenderView.h"
......@@ -310,9 +311,10 @@ bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestReq
return false;
}
void RenderLineBoxList::dirtyLinesFromChangedChild(RenderObject* container, RenderObject* child)
void RenderLineBoxList::dirtyLinesFromChangedChild(RenderBoxModelObject* container, RenderObject* child)
{
if (!container->parent() || (container->isRenderBlock() && (container->selfNeedsLayout() || !container->isRenderBlockFlow())))
ASSERT(container->isRenderInline() || container->isRenderBlockFlow());
if (!container->parent() || (container->isRenderBlockFlow() && container->selfNeedsLayout()))
return;
RenderInline* inlineContainer = container->isRenderInline() ? toRenderInline(container) : 0;
......
......@@ -35,6 +35,7 @@
namespace WebCore {
class InlineFlowBox;
class RenderBlockFlow;
class RenderLineBoxList {
public:
......@@ -63,7 +64,7 @@ public:
void removeLineBox(InlineFlowBox*);
void dirtyLineBoxes();
void dirtyLinesFromChangedChild(RenderObject* parent, RenderObject* child);
void dirtyLinesFromChangedChild(RenderBoxModelObject* parent, RenderObject* child);
void paint(RenderBoxModelObject*, PaintInfo&, const LayoutPoint&) const;
bool hitTest(RenderBoxModelObject*, const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) const;
......
......@@ -102,8 +102,6 @@ struct SameSizeAsRenderObject {
COMPILE_ASSERT(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObject_should_stay_small);
RenderObjectAncestorLineboxDirtySet* RenderObject::s_ancestorLineboxDirtySet = 0;
void* RenderObject::operator new(size_t sz, RenderArena& renderArena)
{
return renderArena.allocate(sz);
......@@ -1498,10 +1496,6 @@ void RenderObject::computeFloatRectForRepaint(const RenderLayerModelObject*, Flo
ASSERT_NOT_REACHED();
}
void RenderObject::dirtyLinesFromChangedChild(RenderObject*)
{
}
#ifndef NDEBUG
void RenderObject::showTreeForThis() const
......@@ -2026,8 +2020,6 @@ void RenderObject::willBeDestroyed()
toRenderLayerModelObject(this)->destroyLayer();
}
setAncestorLineBoxDirty(false);
clearLayoutRootIfNeeded();
}
......
......@@ -136,8 +136,6 @@ struct AnnotatedRegionValue {
};
#endif
typedef WTF::HashSet<const RenderObject*> RenderObjectAncestorLineboxDirtySet;
#ifndef NDEBUG
const int showTreeCharacterOffset = 39;
#endif
......@@ -404,23 +402,6 @@ public:
bool hasColumns() const { return m_bitfields.hasColumns(); }
void setHasColumns(bool b = true) { m_bitfields.setHasColumns(b); }
bool ancestorLineBoxDirty() const { return s_ancestorLineboxDirtySet && s_ancestorLineboxDirtySet->contains(this); }
void setAncestorLineBoxDirty(bool b = true)
{
if (b) {
if (!s_ancestorLineboxDirtySet)
s_ancestorLineboxDirtySet = new RenderObjectAncestorLineboxDirtySet;
s_ancestorLineboxDirtySet->add(this);
setNeedsLayout(true);
} else if (s_ancestorLineboxDirtySet) {
s_ancestorLineboxDirtySet->remove(this);
if (s_ancestorLineboxDirtySet->isEmpty()) {
delete s_ancestorLineboxDirtySet;
s_ancestorLineboxDirtySet = 0;
}
}
}
enum FlowThreadState {
NotInsideFlowThread = 0,
InsideOutOfFlowThread = 1,
......@@ -702,8 +683,6 @@ public:
VisiblePosition createVisiblePosition(int offset, EAffinity);
VisiblePosition createVisiblePosition(const Position&);
virtual void dirtyLinesFromChangedChild(RenderObject*);
// returns the containing block level element for this element.
RenderBlock* containingBlock() const;
......@@ -982,8 +961,6 @@ private:
RenderObject* m_previous;
RenderObject* m_next;
static RenderObjectAncestorLineboxDirtySet* s_ancestorLineboxDirtySet;
#ifndef NDEBUG
bool m_hasAXObject : 1;
bool m_setNeedsLayoutForbidden : 1;
......@@ -1137,31 +1114,6 @@ inline bool RenderObject::isBeforeOrAfterContent() const
return isBeforeContent() || isAfterContent();
}
inline void RenderObject::setNeedsLayout(bool needsLayout, MarkingBehavior markParents)
{
bool alreadyNeededLayout = m_bitfields.needsLayout();
m_bitfields.setNeedsLayout(needsLayout);
if (needsLayout) {
ASSERT(!isSetNeedsLayoutForbidden());
if (!alreadyNeededLayout) {
if (markParents == MarkContainingBlockChain)
markContainingBlocksForLayout();
if (hasLayer())
setLayerNeedsFullRepaint();
}
} else {
setEverHadLayout(true);
setPosChildNeedsLayout(false);
setNeedsSimplifiedNormalFlowLayout(false);
setNormalChildNeedsLayout(false);
setNeedsPositionedMovementLayout(false);
setAncestorLineBoxDirty(false);
#ifndef NDEBUG
checkBlockPositionedObjectsNeedLayout();
#endif
}
}
inline void RenderObject::setChildNeedsLayout(bool childNeedsLayout, MarkingBehavior markParents)
{
bool alreadyNeededLayout = normalChildNeedsLayout();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment