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/DeprecatedPaintLayer.h" | 10 #include "core/paint/DeprecatedPaintLayer.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 , m_layoutObject(layoutObject) | 23 , m_layoutObject(layoutObject) |
24 , m_clipType(clipType) | 24 , m_clipType(clipType) |
25 { | 25 { |
26 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect()); | 26 IntRect snappedClipRect = pixelSnappedIntRect(clipRect.rect()); |
27 OwnPtr<Vector<FloatRoundedRect>> roundedRects; | 27 OwnPtr<Vector<FloatRoundedRect>> roundedRects; |
28 if (localPaintingInfo && clipRect.hasRadius()) { | 28 if (localPaintingInfo && clipRect.hasRadius()) { |
29 roundedRects = adoptPtr(new Vector<FloatRoundedRect>()); | 29 roundedRects = adoptPtr(new Vector<FloatRoundedRect>()); |
30 collectRoundedRectClips(*layoutObject.layer(), *localPaintingInfo, graph
icsContext, fragmentOffset, paintFlags, rule, *roundedRects); | 30 collectRoundedRectClips(*layoutObject.layer(), *localPaintingInfo, graph
icsContext, fragmentOffset, paintFlags, rule, *roundedRects); |
31 } | 31 } |
32 | 32 |
33 OwnPtr<ClipDisplayItem> clipDisplayItem = ClipDisplayItem::create(layoutObje
ct, clipType, snappedClipRect, roundedRects.release()); | 33 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
34 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) { | |
35 clipDisplayItem->replay(graphicsContext); | |
36 } else { | |
37 ASSERT(m_graphicsContext.displayItemList()); | |
38 if (m_graphicsContext.displayItemList()->displayItemConstructionIsDisabl
ed()) | 34 if (m_graphicsContext.displayItemList()->displayItemConstructionIsDisabl
ed()) |
39 return; | 35 return; |
40 m_graphicsContext.displayItemList()->add(clipDisplayItem.release()); | 36 m_graphicsContext.displayItemList()->createAndAppend<ClipDisplayItem>(la
youtObject, m_clipType, snappedClipRect, roundedRects.release()); |
| 37 } else { |
| 38 ClipDisplayItem clipDisplayItem(layoutObject, m_clipType, snappedClipRec
t, roundedRects.release()); |
| 39 clipDisplayItem.replay(graphicsContext); |
41 } | 40 } |
42 } | 41 } |
43 | 42 |
44 static bool inContainingBlockChain(DeprecatedPaintLayer* startLayer, DeprecatedP
aintLayer* endLayer) | 43 static bool inContainingBlockChain(DeprecatedPaintLayer* startLayer, DeprecatedP
aintLayer* endLayer) |
45 { | 44 { |
46 if (startLayer == endLayer) | 45 if (startLayer == endLayer) |
47 return true; | 46 return true; |
48 | 47 |
49 LayoutView* view = startLayer->layoutObject()->view(); | 48 LayoutView* view = startLayer->layoutObject()->view(); |
50 for (LayoutBlock* currentBlock = startLayer->layoutObject()->containingBlock
(); currentBlock && currentBlock != view; currentBlock = currentBlock->containin
gBlock()) { | 49 for (LayoutBlock* currentBlock = startLayer->layoutObject()->containingBlock
(); currentBlock && currentBlock != view; currentBlock = currentBlock->containin
gBlock()) { |
(...skipping 30 matching lines...) Expand all Loading... |
81 } | 80 } |
82 | 81 |
83 LayerClipRecorder::~LayerClipRecorder() | 82 LayerClipRecorder::~LayerClipRecorder() |
84 { | 83 { |
85 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 84 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
86 ASSERT(m_graphicsContext.displayItemList()); | 85 ASSERT(m_graphicsContext.displayItemList()); |
87 if (!m_graphicsContext.displayItemList()->displayItemConstructionIsDisab
led()) { | 86 if (!m_graphicsContext.displayItemList()->displayItemConstructionIsDisab
led()) { |
88 if (m_graphicsContext.displayItemList()->lastDisplayItemIsNoopBegin(
)) | 87 if (m_graphicsContext.displayItemList()->lastDisplayItemIsNoopBegin(
)) |
89 m_graphicsContext.displayItemList()->removeLastDisplayItem(); | 88 m_graphicsContext.displayItemList()->removeLastDisplayItem(); |
90 else | 89 else |
91 m_graphicsContext.displayItemList()->add(EndClipDisplayItem::cre
ate(m_layoutObject, DisplayItem::clipTypeToEndClipType(m_clipType))); | 90 m_graphicsContext.displayItemList()->createAndAppend<EndClipDisp
layItem>(m_layoutObject, DisplayItem::clipTypeToEndClipType(m_clipType)); |
92 } | 91 } |
93 } else { | 92 } else { |
94 m_graphicsContext.restore(); | 93 m_graphicsContext.restore(); |
95 } | 94 } |
96 } | 95 } |
97 | 96 |
98 } // namespace blink | 97 } // namespace blink |
OLD | NEW |