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