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 10 matching lines...) Expand all Loading... |
21 , m_clipType(DisplayItem::UninitializedType) | 21 , m_clipType(DisplayItem::UninitializedType) |
22 { | 22 { |
23 ASSERT(m_paintInfo.phase != PaintPhaseSelfBlockBackgroundOnly && m_paintInfo
.phase != PaintPhaseSelfOutlineOnly); | 23 ASSERT(m_paintInfo.phase != PaintPhaseSelfBlockBackgroundOnly && m_paintInfo
.phase != PaintPhaseSelfOutlineOnly); |
24 | 24 |
25 if (m_paintInfo.phase == PaintPhaseMask) | 25 if (m_paintInfo.phase == PaintPhaseMask) |
26 return; | 26 return; |
27 | 27 |
28 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 28 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
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.paintController().
currentPaintChunkProperties()); | 31 PaintChunkProperties properties(paintInfo.context.getPaintController
().currentPaintChunkProperties()); |
32 properties.clip = objectProperties->overflowClip(); | 32 properties.clip = objectProperties->overflowClip(); |
33 m_scopedClipProperty.emplace(paintInfo.context.paintController(), pr
operties); | 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() && !m_box.layer(
)->isSelfPaintingLayer()) |
40 || m_box.style()->containsPaint(); | 40 || m_box.style()->containsPaint(); |
41 | 41 |
42 if (!isControlClip && !isOverflowOrContainmentClip) | 42 if (!isControlClip && !isOverflowOrContainmentClip) |
43 return; | 43 return; |
(...skipping 12 matching lines...) Expand all Loading... |
56 LayoutRect conservativeClipRect = clipRect; | 56 LayoutRect conservativeClipRect = clipRect; |
57 if (hasBorderRadius) | 57 if (hasBorderRadius) |
58 conservativeClipRect.intersect(LayoutRect(clipRoundedRect.radiusCent
erRect())); | 58 conservativeClipRect.intersect(LayoutRect(clipRoundedRect.radiusCent
erRect())); |
59 conservativeClipRect.moveBy(-accumulatedOffset); | 59 conservativeClipRect.moveBy(-accumulatedOffset); |
60 if (m_box.hasLayer()) | 60 if (m_box.hasLayer()) |
61 conservativeClipRect.move(m_box.scrolledContentOffset()); | 61 conservativeClipRect.move(m_box.scrolledContentOffset()); |
62 if (conservativeClipRect.contains(contentsVisualOverflow)) | 62 if (conservativeClipRect.contains(contentsVisualOverflow)) |
63 return; | 63 return; |
64 } | 64 } |
65 | 65 |
66 if (!m_paintInfo.context.paintController().displayItemConstructionIsDisabled
()) { | 66 if (!m_paintInfo.context.getPaintController().displayItemConstructionIsDisab
led()) { |
67 m_clipType = m_paintInfo.displayItemTypeForClipping(); | 67 m_clipType = m_paintInfo.displayItemTypeForClipping(); |
68 Vector<FloatRoundedRect> roundedRects; | 68 Vector<FloatRoundedRect> roundedRects; |
69 if (hasBorderRadius) | 69 if (hasBorderRadius) |
70 roundedRects.append(clipRoundedRect); | 70 roundedRects.append(clipRoundedRect); |
71 m_paintInfo.context.paintController().createAndAppend<ClipDisplayItem>(m
_box, m_clipType, pixelSnappedIntRect(clipRect), roundedRects); | 71 m_paintInfo.context.getPaintController().createAndAppend<ClipDisplayItem
>(m_box, m_clipType, pixelSnappedIntRect(clipRect), roundedRects); |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
75 BoxClipper::~BoxClipper() | 75 BoxClipper::~BoxClipper() |
76 { | 76 { |
77 if (m_clipType == DisplayItem::UninitializedType) | 77 if (m_clipType == DisplayItem::UninitializedType) |
78 return; | 78 return; |
79 | 79 |
80 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()); |
81 m_paintInfo.context.paintController().endItem<EndClipDisplayItem>(m_box, Dis
playItem::clipTypeToEndClipType(m_clipType)); | 81 m_paintInfo.context.getPaintController().endItem<EndClipDisplayItem>(m_box,
DisplayItem::clipTypeToEndClipType(m_clipType)); |
82 } | 82 } |
83 | 83 |
84 } // namespace blink | 84 } // namespace blink |
OLD | NEW |