| 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/PaintLayerPaintingInfo.h" | 9 #include "core/paint/PaintLayerPaintingInfo.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 LayoutBoxModelObject; | 19 class LayoutBoxModelObject; |
| 20 | 20 |
| 21 class CORE_EXPORT LayerClipRecorder { | 21 class CORE_EXPORT LayerClipRecorder { |
| 22 USING_FAST_MALLOC(LayerClipRecorder); | 22 USING_FAST_MALLOC(LayerClipRecorder); |
| 23 | 23 |
| 24 public: | 24 public: |
| 25 enum BorderRadiusClippingRule { | 25 enum BorderRadiusClippingRule { |
| 26 IncludeSelfForBorderRadius, | 26 IncludeSelfForBorderRadius, |
| 27 DoNotIncludeSelfForBorderRadius | 27 DoNotIncludeSelfForBorderRadius |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 // Set rounded clip rectangles defined by border radii all the way from the Pa
intLayerPaintingInfo | 30 // Set rounded clip rectangles defined by border radii all the way from the |
| 31 // "root" layer down to the specified layer (or the parent of said layer, in c
ase | 31 // PaintLayerPaintingInfo "root" layer down to the specified layer (or the |
| 32 // BorderRadiusClippingRule says to skip self). fragmentOffset is used for mul
ticol, to specify | 32 // parent of said layer, in case BorderRadiusClippingRule says to skip self). |
| 33 // the translation required to get from flow thread coordinates to visual coor
dinates for a | 33 // fragmentOffset is used for multicol, to specify the translation required to |
| 34 // certain column. | 34 // get from flow thread coordinates to visual coordinates for a certain |
| 35 // FIXME: The BorderRadiusClippingRule parameter is really useless now. If we
want to skip self, | 35 // column. |
| 36 // FIXME: The BorderRadiusClippingRule parameter is really useless now. If we |
| 37 // want to skip self, |
| 36 // why not just supply the parent layer as the first parameter instead? | 38 // why not just supply the parent layer as the first parameter instead? |
| 37 // FIXME: The ClipRect passed is in visual coordinates (not flow thread coordi
nates), but at the | 39 // FIXME: The ClipRect passed is in visual coordinates (not flow thread |
| 38 // same time we pass a fragmentOffset, so that we can translate from flow thre
ad coordinates to | 40 // coordinates), but at the same time we pass a fragmentOffset, so that we can |
| 39 // visual coordinates. This may look rather confusing/redundant, but it is nee
ded for rounded | 41 // translate from flow thread coordinates to visual coordinates. This may look |
| 40 // border clipping. Would be nice to clean up this. | 42 // rather confusing/redundant, but it is needed for rounded border clipping. |
| 43 // Would be nice to clean up this. |
| 41 explicit LayerClipRecorder( | 44 explicit LayerClipRecorder( |
| 42 GraphicsContext&, | 45 GraphicsContext&, |
| 43 const LayoutBoxModelObject&, | 46 const LayoutBoxModelObject&, |
| 44 DisplayItem::Type, | 47 DisplayItem::Type, |
| 45 const ClipRect&, | 48 const ClipRect&, |
| 46 const PaintLayerPaintingInfo* localPaintingInfo, | 49 const PaintLayerPaintingInfo* localPaintingInfo, |
| 47 const LayoutPoint& fragmentOffset, | 50 const LayoutPoint& fragmentOffset, |
| 48 PaintLayerFlags, | 51 PaintLayerFlags, |
| 49 BorderRadiusClippingRule = IncludeSelfForBorderRadius); | 52 BorderRadiusClippingRule = IncludeSelfForBorderRadius); |
| 50 | 53 |
| 51 ~LayerClipRecorder(); | 54 ~LayerClipRecorder(); |
| 52 | 55 |
| 53 private: | 56 private: |
| 54 void collectRoundedRectClips(PaintLayer&, | 57 void collectRoundedRectClips(PaintLayer&, |
| 55 const PaintLayerPaintingInfo& localPaintingInfo, | 58 const PaintLayerPaintingInfo& localPaintingInfo, |
| 56 GraphicsContext&, | 59 GraphicsContext&, |
| 57 const LayoutPoint& fragmentOffset, | 60 const LayoutPoint& fragmentOffset, |
| 58 PaintLayerFlags, | 61 PaintLayerFlags, |
| 59 BorderRadiusClippingRule, | 62 BorderRadiusClippingRule, |
| 60 Vector<FloatRoundedRect>& roundedRectClips); | 63 Vector<FloatRoundedRect>& roundedRectClips); |
| 61 | 64 |
| 62 GraphicsContext& m_graphicsContext; | 65 GraphicsContext& m_graphicsContext; |
| 63 const LayoutBoxModelObject& m_layoutObject; | 66 const LayoutBoxModelObject& m_layoutObject; |
| 64 DisplayItem::Type m_clipType; | 67 DisplayItem::Type m_clipType; |
| 65 }; | 68 }; |
| 66 | 69 |
| 67 } // namespace blink | 70 } // namespace blink |
| 68 | 71 |
| 69 #endif // LayerClipRecorder_h | 72 #endif // LayerClipRecorder_h |
| OLD | NEW |