Chromium Code Reviews| 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 LayerClipRecorder_h | 5 #ifndef LayerClipRecorder_h |
| 6 #define LayerClipRecorder_h | 6 #define LayerClipRecorder_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/paint/DeprecatedPaintLayerPaintingInfo.h" | 9 #include "core/paint/DeprecatedPaintLayerPaintingInfo.h" |
| 10 #include "core/paint/PaintPhase.h" | 10 #include "core/paint/PaintPhase.h" |
| 11 #include "platform/graphics/paint/ClipDisplayItem.h" | 11 #include "platform/graphics/paint/ClipDisplayItem.h" |
| 12 #include "platform/graphics/paint/DisplayItem.h" | 12 #include "platform/graphics/paint/DisplayItem.h" |
| 13 #include "wtf/Vector.h" | 13 #include "wtf/Vector.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class ClipRect; | 17 class ClipRect; |
| 18 class GraphicsContext; | 18 class GraphicsContext; |
| 19 class LayoutBox; | |
| 19 class LayoutBoxModelObject; | 20 class LayoutBoxModelObject; |
| 20 | 21 |
| 21 class CORE_EXPORT LayerClipRecorder { | 22 class CORE_EXPORT LayerClipRecorder { |
| 22 WTF_MAKE_FAST_ALLOCATED(LayerClipRecorder); | 23 WTF_MAKE_FAST_ALLOCATED(LayerClipRecorder); |
| 23 public: | 24 public: |
| 24 | 25 |
| 25 enum BorderRadiusClippingRule { IncludeSelfForBorderRadius, DoNotIncludeSelf ForBorderRadius }; | 26 enum BorderRadiusClippingRule { IncludeSelfForBorderRadius, DoNotIncludeSelf ForBorderRadius }; |
| 26 | 27 |
| 27 // Set rounded clip rectangles defined by border radii all the way from the DeprecatedPaintLayerPaintingInfo | 28 // Set rounded clip rectangles defined by border radii all the way from the DeprecatedPaintLayerPaintingInfo |
| 28 // "root" layer down to the specified layer (or the parent of said layer, in case | 29 // "root" layer down to the specified layer (or the parent of said layer, in case |
| 29 // BorderRadiusClippingRule says to skip self). fragmentOffset is used for m ulticol, to specify | 30 // BorderRadiusClippingRule says to skip self). fragmentOffset is used for m ulticol, to specify |
| 30 // the translation required to get from flow thread coordinates to visual co ordinates for a | 31 // the translation required to get from flow thread coordinates to visual co ordinates for a |
| 31 // certain column. | 32 // certain column. |
| 32 // FIXME: The BorderRadiusClippingRule parameter is really useless now. If w e want to skip self, | 33 // FIXME: The BorderRadiusClippingRule parameter is really useless now. If w e want to skip self, |
| 33 // why not just supply the parent layer as the first parameter instead? | 34 // why not just supply the parent layer as the first parameter instead? |
| 34 // FIXME: The ClipRect passed is in visual coordinates (not flow thread coor dinates), but at the | 35 // FIXME: The ClipRect passed is in visual coordinates (not flow thread coor dinates), but at the |
| 35 // same time we pass a fragmentOffset, so that we can translate from flow th read coordinates to | 36 // same time we pass a fragmentOffset, so that we can translate from flow th read coordinates to |
| 36 // visual coordinates. This may look rather confusing/redundant, but it is n eeded for rounded | 37 // visual coordinates. This may look rather confusing/redundant, but it is n eeded for rounded |
| 37 // border clipping. Would be nice to clean up this. | 38 // border clipping. Would be nice to clean up this. |
| 38 explicit LayerClipRecorder(GraphicsContext&, const LayoutBoxModelObject&, Di splayItem::Type, const ClipRect&, const DeprecatedPaintLayerPaintingInfo* localP aintingInfo, const LayoutPoint& fragmentOffset, PaintLayerFlags, BorderRadiusCli ppingRule = IncludeSelfForBorderRadius); | 39 LayerClipRecorder(GraphicsContext&, const LayoutBoxModelObject&, DisplayItem ::Type, const ClipRect&, const DeprecatedPaintLayerPaintingInfo*, const LayoutPo int& fragmentOffset, PaintLayerFlags, BorderRadiusClippingRule = IncludeSelfForB orderRadius); |
| 40 | |
| 41 // Note: This constructor is designed for SPv2, and has drastically differen t semantics than | |
| 42 // the other version above. In the old layer painting model, a layer is resp onsible for | |
| 43 // calculating the accumulated clip from ancestors, and applies the clip to itself. | |
| 44 // In SPv2, it is the layer that establishes overflow clipping who is respon sible to clip | |
| 45 // its descendants. This constructor takes a layer, and only issues clip for that layer. | |
| 46 LayerClipRecorder(GraphicsContext&, const LayoutBox&, const LayoutPoint& pai ntOffset); | |
|
pdr.
2015/09/03 06:16:59
Because the two modes for LayerClipRecorder are so
trchen
2015/09/04 06:10:15
Done.
| |
| 39 | 47 |
| 40 ~LayerClipRecorder(); | 48 ~LayerClipRecorder(); |
| 41 | 49 |
| 42 private: | 50 private: |
| 43 | 51 |
| 44 void collectRoundedRectClips(DeprecatedPaintLayer&, const DeprecatedPaintLay erPaintingInfo& localPaintingInfo, GraphicsContext&, const LayoutPoint& fragment Offset, PaintLayerFlags, | 52 void collectRoundedRectClips(DeprecatedPaintLayer&, const DeprecatedPaintLay erPaintingInfo& localPaintingInfo, GraphicsContext&, const LayoutPoint& fragment Offset, PaintLayerFlags, |
| 45 BorderRadiusClippingRule, Vector<FloatRoundedRect>& roundedRectClips); | 53 BorderRadiusClippingRule, Vector<FloatRoundedRect>& roundedRectClips); |
| 46 | 54 |
| 47 GraphicsContext& m_graphicsContext; | 55 GraphicsContext& m_graphicsContext; |
| 48 const LayoutBoxModelObject& m_layoutObject; | 56 const LayoutBoxModelObject& m_layoutObject; |
| 49 DisplayItem::Type m_clipType; | 57 DisplayItem::Type m_clipType; |
| 50 }; | 58 }; |
| 51 | 59 |
| 52 } // namespace blink | 60 } // namespace blink |
| 53 | 61 |
| 54 #endif // LayerClipRecorder_h | 62 #endif // LayerClipRecorder_h |
| OLD | NEW |