Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1306)

Unified Diff: Source/core/layout/LayoutObject.h

Issue 1124993002: Cleanup: Only need one bit (not two) to express flow thread state. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/LayoutMultiColumnFlowThread.cpp ('k') | Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutObject.h
diff --git a/Source/core/layout/LayoutObject.h b/Source/core/layout/LayoutObject.h
index ae63d6ca79b8b9be6e18a59b44e7aefad3ea1e16..837eeed856cd2810e05e6f2968f4d3afa6ccb728 100644
--- a/Source/core/layout/LayoutObject.h
+++ b/Source/core/layout/LayoutObject.h
@@ -203,7 +203,7 @@ public:
// function follows the containing block chain.
LayoutFlowThread* flowThreadContainingBlock() const
{
- if (flowThreadState() == NotInsideFlowThread)
+ if (!isInsideFlowThread())
return 0;
return locateFlowThreadContainingBlock();
}
@@ -287,9 +287,9 @@ protected:
// Only update if our flow thread state is different from our new parent and if we're not a LayoutFlowThread.
// A LayoutFlowThread is always considered to be inside itself, so it never has to change its state
// in response to parent changes.
- FlowThreadState newState = parent ? parent->flowThreadState() : NotInsideFlowThread;
- if (newState != flowThreadState() && !isLayoutFlowThread())
- setFlowThreadStateIncludingDescendants(newState);
+ bool insideFlowThread = parent && parent->isInsideFlowThread();
+ if (insideFlowThread != isInsideFlowThread() && !isLayoutFlowThread())
+ setIsInsideFlowThreadIncludingDescendants(insideFlowThread);
}
//////////////////////////////////////////
@@ -430,16 +430,10 @@ public:
setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::LineBoxesChanged);
}
- enum FlowThreadState {
- NotInsideFlowThread = 0,
- InsideOutOfFlowThread = 1,
- InsideInFlowThread = 2,
- };
-
- void setFlowThreadStateIncludingDescendants(FlowThreadState);
+ void setIsInsideFlowThreadIncludingDescendants(bool);
- FlowThreadState flowThreadState() const { return m_bitfields.flowThreadState(); }
- void setFlowThreadState(FlowThreadState state) { m_bitfields.setFlowThreadState(state); }
+ bool isInsideFlowThread() const { return m_bitfields.isInsideFlowThread(); }
+ void setIsInsideFlowThread(bool insideFlowThread) { m_bitfields.setIsInsideFlowThread(insideFlowThread); }
// FIXME: Until all SVG layoutObjects can be subclasses of LayoutSVGModelObject we have
// to add SVG layoutObject methods to LayoutObject with an ASSERT_NOT_REACHED() default implementation.
@@ -1307,13 +1301,13 @@ private:
, m_ancestorLineBoxDirty(false)
, m_layoutDidGetCalledSinceLastFrame(false)
, m_hasPendingResourceUpdate(false)
+ , m_isInsideFlowThread(false)
, m_childrenInline(false)
, m_hasColumns(false)
, m_alwaysCreateLineBoxesForLayoutInline(false)
, m_lastBoxDecorationBackgroundObscured(false)
, m_positionedState(IsStaticallyPositioned)
, m_selectionState(SelectionNone)
- , m_flowThreadState(NotInsideFlowThread)
, m_boxDecorationBackgroundState(NoBoxDecorationBackground)
, m_fullPaintInvalidationReason(PaintInvalidationNone)
{
@@ -1355,6 +1349,8 @@ private:
ADD_BOOLEAN_BITFIELD(hasPendingResourceUpdate, HasPendingResourceUpdate);
+ ADD_BOOLEAN_BITFIELD(isInsideFlowThread, IsInsideFlowThread);
+
// from LayoutBlock
ADD_BOOLEAN_BITFIELD(childrenInline, ChildrenInline);
ADD_BOOLEAN_BITFIELD(hasColumns, HasColumns);
@@ -1368,7 +1364,6 @@ private:
private:
unsigned m_positionedState : 2; // PositionedState
unsigned m_selectionState : 3; // SelectionState
- unsigned m_flowThreadState : 2; // FlowThreadState
unsigned m_boxDecorationBackgroundState : 2; // BoxDecorationBackgroundState
unsigned m_fullPaintInvalidationReason : 5; // PaintInvalidationReason
@@ -1387,9 +1382,6 @@ private:
ALWAYS_INLINE SelectionState selectionState() const { return static_cast<SelectionState>(m_selectionState); }
ALWAYS_INLINE void setSelectionState(SelectionState selectionState) { m_selectionState = selectionState; }
- ALWAYS_INLINE FlowThreadState flowThreadState() const { return static_cast<FlowThreadState>(m_flowThreadState); }
- ALWAYS_INLINE void setFlowThreadState(FlowThreadState flowThreadState) { m_flowThreadState = flowThreadState; }
-
ALWAYS_INLINE BoxDecorationBackgroundState boxDecorationBackgroundState() const { return static_cast<BoxDecorationBackgroundState>(m_boxDecorationBackgroundState); }
ALWAYS_INLINE void setBoxDecorationBackgroundState(BoxDecorationBackgroundState s) { m_boxDecorationBackgroundState = s; }
« no previous file with comments | « Source/core/layout/LayoutMultiColumnFlowThread.cpp ('k') | Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698