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

Side by Side Diff: Source/core/rendering/RenderView.cpp

Issue 196533012: Make LayoutState always be RAII (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: It's the ToT as you can see Created 6 years, 9 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 if (!positionedDescendants) 155 if (!positionedDescendants)
156 return; 156 return;
157 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); 157 TrackedRendererListHashSet::iterator end = positionedDescendants->end();
158 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin( ); it != end; ++it) { 158 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin( ); it != end; ++it) {
159 RenderBox* box = *it; 159 RenderBox* box = *it;
160 if (box->node() && box->node()->hasTagName(HTMLNames::dialogTag)) 160 if (box->node() && box->node()->hasTagName(HTMLNames::dialogTag))
161 positionDialog(box); 161 positionDialog(box);
162 } 162 }
163 } 163 }
164 164
165 void RenderView::layoutContent(const LayoutState& state) 165 void RenderView::layoutContent()
166 { 166 {
167 ASSERT(needsLayout()); 167 ASSERT(needsLayout());
168 168
169 LayoutRectRecorder recorder(*this); 169 LayoutRectRecorder recorder(*this);
170 RenderBlockFlow::layout(); 170 RenderBlockFlow::layout();
171 171
172 if (RuntimeEnabledFeatures::dialogElementEnabled()) 172 if (RuntimeEnabledFeatures::dialogElementEnabled())
173 positionDialogs(); 173 positionDialogs();
174 174
175 if (m_frameView->partialLayout().isStopping()) 175 if (m_frameView->partialLayout().isStopping())
176 return; 176 return;
177 177
178 #ifndef NDEBUG 178 #ifndef NDEBUG
179 checkLayoutState(state); 179 checkLayoutState();
180 #endif 180 #endif
181 } 181 }
182 182
183 #ifndef NDEBUG 183 #ifndef NDEBUG
184 void RenderView::checkLayoutState(const LayoutState& state) 184 void RenderView::checkLayoutState()
185 { 185 {
186 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { 186 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) {
187 ASSERT(layoutDeltaMatches(LayoutSize())); 187 ASSERT(layoutDeltaMatches(LayoutSize()));
188 } 188 }
189 ASSERT(!m_layoutStateDisableCount); 189 ASSERT(!m_layoutStateDisableCount);
190 ASSERT(m_layoutState == &state); 190 ASSERT(!m_layoutState->m_next);
191 } 191 }
192 #endif 192 #endif
193 193
194 void RenderView::initializeLayoutState(LayoutState& state) 194 void RootLayoutStateScope::initializeLayoutState()
195 { 195 {
196 state.m_clipped = false; 196 m_rootLayoutState.m_clipped = false;
197 state.m_pageLogicalHeight = m_pageLogicalHeight; 197 m_rootLayoutState.m_pageLogicalHeight = m_view.m_pageLogicalHeight;
198 state.m_pageLogicalHeightChanged = m_pageLogicalHeightChanged; 198 m_rootLayoutState.m_pageLogicalHeightChanged = m_view.m_pageLogicalHeightCha nged;
199 state.m_isPaginated = state.m_pageLogicalHeight; 199 m_rootLayoutState.m_isPaginated = m_rootLayoutState.m_pageLogicalHeight;
200 } 200 }
201 201
202 void RenderView::layout() 202 void RenderView::layout()
203 { 203 {
204 if (!document().paginated()) 204 if (!document().paginated())
205 setPageLogicalHeight(0); 205 setPageLogicalHeight(0);
206 206
207 if (shouldUsePrintingLayout()) 207 if (shouldUsePrintingLayout())
208 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth() ; 208 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth() ;
209 209
(...skipping 15 matching lines...) Expand all
225 } 225 }
226 226
227 if (document().svgExtensions()) 227 if (document().svgExtensions())
228 document().accessSVGExtensions().invalidateSVGRootsWithRelativeLengt hDescendents(&layoutScope); 228 document().accessSVGExtensions().invalidateSVGRootsWithRelativeLengt hDescendents(&layoutScope);
229 } 229 }
230 230
231 ASSERT(!m_layoutState); 231 ASSERT(!m_layoutState);
232 if (!needsLayout()) 232 if (!needsLayout())
233 return; 233 return;
234 234
235 LayoutState state; 235 RootLayoutStateScope rootLayoutStateScope(*this);
236 initializeLayoutState(state);
237 236
238 m_pageLogicalHeightChanged = false; 237 m_pageLogicalHeightChanged = false;
239 m_layoutState = &state;
240 238
241 layoutContent(state); 239 layoutContent();
242 240
243 if (m_frameView->partialLayout().isStopping()) { 241 if (m_frameView->partialLayout().isStopping()) {
244 m_layoutState = 0;
245 return; 242 return;
246 } 243 }
247 244
248 #ifndef NDEBUG 245 #ifndef NDEBUG
249 checkLayoutState(state); 246 checkLayoutState();
250 #endif 247 #endif
251 m_layoutState = 0;
252 clearNeedsLayout(); 248 clearNeedsLayout();
253 } 249 }
254 250
255 void RenderView::mapLocalToContainer(const RenderLayerModelObject* repaintContai ner, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) c onst 251 void RenderView::mapLocalToContainer(const RenderLayerModelObject* repaintContai ner, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) c onst
256 { 252 {
257 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I sFixed)); 253 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I sFixed));
258 254
259 if (!repaintContainer && mode & UseTransforms && shouldUseTransformFromConta iner(0)) { 255 if (!repaintContainer && mode & UseTransforms && shouldUseTransformFromConta iner(0)) {
260 TransformationMatrix t; 256 TransformationMatrix t;
261 getTransformFromContainer(0, LayoutSize(), t); 257 getTransformFromContainer(0, LayoutSize(), t);
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 return viewWidth(IncludeScrollbars) / scale; 987 return viewWidth(IncludeScrollbars) / scale;
992 } 988 }
993 989
994 double RenderView::layoutViewportHeight() const 990 double RenderView::layoutViewportHeight() const
995 { 991 {
996 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; 992 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1;
997 return viewHeight(IncludeScrollbars) / scale; 993 return viewHeight(IncludeScrollbars) / scale;
998 } 994 }
999 995
1000 } // namespace WebCore 996 } // namespace WebCore
OLDNEW
« Source/core/rendering/RenderTable.cpp ('K') | « Source/core/rendering/RenderView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698