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:
, m_lineBreakBidiStatusEor(WTF::Unicode::LeftToRight)
, m_lineBreakBidiStatusLastStrong(WTF::Unicode::LeftToRight)
, m_lineBreakBidiStatusLast(WTF::Unicode::LeftToRight)
, m_isFirstAfterPageBreak(false)
#if ENABLE(ASSERT)
, m_hasBadChildList(false)
#endif
......@@ -288,6 +289,9 @@ public:
parent()->clearDescendantsHaveSameLineHeightAndBaseline();
}
bool isFirstAfterPageBreak() const { return m_isFirstAfterPageBreak; }
void setIsFirstAfterPageBreak(bool isFirstAfterPageBreak) { m_isFirstAfterPageBreak = isFirstAfterPageBreak; }
private:
void addBoxShadowVisualOverflow(LayoutRect& logicalVisualOverflow);
void addBorderOutsetVisualOverflow(LayoutRect& logicalVisualOverflow);
......@@ -334,6 +338,8 @@ protected:
unsigned m_lineBreakBidiStatusLastStrong : 5; // WTF::Unicode::Direction
unsigned m_lineBreakBidiStatusLast : 5; // WTF::Unicode::Direction
unsigned m_isFirstAfterPageBreak : 1;
// End of RootInlineBox-specific members.
#if ENABLE(ASSERT)
......
......@@ -39,8 +39,8 @@ namespace blink {
struct SameSizeAsRootInlineBox : public InlineFlowBox {
unsigned unsignedVariable;
void* pointers[4];
LayoutUnit layoutVariables[5];
void* pointers[3];
LayoutUnit layoutVariables[7];
};
COMPILE_ASSERT(sizeof(RootInlineBox) == sizeof(SameSizeAsRootInlineBox), RootInlineBox_should_stay_small);
......@@ -57,6 +57,8 @@ RootInlineBox::RootInlineBox(RenderBlockFlow& block)
, m_lineTopWithLeading(0)
, m_lineBottomWithLeading(0)
, m_selectionBottom(0)
, m_paginationStrut(0)
, m_paginatedLineWidth(0)
{
setIsHorizontal(block.isHorizontalWritingMode());
}
......
......@@ -54,13 +54,10 @@ public:
LayoutUnit lineTopWithLeading() const { return m_lineTopWithLeading; }
LayoutUnit lineBottomWithLeading() const { return m_lineBottomWithLeading; }
LayoutUnit paginationStrut() const { return m_fragmentationData ? m_fragmentationData->m_paginationStrut : LayoutUnit(0); }
void setPaginationStrut(LayoutUnit strut) { ensureLineFragmentationData()->m_paginationStrut = strut; }
LayoutUnit paginationStrut() const { return m_paginationStrut; }
void setPaginationStrut(LayoutUnit strut) { m_paginationStrut = strut; }
bool isFirstAfterPageBreak() const { return m_fragmentationData ? m_fragmentationData->m_isFirstAfterPageBreak : false; }
void setIsFirstAfterPageBreak(bool isFirstAfterPageBreak) { ensureLineFragmentationData()->m_isFirstAfterPageBreak = isFirstAfterPageBreak; }
void setPaginatedLineWidth(LayoutUnit width) { ensureLineFragmentationData()->m_paginatedLineWidth = width; }
void setPaginatedLineWidth(LayoutUnit width) { m_paginatedLineWidth = width; }
LayoutUnit selectionTop() const;
LayoutUnit selectionBottom() const;
......@@ -186,15 +183,6 @@ public:
private:
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.
unsigned m_lineBreakPos;
......@@ -203,24 +191,6 @@ private:
RenderObject* m_lineBreakObj;
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
// good for as long as the line has not been marked dirty.
OwnPtr<Vector<RenderBox*> > m_floats;
......@@ -230,6 +200,8 @@ private:
LayoutUnit m_lineTopWithLeading;
LayoutUnit m_lineBottomWithLeading;
LayoutUnit m_selectionBottom;
LayoutUnit m_paginationStrut;
LayoutUnit m_paginatedLineWidth;
};
} // 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