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

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

Issue 134473008: Remove CSS regions support, keeping a bare minimum to support "region-based" multicol. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 LayoutRectRecorder recorder(*this); 169 LayoutRectRecorder recorder(*this);
170 RenderBlock::layout(); 170 RenderBlock::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 if (hasRenderNamedFlowThreads())
179 flowThreadController()->layoutRenderNamedFlowThreads();
180
181 #ifndef NDEBUG 178 #ifndef NDEBUG
182 checkLayoutState(state); 179 checkLayoutState(state);
183 #endif 180 #endif
184 } 181 }
185 182
186 #ifndef NDEBUG 183 #ifndef NDEBUG
187 void RenderView::checkLayoutState(const LayoutState& state) 184 void RenderView::checkLayoutState(const LayoutState& state)
188 { 185 {
189 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) { 186 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) {
190 ASSERT(layoutDeltaMatches(LayoutSize())); 187 ASSERT(layoutDeltaMatches(LayoutSize()));
191 } 188 }
192 ASSERT(!m_layoutStateDisableCount); 189 ASSERT(!m_layoutStateDisableCount);
193 ASSERT(m_layoutState == &state); 190 ASSERT(m_layoutState == &state);
194 } 191 }
195 #endif 192 #endif
196 193
197 void RenderView::initializeLayoutState(LayoutState& state) 194 void RenderView::initializeLayoutState(LayoutState& state)
198 { 195 {
199 // FIXME: May be better to push a clip and avoid issuing offscreen repaints. 196 // FIXME: May be better to push a clip and avoid issuing offscreen repaints.
200 state.m_clipped = false; 197 state.m_clipped = false;
201 state.m_pageLogicalHeight = m_pageLogicalHeight; 198 state.m_pageLogicalHeight = m_pageLogicalHeight;
202 state.m_pageLogicalHeightChanged = m_pageLogicalHeightChanged; 199 state.m_pageLogicalHeightChanged = m_pageLogicalHeightChanged;
203 state.m_isPaginated = state.m_pageLogicalHeight; 200 state.m_isPaginated = state.m_pageLogicalHeight;
204 } 201 }
205 202
206 // The algorithm below assumes this is a full layout. In case there are previous ly computed values for regions, supplemental steps are taken
207 // to ensure the results are the same as those obtained from a full layout (i.e. the auto-height regions from all the flows are marked as needing
208 // layout).
209 // 1. The flows are laid out from the outer flow to the inner flow. This success fully computes the outer non-auto-height regions size so the
210 // inner flows have the necessary information to correctly fragment the content.
211 // 2. The flows are laid out from the inner flow to the outer flow. After an inn er flow is laid out it goes into the constrained layout phase
212 // and marks the auto-height regions they need layout. This means the outer flow s will relayout if they depend on regions with auto-height regions
213 // belonging to inner flows. This step will correctly set the computedAutoHeight for the auto-height regions. It's possible for non-auto-height
214 // regions to relayout if they depend on auto-height regions. This will invalida te the inner flow threads and mark them as needing layout.
215 // 3. The last step is to do one last layout if there are pathological dependenc ies between non-auto-height regions and auto-height regions
216 // as detected in the previous step.
217 void RenderView::layoutContentInAutoLogicalHeightRegions(const LayoutState& stat e)
218 {
219 if (!m_frameView->partialLayout().isStopping()) {
220 // Disable partial layout for any two-pass layout algorithm.
221 m_frameView->partialLayout().reset();
222 }
223
224 // We need to invalidate all the flows with auto-height regions if one such flow needs layout.
225 // If none is found we do a layout a check back again afterwards.
226 if (!flowThreadController()->updateFlowThreadsNeedingLayout()) {
227 // Do a first layout of the content. In some cases more layouts are not needed (e.g. only flows with non-auto-height regions have changed).
228 layoutContent(state);
229
230 // If we find no named flow needing a two step layout after the first la yout, exit early.
231 // Otherwise, initiate the two step layout algorithm and recompute all t he flows.
232 if (!flowThreadController()->updateFlowThreadsNeedingTwoStepLayout())
233 return;
234 }
235
236 // Layout to recompute all the named flows with auto-height regions.
237 layoutContent(state);
238
239 // Propagate the computed auto-height values upwards.
240 // Non-auto-height regions may invalidate the flow thread because they depen ded on auto-height regions, but that's ok.
241 flowThreadController()->updateFlowThreadsIntoConstrainedPhase();
242
243 // Do one last layout that should update the auto-height regions found in th e main flow
244 // and solve pathological dependencies between regions (e.g. a non-auto-heig ht region depending
245 // on an auto-height one).
246 if (needsLayout())
247 layoutContent(state);
248 }
249
250 void RenderView::layout() 203 void RenderView::layout()
251 { 204 {
252 if (!document().paginated()) 205 if (!document().paginated())
253 setPageLogicalHeight(0); 206 setPageLogicalHeight(0);
254 207
255 if (shouldUsePrintingLayout()) 208 if (shouldUsePrintingLayout())
256 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth() ; 209 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = logicalWidth() ;
257 210
258 SubtreeLayoutScope layoutScope(this); 211 SubtreeLayoutScope layoutScope(this);
259 212
(...skipping 19 matching lines...) Expand all
279 ASSERT(!m_layoutState); 232 ASSERT(!m_layoutState);
280 if (!needsLayout()) 233 if (!needsLayout())
281 return; 234 return;
282 235
283 LayoutState state; 236 LayoutState state;
284 initializeLayoutState(state); 237 initializeLayoutState(state);
285 238
286 m_pageLogicalHeightChanged = false; 239 m_pageLogicalHeightChanged = false;
287 m_layoutState = &state; 240 m_layoutState = &state;
288 241
289 if (checkTwoPassLayoutForAutoHeightRegions()) 242 layoutContent(state);
290 layoutContentInAutoLogicalHeightRegions(state);
291 else
292 layoutContent(state);
293 243
294 if (m_frameView->partialLayout().isStopping()) { 244 if (m_frameView->partialLayout().isStopping()) {
295 m_layoutState = 0; 245 m_layoutState = 0;
296 return; 246 return;
297 } 247 }
298 248
299 #ifndef NDEBUG 249 #ifndef NDEBUG
300 checkLayoutState(state); 250 checkLayoutState(state);
301 #endif 251 #endif
302 m_layoutState = 0; 252 m_layoutState = 0;
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 940
991 return m_compositor.get(); 941 return m_compositor.get();
992 } 942 }
993 943
994 void RenderView::setIsInWindow(bool isInWindow) 944 void RenderView::setIsInWindow(bool isInWindow)
995 { 945 {
996 if (m_compositor) 946 if (m_compositor)
997 m_compositor->setIsInWindow(isInWindow); 947 m_compositor->setIsInWindow(isInWindow);
998 } 948 }
999 949
1000 void RenderView::styleDidChange(StyleDifference diff, const RenderStyle* oldStyl e)
1001 {
1002 RenderBlock::styleDidChange(diff, oldStyle);
1003 if (hasRenderNamedFlowThreads())
1004 flowThreadController()->styleDidChange();
1005 }
1006
1007 bool RenderView::hasRenderNamedFlowThreads() const
1008 {
1009 return m_flowThreadController && m_flowThreadController->hasRenderNamedFlowT hreads();
1010 }
1011
1012 bool RenderView::checkTwoPassLayoutForAutoHeightRegions() const
1013 {
1014 return hasRenderNamedFlowThreads() && m_flowThreadController->hasFlowThreads WithAutoLogicalHeightRegions();
1015 }
1016
1017 FlowThreadController* RenderView::flowThreadController() 950 FlowThreadController* RenderView::flowThreadController()
1018 { 951 {
1019 if (!m_flowThreadController) 952 if (!m_flowThreadController)
1020 m_flowThreadController = FlowThreadController::create(this); 953 m_flowThreadController = FlowThreadController::create();
1021 954
1022 return m_flowThreadController.get(); 955 return m_flowThreadController.get();
1023 } 956 }
1024 957
1025 void RenderView::pushLayoutStateForCurrentFlowThread(const RenderObject* object) 958 void RenderView::pushLayoutStateForCurrentFlowThread(const RenderObject* object)
1026 { 959 {
1027 if (!m_flowThreadController) 960 if (!m_flowThreadController)
1028 return; 961 return;
1029 962
1030 RenderFlowThread* currentFlowThread = m_flowThreadController->currentRenderF lowThread(); 963 RenderFlowThread* currentFlowThread = m_flowThreadController->currentRenderF lowThread();
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 return true; 1063 return true;
1131 if (childStyle->top().isPercent() || childStyle->height().isPercent( ) || childStyle->minHeight().isPercent() || childStyle->maxHeight().isPercent() || !childStyle->bottom().isAuto()) 1064 if (childStyle->top().isPercent() || childStyle->height().isPercent( ) || childStyle->minHeight().isPercent() || childStyle->maxHeight().isPercent() || !childStyle->bottom().isAuto())
1132 return true; 1065 return true;
1133 } 1066 }
1134 } 1067 }
1135 1068
1136 return false; 1069 return false;
1137 } 1070 }
1138 1071
1139 } // namespace WebCore 1072 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698