| 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/layout/svg/LayoutSVGRoot.h" | 8 #include "core/layout/svg/LayoutSVGRoot.h" |
| 9 #include "core/paint/ObjectPaintProperties.h" | 9 #include "core/paint/ObjectPaintProperties.h" |
| 10 #include "core/paint/PaintInfo.h" | 10 #include "core/paint/PaintInfo.h" |
| 11 #include "core/paint/PaintLayer.h" | 11 #include "core/paint/PaintLayer.h" |
| 12 #include "platform/RuntimeEnabledFeatures.h" | 12 #include "platform/RuntimeEnabledFeatures.h" |
| 13 #include "platform/graphics/GraphicsLayer.h" | 13 #include "platform/graphics/GraphicsLayer.h" |
| 14 #include "platform/graphics/paint/ClipDisplayItem.h" | 14 #include "platform/graphics/paint/ClipDisplayItem.h" |
| 15 #include "platform/graphics/paint/PaintController.h" | 15 #include "platform/graphics/paint/PaintController.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 static bool boxNeedsClip(const LayoutBox& box) { | 19 static bool boxNeedsClip(const LayoutBox& box) { |
| 20 if (box.hasControlClip()) | 20 if (box.hasControlClip()) |
| 21 return true; | 21 return true; |
| 22 if (box.isSVGRoot() && toLayoutSVGRoot(box).shouldApplyViewportClip()) | 22 if (box.isSVGRoot() && toLayoutSVGRoot(box).shouldApplyViewportClip()) |
| 23 return true; | 23 return true; |
| 24 if (box.hasLayer() && box.layer()->isSelfPaintingLayer()) | 24 if (box.hasLayer() && box.layer()->isSelfPaintingLayer()) |
| 25 return false; | 25 return false; |
| 26 return box.hasOverflowClip() || box.styleRef().containsPaint(); | 26 return box.hasOverflowClip() || box.styleRef().containsPaint(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 DISABLE_CFI_PERF |
| 29 BoxClipper::BoxClipper(const LayoutBox& box, | 30 BoxClipper::BoxClipper(const LayoutBox& box, |
| 30 const PaintInfo& paintInfo, | 31 const PaintInfo& paintInfo, |
| 31 const LayoutPoint& accumulatedOffset, | 32 const LayoutPoint& accumulatedOffset, |
| 32 ContentsClipBehavior contentsClipBehavior) | 33 ContentsClipBehavior contentsClipBehavior) |
| 33 : m_box(box), | 34 : m_box(box), |
| 34 m_paintInfo(paintInfo), | 35 m_paintInfo(paintInfo), |
| 35 m_clipType(DisplayItem::kUninitializedType) { | 36 m_clipType(DisplayItem::kUninitializedType) { |
| 36 DCHECK(m_paintInfo.phase != PaintPhaseSelfBlockBackgroundOnly && | 37 DCHECK(m_paintInfo.phase != PaintPhaseSelfBlockBackgroundOnly && |
| 37 m_paintInfo.phase != PaintPhaseSelfOutlineOnly); | 38 m_paintInfo.phase != PaintPhaseSelfOutlineOnly); |
| 38 | 39 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 BoxClipper::~BoxClipper() { | 98 BoxClipper::~BoxClipper() { |
| 98 if (m_clipType == DisplayItem::kUninitializedType) | 99 if (m_clipType == DisplayItem::kUninitializedType) |
| 99 return; | 100 return; |
| 100 | 101 |
| 101 DCHECK(boxNeedsClip(m_box)); | 102 DCHECK(boxNeedsClip(m_box)); |
| 102 m_paintInfo.context.getPaintController().endItem<EndClipDisplayItem>( | 103 m_paintInfo.context.getPaintController().endItem<EndClipDisplayItem>( |
| 103 m_box, DisplayItem::clipTypeToEndClipType(m_clipType)); | 104 m_box, DisplayItem::clipTypeToEndClipType(m_clipType)); |
| 104 } | 105 } |
| 105 | 106 |
| 106 } // namespace blink | 107 } // namespace blink |
| OLD | NEW |