| 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/rendering/ClipRect.h" | 8 #include "core/rendering/ClipRect.h" |
| 9 #include "core/rendering/RenderLayer.h" | 9 #include "core/rendering/RenderLayer.h" |
| 10 #include "core/rendering/RenderView.h" | 10 #include "core/rendering/RenderView.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 RenderView* view = startLayer->renderer()->view(); | 44 RenderView* view = startLayer->renderer()->view(); |
| 45 for (RenderBlock* currentBlock = startLayer->renderer()->containingBlock();
currentBlock && currentBlock != view; currentBlock = currentBlock->containingBlo
ck()) { | 45 for (RenderBlock* currentBlock = startLayer->renderer()->containingBlock();
currentBlock && currentBlock != view; currentBlock = currentBlock->containingBlo
ck()) { |
| 46 if (currentBlock->layer() == endLayer) | 46 if (currentBlock->layer() == endLayer) |
| 47 return true; | 47 return true; |
| 48 } | 48 } |
| 49 | 49 |
| 50 return false; | 50 return false; |
| 51 } | 51 } |
| 52 | 52 |
| 53 void LayerClipRecorder::collectRoundedRectClips(RenderLayer& renderLayer, const
LayerPaintingInfo& localPaintingInfo, GraphicsContext* context, const LayoutPoin
t& fragmentOffset, PaintLayerFlags paintFlags, | 53 void LayerClipRecorder::collectRoundedRectClips(RenderLayer& renderLayer, const
LayerPaintingInfo& localPaintingInfo, GraphicsContext* context, const LayoutPoin
t& fragmentOffset, PaintLayerFlags paintFlags, |
| 54 BorderRadiusClippingRule rule, Vector<RoundedRect>& roundedRectClips) | 54 BorderRadiusClippingRule rule, Vector<FloatRoundedRect>& roundedRectClips) |
| 55 { | 55 { |
| 56 // If the clip rect has been tainted by a border radius, then we have to wal
k up our layer chain applying the clips from | 56 // If the clip rect has been tainted by a border radius, then we have to wal
k up our layer chain applying the clips from |
| 57 // any layers with overflow. The condition for being able to apply these cli
ps is that the overflow object be in our | 57 // any layers with overflow. The condition for being able to apply these cli
ps is that the overflow object be in our |
| 58 // containing block chain so we check that also. | 58 // containing block chain so we check that also. |
| 59 for (RenderLayer* layer = rule == IncludeSelfForBorderRadius ? &renderLayer
: renderLayer.parent(); layer; layer = layer->parent()) { | 59 for (RenderLayer* layer = rule == IncludeSelfForBorderRadius ? &renderLayer
: renderLayer.parent(); layer; layer = layer->parent()) { |
| 60 // Composited scrolling layers handle border-radius clip in the composit
or via a mask layer. We do not | 60 // Composited scrolling layers handle border-radius clip in the composit
or via a mask layer. We do not |
| 61 // want to apply a border-radius clip to the layer contents itself, beca
use that would require re-rastering | 61 // want to apply a border-radius clip to the layer contents itself, beca
use that would require re-rastering |
| 62 // every frame to update the clip. We only want to make sure that the ma
sk layer is properly clipped so | 62 // every frame to update the clip. We only want to make sure that the ma
sk layer is properly clipped so |
| 63 // that it can in turn clip the scrolled contents in the compositor. | 63 // that it can in turn clip the scrolled contents in the compositor. |
| 64 if (layer->needsCompositedScrolling() && !(paintFlags & PaintLayerPainti
ngChildClippingMaskPhase)) | 64 if (layer->needsCompositedScrolling() && !(paintFlags & PaintLayerPainti
ngChildClippingMaskPhase)) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 80 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 80 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
| 81 OwnPtr<EndClipDisplayItem> endClip = EndClipDisplayItem::create(m_render
er->displayItemClient()); | 81 OwnPtr<EndClipDisplayItem> endClip = EndClipDisplayItem::create(m_render
er->displayItemClient()); |
| 82 ASSERT(m_graphicsContext->displayItemList()); | 82 ASSERT(m_graphicsContext->displayItemList()); |
| 83 m_graphicsContext->displayItemList()->add(endClip.release()); | 83 m_graphicsContext->displayItemList()->add(endClip.release()); |
| 84 } else { | 84 } else { |
| 85 m_graphicsContext->restore(); | 85 m_graphicsContext->restore(); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 } // namespace blink | 89 } // namespace blink |
| OLD | NEW |