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/ObjectPaintProperties.h" |
9 #include "core/paint/PaintInfo.h" | 9 #include "core/paint/PaintInfo.h" |
10 #include "core/paint/PaintLayer.h" | 10 #include "core/paint/PaintLayer.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 const auto* objectProperties = m_box.objectPaintProperties(); | 29 const auto* objectProperties = m_box.objectPaintProperties(); |
30 if (objectProperties && objectProperties->overflowClip()) { | 30 if (objectProperties && objectProperties->overflowClip()) { |
31 PaintChunkProperties properties(paintInfo.context.getPaintController
().currentPaintChunkProperties()); | 31 PaintChunkProperties properties(paintInfo.context.getPaintController
().currentPaintChunkProperties()); |
32 properties.clip = objectProperties->overflowClip(); | 32 properties.clip = objectProperties->overflowClip(); |
33 m_scopedClipProperty.emplace(paintInfo.context.getPaintController(),
properties); | 33 m_scopedClipProperty.emplace(paintInfo.context.getPaintController(),
properties); |
34 } | 34 } |
35 return; | 35 return; |
36 } | 36 } |
37 | 37 |
38 bool isControlClip = m_box.hasControlClip(); | 38 bool isControlClip = m_box.hasControlClip(); |
39 bool isOverflowOrContainmentClip = (m_box.hasOverflowClip() && !m_box.layer(
)->isSelfPaintingLayer()) | 39 bool isOverflowOrContainmentClip = (m_box.hasOverflowClip() || box.styleRef(
).containsPaint()) && !m_box.layer()->isSelfPaintingLayer(); |
40 || m_box.style()->containsPaint(); | |
41 | 40 |
42 if (!isControlClip && !isOverflowOrContainmentClip) | 41 if (!isControlClip && !isOverflowOrContainmentClip) |
43 return; | 42 return; |
44 | 43 |
45 LayoutRect clipRect = isControlClip ? m_box.controlClipRect(accumulatedOffse
t) : m_box.overflowClipRect(accumulatedOffset); | 44 LayoutRect clipRect = isControlClip ? m_box.controlClipRect(accumulatedOffse
t) : m_box.overflowClipRect(accumulatedOffset); |
46 FloatRoundedRect clipRoundedRect(0, 0, 0, 0); | 45 FloatRoundedRect clipRoundedRect(0, 0, 0, 0); |
47 bool hasBorderRadius = m_box.style()->hasBorderRadius(); | 46 bool hasBorderRadius = m_box.style()->hasBorderRadius(); |
48 if (hasBorderRadius) | 47 if (hasBorderRadius) |
49 clipRoundedRect = m_box.style()->getRoundedInnerBorderFor(LayoutRect(acc
umulatedOffset, m_box.size())); | 48 clipRoundedRect = m_box.style()->getRoundedInnerBorderFor(LayoutRect(acc
umulatedOffset, m_box.size())); |
50 | 49 |
(...skipping 26 matching lines...) Expand all Loading... |
77 BoxClipper::~BoxClipper() | 76 BoxClipper::~BoxClipper() |
78 { | 77 { |
79 if (m_clipType == DisplayItem::UninitializedType) | 78 if (m_clipType == DisplayItem::UninitializedType) |
80 return; | 79 return; |
81 | 80 |
82 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()-
>isSelfPaintingLayer()) || m_box.style()->containsPaint()); | 81 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()-
>isSelfPaintingLayer()) || m_box.style()->containsPaint()); |
83 m_paintInfo.context.getPaintController().endItem<EndClipDisplayItem>(m_box,
DisplayItem::clipTypeToEndClipType(m_clipType)); | 82 m_paintInfo.context.getPaintController().endItem<EndClipDisplayItem>(m_box,
DisplayItem::clipTypeToEndClipType(m_clipType)); |
84 } | 83 } |
85 | 84 |
86 } // namespace blink | 85 } // namespace blink |
OLD | NEW |