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/PartPainter.h" | 5 #include "core/paint/PartPainter.h" |
6 | 6 |
7 #include "core/frame/FrameOrPlugin.h" | 7 #include "core/frame/FrameOrPlugin.h" |
8 #include "core/layout/LayoutPart.h" | 8 #include "core/layout/LayoutPart.h" |
9 #include "core/paint/BoxPainter.h" | 9 #include "core/paint/BoxPainter.h" |
10 #include "core/paint/LayoutObjectDrawingRecorder.h" | 10 #include "core/paint/LayoutObjectDrawingRecorder.h" |
11 #include "core/paint/ObjectPainter.h" | 11 #include "core/paint/ObjectPainter.h" |
12 #include "core/paint/PaintInfo.h" | 12 #include "core/paint/PaintInfo.h" |
13 #include "core/paint/PaintLayer.h" | 13 #include "core/paint/PaintLayer.h" |
14 #include "core/paint/ReplacedPainter.h" | 14 #include "core/paint/ReplacedPainter.h" |
15 #include "core/paint/RoundedInnerRectClipper.h" | 15 #include "core/paint/RoundedInnerRectClipper.h" |
16 #include "core/paint/ScrollableAreaPainter.h" | 16 #include "core/paint/ScrollableAreaPainter.h" |
17 #include "core/paint/TransformRecorder.h" | 17 #include "core/paint/TransformRecorder.h" |
18 #include "platform/wtf/Optional.h" | 18 #include "platform/wtf/Optional.h" |
19 | 19 |
20 namespace blink { | 20 namespace blink { |
21 | 21 |
22 bool PartPainter::IsSelected() const { | 22 bool PartPainter::IsSelected() const { |
23 SelectionState s = layout_part_.GetSelectionState(); | 23 SelectionState s = layout_part_.GetSelectionState(); |
24 if (s == SelectionNone) | 24 if (s == SelectionNone) |
25 return false; | 25 return false; |
26 if (s == SelectionInside) | 26 if (s == SelectionInside) |
27 return true; | 27 return true; |
28 | 28 |
29 int selection_start, selection_end; | 29 int selection_start, selection_end; |
30 layout_part_.SelectionStartEnd(selection_start, selection_end); | 30 std::tie(selection_start, selection_end) = layout_part_.SelectionStartEnd(); |
31 if (s == SelectionStart) | 31 if (s == SelectionStart) |
32 return selection_start == 0; | 32 return selection_start == 0; |
33 | 33 |
34 int end = layout_part_.GetNode()->hasChildren() | 34 int end = layout_part_.GetNode()->hasChildren() |
35 ? layout_part_.GetNode()->CountChildren() | 35 ? layout_part_.GetNode()->CountChildren() |
36 : 1; | 36 : 1; |
37 if (s == SelectionEnd) | 37 if (s == SelectionEnd) |
38 return selection_end == end; | 38 return selection_end == end; |
39 if (s == SelectionBoth) | 39 if (s == SelectionBoth) |
40 return selection_start == 0 && selection_end == end; | 40 return selection_start == 0 && selection_end == end; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 paint_location - frame_or_plugin->FrameRect().Location(); | 134 paint_location - frame_or_plugin->FrameRect().Location(); |
135 TransformRecorder transform( | 135 TransformRecorder transform( |
136 paint_info.context, layout_part_, | 136 paint_info.context, layout_part_, |
137 AffineTransform::Translation(view_paint_offset.Width(), | 137 AffineTransform::Translation(view_paint_offset.Width(), |
138 view_paint_offset.Height())); | 138 view_paint_offset.Height())); |
139 CullRect adjusted_cull_rect(paint_info.GetCullRect(), -view_paint_offset); | 139 CullRect adjusted_cull_rect(paint_info.GetCullRect(), -view_paint_offset); |
140 frame_or_plugin->Paint(paint_info.context, adjusted_cull_rect); | 140 frame_or_plugin->Paint(paint_info.context, adjusted_cull_rect); |
141 } | 141 } |
142 | 142 |
143 } // namespace blink | 143 } // namespace blink |
OLD | NEW |