Commit 7b45e91a authored by leviw@chromium.org's avatar leviw@chromium.org

Remove FragementationData lazyness

Having fragmentation data be lazy on RootInlineBox only saves us a single
int (due to the pointer and the fact that we have room to pack its bool
into InlineFlowBox's bitfields), and the allocation overhead was large enough
it appeared on performance tests (see bug).

BUG=313700

Review URL: https://codereview.chromium.org/715973004

git-svn-id: svn://svn.chromium.org/blink/trunk@185170 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 80eaa7fe
...@@ -56,6 +56,7 @@ public: ...@@ -56,6 +56,7 @@ public:
, m_lineBreakBidiStatusEor(WTF::Unicode::LeftToRight) , m_lineBreakBidiStatusEor(WTF::Unicode::LeftToRight)
, m_lineBreakBidiStatusLastStrong(WTF::Unicode::LeftToRight) , m_lineBreakBidiStatusLastStrong(WTF::Unicode::LeftToRight)
, m_lineBreakBidiStatusLast(WTF::Unicode::LeftToRight) , m_lineBreakBidiStatusLast(WTF::Unicode::LeftToRight)
, m_isFirstAfterPageBreak(false)
#if ENABLE(ASSERT) #if ENABLE(ASSERT)
, m_hasBadChildList(false) , m_hasBadChildList(false)
#endif #endif
...@@ -288,6 +289,9 @@ public: ...@@ -288,6 +289,9 @@ public:
parent()->clearDescendantsHaveSameLineHeightAndBaseline(); parent()->clearDescendantsHaveSameLineHeightAndBaseline();
} }
bool isFirstAfterPageBreak() const { return m_isFirstAfterPageBreak; }
void setIsFirstAfterPageBreak(bool isFirstAfterPageBreak) { m_isFirstAfterPageBreak = isFirstAfterPageBreak; }
private: private:
void addBoxShadowVisualOverflow(LayoutRect& logicalVisualOverflow); void addBoxShadowVisualOverflow(LayoutRect& logicalVisualOverflow);
void addBorderOutsetVisualOverflow(LayoutRect& logicalVisualOverflow); void addBorderOutsetVisualOverflow(LayoutRect& logicalVisualOverflow);
...@@ -334,6 +338,8 @@ protected: ...@@ -334,6 +338,8 @@ protected:
unsigned m_lineBreakBidiStatusLastStrong : 5; // WTF::Unicode::Direction unsigned m_lineBreakBidiStatusLastStrong : 5; // WTF::Unicode::Direction
unsigned m_lineBreakBidiStatusLast : 5; // WTF::Unicode::Direction unsigned m_lineBreakBidiStatusLast : 5; // WTF::Unicode::Direction
unsigned m_isFirstAfterPageBreak : 1;
// End of RootInlineBox-specific members. // End of RootInlineBox-specific members.
#if ENABLE(ASSERT) #if ENABLE(ASSERT)
......
...@@ -39,8 +39,8 @@ namespace blink { ...@@ -39,8 +39,8 @@ namespace blink {
struct SameSizeAsRootInlineBox : public InlineFlowBox { struct SameSizeAsRootInlineBox : public InlineFlowBox {
unsigned unsignedVariable; unsigned unsignedVariable;
void* pointers[4]; void* pointers[3];
LayoutUnit layoutVariables[5]; LayoutUnit layoutVariables[7];
}; };
COMPILE_ASSERT(sizeof(RootInlineBox) == sizeof(SameSizeAsRootInlineBox), RootInlineBox_should_stay_small); COMPILE_ASSERT(sizeof(RootInlineBox) == sizeof(SameSizeAsRootInlineBox), RootInlineBox_should_stay_small);
...@@ -57,6 +57,8 @@ RootInlineBox::RootInlineBox(RenderBlockFlow& block) ...@@ -57,6 +57,8 @@ RootInlineBox::RootInlineBox(RenderBlockFlow& block)
, m_lineTopWithLeading(0) , m_lineTopWithLeading(0)
, m_lineBottomWithLeading(0) , m_lineBottomWithLeading(0)
, m_selectionBottom(0) , m_selectionBottom(0)
, m_paginationStrut(0)
, m_paginatedLineWidth(0)
{ {
setIsHorizontal(block.isHorizontalWritingMode()); setIsHorizontal(block.isHorizontalWritingMode());
} }
......
...@@ -54,13 +54,10 @@ public: ...@@ -54,13 +54,10 @@ public:
LayoutUnit lineTopWithLeading() const { return m_lineTopWithLeading; } LayoutUnit lineTopWithLeading() const { return m_lineTopWithLeading; }
LayoutUnit lineBottomWithLeading() const { return m_lineBottomWithLeading; } LayoutUnit lineBottomWithLeading() const { return m_lineBottomWithLeading; }
LayoutUnit paginationStrut() const { return m_fragmentationData ? m_fragmentationData->m_paginationStrut : LayoutUnit(0); } LayoutUnit paginationStrut() const { return m_paginationStrut; }
void setPaginationStrut(LayoutUnit strut) { ensureLineFragmentationData()->m_paginationStrut = strut; } void setPaginationStrut(LayoutUnit strut) { m_paginationStrut = strut; }
bool isFirstAfterPageBreak() const { return m_fragmentationData ? m_fragmentationData->m_isFirstAfterPageBreak : false; } void setPaginatedLineWidth(LayoutUnit width) { m_paginatedLineWidth = width; }
void setIsFirstAfterPageBreak(bool isFirstAfterPageBreak) { ensureLineFragmentationData()->m_isFirstAfterPageBreak = isFirstAfterPageBreak; }
void setPaginatedLineWidth(LayoutUnit width) { ensureLineFragmentationData()->m_paginatedLineWidth = width; }
LayoutUnit selectionTop() const; LayoutUnit selectionTop() const;
LayoutUnit selectionBottom() const; LayoutUnit selectionBottom() const;
...@@ -186,15 +183,6 @@ public: ...@@ -186,15 +183,6 @@ public:
private: private:
LayoutUnit beforeAnnotationsAdjustment() const; LayoutUnit beforeAnnotationsAdjustment() const;
struct LineFragmentationData;
LineFragmentationData* ensureLineFragmentationData()
{
if (!m_fragmentationData)
m_fragmentationData = adoptPtr(new LineFragmentationData());
return m_fragmentationData.get();
}
// This folds into the padding at the end of InlineFlowBox on 64-bit. // This folds into the padding at the end of InlineFlowBox on 64-bit.
unsigned m_lineBreakPos; unsigned m_lineBreakPos;
...@@ -203,24 +191,6 @@ private: ...@@ -203,24 +191,6 @@ private:
RenderObject* m_lineBreakObj; RenderObject* m_lineBreakObj;
RefPtr<BidiContext> m_lineBreakContext; RefPtr<BidiContext> m_lineBreakContext;
struct LineFragmentationData {
WTF_MAKE_NONCOPYABLE(LineFragmentationData); WTF_MAKE_FAST_ALLOCATED;
public:
LineFragmentationData()
: m_paginationStrut(0)
, m_paginatedLineWidth(0)
, m_isFirstAfterPageBreak(false)
{
}
LayoutUnit m_paginationStrut;
LayoutUnit m_paginatedLineWidth;
bool m_isFirstAfterPageBreak;
};
OwnPtr<LineFragmentationData> m_fragmentationData;
// Floats hanging off the line are pushed into this vector during layout. It is only // Floats hanging off the line are pushed into this vector during layout. It is only
// good for as long as the line has not been marked dirty. // good for as long as the line has not been marked dirty.
OwnPtr<Vector<RenderBox*> > m_floats; OwnPtr<Vector<RenderBox*> > m_floats;
...@@ -230,6 +200,8 @@ private: ...@@ -230,6 +200,8 @@ private:
LayoutUnit m_lineTopWithLeading; LayoutUnit m_lineTopWithLeading;
LayoutUnit m_lineBottomWithLeading; LayoutUnit m_lineBottomWithLeading;
LayoutUnit m_selectionBottom; LayoutUnit m_selectionBottom;
LayoutUnit m_paginationStrut;
LayoutUnit m_paginatedLineWidth;
}; };
} // namespace blink } // namespace blink
......
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