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

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

Issue 779183004: Get rid of the PaintLayerFlags bitmask. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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) 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 175 }
176 176
177 void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutPoint&) co nst; 177 void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutPoint&) co nst;
178 void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutRect&) con st; 178 void convertToLayerCoords(const RenderLayer* ancestorLayer, LayoutRect&) con st;
179 179
180 // The two main functions that use the layer system. The paint method 180 // The two main functions that use the layer system. The paint method
181 // paints the layers that intersect the damage rect from back to 181 // paints the layers that intersect the damage rect from back to
182 // front. The hitTest method looks for mouse events by walking 182 // front. The hitTest method looks for mouse events by walking
183 // layers that intersect the point from front to back. 183 // layers that intersect the point from front to back.
184 // paint() assumes that the caller will clip to the bounds of damageRect if necessary. 184 // paint() assumes that the caller will clip to the bounds of damageRect if necessary.
185 void paint(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior = P aintBehaviorNormal, RenderObject* paintingRoot = 0, PaintLayerFlags = 0); 185 void paint(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior = P aintBehaviorNormal, RenderObject* paintingRoot = 0);
186 bool hitTest(const HitTestRequest&, HitTestResult&); 186 bool hitTest(const HitTestRequest&, HitTestResult&);
187 bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&); 187 bool hitTest(const HitTestRequest&, const HitTestLocation&, HitTestResult&);
188 void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior, RenderObject* paintingRoot = 0); 188 void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect, PaintBehavior, RenderObject* paintingRoot = 0);
189 189
190 // Pass offsetFromRoot if known. 190 // Pass offsetFromRoot if known.
191 bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& d amageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot = 0) const; 191 bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& d amageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromRoot = 0) const;
192 192
193 // Bounding box relative to some ancestor layer. Pass offsetFromRoot if know n. 193 // Bounding box relative to some ancestor layer. Pass offsetFromRoot if know n.
194 LayoutRect physicalBoundingBox(const RenderLayer* ancestorLayer, const Layou tPoint* offsetFromRoot = 0) const; 194 LayoutRect physicalBoundingBox(const RenderLayer* ancestorLayer, const Layou tPoint* offsetFromRoot = 0) const;
195 LayoutRect physicalBoundingBoxIncludingReflectionAndStackingChildren(const R enderLayer* ancestorLayer, const LayoutPoint& offsetFromRoot) const; 195 LayoutRect physicalBoundingBoxIncludingReflectionAndStackingChildren(const R enderLayer* ancestorLayer, const LayoutPoint& offsetFromRoot) const;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 RenderLayerClipper& clipper() { return m_clipper; } 297 RenderLayerClipper& clipper() { return m_clipper; }
298 const RenderLayerClipper& clipper() const { return m_clipper; } 298 const RenderLayerClipper& clipper() const { return m_clipper; }
299 299
300 inline bool isPositionedContainer() const 300 inline bool isPositionedContainer() const
301 { 301 {
302 // FIXME: This is not in sync with containingBlock. 302 // FIXME: This is not in sync with containingBlock.
303 RenderLayerModelObject* layerRenderer = renderer(); 303 RenderLayerModelObject* layerRenderer = renderer();
304 return isRootLayer() || layerRenderer->isPositioned() || hasTransform(); 304 return isRootLayer() || layerRenderer->isPositioned() || hasTransform();
305 } 305 }
306 306
307 // paintLayer() assumes that the caller will clip to the bounds of the paint ing dirty if necessary.
308 void paintLayer(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags) ;
309
310 bool scrollsOverflow() const; 307 bool scrollsOverflow() const;
311 308
312 CompositingReasons potentialCompositingReasonsFromStyle() const { return m_p otentialCompositingReasonsFromStyle; } 309 CompositingReasons potentialCompositingReasonsFromStyle() const { return m_p otentialCompositingReasonsFromStyle; }
313 void setPotentialCompositingReasonsFromStyle(CompositingReasons reasons) { A SSERT(reasons == (reasons & CompositingReasonComboAllStyleDeterminedReasons)); m _potentialCompositingReasonsFromStyle = reasons; } 310 void setPotentialCompositingReasonsFromStyle(CompositingReasons reasons) { A SSERT(reasons == (reasons & CompositingReasonComboAllStyleDeterminedReasons)); m _potentialCompositingReasonsFromStyle = reasons; }
314 311
315 bool hasStyleDeterminedDirectCompositingReasons() const { return m_potential CompositingReasonsFromStyle & CompositingReasonComboAllDirectStyleDeterminedReas ons; } 312 bool hasStyleDeterminedDirectCompositingReasons() const { return m_potential CompositingReasonsFromStyle & CompositingReasonComboAllDirectStyleDeterminedReas ons; }
316 313
317 class AncestorDependentCompositingInputs { 314 class AncestorDependentCompositingInputs {
318 public: 315 public:
319 AncestorDependentCompositingInputs() 316 AncestorDependentCompositingInputs()
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 void updateSelfPaintingLayer(); 413 void updateSelfPaintingLayer();
417 414
418 RenderLayer* enclosingTransformedAncestor() const; 415 RenderLayer* enclosingTransformedAncestor() const;
419 LayoutPoint computeOffsetFromTransformedAncestor() const; 416 LayoutPoint computeOffsetFromTransformedAncestor() const;
420 417
421 void didUpdateNeedsCompositedScrolling(); 418 void didUpdateNeedsCompositedScrolling();
422 419
423 void setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); 420 void setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants();
424 421
425 private: 422 private:
423 // TODO(ojan): Get rid of this. These are basically layer-tree-only paint ph ases.
424 enum PaintLayerFlags {
425 PaintContent,
426 PaintOverlayScrollbars,
427 };
428
426 // Bounding box in the coordinates of this layer. 429 // Bounding box in the coordinates of this layer.
427 LayoutRect logicalBoundingBox() const; 430 LayoutRect logicalBoundingBox() const;
428 431
429 bool hasOverflowControls() const; 432 bool hasOverflowControls() const;
430 433
431 void setAncestorChainHasSelfPaintingLayerDescendant(); 434 void setAncestorChainHasSelfPaintingLayerDescendant();
432 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 435 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
433 436
434 void clipToRect(const LayerPaintingInfo&, GraphicsContext*, const ClipRect&, PaintLayerFlags, BorderRadiusClippingRule = IncludeSelfForBorderRadius); 437 void clipToRect(const LayerPaintingInfo&, GraphicsContext*, const ClipRect&, BorderRadiusClippingRule = IncludeSelfForBorderRadius);
435 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C lipRect&); 438 void restoreClip(GraphicsContext*, const LayoutRect& paintDirtyRect, const C lipRect&);
436 439
437 void setNextSibling(RenderLayer* next) { m_next = next; } 440 void setNextSibling(RenderLayer* next) { m_next = next; }
438 void setPreviousSibling(RenderLayer* prev) { m_previous = prev; } 441 void setPreviousSibling(RenderLayer* prev) { m_previous = prev; }
439 void setFirstChild(RenderLayer* first) { m_first = first; } 442 void setFirstChild(RenderLayer* first) { m_first = first; }
440 void setLastChild(RenderLayer* last) { m_last = last; } 443 void setLastChild(RenderLayer* last) { m_last = last; }
441 444
442 void updateHasSelfPaintingLayerDescendant() const; 445 void updateHasSelfPaintingLayerDescendant() const;
443 446
444 bool hasSelfPaintingLayerDescendant() const 447 bool hasSelfPaintingLayerDescendant() const
445 { 448 {
446 if (m_hasSelfPaintingLayerDescendantDirty) 449 if (m_hasSelfPaintingLayerDescendantDirty)
447 updateHasSelfPaintingLayerDescendant(); 450 updateHasSelfPaintingLayerDescendant();
448 ASSERT(!m_hasSelfPaintingLayerDescendantDirty); 451 ASSERT(!m_hasSelfPaintingLayerDescendantDirty);
449 return m_hasSelfPaintingLayerDescendant; 452 return m_hasSelfPaintingLayerDescendant;
450 } 453 }
451 454
452 LayoutPoint renderBoxLocation() const { return renderer()->isBox() ? toRende rBox(renderer())->location() : LayoutPoint(); } 455 LayoutPoint renderBoxLocation() const { return renderer()->isBox() ? toRende rBox(renderer())->location() : LayoutPoint(); }
453 456
457 // paintLayer() assumes that the caller will clip to the bounds of the paint ing dirty if necessary.
458 void paintLayer(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags) ;
459
454 // paintLayerContents() assumes that the caller will clip to the bounds of t he painting dirty rect if necessary. 460 // paintLayerContents() assumes that the caller will clip to the bounds of t he painting dirty rect if necessary.
455 void paintLayerContents(GraphicsContext*, const LayerPaintingInfo&, PaintLay erFlags); 461 void paintLayerContents(GraphicsContext*, const LayerPaintingInfo&, PaintLay erFlags);
456 462
457 void paintLayerByApplyingTransform(GraphicsContext*, const LayerPaintingInfo &, PaintLayerFlags, const LayoutPoint& translationOffset = LayoutPoint()); 463 void paintLayerByApplyingTransform(GraphicsContext*, const LayerPaintingInfo &, PaintLayerFlags, const LayoutPoint& translationOffset = LayoutPoint());
458 464
459 void paintChildren(unsigned childrenToVisit, GraphicsContext*, const LayerPa intingInfo&, PaintLayerFlags); 465 void paintChildren(unsigned childrenToVisit, GraphicsContext*, const LayerPa intingInfo&, PaintLayerFlags);
460 466
461 void collectFragments(LayerFragments&, const RenderLayer* rootLayer, const L ayoutRect& dirtyRect, 467 void collectFragments(LayerFragments&, const RenderLayer* rootLayer, const L ayoutRect& dirtyRect,
462 ClipRectsCacheSlot, const LayoutPoint* offsetFromRoot = 0, 468 ClipRectsCacheSlot, const LayoutPoint* offsetFromRoot = 0,
463 const LayoutSize& subPixelAccumulation = LayoutSize(), const LayoutRect* layerBoundingBox = 0); 469 const LayoutSize& subPixelAccumulation = LayoutSize(), const LayoutRect* layerBoundingBox = 0);
464 void updatePaintingInfoForFragments(LayerFragments&, const LayerPaintingInfo &, PaintLayerFlags, bool shouldPaintContent, const LayoutPoint* offsetFromRoot); 470 void updatePaintingInfoForFragments(LayerFragments&, const LayerPaintingInfo &, bool shouldPaintContent, const LayoutPoint* offsetFromRoot);
465 void paintBackgroundForFragments(const LayerFragments&, GraphicsContext*, Gr aphicsContext* transparencyLayerContext, 471 void paintBackgroundForFragments(const LayerFragments&, GraphicsContext*, Gr aphicsContext* transparencyLayerContext,
466 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, con st LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer, Pai ntLayerFlags); 472 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, con st LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer);
467 void paintForegroundForFragments(const LayerFragments&, GraphicsContext*, Gr aphicsContext* transparencyLayerContext, 473 void paintForegroundForFragments(const LayerFragments&, GraphicsContext*, Gr aphicsContext* transparencyLayerContext,
468 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, con st LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer, 474 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, con st LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer);
469 PaintLayerFlags); 475 void paintForegroundForFragmentsWithPhase(PaintPhase, const LayerFragments&, GraphicsContext*, const LayerPaintingInfo&, PaintBehavior, RenderObject* painti ngRootForRenderer);
470 void paintForegroundForFragmentsWithPhase(PaintPhase, const LayerFragments&, GraphicsContext*, const LayerPaintingInfo&, PaintBehavior, RenderObject* painti ngRootForRenderer, PaintLayerFlags); 476 void paintOutlineForFragments(const LayerFragments&, GraphicsContext*, const LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer);
471 void paintOutlineForFragments(const LayerFragments&, GraphicsContext*, const LayerPaintingInfo&, PaintBehavior, RenderObject* paintingRootForRenderer, Paint LayerFlags); 477 void paintOverflowControlsForFragments(const LayerFragments&, GraphicsContex t*, const LayerPaintingInfo&);
472 void paintOverflowControlsForFragments(const LayerFragments&, GraphicsContex t*, const LayerPaintingInfo&, PaintLayerFlags); 478 void paintMaskForFragments(const LayerFragments&, GraphicsContext*, const La yerPaintingInfo&, RenderObject* paintingRootForRenderer);
473 void paintMaskForFragments(const LayerFragments&, GraphicsContext*, const La yerPaintingInfo&, RenderObject* paintingRootForRenderer, PaintLayerFlags);
474 void paintChildClippingMaskForFragments(const LayerFragments&, GraphicsConte xt*, const LayerPaintingInfo&, RenderObject* paintingRootForRenderer, PaintLayer Flags); 479 void paintChildClippingMaskForFragments(const LayerFragments&, GraphicsConte xt*, const LayerPaintingInfo&, RenderObject* paintingRootForRenderer, PaintLayer Flags);
475 480
476 RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLaye r, const HitTestRequest& request, HitTestResult& result, 481 RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLaye r, const HitTestRequest& request, HitTestResult& result,
477 const LayoutRect& hitTestRect, const HitTestLocati on&, bool appliedTransform, 482 const LayoutRect& hitTestRect, const HitTestLocati on&, bool appliedTransform,
478 const HitTestingTransformState* transformState = 0 , double* zOffset = 0); 483 const HitTestingTransformState* transformState = 0 , double* zOffset = 0);
479 RenderLayer* hitTestLayerByApplyingTransform(RenderLayer* rootLayer, RenderL ayer* containerLayer, const HitTestRequest&, HitTestResult&, 484 RenderLayer* hitTestLayerByApplyingTransform(RenderLayer* rootLayer, RenderL ayer* containerLayer, const HitTestRequest&, HitTestResult&,
480 const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingT ransformState* = 0, double* zOffset = 0, 485 const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingT ransformState* = 0, double* zOffset = 0,
481 const LayoutPoint& translationOffset = LayoutPoint()); 486 const LayoutPoint& translationOffset = LayoutPoint());
482 RenderLayer* hitTestChildren(ChildrenIteration, RenderLayer* rootLayer, cons t HitTestRequest&, HitTestResult&, 487 RenderLayer* hitTestChildren(ChildrenIteration, RenderLayer* rootLayer, cons t HitTestRequest&, HitTestResult&,
483 const LayoutRect& hitTestRect, const HitTestLocatio n&, 488 const LayoutRect& hitTestRect, const HitTestLocatio n&,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 594
590 } // namespace blink 595 } // namespace blink
591 596
592 #ifndef NDEBUG 597 #ifndef NDEBUG
593 // Outside the WebCore namespace for ease of invocation from gdb. 598 // Outside the WebCore namespace for ease of invocation from gdb.
594 void showLayerTree(const blink::RenderLayer*); 599 void showLayerTree(const blink::RenderLayer*);
595 void showLayerTree(const blink::RenderObject*); 600 void showLayerTree(const blink::RenderObject*);
596 #endif 601 #endif
597 602
598 #endif // SKY_ENGINE_CORE_RENDERING_RENDERLAYER_H_ 603 #endif // SKY_ENGINE_CORE_RENDERING_RENDERLAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698