Chromium Code Reviews| 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()) | |
|
pdr.
2017/01/13 22:09:36
Please move this down a few lines.
chrishtr
2017/01/13 22:14:22
Done. Also added a comment inspired by your catch.
| |
| 23 return true; | |
| 24 if (box.hasLayer() && box.layer()->isSelfPaintingLayer()) | 22 if (box.hasLayer() && box.layer()->isSelfPaintingLayer()) |
| 25 return false; | 23 return false; |
| 26 return box.hasOverflowClip() || box.styleRef().containsPaint(); | 24 return box.hasOverflowClip() || box.styleRef().containsPaint(); |
| 27 } | 25 } |
| 28 | 26 |
| 29 DISABLE_CFI_PERF | 27 DISABLE_CFI_PERF |
| 30 BoxClipper::BoxClipper(const LayoutBox& box, | 28 BoxClipper::BoxClipper(const LayoutBox& box, |
| 31 const PaintInfo& paintInfo, | 29 const PaintInfo& paintInfo, |
| 32 const LayoutPoint& accumulatedOffset, | 30 const LayoutPoint& accumulatedOffset, |
| 33 ContentsClipBehavior contentsClipBehavior) | 31 ContentsClipBehavior contentsClipBehavior) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 BoxClipper::~BoxClipper() { | 96 BoxClipper::~BoxClipper() { |
| 99 if (m_clipType == DisplayItem::kUninitializedType) | 97 if (m_clipType == DisplayItem::kUninitializedType) |
| 100 return; | 98 return; |
| 101 | 99 |
| 102 DCHECK(boxNeedsClip(m_box)); | 100 DCHECK(boxNeedsClip(m_box)); |
| 103 m_paintInfo.context.getPaintController().endItem<EndClipDisplayItem>( | 101 m_paintInfo.context.getPaintController().endItem<EndClipDisplayItem>( |
| 104 m_box, DisplayItem::clipTypeToEndClipType(m_clipType)); | 102 m_box, DisplayItem::clipTypeToEndClipType(m_clipType)); |
| 105 } | 103 } |
| 106 | 104 |
| 107 } // namespace blink | 105 } // namespace blink |
| OLD | NEW |