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

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

Issue 99883002: Refactor BlendMode into a separate class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 7 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 */ 43 */
44 44
45 #ifndef RenderLayer_h 45 #ifndef RenderLayer_h
46 #define RenderLayer_h 46 #define RenderLayer_h
47 47
48 #include "core/rendering/CompositedLayerMappingPtr.h" 48 #include "core/rendering/CompositedLayerMappingPtr.h"
49 #include "core/rendering/CompositingReasons.h" 49 #include "core/rendering/CompositingReasons.h"
50 #include "core/rendering/LayerPaintingInfo.h" 50 #include "core/rendering/LayerPaintingInfo.h"
51 #include "core/rendering/PaintInfo.h" 51 #include "core/rendering/PaintInfo.h"
52 #include "core/rendering/RenderBox.h" 52 #include "core/rendering/RenderBox.h"
53 #include "core/rendering/RenderLayerBlendInfo.h"
53 #include "core/rendering/RenderLayerClipper.h" 54 #include "core/rendering/RenderLayerClipper.h"
54 #include "core/rendering/RenderLayerFilterInfo.h" 55 #include "core/rendering/RenderLayerFilterInfo.h"
55 #include "core/rendering/RenderLayerReflectionInfo.h" 56 #include "core/rendering/RenderLayerReflectionInfo.h"
56 #include "core/rendering/RenderLayerRepainter.h" 57 #include "core/rendering/RenderLayerRepainter.h"
57 #include "core/rendering/RenderLayerScrollableArea.h" 58 #include "core/rendering/RenderLayerScrollableArea.h"
58 #include "core/rendering/RenderLayerStackingNode.h" 59 #include "core/rendering/RenderLayerStackingNode.h"
59 #include "core/rendering/RenderLayerStackingNodeIterator.h" 60 #include "core/rendering/RenderLayerStackingNodeIterator.h"
60 #include "wtf/OwnPtr.h" 61 #include "wtf/OwnPtr.h"
61 62
62 namespace WebCore { 63 namespace WebCore {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 void updateLayerPositionsAfterLayout(const RenderLayer* rootLayer, UpdateLay erPositionsFlags); 161 void updateLayerPositionsAfterLayout(const RenderLayer* rootLayer, UpdateLay erPositionsFlags);
161 162
162 void updateLayerPositionsAfterOverflowScroll(); 163 void updateLayerPositionsAfterOverflowScroll();
163 void updateLayerPositionsAfterDocumentScroll(); 164 void updateLayerPositionsAfterDocumentScroll();
164 165
165 bool isPaginated() const { return m_isPaginated; } 166 bool isPaginated() const { return m_isPaginated; }
166 RenderLayer* enclosingPaginationLayer() const { return m_enclosingPagination Layer; } 167 RenderLayer* enclosingPaginationLayer() const { return m_enclosingPagination Layer; }
167 168
168 void updateTransform(); 169 void updateTransform();
169 170
170 void updateBlendMode();
171
172 const LayoutSize& offsetForInFlowPosition() const { return m_offsetForInFlow Position; } 171 const LayoutSize& offsetForInFlowPosition() const { return m_offsetForInFlow Position; }
173 172
174 void addBlockSelectionGapsBounds(const LayoutRect&); 173 void addBlockSelectionGapsBounds(const LayoutRect&);
175 void clearBlockSelectionGapsBounds(); 174 void clearBlockSelectionGapsBounds();
176 void repaintBlockSelectionGaps(); 175 void repaintBlockSelectionGaps();
177 bool hasBlockSelectionGapBounds() const; 176 bool hasBlockSelectionGapBounds() const;
178 177
179 RenderLayerStackingNode* stackingNode() { return m_stackingNode.get(); } 178 RenderLayerStackingNode* stackingNode() { return m_stackingNode.get(); }
180 const RenderLayerStackingNode* stackingNode() const { return m_stackingNode. get(); } 179 const RenderLayerStackingNode* stackingNode() const { return m_stackingNode. get(); }
181 180
(...skipping 17 matching lines...) Expand all
199 // FIXME: We should ASSERT(!m_hasSelfPaintingLayerDescendantDirty); here but we hit the same bugs as visible content above. 198 // FIXME: We should ASSERT(!m_hasSelfPaintingLayerDescendantDirty); here but we hit the same bugs as visible content above.
200 // Part of the issue is with subtree relayout: we don't check if our ancesto rs have some descendant flags dirty, missing some updates. 199 // Part of the issue is with subtree relayout: we don't check if our ancesto rs have some descendant flags dirty, missing some updates.
201 bool hasSelfPaintingLayerDescendant() const { return m_hasSelfPaintingLayerD escendant; } 200 bool hasSelfPaintingLayerDescendant() const { return m_hasSelfPaintingLayerD escendant; }
202 201
203 // FIXME: We should ASSERT(!m_hasOutOfFlowPositionedDescendantDirty) here. S ee above. 202 // FIXME: We should ASSERT(!m_hasOutOfFlowPositionedDescendantDirty) here. S ee above.
204 bool hasOutOfFlowPositionedDescendant() const { return m_hasOutOfFlowPositio nedDescendant; } 203 bool hasOutOfFlowPositionedDescendant() const { return m_hasOutOfFlowPositio nedDescendant; }
205 204
206 void setHasOutOfFlowPositionedDescendant(bool hasDescendant) { m_hasOutOfFlo wPositionedDescendant = hasDescendant; } 205 void setHasOutOfFlowPositionedDescendant(bool hasDescendant) { m_hasOutOfFlo wPositionedDescendant = hasDescendant; }
207 void setHasOutOfFlowPositionedDescendantDirty(bool dirty) { m_hasOutOfFlowPo sitionedDescendantDirty = dirty; } 206 void setHasOutOfFlowPositionedDescendantDirty(bool dirty) { m_hasOutOfFlowPo sitionedDescendantDirty = dirty; }
208 207
209 bool childLayerHasBlendMode() const { ASSERT(!m_childLayerHasBlendModeStatus Dirty); return m_childLayerHasBlendMode; }
210
211 bool hasUnclippedDescendant() const { return m_hasUnclippedDescendant; } 208 bool hasUnclippedDescendant() const { return m_hasUnclippedDescendant; }
212 void setHasUnclippedDescendant(bool hasDescendant) { m_hasUnclippedDescendan t = hasDescendant; } 209 void setHasUnclippedDescendant(bool hasDescendant) { m_hasUnclippedDescendan t = hasDescendant; }
213 void updateHasUnclippedDescendant(); 210 void updateHasUnclippedDescendant();
214 bool isUnclippedDescendant() const { return m_isUnclippedDescendant; } 211 bool isUnclippedDescendant() const { return m_isUnclippedDescendant; }
215 212
216 bool hasVisibleNonLayerContent() const { return m_hasVisibleNonLayerContent; } 213 bool hasVisibleNonLayerContent() const { return m_hasVisibleNonLayerContent; }
217 void updateHasVisibleNonLayerContent(); 214 void updateHasVisibleNonLayerContent();
218 215
219 // Gets the nearest enclosing positioned ancestor layer (also includes 216 // Gets the nearest enclosing positioned ancestor layer (also includes
220 // the <html> layer and the root layer). 217 // the <html> layer and the root layer).
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 // Returns true if the layer has a -webkit-perspective. 326 // Returns true if the layer has a -webkit-perspective.
330 // Note that this transform has the perspective-origin baked in. 327 // Note that this transform has the perspective-origin baked in.
331 TransformationMatrix perspectiveTransform() const; 328 TransformationMatrix perspectiveTransform() const;
332 FloatPoint perspectiveOrigin() const; 329 FloatPoint perspectiveOrigin() const;
333 bool preserves3D() const { return renderer()->style()->transformStyle3D() == TransformStyle3DPreserve3D; } 330 bool preserves3D() const { return renderer()->style()->transformStyle3D() == TransformStyle3DPreserve3D; }
334 bool has3DTransform() const { return m_transform && !m_transform->isAffine() ; } 331 bool has3DTransform() const { return m_transform && !m_transform->isAffine() ; }
335 332
336 void filterNeedsRepaint(); 333 void filterNeedsRepaint();
337 bool hasFilter() const { return renderer()->hasFilter(); } 334 bool hasFilter() const { return renderer()->hasFilter(); }
338 335
339 bool hasBlendMode() const; 336 bool paintsWithBlendMode() const { return m_blendInfo.hasBlendMode() && comp ositingState() != PaintsIntoOwnBacking; }
340 bool paintsWithBlendMode() const { return hasBlendMode() && compositingState () != PaintsIntoOwnBacking; }
341 337
342 void* operator new(size_t); 338 void* operator new(size_t);
343 // Only safe to call from RenderLayerModelObject::destroyLayer() 339 // Only safe to call from RenderLayerModelObject::destroyLayer()
344 void operator delete(void*); 340 void operator delete(void*);
345 341
346 CompositingState compositingState() const; 342 CompositingState compositingState() const;
347 343
348 CompositedLayerMappingPtr compositedLayerMapping() const { return m_composit edLayerMapping.get(); } 344 CompositedLayerMappingPtr compositedLayerMapping() const { return m_composit edLayerMapping.get(); }
349 CompositedLayerMappingPtr ensureCompositedLayerMapping(); 345 CompositedLayerMappingPtr ensureCompositedLayerMapping();
350 346
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 // RenderObject::canContainFixedPositionedObject() should probably be us ed 436 // RenderObject::canContainFixedPositionedObject() should probably be us ed
441 // instead. 437 // instead.
442 RenderLayerModelObject* layerRenderer = renderer(); 438 RenderLayerModelObject* layerRenderer = renderer();
443 return isRootLayer() || layerRenderer->isPositioned() || hasTransform(); 439 return isRootLayer() || layerRenderer->isPositioned() || hasTransform();
444 } 440 }
445 441
446 void paintLayer(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags) ; 442 void paintLayer(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags) ;
447 443
448 PassOwnPtr<Vector<FloatRect> > collectTrackedRepaintRects() const; 444 PassOwnPtr<Vector<FloatRect> > collectTrackedRepaintRects() const;
449 445
446 RenderLayerBlendInfo& blendInfo() { return m_blendInfo; }
447
450 void setOffsetFromSquashingLayerOrigin(IntSize offset) { m_compositingProper ties.offsetFromSquashingLayerOrigin = offset; } 448 void setOffsetFromSquashingLayerOrigin(IntSize offset) { m_compositingProper ties.offsetFromSquashingLayerOrigin = offset; }
451 IntSize offsetFromSquashingLayerOrigin() const { return m_compositingPropert ies.offsetFromSquashingLayerOrigin; } 449 IntSize offsetFromSquashingLayerOrigin() const { return m_compositingPropert ies.offsetFromSquashingLayerOrigin; }
452 450
453 private: 451 private:
454 bool hasOverflowControls() const; 452 bool hasOverflowControls() const;
455 453
456 void setIsUnclippedDescendant(bool isUnclippedDescendant) { m_isUnclippedDes cendant = isUnclippedDescendant; } 454 void setIsUnclippedDescendant(bool isUnclippedDescendant) { m_isUnclippedDes cendant = isUnclippedDescendant; }
457 455
458 void setAncestorChainHasSelfPaintingLayerDescendant(); 456 void setAncestorChainHasSelfPaintingLayerDescendant();
459 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 457 void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 bool requiresScrollableArea() const { return renderBox(); } 565 bool requiresScrollableArea() const { return renderBox(); }
568 void updateScrollableArea(); 566 void updateScrollableArea();
569 567
570 // Returns true our scrollable area is in the FrameView's collection of scro llable areas. This can 568 // Returns true our scrollable area is in the FrameView's collection of scro llable areas. This can
571 // only happen if we're both scrollable, and we do in fact overflow. 569 // only happen if we're both scrollable, and we do in fact overflow.
572 bool scrollsOverflow() const; 570 bool scrollsOverflow() const;
573 571
574 void dirtyAncestorChainVisibleDescendantStatus(); 572 void dirtyAncestorChainVisibleDescendantStatus();
575 void setAncestorChainHasVisibleDescendant(); 573 void setAncestorChainHasVisibleDescendant();
576 574
577 void dirtyAncestorChainBlendedDescendantStatus();
578 void setAncestorChainBlendedDescendant();
579
580 void updateDescendantDependentFlags(); 575 void updateDescendantDependentFlags();
581 576
582 // This flag is computed by RenderLayerCompositor, which knows more about 3d hierarchies than we do. 577 // This flag is computed by RenderLayerCompositor, which knows more about 3d hierarchies than we do.
583 void setHas3DTransformedDescendant(bool b) { m_has3DTransformedDescendant = b; } 578 void setHas3DTransformedDescendant(bool b) { m_has3DTransformedDescendant = b; }
584 bool has3DTransformedDescendant() const { return m_has3DTransformedDescendan t; } 579 bool has3DTransformedDescendant() const { return m_has3DTransformedDescendan t; }
585 580
586 void dirty3DTransformedDescendantStatus(); 581 void dirty3DTransformedDescendantStatus();
587 // Both updates the status, and returns true if descendants of this have 3d. 582 // Both updates the status, and returns true if descendants of this have 3d.
588 bool update3DTransformedDescendantStatus(); 583 bool update3DTransformedDescendantStatus();
589 584
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 unsigned m_hasUnclippedDescendant : 1; 631 unsigned m_hasUnclippedDescendant : 1;
637 632
638 unsigned m_isUnclippedDescendant : 1; 633 unsigned m_isUnclippedDescendant : 1;
639 634
640 const unsigned m_isRootLayer : 1; 635 const unsigned m_isRootLayer : 1;
641 636
642 unsigned m_usedTransparency : 1; // Tracks whether we need to close a transp arent layer, i.e., whether 637 unsigned m_usedTransparency : 1; // Tracks whether we need to close a transp arent layer, i.e., whether
643 // we ended up painting this layer or any desce ndants (and therefore need to 638 // we ended up painting this layer or any desce ndants (and therefore need to
644 // blend). 639 // blend).
645 640
646 unsigned m_childLayerHasBlendMode : 1;
647 unsigned m_childLayerHasBlendModeStatusDirty : 1;
648
649 unsigned m_visibleContentStatusDirty : 1; 641 unsigned m_visibleContentStatusDirty : 1;
650 unsigned m_hasVisibleContent : 1; 642 unsigned m_hasVisibleContent : 1;
651 unsigned m_visibleDescendantStatusDirty : 1; 643 unsigned m_visibleDescendantStatusDirty : 1;
652 unsigned m_hasVisibleDescendant : 1; 644 unsigned m_hasVisibleDescendant : 1;
653 645
654 unsigned m_hasVisibleNonLayerContent : 1; 646 unsigned m_hasVisibleNonLayerContent : 1;
655 647
656 unsigned m_isPaginated : 1; // If we think this layer is split by a multi-co lumn ancestor, then this bit will be set. 648 unsigned m_isPaginated : 1; // If we think this layer is split by a multi-co lumn ancestor, then this bit will be set.
657 649
658 unsigned m_3DTransformedDescendantStatusDirty : 1; 650 unsigned m_3DTransformedDescendantStatusDirty : 1;
659 // Set on a stacking context layer that has 3D descendants anywhere 651 // Set on a stacking context layer that has 3D descendants anywhere
660 // in a preserves3D hierarchy. Hint to do 3D-aware hit testing. 652 // in a preserves3D hierarchy. Hint to do 3D-aware hit testing.
661 unsigned m_has3DTransformedDescendant : 1; 653 unsigned m_has3DTransformedDescendant : 1;
662 654
663 unsigned m_containsDirtyOverlayScrollbars : 1; 655 unsigned m_containsDirtyOverlayScrollbars : 1;
664 656
665 // This is an optimization added for <table>. 657 // This is an optimization added for <table>.
666 // Currently cells do not need to update their repaint rectangles when scrol ling. This also 658 // Currently cells do not need to update their repaint rectangles when scrol ling. This also
667 // saves a lot of time when scrolling on a table. 659 // saves a lot of time when scrolling on a table.
668 const unsigned m_canSkipRepaintRectsUpdateOnScroll : 1; 660 const unsigned m_canSkipRepaintRectsUpdateOnScroll : 1;
669 661
670 unsigned m_hasFilterInfo : 1; 662 unsigned m_hasFilterInfo : 1;
671 663
672 blink::WebBlendMode m_blendMode;
673
674 RenderLayerModelObject* m_renderer; 664 RenderLayerModelObject* m_renderer;
675 665
676 RenderLayer* m_parent; 666 RenderLayer* m_parent;
677 RenderLayer* m_previous; 667 RenderLayer* m_previous;
678 RenderLayer* m_next; 668 RenderLayer* m_next;
679 RenderLayer* m_first; 669 RenderLayer* m_first;
680 RenderLayer* m_last; 670 RenderLayer* m_last;
681 671
682 // Our current relative position offset. 672 // Our current relative position offset.
683 LayoutSize m_offsetForInFlowPosition; 673 LayoutSize m_offsetForInFlowPosition;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 732
743 OwnPtr<CompositedLayerMapping> m_compositedLayerMapping; 733 OwnPtr<CompositedLayerMapping> m_compositedLayerMapping;
744 OwnPtr<RenderLayerScrollableArea> m_scrollableArea; 734 OwnPtr<RenderLayerScrollableArea> m_scrollableArea;
745 735
746 CompositedLayerMapping* m_groupedMapping; 736 CompositedLayerMapping* m_groupedMapping;
747 737
748 RenderLayerRepainter m_repainter; 738 RenderLayerRepainter m_repainter;
749 RenderLayerClipper m_clipper; // FIXME: Lazily allocate? 739 RenderLayerClipper m_clipper; // FIXME: Lazily allocate?
750 OwnPtr<RenderLayerStackingNode> m_stackingNode; 740 OwnPtr<RenderLayerStackingNode> m_stackingNode;
751 OwnPtr<RenderLayerReflectionInfo> m_reflectionInfo; 741 OwnPtr<RenderLayerReflectionInfo> m_reflectionInfo;
742 RenderLayerBlendInfo m_blendInfo;
752 }; 743 };
753 744
754 } // namespace WebCore 745 } // namespace WebCore
755 746
756 #ifndef NDEBUG 747 #ifndef NDEBUG
757 // Outside the WebCore namespace for ease of invocation from gdb. 748 // Outside the WebCore namespace for ease of invocation from gdb.
758 void showLayerTree(const WebCore::RenderLayer*); 749 void showLayerTree(const WebCore::RenderLayer*);
759 void showLayerTree(const WebCore::RenderObject*); 750 void showLayerTree(const WebCore::RenderObject*);
760 #endif 751 #endif
761 752
762 #endif // RenderLayer_h 753 #endif // RenderLayer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698