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

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

Issue 143323014: *** DO NOT LAND *** Attempt to understand Regions complexity Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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/RenderTreeAsText.cpp ('k') | Source/core/rendering/RenderView.cpp » ('j') | 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) 2006 Apple Computer, Inc. 3 * Copyright (C) 2006 Apple Computer, Inc.
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 13 matching lines...) Expand all
24 24
25 #include "core/frame/FrameView.h" 25 #include "core/frame/FrameView.h"
26 #include "core/rendering/LayoutState.h" 26 #include "core/rendering/LayoutState.h"
27 #include "core/rendering/RenderBlockFlow.h" 27 #include "core/rendering/RenderBlockFlow.h"
28 #include "platform/PODFreeListArena.h" 28 #include "platform/PODFreeListArena.h"
29 #include "platform/scroll/ScrollableArea.h" 29 #include "platform/scroll/ScrollableArea.h"
30 #include "wtf/OwnPtr.h" 30 #include "wtf/OwnPtr.h"
31 31
32 namespace WebCore { 32 namespace WebCore {
33 33
34 class FlowThreadController;
35 class RenderLayerCompositor; 34 class RenderLayerCompositor;
36 class RenderQuote; 35 class RenderQuote;
37 36
38 // The root of the render tree, corresponding to the CSS initial containing bloc k. 37 // The root of the render tree, corresponding to the CSS initial containing bloc k.
39 // It's dimensions match that of the logical viewport (which may be different fr om 38 // It's dimensions match that of the logical viewport (which may be different fr om
40 // the visible viewport in fixed-layout mode), and it is always at position (0,0 ) 39 // the visible viewport in fixed-layout mode), and it is always at position (0,0 )
41 // relative to the document (and so isn't necessarily in view). 40 // relative to the document (and so isn't necessarily in view).
42 class RenderView FINAL : public RenderBlockFlow { 41 class RenderView FINAL : public RenderBlockFlow {
43 public: 42 public:
44 explicit RenderView(Document*); 43 explicit RenderView(Document*);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 bool usesCompositing() const; 163 bool usesCompositing() const;
165 164
166 IntRect unscaledDocumentRect() const; 165 IntRect unscaledDocumentRect() const;
167 LayoutRect backgroundRect(RenderBox* backgroundRenderer) const; 166 LayoutRect backgroundRect(RenderBox* backgroundRenderer) const;
168 167
169 IntRect documentRect() const; 168 IntRect documentRect() const;
170 169
171 // Renderer that paints the root background has background-images which all have background-attachment: fixed. 170 // Renderer that paints the root background has background-images which all have background-attachment: fixed.
172 bool rootBackgroundIsEntirelyFixed() const; 171 bool rootBackgroundIsEntirelyFixed() const;
173 172
174 bool hasRenderNamedFlowThreads() const;
175 bool checkTwoPassLayoutForAutoHeightRegions() const;
176 FlowThreadController* flowThreadController();
177
178 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV ERRIDE;
179
180 IntervalArena* intervalArena(); 173 IntervalArena* intervalArena();
181 174
182 void setRenderQuoteHead(RenderQuote* head) { m_renderQuoteHead = head; } 175 void setRenderQuoteHead(RenderQuote* head) { m_renderQuoteHead = head; }
183 RenderQuote* renderQuoteHead() const { return m_renderQuoteHead; } 176 RenderQuote* renderQuoteHead() const { return m_renderQuoteHead; }
184 177
185 // FIXME: This is a work around because the current implementation of counte rs 178 // FIXME: This is a work around because the current implementation of counte rs
186 // requires walking the entire tree repeatedly and most pages don't actually use either 179 // requires walking the entire tree repeatedly and most pages don't actually use either
187 // feature so we shouldn't take the performance hit when not needed. Long te rm we should 180 // feature so we shouldn't take the performance hit when not needed. Long te rm we should
188 // rewrite the counter and quotes code. 181 // rewrite the counter and quotes code.
189 void addRenderCounter() { m_renderCounterCount++; } 182 void addRenderCounter() { m_renderCounterCount++; }
190 void removeRenderCounter() { ASSERT(m_renderCounterCount > 0); m_renderCount erCount--; } 183 void removeRenderCounter() { ASSERT(m_renderCounterCount > 0); m_renderCount erCount--; }
191 bool hasRenderCounters() { return m_renderCounterCount; } 184 bool hasRenderCounters() { return m_renderCounterCount; }
192 185
193 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) OVERRIDE;
194
195 virtual bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const OVERRIDE; 186 virtual bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const OVERRIDE;
196 187
197 double layoutViewportWidth() const; 188 double layoutViewportWidth() const;
198 double layoutViewportHeight() const; 189 double layoutViewportHeight() const;
199 190
200 private: 191 private:
201 virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContai ner, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0) const OVERRIDE; 192 virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContai ner, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0) const OVERRIDE;
202 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE; 193 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObj ect* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE;
203 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c onst OVERRIDE; 194 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c onst OVERRIDE;
204 virtual bool requiresColumns(int desiredColumnCount) const OVERRIDE; 195 virtual bool requiresColumns(int desiredColumnCount) const OVERRIDE;
205 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const OVERRIDE; 196 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const OVERRIDE;
206 197
207 bool initializeLayoutState(LayoutState&); 198 bool initializeLayoutState(LayoutState&);
208 199
209 virtual void calcColumnWidth() OVERRIDE; 200 virtual void calcColumnWidth() OVERRIDE;
210 virtual ColumnInfo::PaginationUnit paginationUnit() const OVERRIDE; 201 virtual ColumnInfo::PaginationUnit paginationUnit() const OVERRIDE;
211 202
212 bool shouldRepaint(const LayoutRect&) const; 203 bool shouldRepaint(const LayoutRect&) const;
213 204
214 // These functions may only be accessed by LayoutStateMaintainer. 205 // These functions may only be accessed by LayoutStateMaintainer.
215 bool pushLayoutState(RenderBox* renderer, const LayoutSize& offset, LayoutUn it pageHeight = 0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0) 206 bool pushLayoutState(RenderBox* renderer, const LayoutSize& offset, LayoutUn it pageHeight = 0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0)
216 { 207 {
217 // We push LayoutState even if layoutState is disabled because it stores layoutDelta too. 208 // We push LayoutState even if layoutState is disabled because it stores layoutDelta too.
218 if (!doingFullRepaint() || m_layoutState->isPaginated() || renderer->has Columns() || renderer->flowThreadContainingBlock() 209 if (!doingFullRepaint() || m_layoutState->isPaginated() || renderer->has Columns()
219 || m_layoutState->lineGrid() || (renderer->style()->lineGrid() != Re nderStyle::initialLineGrid() && renderer->isRenderBlockFlow()) 210 || m_layoutState->lineGrid() || (renderer->style()->lineGrid() != Re nderStyle::initialLineGrid() && renderer->isRenderBlockFlow())
220 || (renderer->isRenderBlock() && toRenderBlock(renderer)->shapeInsid eInfo()) 211 || (renderer->isRenderBlock() && toRenderBlock(renderer)->shapeInsid eInfo())
221 || (m_layoutState->shapeInsideInfo() && renderer->isRenderBlock() && !toRenderBlock(renderer)->allowsShapeInsideInfoSharing(m_layoutState->shapeInsi deInfo()->owner())) 212 || (m_layoutState->shapeInsideInfo() && renderer->isRenderBlock() && !toRenderBlock(renderer)->allowsShapeInsideInfoSharing(m_layoutState->shapeInsi deInfo()->owner()))
222 ) { 213 ) {
223 pushLayoutStateForCurrentFlowThread(renderer);
224 m_layoutState = new LayoutState(m_layoutState, renderer, offset, pag eHeight, pageHeightChanged, colInfo); 214 m_layoutState = new LayoutState(m_layoutState, renderer, offset, pag eHeight, pageHeightChanged, colInfo);
225 return true; 215 return true;
226 } 216 }
227 return false; 217 return false;
228 } 218 }
229 219
230 void popLayoutState() 220 void popLayoutState()
231 { 221 {
232 LayoutState* state = m_layoutState; 222 LayoutState* state = m_layoutState;
233 m_layoutState = state->m_next; 223 m_layoutState = state->m_next;
234 delete state; 224 delete state;
235 popLayoutStateForCurrentFlowThread();
236 } 225 }
237 226
238 // Suspends the LayoutState optimization. Used under transforms that cannot be represented by 227 // Suspends the LayoutState optimization. Used under transforms that cannot be represented by
239 // LayoutState (common in SVG) and when manipulating the render tree during layout in ways 228 // LayoutState (common in SVG) and when manipulating the render tree during layout in ways
240 // that can trigger repaint of a non-child (e.g. when a list item moves its list marker around). 229 // that can trigger repaint of a non-child (e.g. when a list item moves its list marker around).
241 // Note that even when disabled, LayoutState is still used to store layoutDe lta. 230 // Note that even when disabled, LayoutState is still used to store layoutDe lta.
242 // These functions may only be accessed by LayoutStateMaintainer or LayoutSt ateDisabler. 231 // These functions may only be accessed by LayoutStateMaintainer or LayoutSt ateDisabler.
243 void disableLayoutState() { m_layoutStateDisableCount++; } 232 void disableLayoutState() { m_layoutStateDisableCount++; }
244 void enableLayoutState() { ASSERT(m_layoutStateDisableCount > 0); m_layoutSt ateDisableCount--; } 233 void enableLayoutState() { ASSERT(m_layoutStateDisableCount > 0); m_layoutSt ateDisableCount--; }
245 234
246 void layoutContent(const LayoutState&); 235 void layoutContent(const LayoutState&);
247 void layoutContentInAutoLogicalHeightRegions(const LayoutState&);
248 #ifndef NDEBUG 236 #ifndef NDEBUG
249 void checkLayoutState(const LayoutState&); 237 void checkLayoutState(const LayoutState&);
250 #endif 238 #endif
251 239
252 void positionDialog(RenderBox*); 240 void positionDialog(RenderBox*);
253 void positionDialogs(); 241 void positionDialogs();
254 242
255 void pushLayoutStateForCurrentFlowThread(const RenderObject*);
256 void popLayoutStateForCurrentFlowThread();
257
258 friend class LayoutStateMaintainer; 243 friend class LayoutStateMaintainer;
259 friend class LayoutStateDisabler; 244 friend class LayoutStateDisabler;
260 245
261 bool shouldUsePrintingLayout() const; 246 bool shouldUsePrintingLayout() const;
262 247
263 FrameView* m_frameView; 248 FrameView* m_frameView;
264 249
265 RenderObject* m_selectionStart; 250 RenderObject* m_selectionStart;
266 RenderObject* m_selectionEnd; 251 RenderObject* m_selectionEnd;
267 252
268 int m_selectionStartPos; 253 int m_selectionStartPos;
269 int m_selectionEndPos; 254 int m_selectionEndPos;
270 255
271 int m_maximalOutlineSize; // Used to apply a fudge factor to dirty-rect chec ks on blocks/tables. 256 int m_maximalOutlineSize; // Used to apply a fudge factor to dirty-rect chec ks on blocks/tables.
272 int m_oldMaximalOutlineSize; // The fudge factor from the previous layout. 257 int m_oldMaximalOutlineSize; // The fudge factor from the previous layout.
273 258
274 LayoutUnit m_pageLogicalHeight; 259 LayoutUnit m_pageLogicalHeight;
275 bool m_pageLogicalHeightChanged; 260 bool m_pageLogicalHeightChanged;
276 LayoutState* m_layoutState; 261 LayoutState* m_layoutState;
277 unsigned m_layoutStateDisableCount; 262 unsigned m_layoutStateDisableCount;
278 OwnPtr<RenderLayerCompositor> m_compositor; 263 OwnPtr<RenderLayerCompositor> m_compositor;
279 OwnPtr<FlowThreadController> m_flowThreadController;
280 RefPtr<IntervalArena> m_intervalArena; 264 RefPtr<IntervalArena> m_intervalArena;
281 265
282 RenderQuote* m_renderQuoteHead; 266 RenderQuote* m_renderQuoteHead;
283 unsigned m_renderCounterCount; 267 unsigned m_renderCounterCount;
284 }; 268 };
285 269
286 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderView, isRenderView()); 270 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderView, isRenderView());
287 271
288 // Stack-based class to assist with LayoutState push/pop 272 // Stack-based class to assist with LayoutState push/pop
289 class LayoutStateMaintainer { 273 class LayoutStateMaintainer {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 if (m_view) 348 if (m_view)
365 m_view->enableLayoutState(); 349 m_view->enableLayoutState();
366 } 350 }
367 private: 351 private:
368 RenderView* m_view; 352 RenderView* m_view;
369 }; 353 };
370 354
371 } // namespace WebCore 355 } // namespace WebCore
372 356
373 #endif // RenderView_h 357 #endif // RenderView_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderTreeAsText.cpp ('k') | Source/core/rendering/RenderView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698