| 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" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 LayoutRect clipRect = m_box.hasControlClip() | 58 LayoutRect clipRect = m_box.hasControlClip() |
| 59 ? m_box.controlClipRect(accumulatedOffset) | 59 ? m_box.controlClipRect(accumulatedOffset) |
| 60 : m_box.overflowClipRect(accumulatedOffset); | 60 : m_box.overflowClipRect(accumulatedOffset); |
| 61 FloatRoundedRect clipRoundedRect(0, 0, 0, 0); | 61 FloatRoundedRect clipRoundedRect(0, 0, 0, 0); |
| 62 bool hasBorderRadius = m_box.style()->hasBorderRadius(); | 62 bool hasBorderRadius = m_box.style()->hasBorderRadius(); |
| 63 if (hasBorderRadius) | 63 if (hasBorderRadius) |
| 64 clipRoundedRect = m_box.style()->getRoundedInnerBorderFor( | 64 clipRoundedRect = m_box.style()->getRoundedInnerBorderFor( |
| 65 LayoutRect(accumulatedOffset, m_box.size())); | 65 LayoutRect(accumulatedOffset, m_box.size())); |
| 66 | 66 |
| 67 // Selection may extend beyond visual overflow, so this optimization is invali
d if selection is present. | 67 // Selection may extend beyond visual overflow, so this optimization is |
| 68 // invalid if selection is present. |
| 68 if (contentsClipBehavior == SkipContentsClipIfPossible && | 69 if (contentsClipBehavior == SkipContentsClipIfPossible && |
| 69 box.getSelectionState() == SelectionNone) { | 70 box.getSelectionState() == SelectionNone) { |
| 70 LayoutRect contentsVisualOverflow = m_box.contentsVisualOverflowRect(); | 71 LayoutRect contentsVisualOverflow = m_box.contentsVisualOverflowRect(); |
| 71 if (contentsVisualOverflow.isEmpty()) | 72 if (contentsVisualOverflow.isEmpty()) |
| 72 return; | 73 return; |
| 73 | 74 |
| 74 LayoutRect conservativeClipRect = clipRect; | 75 LayoutRect conservativeClipRect = clipRect; |
| 75 if (hasBorderRadius) | 76 if (hasBorderRadius) |
| 76 conservativeClipRect.intersect( | 77 conservativeClipRect.intersect( |
| 77 LayoutRect(clipRoundedRect.radiusCenterRect())); | 78 LayoutRect(clipRoundedRect.radiusCenterRect())); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 96 BoxClipper::~BoxClipper() { | 97 BoxClipper::~BoxClipper() { |
| 97 if (m_clipType == DisplayItem::kUninitializedType) | 98 if (m_clipType == DisplayItem::kUninitializedType) |
| 98 return; | 99 return; |
| 99 | 100 |
| 100 DCHECK(boxNeedsClip(m_box)); | 101 DCHECK(boxNeedsClip(m_box)); |
| 101 m_paintInfo.context.getPaintController().endItem<EndClipDisplayItem>( | 102 m_paintInfo.context.getPaintController().endItem<EndClipDisplayItem>( |
| 102 m_box, DisplayItem::clipTypeToEndClipType(m_clipType)); | 103 m_box, DisplayItem::clipTypeToEndClipType(m_clipType)); |
| 103 } | 104 } |
| 104 | 105 |
| 105 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |