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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 FloatRoundedRect clip_rounded_rect(0, 0, 0, 0); | 63 FloatRoundedRect clip_rounded_rect(0, 0, 0, 0); |
64 bool has_border_radius = box_.Style()->HasBorderRadius(); | 64 bool has_border_radius = box_.Style()->HasBorderRadius(); |
65 if (has_border_radius) { | 65 if (has_border_radius) { |
66 clip_rounded_rect = box_.Style()->GetRoundedInnerBorderFor( | 66 clip_rounded_rect = box_.Style()->GetRoundedInnerBorderFor( |
67 LayoutRect(accumulated_offset, box_.Size())); | 67 LayoutRect(accumulated_offset, box_.Size())); |
68 } | 68 } |
69 | 69 |
70 // Selection may extend beyond visual overflow, so this optimization is | 70 // Selection may extend beyond visual overflow, so this optimization is |
71 // invalid if selection is present. | 71 // invalid if selection is present. |
72 if (contents_clip_behavior == kSkipContentsClipIfPossible && | 72 if (contents_clip_behavior == kSkipContentsClipIfPossible && |
73 box.GetSelectionState() == SelectionNone) { | 73 box.GetSelectionState() == SelectionState::kNone) { |
74 LayoutRect contents_visual_overflow = box_.ContentsVisualOverflowRect(); | 74 LayoutRect contents_visual_overflow = box_.ContentsVisualOverflowRect(); |
75 if (contents_visual_overflow.IsEmpty()) | 75 if (contents_visual_overflow.IsEmpty()) |
76 return; | 76 return; |
77 | 77 |
78 LayoutRect conservative_clip_rect = clip_rect; | 78 LayoutRect conservative_clip_rect = clip_rect; |
79 if (has_border_radius) | 79 if (has_border_radius) |
80 conservative_clip_rect.Intersect( | 80 conservative_clip_rect.Intersect( |
81 LayoutRect(clip_rounded_rect.RadiusCenterRect())); | 81 LayoutRect(clip_rounded_rect.RadiusCenterRect())); |
82 conservative_clip_rect.MoveBy(-accumulated_offset); | 82 conservative_clip_rect.MoveBy(-accumulated_offset); |
83 if (box_.HasLayer()) | 83 if (box_.HasLayer()) |
(...skipping 16 matching lines...) Expand all Loading... |
100 BoxClipper::~BoxClipper() { | 100 BoxClipper::~BoxClipper() { |
101 if (clip_type_ == DisplayItem::kUninitializedType) | 101 if (clip_type_ == DisplayItem::kUninitializedType) |
102 return; | 102 return; |
103 | 103 |
104 DCHECK(BoxNeedsClip(box_)); | 104 DCHECK(BoxNeedsClip(box_)); |
105 paint_info_.context.GetPaintController().EndItem<EndClipDisplayItem>( | 105 paint_info_.context.GetPaintController().EndItem<EndClipDisplayItem>( |
106 box_, DisplayItem::ClipTypeToEndClipType(clip_type_)); | 106 box_, DisplayItem::ClipTypeToEndClipType(clip_type_)); |
107 } | 107 } |
108 | 108 |
109 } // namespace blink | 109 } // namespace blink |
OLD | NEW |