OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ClipRecorder_h | 5 #ifndef LayerClipRecorder_h |
6 #define ClipRecorder_h | 6 #define LayerClipRecorder_h |
7 | 7 |
8 #include "core/paint/ViewDisplayList.h" | 8 #include "core/paint/ViewDisplayList.h" |
9 #include "core/rendering/LayerPaintingInfo.h" | 9 #include "core/rendering/LayerPaintingInfo.h" |
10 #include "core/rendering/PaintPhase.h" | 10 #include "core/rendering/PaintPhase.h" |
11 #include "core/rendering/RenderLayerModelObject.h" | |
12 #include "platform/geometry/RoundedRect.h" | |
13 #include "wtf/Vector.h" | 11 #include "wtf/Vector.h" |
14 | 12 |
15 namespace blink { | 13 namespace blink { |
16 | 14 |
17 class ClipRect; | 15 class ClipRect; |
18 class GraphicsContext; | 16 class GraphicsContext; |
| 17 class RenderLayerModelObject; |
19 | 18 |
20 class ClipDisplayItem : public DisplayItem { | 19 class LayerClipRecorder { |
21 public: | |
22 ClipDisplayItem(const RenderLayerModelObject* renderer, Type type, IntRect c
lipRect) | |
23 : DisplayItem(renderer, type), m_clipRect(clipRect) { } | |
24 | |
25 Vector<RoundedRect>& roundedRectClips() { return m_roundedRectClips; } | |
26 virtual void replay(GraphicsContext*) override; | |
27 | |
28 IntRect m_clipRect; | |
29 Vector<RoundedRect> m_roundedRectClips; | |
30 #ifndef NDEBUG | |
31 virtual WTF::String asDebugString() const override; | |
32 #endif | |
33 }; | |
34 | |
35 class EndClipDisplayItem : public DisplayItem { | |
36 public: | |
37 EndClipDisplayItem(const RenderLayerModelObject* renderer) : DisplayItem(ren
derer, EndClip) { } | |
38 | |
39 virtual void replay(GraphicsContext*) override; | |
40 }; | |
41 | |
42 class ClipRecorder { | |
43 public: | 20 public: |
44 | 21 |
45 enum BorderRadiusClippingRule { IncludeSelfForBorderRadius, DoNotIncludeSelf
ForBorderRadius }; | 22 enum BorderRadiusClippingRule { IncludeSelfForBorderRadius, DoNotIncludeSelf
ForBorderRadius }; |
46 | 23 |
47 // Set rounded clip rectangles defined by border radii all the way from the
LayerPaintingInfo | 24 // Set rounded clip rectangles defined by border radii all the way from the
LayerPaintingInfo |
48 // "root" layer down to the specified layer (or the parent of said layer, in
case | 25 // "root" layer down to the specified layer (or the parent of said layer, in
case |
49 // BorderRadiusClippingRule says to skip self). fragmentOffset is used for m
ulticol, to specify | 26 // BorderRadiusClippingRule says to skip self). fragmentOffset is used for m
ulticol, to specify |
50 // the translation required to get from flow thread coordinates to visual co
ordinates for a | 27 // the translation required to get from flow thread coordinates to visual co
ordinates for a |
51 // certain column. | 28 // certain column. |
52 // FIXME: The BorderRadiusClippingRule parameter is really useless now. If w
e want to skip self, | 29 // FIXME: The BorderRadiusClippingRule parameter is really useless now. If w
e want to skip self, |
53 // why not just supply the parent layer as the first parameter instead? | 30 // why not just supply the parent layer as the first parameter instead? |
54 // FIXME: The ClipRect passed is in visual coordinates (not flow thread coor
dinates), but at the | 31 // FIXME: The ClipRect passed is in visual coordinates (not flow thread coor
dinates), but at the |
55 // same time we pass a fragmentOffset, so that we can translate from flow th
read coordinates to | 32 // same time we pass a fragmentOffset, so that we can translate from flow th
read coordinates to |
56 // visual coordinates. This may look rather confusing/redundant, but it is n
eeded for rounded | 33 // visual coordinates. This may look rather confusing/redundant, but it is n
eeded for rounded |
57 // border clipping. Would be nice to clean up this. | 34 // border clipping. Would be nice to clean up this. |
58 explicit ClipRecorder(const RenderLayerModelObject*, GraphicsContext*, Displ
ayItem::Type, const ClipRect&, const LayerPaintingInfo* localPaintingInfo, const
LayoutPoint& fragmentOffset, PaintLayerFlags, BorderRadiusClippingRule = Includ
eSelfForBorderRadius); | 35 explicit LayerClipRecorder(const RenderLayerModelObject*, GraphicsContext*,
DisplayItem::Type, const ClipRect&, const LayerPaintingInfo* localPaintingInfo,
const LayoutPoint& fragmentOffset, PaintLayerFlags, BorderRadiusClippingRule = I
ncludeSelfForBorderRadius); |
59 | 36 |
60 ~ClipRecorder(); | 37 ~LayerClipRecorder(); |
61 | 38 |
62 private: | 39 private: |
63 | 40 |
64 void collectRoundedRectClips(RenderLayer&, const LayerPaintingInfo& localPai
ntingInfo, GraphicsContext*, const LayoutPoint& fragmentOffset, PaintLayerFlags, | 41 void collectRoundedRectClips(RenderLayer&, const LayerPaintingInfo& localPai
ntingInfo, GraphicsContext*, const LayoutPoint& fragmentOffset, PaintLayerFlags, |
65 BorderRadiusClippingRule, Vector<RoundedRect>& roundedRectClips); | 42 BorderRadiusClippingRule, Vector<RoundedRect>& roundedRectClips); |
66 | 43 |
67 GraphicsContext* m_graphicsContext; | 44 GraphicsContext* m_graphicsContext; |
68 const RenderLayerModelObject* m_renderer; | 45 const RenderLayerModelObject* m_renderer; |
69 }; | 46 }; |
70 | 47 |
71 } // namespace blink | 48 } // namespace blink |
72 | 49 |
73 #endif // ViewDisplayList_h | 50 #endif // LayerDisplayList_h |
OLD | NEW |