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

Side by Side Diff: sky/engine/core/rendering/RenderLayer.h

Issue 899753003: Walk render tree instead of render layers for paint. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: address review comments Created 5 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
« no previous file with comments | « sky/engine/core/rendering/RenderInline.cpp ('k') | sky/engine/core/rendering/RenderLayer.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) 2003, 2009, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Intel Corporation. All rights reserved. 3 * Copyright (C) 2013 Intel Corporation. All rights reserved.
4 * 4 *
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
6 * 6 *
7 * Other contributors: 7 * Other contributors:
8 * Robert O'Callahan <roc+@cs.cmu.edu> 8 * Robert O'Callahan <roc+@cs.cmu.edu>
9 * David Baron <dbaron@fas.harvard.edu> 9 * David Baron <dbaron@fas.harvard.edu>
10 * Christian Biesinger <cbiesinger@web.de> 10 * Christian Biesinger <cbiesinger@web.de>
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 const RenderLayerStackingNode* stackingNode() const { return m_stackingNode. get(); } 127 const RenderLayerStackingNode* stackingNode() const { return m_stackingNode. get(); }
128 128
129 bool hasBoxDecorationsOrBackground() const; 129 bool hasBoxDecorationsOrBackground() const;
130 bool hasVisibleBoxDecorations() const; 130 bool hasVisibleBoxDecorations() const;
131 // Returns true if this layer has visible content (ignoring any child layers ). 131 // Returns true if this layer has visible content (ignoring any child layers ).
132 bool isVisuallyNonEmpty() const; 132 bool isVisuallyNonEmpty() const;
133 // True if this layer container renderers that paint. 133 // True if this layer container renderers that paint.
134 bool hasNonEmptyChildRenderers() const; 134 bool hasNonEmptyChildRenderers() const;
135 135
136 bool usedTransparency() const { return m_usedTransparency; } 136 bool usedTransparency() const { return m_usedTransparency; }
137 void clearUsedTransparency() { m_usedTransparency = false; }
137 138
138 // Gets the nearest enclosing positioned ancestor layer (also includes 139 // Gets the nearest enclosing positioned ancestor layer (also includes
139 // the <html> layer and the root layer). 140 // the <html> layer and the root layer).
140 RenderLayer* enclosingPositionedAncestor() const; 141 RenderLayer* enclosingPositionedAncestor() const;
141 142
142 RenderLayer* enclosingOverflowClipLayer(IncludeSelfOrNot = IncludeSelf) cons t; 143 RenderLayer* enclosingOverflowClipLayer(IncludeSelfOrNot = IncludeSelf) cons t;
143 144
144 const RenderLayer* compositingContainer() const; 145 const RenderLayer* compositingContainer() const;
145 RenderLayer* enclosingFilterLayer(IncludeSelfOrNot = IncludeSelf) const; 146 RenderLayer* enclosingFilterLayer(IncludeSelfOrNot = IncludeSelf) const;
146 bool hasAncestorWithFilterOutsets() const; 147 bool hasAncestorWithFilterOutsets() const;
147 148
148 void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutPoint&) co nst; 149 void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutPoint&) co nst;
149 void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutRect&) con st; 150 void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutRect&) con st;
150 151
151 // The two main functions that use the layer system. The paint method 152 // The two main functions that use the layer system. The paint method
152 // paints the layers that intersect the damage rect from back to 153 // paints the layers that intersect the damage rect from back to
153 // front. The hitTest method looks for mouse events by walking 154 // front. The hitTest method looks for mouse events by walking
154 // layers that intersect the point from front to back. 155 // layers that intersect the point from front to back.
155 // paint() assumes that the caller will clip to the bounds of damageRect if necessary.
156 void paint(GraphicsContext*, const LayoutRect& damageRect);
157 bool hitTest(const HitTestRequest&, HitTestResult&); 156 bool hitTest(const HitTestRequest&, HitTestResult&);
158 bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&); 157 bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&);
159 158
160 // Pass offsetFromRoot if known. 159 // Pass offsetFromRoot if known.
161 bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& d amageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot = 0) const; 160 bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& d amageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot = 0) const;
162 161
163 // Bounding box relative to some ancestor layer. Pass offsetFromRoot if know n. 162 // Bounding box relative to some ancestor layer. Pass offsetFromRoot if know n.
164 LayoutRect physicalBoundingBox(const RenderLayer* ancestorLayer, const Layou tPoint* offsetFromRoot = 0) const; 163 LayoutRect physicalBoundingBox(const RenderLayer* ancestorLayer, const Layou tPoint* offsetFromRoot = 0) const;
165 LayoutRect physicalBoundingBoxIncludingReflectionAndStackingChildren(const R enderLayer* ancestorLayer, const LayoutPoint& offsetFromRoot) const; 164 LayoutRect physicalBoundingBoxIncludingReflectionAndStackingChildren(const R enderLayer* ancestorLayer, const LayoutPoint& offsetFromRoot) const;
166 165
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 inline bool isPositionedContainer() const 236 inline bool isPositionedContainer() const
238 { 237 {
239 // FIXME: This is not in sync with containingBlock. 238 // FIXME: This is not in sync with containingBlock.
240 RenderLayerModelObject* layerRenderer = renderer(); 239 RenderLayerModelObject* layerRenderer = renderer();
241 return isRootLayer() || layerRenderer->isPositioned() || hasTransform(); 240 return isRootLayer() || layerRenderer->isPositioned() || hasTransform();
242 } 241 }
243 242
244 void updateOrRemoveFilterEffectRenderer(); 243 void updateOrRemoveFilterEffectRenderer();
245 void updateSelfPaintingLayer(); 244 void updateSelfPaintingLayer();
246 245
246 void clipToRect(const LayerPaintingInfo&, GraphicsContext*, const ClipRect&, BorderRadiusClippingRule = IncludeSelfForBorderRadius);
247 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C lipRect&);
248
247 private: 249 private:
248 // TODO(ojan): Get rid of this. These are basically layer-tree-only paint ph ases. 250 // TODO(ojan): Get rid of this. These are basically layer-tree-only paint ph ases.
249 enum PaintLayerFlags { 251 enum PaintLayerFlags {
250 PaintContent, 252 PaintContent,
251 }; 253 };
252 254
253 // Bounding box in the coordinates of this layer. 255 // Bounding box in the coordinates of this layer.
254 LayoutRect logicalBoundingBox() const; 256 LayoutRect logicalBoundingBox() const;
255 257
256 void setAncestorChainHasSelfPaintingLayerDescendant(); 258 void setAncestorChainHasSelfPaintingLayerDescendant();
257 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 259 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
258 260
259 void clipToRect(const LayerPaintingInfo&, GraphicsContext*, const ClipRect&, BorderRadiusClippingRule = IncludeSelfForBorderRadius);
260 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C lipRect&);
261
262 void setNextSibling(RenderLayer* next) { m_next = next; } 261 void setNextSibling(RenderLayer* next) { m_next = next; }
263 void setPreviousSibling(RenderLayer* prev) { m_previous = prev; } 262 void setPreviousSibling(RenderLayer* prev) { m_previous = prev; }
264 void setFirstChild(RenderLayer* first) { m_first = first; } 263 void setFirstChild(RenderLayer* first) { m_first = first; }
265 void setLastChild(RenderLayer* last) { m_last = last; } 264 void setLastChild(RenderLayer* last) { m_last = last; }
266 265
267 void updateHasSelfPaintingLayerDescendant() const; 266 void updateHasSelfPaintingLayerDescendant() const;
268 267
269 bool hasSelfPaintingLayerDescendant() const 268 bool hasSelfPaintingLayerDescendant() const
270 { 269 {
271 if (m_hasSelfPaintingLayerDescendantDirty) 270 if (m_hasSelfPaintingLayerDescendantDirty)
272 updateHasSelfPaintingLayerDescendant(); 271 updateHasSelfPaintingLayerDescendant();
273 ASSERT(!m_hasSelfPaintingLayerDescendantDirty); 272 ASSERT(!m_hasSelfPaintingLayerDescendantDirty);
274 return m_hasSelfPaintingLayerDescendant; 273 return m_hasSelfPaintingLayerDescendant;
275 } 274 }
276 275
277 LayoutPoint renderBoxLocation() const { return renderer()->isBox() ? toRende rBox(renderer())->location() : LayoutPoint(); } 276 LayoutPoint renderBoxLocation() const { return renderer()->isBox() ? toRende rBox(renderer())->location() : LayoutPoint(); }
278 277
279 // paintLayer() assumes that the caller will clip to the bounds of the paint ing dirty if necessary.
280 void paintLayer(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags) ;
281
282 // paintLayerContents() assumes that the caller will clip to the bounds of t he painting dirty rect if necessary.
283 void paintLayerContents(GraphicsContext*, const LayerPaintingInfo&, PaintLay erFlags);
284
285 void paintLayerByApplyingTransform(GraphicsContext*, const LayerPaintingInfo &, PaintLayerFlags, const LayoutPoint& translationOffset = LayoutPoint());
286
287 void paintChildren(unsigned childrenToVisit, GraphicsContext*, const LayerPa intingInfo&, PaintLayerFlags);
288
289 void paintForeground(GraphicsContext*, GraphicsContext* transparencyLayerCon text,
290 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, con st LayerPaintingInfo&,
291 LayoutPoint& layerLocation, ClipRect& layerForegroundRect);
292
293 RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLaye r, const HitTestRequest& request, HitTestResult& result, 278 RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLaye r, const HitTestRequest& request, HitTestResult& result,
294 const LayoutRect& hitTestRect, const HitTestLocati on&, bool appliedTransform, 279 const LayoutRect& hitTestRect, const HitTestLocati on&, bool appliedTransform,
295 const HitTestingTransformState* transformState = 0 , double* zOffset = 0); 280 const HitTestingTransformState* transformState = 0 , double* zOffset = 0);
296 RenderLayer* hitTestLayerByApplyingTransform(RenderLayer* rootLayer, RenderL ayer* containerLayer, const HitTestRequest&, HitTestResult&, 281 RenderLayer* hitTestLayerByApplyingTransform(RenderLayer* rootLayer, RenderL ayer* containerLayer, const HitTestRequest&, HitTestResult&,
297 const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingT ransformState* = 0, double* zOffset = 0, 282 const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingT ransformState* = 0, double* zOffset = 0,
298 const LayoutPoint& translationOffset = LayoutPoint()); 283 const LayoutPoint& translationOffset = LayoutPoint());
299 RenderLayer* hitTestChildren(ChildrenIteration, RenderLayer* rootLayer, cons t HitTestRequest&, HitTestResult&, 284 RenderLayer* hitTestChildren(ChildrenIteration, RenderLayer* rootLayer, cons t HitTestRequest&, HitTestResult&,
300 const LayoutRect& hitTestRect, const HitTestLocatio n&, 285 const LayoutRect& hitTestRect, const HitTestLocatio n&,
301 const HitTestingTransformState* transformState, dou ble* zOffsetForDescendants, double* zOffset, 286 const HitTestingTransformState* transformState, dou ble* zOffsetForDescendants, double* zOffset,
302 const HitTestingTransformState* unflattenedTransfor mState, bool depthSortDescendants); 287 const HitTestingTransformState* unflattenedTransfor mState, bool depthSortDescendants);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 356
372 } // namespace blink 357 } // namespace blink
373 358
374 #ifndef NDEBUG 359 #ifndef NDEBUG
375 // Outside the WebCore namespace for ease of invocation from gdb. 360 // Outside the WebCore namespace for ease of invocation from gdb.
376 void showLayerTree(const blink::RenderLayer*); 361 void showLayerTree(const blink::RenderLayer*);
377 void showLayerTree(const blink::RenderObject*); 362 void showLayerTree(const blink::RenderObject*);
378 #endif 363 #endif
379 364
380 #endif // SKY_ENGINE_CORE_RENDERING_RENDERLAYER_H_ 365 #endif // SKY_ENGINE_CORE_RENDERING_RENDERLAYER_H_
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderInline.cpp ('k') | sky/engine/core/rendering/RenderLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698