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 #include "config.h" | 5 #include "config.h" |
6 #include "core/paint/LayerClipRecorder.h" | 6 #include "core/paint/LayerClipRecorder.h" |
7 | 7 |
8 #include "core/layout/ClipRect.h" | 8 #include "core/layout/ClipRect.h" |
9 #include "core/layout/LayoutView.h" | 9 #include "core/layout/LayoutView.h" |
10 #include "core/paint/PaintLayer.h" | 10 #include "core/paint/PaintLayer.h" |
11 #include "platform/geometry/IntRect.h" | 11 #include "platform/geometry/IntRect.h" |
12 #include "platform/graphics/GraphicsContext.h" | 12 #include "platform/graphics/GraphicsContext.h" |
13 #include "platform/graphics/GraphicsLayer.h" | 13 #include "platform/graphics/GraphicsLayer.h" |
14 #include "platform/graphics/paint/ClipRecorder.h" | 14 #include "platform/graphics/paint/ClipRecorder.h" |
15 #include "platform/graphics/paint/DisplayItemList.h" | 15 #include "platform/graphics/paint/PaintController.h" |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 | 18 |
19 LayerClipRecorder::LayerClipRecorder(GraphicsContext& graphicsContext, const Lay
outBoxModelObject& layoutObject, DisplayItem::Type clipType, const ClipRect& cli
pRect, | 19 LayerClipRecorder::LayerClipRecorder(GraphicsContext& graphicsContext, const Lay
outBoxModelObject& layoutObject, DisplayItem::Type clipType, const ClipRect& cli
pRect, |
20 const PaintLayerPaintingInfo* localPaintingInfo, const LayoutPoint& fragment
Offset, PaintLayerFlags paintFlags, BorderRadiusClippingRule rule) | 20 const PaintLayerPaintingInfo* localPaintingInfo, const LayoutPoint& fragment
Offset, PaintLayerFlags paintFlags, BorderRadiusClippingRule rule) |
21 : m_graphicsContext(graphicsContext) | 21 : m_graphicsContext(graphicsContext) |
22 , m_layoutObject(layoutObject) | 22 , m_layoutObject(layoutObject) |
23 , m_clipType(clipType) | 23 , m_clipType(clipType) |
24 { | 24 { |
25 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect()); | 25 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect()); |
26 Vector<FloatRoundedRect> roundedRects; | 26 Vector<FloatRoundedRect> roundedRects; |
27 if (localPaintingInfo && clipRect.hasRadius()) { | 27 if (localPaintingInfo && clipRect.hasRadius()) { |
28 collectRoundedRectClips(*layoutObject.layer(), *localPaintingInfo, graph
icsContext, fragmentOffset, paintFlags, rule, roundedRects); | 28 collectRoundedRectClips(*layoutObject.layer(), *localPaintingInfo, graph
icsContext, fragmentOffset, paintFlags, rule, roundedRects); |
29 } | 29 } |
30 | 30 |
31 ASSERT(m_graphicsContext.displayItemList()); | 31 ASSERT(m_graphicsContext.paintController()); |
32 m_graphicsContext.displayItemList()->createAndAppend<ClipDisplayItem>(layout
Object, m_clipType, snappedClipRect, roundedRects); | 32 m_graphicsContext.paintController()->createAndAppend<ClipDisplayItem>(layout
Object, m_clipType, snappedClipRect, roundedRects); |
33 } | 33 } |
34 | 34 |
35 static bool inContainingBlockChain(PaintLayer* startLayer, PaintLayer* endLayer) | 35 static bool inContainingBlockChain(PaintLayer* startLayer, PaintLayer* endLayer) |
36 { | 36 { |
37 if (startLayer == endLayer) | 37 if (startLayer == endLayer) |
38 return true; | 38 return true; |
39 | 39 |
40 LayoutView* view = startLayer->layoutObject()->view(); | 40 LayoutView* view = startLayer->layoutObject()->view(); |
41 for (const LayoutBlock* currentBlock = startLayer->layoutObject()->containin
gBlock(); currentBlock &¤tBlock != view; currentBlock = currentBlock->cont
ainingBlock()) { | 41 for (const LayoutBlock* currentBlock = startLayer->layoutObject()->containin
gBlock(); currentBlock &¤tBlock != view; currentBlock = currentBlock->cont
ainingBlock()) { |
42 if (currentBlock->layer() == endLayer) | 42 if (currentBlock->layer() == endLayer) |
(...skipping 23 matching lines...) Expand all Loading... |
66 roundedRectClips.append(layer->layoutObject()->style()->getRoundedIn
nerBorderFor(LayoutRect(delta, LayoutSize(layer->size())))); | 66 roundedRectClips.append(layer->layoutObject()->style()->getRoundedIn
nerBorderFor(LayoutRect(delta, LayoutSize(layer->size())))); |
67 } | 67 } |
68 | 68 |
69 if (layer == localPaintingInfo.rootLayer) | 69 if (layer == localPaintingInfo.rootLayer) |
70 break; | 70 break; |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 LayerClipRecorder::~LayerClipRecorder() | 74 LayerClipRecorder::~LayerClipRecorder() |
75 { | 75 { |
76 ASSERT(m_graphicsContext.displayItemList()); | 76 ASSERT(m_graphicsContext.paintController()); |
77 m_graphicsContext.displayItemList()->endItem<EndClipDisplayItem>(m_layoutObj
ect, DisplayItem::clipTypeToEndClipType(m_clipType)); | 77 m_graphicsContext.paintController()->endItem<EndClipDisplayItem>(m_layoutObj
ect, DisplayItem::clipTypeToEndClipType(m_clipType)); |
78 } | 78 } |
79 | 79 |
80 } // namespace blink | 80 } // namespace blink |
OLD | NEW |