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

Unified Diff: Source/core/rendering/LayoutState.h

Issue 335963002: Change LayoutState to be stack-allocated (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix push function to match old behavior... Created 6 years, 6 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
Index: Source/core/rendering/LayoutState.h
diff --git a/Source/core/rendering/LayoutState.h b/Source/core/rendering/LayoutState.h
index b873b3fbd075880cd11ca21b3f815fd39b4776a4..dce1b1be56283178e37d8a1fef038c475712acd2 100644
--- a/Source/core/rendering/LayoutState.h
+++ b/Source/core/rendering/LayoutState.h
@@ -33,38 +33,24 @@
namespace WebCore {
+class ForceHorriblySlowRectMapping;
class RenderBlockFlow;
class RenderBox;
class RenderObject;
class RenderFlowThread;
+class RenderView;
class LayoutState {
WTF_MAKE_NONCOPYABLE(LayoutState);
public:
// Constructor for root LayoutState created by RenderView
- LayoutState(LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged)
- : m_clipped(false)
- , m_isPaginated(pageLogicalHeight)
- , m_pageLogicalHeightChanged(pageLogicalHeightChanged)
-#if ASSERT_ENABLED
- , m_layoutDeltaXSaturated(false)
- , m_layoutDeltaYSaturated(false)
-#endif
- , m_columnInfo(0)
- , m_next(0)
- , m_pageLogicalHeight(pageLogicalHeight)
-#ifndef NDEBUG
- , m_renderer(0)
-#endif
- {
- }
+ LayoutState(LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged, RenderView&);
+ // Constructor for sub-tree Layout and RenderTableSections
+ explicit LayoutState(RenderObject& root);
- LayoutState(LayoutState*, RenderBox&, const LayoutSize& offset, LayoutUnit pageLogicalHeight, bool pageHeightLogicalChanged, ColumnInfo*);
- explicit LayoutState(RenderObject&);
+ LayoutState(RenderBox&, const LayoutSize& offset, LayoutUnit pageLogicalHeight = 0, bool pageHeightLogicalChanged = false, ColumnInfo* = 0);
- // LayoutState is allocated out of the rendering partition.
- void* operator new(size_t);
- void operator delete(void*);
+ ~LayoutState();
void clearPaginationInformation();
bool isPaginatingColumns() const { return m_columnInfo; }
@@ -100,23 +86,37 @@ public:
ColumnInfo* columnInfo() const { return m_columnInfo; }
- const LayoutRect& clipRect() const { return m_clipRect; }
- const LayoutSize& paintOffset() const { return m_paintOffset; }
+ bool cachedOffsetsEnabled() const { return m_cachedOffsetsEnabled; }
+
+ const LayoutRect& clipRect() const
+ {
+ ASSERT(m_cachedOffsetsEnabled);
+ return m_clipRect;
+ }
+ const LayoutSize& paintOffset() const
+ {
+ ASSERT(m_cachedOffsetsEnabled);
+ return m_paintOffset;
+ }
+
+
+ RenderObject& renderer() const { return m_renderer; }
-#ifndef NDEBUG
- RenderObject* renderer() const { return m_renderer; }
-#endif
#if ASSERT_ENABLED
bool layoutDeltaXSaturated() const { return m_layoutDeltaXSaturated; }
bool layoutDeltaYSaturated() const { return m_layoutDeltaYSaturated; }
#endif
private:
+ friend class ForceHorriblySlowRectMapping;
+
// Do not add anything apart from bitfields until after m_columnInfo. See https://bugs.webkit.org/show_bug.cgi?id=100173
bool m_clipped:1;
bool m_isPaginated:1;
// If our page height has changed, this will force all blocks to relayout.
bool m_pageLogicalHeightChanged:1;
+
+ bool m_cachedOffsetsEnabled:1;
#if ASSERT_ENABLED
bool m_layoutDeltaXSaturated:1;
bool m_layoutDeltaYSaturated:1;
@@ -143,9 +143,7 @@ private:
// The offset of the start of the first page in the nearest enclosing pagination model.
LayoutSize m_pageOffset;
-#ifndef NDEBUG
- RenderObject* m_renderer;
-#endif
+ RenderObject& m_renderer;
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698