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

Side by Side 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: Address comments 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 15 matching lines...) Expand all
26 #ifndef LayoutState_h 26 #ifndef LayoutState_h
27 #define LayoutState_h 27 #define LayoutState_h
28 28
29 #include "core/rendering/ColumnInfo.h" 29 #include "core/rendering/ColumnInfo.h"
30 #include "platform/geometry/LayoutRect.h" 30 #include "platform/geometry/LayoutRect.h"
31 #include "wtf/HashMap.h" 31 #include "wtf/HashMap.h"
32 #include "wtf/Noncopyable.h" 32 #include "wtf/Noncopyable.h"
33 33
34 namespace WebCore { 34 namespace WebCore {
35 35
36 class ForceHorriblySlowRectMapping;
36 class RenderBlockFlow; 37 class RenderBlockFlow;
37 class RenderBox; 38 class RenderBox;
38 class RenderObject; 39 class RenderObject;
39 class RenderFlowThread; 40 class RenderFlowThread;
41 class RenderView;
40 42
41 class LayoutState { 43 class LayoutState {
42 WTF_MAKE_NONCOPYABLE(LayoutState); 44 WTF_MAKE_NONCOPYABLE(LayoutState);
43 public: 45 public:
44 // Constructor for root LayoutState created by RenderView 46 // Constructor for root LayoutState created by RenderView
45 LayoutState(LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged) 47 LayoutState(LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged, Ren derView&);
46 : m_clipped(false) 48 // Constructor for sub-tree Layout and RenderTableSections
47 , m_isPaginated(pageLogicalHeight) 49 explicit LayoutState(RenderObject& root);
48 , m_pageLogicalHeightChanged(pageLogicalHeightChanged)
49 #if ASSERT_ENABLED
50 , m_layoutDeltaXSaturated(false)
51 , m_layoutDeltaYSaturated(false)
52 #endif
53 , m_columnInfo(0)
54 , m_next(0)
55 , m_pageLogicalHeight(pageLogicalHeight)
56 #ifndef NDEBUG
57 , m_renderer(0)
58 #endif
59 {
60 }
61 50
62 LayoutState(LayoutState*, RenderBox&, const LayoutSize& offset, LayoutUnit p ageLogicalHeight, bool pageHeightLogicalChanged, ColumnInfo*); 51 LayoutState(RenderBox&, const LayoutSize& offset, LayoutUnit pageLogicalHeig ht = 0, bool pageHeightLogicalChanged = false, ColumnInfo* = 0);
63 explicit LayoutState(RenderObject&);
64 52
65 // LayoutState is allocated out of the rendering partition. 53 ~LayoutState();
66 void* operator new(size_t);
67 void operator delete(void*);
68 54
69 void clearPaginationInformation(); 55 void clearPaginationInformation();
70 bool isPaginatingColumns() const { return m_columnInfo; } 56 bool isPaginatingColumns() const { return m_columnInfo; }
71 bool isPaginated() const { return m_isPaginated; } 57 bool isPaginated() const { return m_isPaginated; }
72 bool isClipped() const { return m_clipped; } 58 bool isClipped() const { return m_clipped; }
73 59
74 // The page logical offset is the object's offset from the top of the page i n the page progression 60 // The page logical offset is the object's offset from the top of the page i n the page progression
75 // direction (so an x-offset in vertical text and a y-offset for horizontal text). 61 // direction (so an x-offset in vertical text and a y-offset for horizontal text).
76 LayoutUnit pageLogicalOffset(const RenderBox&, const LayoutUnit& childLogica lOffset) const; 62 LayoutUnit pageLogicalOffset(const RenderBox&, const LayoutUnit& childLogica lOffset) const;
77 63
(...skipping 15 matching lines...) Expand all
93 const LayoutSize& pageOffset() const { return m_pageOffset; } 79 const LayoutSize& pageOffset() const { return m_pageOffset; }
94 LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; } 80 LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; }
95 bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; } 81 bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; }
96 82
97 LayoutState* next() const { return m_next; } 83 LayoutState* next() const { return m_next; }
98 84
99 bool needsBlockDirectionLocationSetBeforeLayout() const { return m_isPaginat ed && m_pageLogicalHeight; } 85 bool needsBlockDirectionLocationSetBeforeLayout() const { return m_isPaginat ed && m_pageLogicalHeight; }
100 86
101 ColumnInfo* columnInfo() const { return m_columnInfo; } 87 ColumnInfo* columnInfo() const { return m_columnInfo; }
102 88
103 const LayoutRect& clipRect() const { return m_clipRect; } 89 bool cachedOffsetsEnabled() const { return m_cachedOffsetsEnabled; }
104 const LayoutSize& paintOffset() const { return m_paintOffset; }
105 90
106 #ifndef NDEBUG 91 const LayoutRect& clipRect() const
107 RenderObject* renderer() const { return m_renderer; } 92 {
108 #endif 93 ASSERT(m_cachedOffsetsEnabled);
94 return m_clipRect;
95 }
96 const LayoutSize& paintOffset() const
97 {
98 ASSERT(m_cachedOffsetsEnabled);
99 return m_paintOffset;
100 }
101
102
103 RenderObject& renderer() const { return m_renderer; }
104
109 #if ASSERT_ENABLED 105 #if ASSERT_ENABLED
110 bool layoutDeltaXSaturated() const { return m_layoutDeltaXSaturated; } 106 bool layoutDeltaXSaturated() const { return m_layoutDeltaXSaturated; }
111 bool layoutDeltaYSaturated() const { return m_layoutDeltaYSaturated; } 107 bool layoutDeltaYSaturated() const { return m_layoutDeltaYSaturated; }
112 #endif 108 #endif
113 109
114 private: 110 private:
111 friend class ForceHorriblySlowRectMapping;
112
115 // Do not add anything apart from bitfields until after m_columnInfo. See ht tps://bugs.webkit.org/show_bug.cgi?id=100173 113 // Do not add anything apart from bitfields until after m_columnInfo. See ht tps://bugs.webkit.org/show_bug.cgi?id=100173
116 bool m_clipped:1; 114 bool m_clipped:1;
117 bool m_isPaginated:1; 115 bool m_isPaginated:1;
118 // If our page height has changed, this will force all blocks to relayout. 116 // If our page height has changed, this will force all blocks to relayout.
119 bool m_pageLogicalHeightChanged:1; 117 bool m_pageLogicalHeightChanged:1;
118
119 bool m_cachedOffsetsEnabled:1;
120 #if ASSERT_ENABLED 120 #if ASSERT_ENABLED
121 bool m_layoutDeltaXSaturated:1; 121 bool m_layoutDeltaXSaturated:1;
122 bool m_layoutDeltaYSaturated:1; 122 bool m_layoutDeltaYSaturated:1;
esprehn 2014/06/14 03:08:27 We should switch all these back to real bools inst
123 #endif 123 #endif
124 // If the enclosing pagination model is a column model, then this will store column information for easy retrieval/manipulation. 124 // If the enclosing pagination model is a column model, then this will store column information for easy retrieval/manipulation.
125 ColumnInfo* m_columnInfo; 125 ColumnInfo* m_columnInfo;
126 LayoutState* m_next; 126 LayoutState* m_next;
127 127
128 // FIXME: Distinguish between the layout clip rect and the paint clip rect w hich may be larger, 128 // FIXME: Distinguish between the layout clip rect and the paint clip rect w hich may be larger,
129 // e.g., because of composited scrolling. 129 // e.g., because of composited scrolling.
130 LayoutRect m_clipRect; 130 LayoutRect m_clipRect;
131 131
132 // x/y offset from container. Includes relative positioning and scroll offse ts. 132 // x/y offset from container. Includes relative positioning and scroll offse ts.
133 LayoutSize m_paintOffset; 133 LayoutSize m_paintOffset;
134 // x/y offset from container. Does not include relative positioning or scrol l offsets. 134 // x/y offset from container. Does not include relative positioning or scrol l offsets.
135 LayoutSize m_layoutOffset; 135 LayoutSize m_layoutOffset;
136 // Transient offset from the final position of the object 136 // Transient offset from the final position of the object
137 // used to ensure that repaints happen in the correct place. 137 // used to ensure that repaints happen in the correct place.
138 // This is a total delta accumulated from the root. 138 // This is a total delta accumulated from the root.
139 LayoutSize m_layoutDelta; 139 LayoutSize m_layoutDelta;
140 140
141 // The current page height for the pagination model that encloses us. 141 // The current page height for the pagination model that encloses us.
142 LayoutUnit m_pageLogicalHeight; 142 LayoutUnit m_pageLogicalHeight;
143 // The offset of the start of the first page in the nearest enclosing pagina tion model. 143 // The offset of the start of the first page in the nearest enclosing pagina tion model.
144 LayoutSize m_pageOffset; 144 LayoutSize m_pageOffset;
145 145
146 #ifndef NDEBUG 146 RenderObject& m_renderer;
147 RenderObject* m_renderer;
148 #endif
149 }; 147 };
150 148
151 } // namespace WebCore 149 } // namespace WebCore
152 150
153 #endif // LayoutState_h 151 #endif // LayoutState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698