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/ReplacedPainter.h" | 5 #include "core/paint/ReplacedPainter.h" |
6 | 6 |
7 #include "core/layout/LayoutReplaced.h" | 7 #include "core/layout/LayoutReplaced.h" |
8 #include "core/layout/api/SelectionState.h" | 8 #include "core/layout/api/SelectionState.h" |
9 #include "core/layout/compositing/CompositedLayerMapping.h" | 9 #include "core/layout/compositing/CompositedLayerMapping.h" |
10 #include "core/layout/svg/LayoutSVGRoot.h" | 10 #include "core/layout/svg/LayoutSVGRoot.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return; | 68 return; |
69 } | 69 } |
70 | 70 |
71 if (paint_info.phase != kPaintPhaseForeground && | 71 if (paint_info.phase != kPaintPhaseForeground && |
72 paint_info.phase != kPaintPhaseSelection && | 72 paint_info.phase != kPaintPhaseSelection && |
73 !layout_replaced_.CanHaveChildren() && | 73 !layout_replaced_.CanHaveChildren() && |
74 paint_info.phase != kPaintPhaseClippingMask) | 74 paint_info.phase != kPaintPhaseClippingMask) |
75 return; | 75 return; |
76 | 76 |
77 if (paint_info.phase == kPaintPhaseSelection) | 77 if (paint_info.phase == kPaintPhaseSelection) |
78 if (layout_replaced_.GetSelectionState() == SelectionNone) | 78 if (layout_replaced_.GetSelectionState() == SelectionState::kNone) |
79 return; | 79 return; |
80 | 80 |
81 { | 81 { |
82 Optional<RoundedInnerRectClipper> clipper; | 82 Optional<RoundedInnerRectClipper> clipper; |
83 bool completely_clipped_out = false; | 83 bool completely_clipped_out = false; |
84 if (layout_replaced_.Style()->HasBorderRadius()) { | 84 if (layout_replaced_.Style()->HasBorderRadius()) { |
85 if (border_rect.IsEmpty()) { | 85 if (border_rect.IsEmpty()) { |
86 completely_clipped_out = true; | 86 completely_clipped_out = true; |
87 } else if (ShouldApplyViewportClip(layout_replaced_)) { | 87 } else if (ShouldApplyViewportClip(layout_replaced_)) { |
88 // Push a clip if we have a border radius, since we want to round the | 88 // Push a clip if we have a border radius, since we want to round the |
(...skipping 23 matching lines...) Expand all Loading... |
112 } else { | 112 } else { |
113 layout_replaced_.PaintReplaced(paint_info, adjusted_paint_offset); | 113 layout_replaced_.PaintReplaced(paint_info, adjusted_paint_offset); |
114 } | 114 } |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 // The selection tint never gets clipped by border-radius rounding, since we | 118 // The selection tint never gets clipped by border-radius rounding, since we |
119 // want it to run right up to the edges of surrounding content. | 119 // want it to run right up to the edges of surrounding content. |
120 bool draw_selection_tint = | 120 bool draw_selection_tint = |
121 paint_info.phase == kPaintPhaseForeground && | 121 paint_info.phase == kPaintPhaseForeground && |
122 layout_replaced_.GetSelectionState() != SelectionNone && | 122 layout_replaced_.GetSelectionState() != SelectionState::kNone && |
123 !paint_info.IsPrinting(); | 123 !paint_info.IsPrinting(); |
124 if (draw_selection_tint && | 124 if (draw_selection_tint && |
125 !LayoutObjectDrawingRecorder::UseCachedDrawingIfPossible( | 125 !LayoutObjectDrawingRecorder::UseCachedDrawingIfPossible( |
126 paint_info.context, layout_replaced_, DisplayItem::kSelectionTint)) { | 126 paint_info.context, layout_replaced_, DisplayItem::kSelectionTint)) { |
127 LayoutRect selection_painting_rect = layout_replaced_.LocalSelectionRect(); | 127 LayoutRect selection_painting_rect = layout_replaced_.LocalSelectionRect(); |
128 selection_painting_rect.MoveBy(adjusted_paint_offset); | 128 selection_painting_rect.MoveBy(adjusted_paint_offset); |
129 IntRect selection_painting_int_rect = | 129 IntRect selection_painting_int_rect = |
130 PixelSnappedIntRect(selection_painting_rect); | 130 PixelSnappedIntRect(selection_painting_rect); |
131 | 131 |
132 LayoutObjectDrawingRecorder drawing_recorder( | 132 LayoutObjectDrawingRecorder drawing_recorder( |
(...skipping 26 matching lines...) Expand all Loading... |
159 paint_rect.Unite(layout_replaced_.LocalSelectionRect()); | 159 paint_rect.Unite(layout_replaced_.LocalSelectionRect()); |
160 paint_rect.MoveBy(adjusted_paint_offset); | 160 paint_rect.MoveBy(adjusted_paint_offset); |
161 | 161 |
162 if (!paint_info.GetCullRect().IntersectsCullRect(paint_rect)) | 162 if (!paint_info.GetCullRect().IntersectsCullRect(paint_rect)) |
163 return false; | 163 return false; |
164 | 164 |
165 return true; | 165 return true; |
166 } | 166 } |
167 | 167 |
168 } // namespace blink | 168 } // namespace blink |
OLD | NEW |