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

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: Updated to ToT 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
« no previous file with comments | « Source/core/rendering/RenderView.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 if (!positionedDescendants) 154 if (!positionedDescendants)
155 return; 155 return;
156 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); 156 TrackedRendererListHashSet::iterator end = positionedDescendants->end();
157 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin( ); it != end; ++it) { 157 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin( ); it != end; ++it) {
158 RenderBox* box = *it; 158 RenderBox* box = *it;
159 if (isHTMLDialogElement(box->node())) 159 if (isHTMLDialogElement(box->node()))
160 positionDialog(box); 160 positionDialog(box);
161 } 161 }
162 } 162 }
163 163
164 void RenderView::layoutContent(const LayoutState& state) 164 void RenderView::layoutContent()
165 { 165 {
166 ASSERT(needsLayout()); 166 ASSERT(needsLayout());
167 167
168 LayoutRectRecorder recorder(*this); 168 LayoutRectRecorder recorder(*this);
169 RenderBlockFlow::layout(); 169 RenderBlockFlow::layout();
170 170
171 if (RuntimeEnabledFeatures::dialogElementEnabled()) 171 if (RuntimeEnabledFeatures::dialogElementEnabled())
172 positionDialogs(); 172 positionDialogs();
173 173
174 #ifndef NDEBUG 174 #ifndef NDEBUG
175 checkLayoutState(state); 175 checkLayoutState();
176 #endif 176 #endif
177 } 177 }
178 178
179 #ifndef NDEBUG 179 #ifndef NDEBUG
180 void RenderView::checkLayoutState(const LayoutState& state) 180 void RenderView::checkLayoutState()
181 { 181 {
182 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { 182 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) {
183 ASSERT(layoutDeltaMatches(LayoutSize())); 183 ASSERT(layoutDeltaMatches(LayoutSize()));
184 } 184 }
185 ASSERT(!m_layoutStateDisableCount); 185 ASSERT(!m_layoutStateDisableCount);
186 ASSERT(m_layoutState == &state); 186 ASSERT(!m_layoutState->m_next);
187 } 187 }
188 #endif 188 #endif
189 189
190 void RenderView::initializeLayoutState(LayoutState& state) 190 void RootLayoutStateScope::initializeLayoutState()
191 { 191 {
192 state.m_clipped = false; 192 m_rootLayoutState.m_clipped = false;
193 state.m_pageLogicalHeight = m_pageLogicalHeight; 193 m_rootLayoutState.m_pageLogicalHeight = m_view.m_pageLogicalHeight;
194 state.m_pageLogicalHeightChanged = m_pageLogicalHeightChanged; 194 m_rootLayoutState.m_pageLogicalHeightChanged = m_view.m_pageLogicalHeightCha nged;
195 state.m_isPaginated = state.m_pageLogicalHeight; 195 m_rootLayoutState.m_isPaginated = m_rootLayoutState.m_pageLogicalHeight;
196 } 196 }
197 197
198 void RenderView::layout() 198 void RenderView::layout()
199 { 199 {
200 if (!document().paginated()) 200 if (!document().paginated())
201 setPageLogicalHeight(0); 201 setPageLogicalHeight(0);
202 202
203 if (shouldUsePrintingLayout()) 203 if (shouldUsePrintingLayout())
204 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth() ; 204 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth() ;
205 205
(...skipping 15 matching lines...) Expand all
221 } 221 }
222 222
223 if (document().svgExtensions()) 223 if (document().svgExtensions())
224 document().accessSVGExtensions().invalidateSVGRootsWithRelativeLengt hDescendents(&layoutScope); 224 document().accessSVGExtensions().invalidateSVGRootsWithRelativeLengt hDescendents(&layoutScope);
225 } 225 }
226 226
227 ASSERT(!m_layoutState); 227 ASSERT(!m_layoutState);
228 if (!needsLayout()) 228 if (!needsLayout())
229 return; 229 return;
230 230
231 LayoutState state; 231 RootLayoutStateScope rootLayoutStateScope(*this);
232 initializeLayoutState(state);
233 232
234 m_pageLogicalHeightChanged = false; 233 m_pageLogicalHeightChanged = false;
235 m_layoutState = &state;
236 234
237 layoutContent(state); 235 layoutContent();
238 236
239 #ifndef NDEBUG 237 #ifndef NDEBUG
240 checkLayoutState(state); 238 checkLayoutState();
241 #endif 239 #endif
242 m_layoutState = 0;
243 clearNeedsLayout(); 240 clearNeedsLayout();
244 } 241 }
245 242
246 void RenderView::mapLocalToContainer(const RenderLayerModelObject* repaintContai ner, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) c onst 243 void RenderView::mapLocalToContainer(const RenderLayerModelObject* repaintContai ner, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) c onst
247 { 244 {
248 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I sFixed)); 245 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I sFixed));
249 246
250 if (!repaintContainer && mode & UseTransforms && shouldUseTransformFromConta iner(0)) { 247 if (!repaintContainer && mode & UseTransforms && shouldUseTransformFromConta iner(0)) {
251 TransformationMatrix t; 248 TransformationMatrix t;
252 getTransformFromContainer(0, LayoutSize(), t); 249 getTransformFromContainer(0, LayoutSize(), t);
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 return viewWidth(IncludeScrollbars) / scale; 966 return viewWidth(IncludeScrollbars) / scale;
970 } 967 }
971 968
972 double RenderView::layoutViewportHeight() const 969 double RenderView::layoutViewportHeight() const
973 { 970 {
974 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; 971 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1;
975 return viewHeight(IncludeScrollbars) / scale; 972 return viewHeight(IncludeScrollbars) / scale;
976 } 973 }
977 974
978 } // namespace WebCore 975 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698