| 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 ALLOW_UNUSED_LOCAL(m_clipType); |
| 34 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 34 ALLOW_UNUSED_LOCAL(snappedClipRect); |
| 35 clipDisplayItem->replay(graphicsContext); | 35 ALLOW_UNUSED_LOCAL(m_layoutObject); |
| 36 } else { | 36 ALLOW_UNUSED_LOCAL(m_graphicsContext); |
| 37 ASSERT(m_graphicsContext.displayItemList()); | 37 //OwnPtr<ClipDisplayItem> clipDisplayItem = ClipDisplayItem::create(layoutOb
ject, clipType, snappedClipRect, roundedRects.release()); |
| 38 if (m_graphicsContext.displayItemList()->displayItemConstructionIsDisabl
ed()) | 38 //if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
| 39 return; | 39 // clipDisplayItem->replay(graphicsContext); |
| 40 m_graphicsContext.displayItemList()->add(clipDisplayItem.release()); | 40 //} else { |
| 41 } | 41 // ASSERT(m_graphicsContext.displayItemList()); |
| 42 // if (m_graphicsContext.displayItemList()->displayItemConstructionIsDisa
bled()) |
| 43 // return; |
| 44 // m_graphicsContext.displayItemList()->add(clipDisplayItem.release()); |
| 45 //} |
| 42 } | 46 } |
| 43 | 47 |
| 44 static bool inContainingBlockChain(DeprecatedPaintLayer* startLayer, DeprecatedP
aintLayer* endLayer) | 48 static bool inContainingBlockChain(DeprecatedPaintLayer* startLayer, DeprecatedP
aintLayer* endLayer) |
| 45 { | 49 { |
| 46 if (startLayer == endLayer) | 50 if (startLayer == endLayer) |
| 47 return true; | 51 return true; |
| 48 | 52 |
| 49 LayoutView* view = startLayer->layoutObject()->view(); | 53 LayoutView* view = startLayer->layoutObject()->view(); |
| 50 for (LayoutBlock* currentBlock = startLayer->layoutObject()->containingBlock
(); currentBlock && currentBlock != view; currentBlock = currentBlock->containin
gBlock()) { | 54 for (LayoutBlock* currentBlock = startLayer->layoutObject()->containingBlock
(); currentBlock && currentBlock != view; currentBlock = currentBlock->containin
gBlock()) { |
| 51 if (currentBlock->layer() == endLayer) | 55 if (currentBlock->layer() == endLayer) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 75 roundedRectClips.append(layer->layoutObject()->style()->getRoundedIn
nerBorderFor(LayoutRect(delta, LayoutSize(layer->size())))); | 79 roundedRectClips.append(layer->layoutObject()->style()->getRoundedIn
nerBorderFor(LayoutRect(delta, LayoutSize(layer->size())))); |
| 76 } | 80 } |
| 77 | 81 |
| 78 if (layer == localPaintingInfo.rootLayer) | 82 if (layer == localPaintingInfo.rootLayer) |
| 79 break; | 83 break; |
| 80 } | 84 } |
| 81 } | 85 } |
| 82 | 86 |
| 83 LayerClipRecorder::~LayerClipRecorder() | 87 LayerClipRecorder::~LayerClipRecorder() |
| 84 { | 88 { |
| 85 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 89 //if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
| 86 ASSERT(m_graphicsContext.displayItemList()); | 90 // ASSERT(m_graphicsContext.displayItemList()); |
| 87 if (!m_graphicsContext.displayItemList()->displayItemConstructionIsDisab
led()) { | 91 // if (!m_graphicsContext.displayItemList()->displayItemConstructionIsDis
abled()) { |
| 88 if (m_graphicsContext.displayItemList()->lastDisplayItemIsNoopBegin(
)) | 92 // if (m_graphicsContext.displayItemList()->lastDisplayItemIsNoopBegi
n()) |
| 89 m_graphicsContext.displayItemList()->removeLastDisplayItem(); | 93 // m_graphicsContext.displayItemList()->removeLastDisplayItem(); |
| 90 else | 94 // else |
| 91 m_graphicsContext.displayItemList()->add(EndClipDisplayItem::cre
ate(m_layoutObject, DisplayItem::clipTypeToEndClipType(m_clipType))); | 95 // m_graphicsContext.displayItemList()->add(EndClipDisplayItem::c
reate(m_layoutObject, DisplayItem::clipTypeToEndClipType(m_clipType))); |
| 92 } | 96 // } |
| 93 } else { | 97 //} else { |
| 94 m_graphicsContext.restore(); | 98 // m_graphicsContext.restore(); |
| 95 } | 99 //} |
| 96 } | 100 } |
| 97 | 101 |
| 98 } // namespace blink | 102 } // namespace blink |
| OLD | NEW |