| 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/BoxClipper.h" | 5 #include "core/paint/BoxClipper.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutBox.h" | 7 #include "core/layout/LayoutBox.h" |
| 8 #include "core/paint/ObjectPaintProperties.h" |
| 8 #include "core/paint/PaintInfo.h" | 9 #include "core/paint/PaintInfo.h" |
| 9 #include "core/paint/PaintLayer.h" | 10 #include "core/paint/PaintLayer.h" |
| 10 #include "platform/RuntimeEnabledFeatures.h" | 11 #include "platform/RuntimeEnabledFeatures.h" |
| 11 #include "platform/graphics/GraphicsLayer.h" | 12 #include "platform/graphics/GraphicsLayer.h" |
| 12 #include "platform/graphics/paint/ClipDisplayItem.h" | 13 #include "platform/graphics/paint/ClipDisplayItem.h" |
| 13 #include "platform/graphics/paint/PaintController.h" | 14 #include "platform/graphics/paint/PaintController.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 BoxClipper::BoxClipper(const LayoutBox& box, const PaintInfo& paintInfo, const L
ayoutPoint& accumulatedOffset, ContentsClipBehavior contentsClipBehavior) | 18 BoxClipper::BoxClipper(const LayoutBox& box, const PaintInfo& paintInfo, const L
ayoutPoint& accumulatedOffset, ContentsClipBehavior contentsClipBehavior) |
| 18 : m_box(box) | 19 : m_box(box) |
| 19 , m_paintInfo(paintInfo) | 20 , m_paintInfo(paintInfo) |
| 20 , m_clipType(DisplayItem::UninitializedType) | 21 , m_clipType(DisplayItem::UninitializedType) |
| 21 { | 22 { |
| 22 ASSERT(m_paintInfo.phase != PaintPhaseSelfBlockBackgroundOnly && m_paintInfo
.phase != PaintPhaseSelfOutlineOnly); | 23 ASSERT(m_paintInfo.phase != PaintPhaseSelfBlockBackgroundOnly && m_paintInfo
.phase != PaintPhaseSelfOutlineOnly); |
| 23 | 24 |
| 24 if (m_paintInfo.phase == PaintPhaseMask) | 25 if (m_paintInfo.phase == PaintPhaseMask) |
| 25 return; | 26 return; |
| 26 | 27 |
| 28 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 29 const auto* objectProperties = m_box.objectPaintProperties(); |
| 30 if (objectProperties && objectProperties->overflowClip()) { |
| 31 PaintChunkProperties properties(paintInfo.context.paintController().
currentPaintChunkProperties()); |
| 32 properties.clip = objectProperties->overflowClip(); |
| 33 m_scopedClipProperty.emplace(paintInfo.context.paintController(), pr
operties); |
| 34 } |
| 35 return; |
| 36 } |
| 37 |
| 27 bool isControlClip = m_box.hasControlClip(); | 38 bool isControlClip = m_box.hasControlClip(); |
| 28 bool isOverflowOrContainmentClip = (m_box.hasOverflowClip() && !m_box.layer(
)->isSelfPaintingLayer()) | 39 bool isOverflowOrContainmentClip = (m_box.hasOverflowClip() && !m_box.layer(
)->isSelfPaintingLayer()) |
| 29 || m_box.style()->containsPaint(); | 40 || m_box.style()->containsPaint(); |
| 30 | 41 |
| 31 if (!isControlClip && !isOverflowOrContainmentClip) | 42 if (!isControlClip && !isOverflowOrContainmentClip) |
| 32 return; | 43 return; |
| 33 | 44 |
| 34 LayoutRect clipRect = isControlClip ? m_box.controlClipRect(accumulatedOffse
t) : m_box.overflowClipRect(accumulatedOffset); | 45 LayoutRect clipRect = isControlClip ? m_box.controlClipRect(accumulatedOffse
t) : m_box.overflowClipRect(accumulatedOffset); |
| 35 FloatRoundedRect clipRoundedRect(0, 0, 0, 0); | 46 FloatRoundedRect clipRoundedRect(0, 0, 0, 0); |
| 36 bool hasBorderRadius = m_box.style()->hasBorderRadius(); | 47 bool hasBorderRadius = m_box.style()->hasBorderRadius(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 64 BoxClipper::~BoxClipper() | 75 BoxClipper::~BoxClipper() |
| 65 { | 76 { |
| 66 if (m_clipType == DisplayItem::UninitializedType) | 77 if (m_clipType == DisplayItem::UninitializedType) |
| 67 return; | 78 return; |
| 68 | 79 |
| 69 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()-
>isSelfPaintingLayer()) || m_box.style()->containsPaint()); | 80 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()-
>isSelfPaintingLayer()) || m_box.style()->containsPaint()); |
| 70 m_paintInfo.context.paintController().endItem<EndClipDisplayItem>(m_box, Dis
playItem::clipTypeToEndClipType(m_clipType)); | 81 m_paintInfo.context.paintController().endItem<EndClipDisplayItem>(m_box, Dis
playItem::clipTypeToEndClipType(m_clipType)); |
| 71 } | 82 } |
| 72 | 83 |
| 73 } // namespace blink | 84 } // namespace blink |
| OLD | NEW |