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 29 matching lines...) Expand all Loading... |
40 | 40 |
41 if (!isControlClip && !isOverflowOrContainmentClip) | 41 if (!isControlClip && !isOverflowOrContainmentClip) |
42 return; | 42 return; |
43 | 43 |
44 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); |
45 FloatRoundedRect clipRoundedRect(0, 0, 0, 0); | 45 FloatRoundedRect clipRoundedRect(0, 0, 0, 0); |
46 bool hasBorderRadius = m_box.style()->hasBorderRadius(); | 46 bool hasBorderRadius = m_box.style()->hasBorderRadius(); |
47 if (hasBorderRadius) | 47 if (hasBorderRadius) |
48 clipRoundedRect = m_box.style()->getRoundedInnerBorderFor(LayoutRect(acc
umulatedOffset, m_box.size())); | 48 clipRoundedRect = m_box.style()->getRoundedInnerBorderFor(LayoutRect(acc
umulatedOffset, m_box.size())); |
49 | 49 |
50 // Selection does not affect visual overflow, so this optimization is invali
d if selection | 50 // Selection may extend beyond visual overflow, so this optimization is inva
lid if selection is present. |
51 // is present. | |
52 if (contentsClipBehavior == SkipContentsClipIfPossible && box.getSelectionSt
ate() == SelectionNone) { | 51 if (contentsClipBehavior == SkipContentsClipIfPossible && box.getSelectionSt
ate() == SelectionNone) { |
53 LayoutRect contentsVisualOverflow = m_box.contentsVisualOverflowRect(); | 52 LayoutRect contentsVisualOverflow = m_box.contentsVisualOverflowRect(); |
54 if (contentsVisualOverflow.isEmpty()) | 53 if (contentsVisualOverflow.isEmpty()) |
55 return; | 54 return; |
56 | 55 |
57 LayoutRect conservativeClipRect = clipRect; | 56 LayoutRect conservativeClipRect = clipRect; |
58 if (hasBorderRadius) | 57 if (hasBorderRadius) |
59 conservativeClipRect.intersect(LayoutRect(clipRoundedRect.radiusCent
erRect())); | 58 conservativeClipRect.intersect(LayoutRect(clipRoundedRect.radiusCent
erRect())); |
60 conservativeClipRect.moveBy(-accumulatedOffset); | 59 conservativeClipRect.moveBy(-accumulatedOffset); |
61 if (m_box.hasLayer()) | 60 if (m_box.hasLayer()) |
(...skipping 14 matching lines...) Expand all Loading... |
76 BoxClipper::~BoxClipper() | 75 BoxClipper::~BoxClipper() |
77 { | 76 { |
78 if (m_clipType == DisplayItem::UninitializedType) | 77 if (m_clipType == DisplayItem::UninitializedType) |
79 return; | 78 return; |
80 | 79 |
81 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()); |
82 m_paintInfo.context.getPaintController().endItem<EndClipDisplayItem>(m_box,
DisplayItem::clipTypeToEndClipType(m_clipType)); | 81 m_paintInfo.context.getPaintController().endItem<EndClipDisplayItem>(m_box,
DisplayItem::clipTypeToEndClipType(m_clipType)); |
83 } | 82 } |
84 | 83 |
85 } // namespace blink | 84 } // namespace blink |
OLD | NEW |