| 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/layout/LayoutPart.h" | 8 #include "core/layout/LayoutPart.h" |
| 8 #include "core/paint/BoxPainter.h" | 9 #include "core/paint/BoxPainter.h" |
| 9 #include "core/paint/LayoutObjectDrawingRecorder.h" | 10 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 10 #include "core/paint/ObjectPainter.h" | 11 #include "core/paint/ObjectPainter.h" |
| 11 #include "core/paint/PaintInfo.h" | 12 #include "core/paint/PaintInfo.h" |
| 12 #include "core/paint/PaintLayer.h" | 13 #include "core/paint/PaintLayer.h" |
| 13 #include "core/paint/ReplacedPainter.h" | 14 #include "core/paint/ReplacedPainter.h" |
| 14 #include "core/paint/RoundedInnerRectClipper.h" | 15 #include "core/paint/RoundedInnerRectClipper.h" |
| 15 #include "core/paint/ScrollableAreaPainter.h" | 16 #include "core/paint/ScrollableAreaPainter.h" |
| 16 #include "core/paint/TransformRecorder.h" | 17 #include "core/paint/TransformRecorder.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 BoxPainter(layout_part_).PaintMask(paint_info, adjusted_paint_offset); | 63 BoxPainter(layout_part_).PaintMask(paint_info, adjusted_paint_offset); |
| 63 return; | 64 return; |
| 64 } | 65 } |
| 65 | 66 |
| 66 if (ShouldPaintSelfOutline(paint_info.phase)) | 67 if (ShouldPaintSelfOutline(paint_info.phase)) |
| 67 ObjectPainter(layout_part_).PaintOutline(paint_info, adjusted_paint_offset); | 68 ObjectPainter(layout_part_).PaintOutline(paint_info, adjusted_paint_offset); |
| 68 | 69 |
| 69 if (paint_info.phase != kPaintPhaseForeground) | 70 if (paint_info.phase != kPaintPhaseForeground) |
| 70 return; | 71 return; |
| 71 | 72 |
| 72 if (layout_part_.PluginOrFrame()) { | 73 if (layout_part_.GetFrameOrPlugin()) { |
| 73 // TODO(schenney) crbug.com/93805 Speculative release assert to verify that | 74 // TODO(schenney) crbug.com/93805 Speculative release assert to verify that |
| 74 // the crashes we see in FrameViewBase painting are due to a destroyed | 75 // the crashes we see in FrameViewBase painting are due to a destroyed |
| 75 // LayoutPart object. | 76 // LayoutPart object. |
| 76 CHECK(layout_part_.GetNode()); | 77 CHECK(layout_part_.GetNode()); |
| 77 Optional<RoundedInnerRectClipper> clipper; | 78 Optional<RoundedInnerRectClipper> clipper; |
| 78 if (layout_part_.Style()->HasBorderRadius()) { | 79 if (layout_part_.Style()->HasBorderRadius()) { |
| 79 if (border_rect.IsEmpty()) | 80 if (border_rect.IsEmpty()) |
| 80 return; | 81 return; |
| 81 | 82 |
| 82 FloatRoundedRect rounded_inner_rect = | 83 FloatRoundedRect rounded_inner_rect = |
| (...skipping 29 matching lines...) Expand all Loading... |
| 112 ScrollableAreaPainter(*layout_part_.Layer()->GetScrollableArea()) | 113 ScrollableAreaPainter(*layout_part_.Layer()->GetScrollableArea()) |
| 113 .PaintResizer(paint_info.context, | 114 .PaintResizer(paint_info.context, |
| 114 RoundedIntPoint(adjusted_paint_offset), | 115 RoundedIntPoint(adjusted_paint_offset), |
| 115 paint_info.GetCullRect()); | 116 paint_info.GetCullRect()); |
| 116 } | 117 } |
| 117 | 118 |
| 118 void PartPainter::PaintContents(const PaintInfo& paint_info, | 119 void PartPainter::PaintContents(const PaintInfo& paint_info, |
| 119 const LayoutPoint& paint_offset) { | 120 const LayoutPoint& paint_offset) { |
| 120 LayoutPoint adjusted_paint_offset = paint_offset + layout_part_.Location(); | 121 LayoutPoint adjusted_paint_offset = paint_offset + layout_part_.Location(); |
| 121 | 122 |
| 122 FrameViewBase* frame_view_base = layout_part_.PluginOrFrame(); | 123 FrameOrPlugin* frame_or_plugin = layout_part_.GetFrameOrPlugin(); |
| 123 CHECK(frame_view_base); | 124 CHECK(frame_or_plugin); |
| 124 | 125 |
| 125 IntPoint paint_location(RoundedIntPoint( | 126 IntPoint paint_location(RoundedIntPoint( |
| 126 adjusted_paint_offset + layout_part_.ReplacedContentRect().Location())); | 127 adjusted_paint_offset + layout_part_.ReplacedContentRect().Location())); |
| 127 | 128 |
| 128 // FrameViewBases don't support painting with a paint offset, but instead | 129 // Views don't support painting with a paint offset, but instead |
| 129 // offset themselves using the frame rect location. To paint FrameViewBases at | 130 // offset themselves using the frame rect location. To paint Views at |
| 130 // our desired location, we need to apply paint offset as a transform, with | 131 // our desired location, we need to apply paint offset as a transform, with |
| 131 // the frame rect neutralized. | 132 // the frame rect neutralized. |
| 132 IntSize frame_view_base_paint_offset = | 133 IntSize view_paint_offset = |
| 133 paint_location - frame_view_base->FrameRect().Location(); | 134 paint_location - frame_or_plugin->FrameRect().Location(); |
| 134 TransformRecorder transform( | 135 TransformRecorder transform( |
| 135 paint_info.context, layout_part_, | 136 paint_info.context, layout_part_, |
| 136 AffineTransform::Translation(frame_view_base_paint_offset.Width(), | 137 AffineTransform::Translation(view_paint_offset.Width(), |
| 137 frame_view_base_paint_offset.Height())); | 138 view_paint_offset.Height())); |
| 138 CullRect adjusted_cull_rect(paint_info.GetCullRect(), | 139 CullRect adjusted_cull_rect(paint_info.GetCullRect(), -view_paint_offset); |
| 139 -frame_view_base_paint_offset); | 140 frame_or_plugin->Paint(paint_info.context, adjusted_cull_rect); |
| 140 frame_view_base->Paint(paint_info.context, adjusted_cull_rect); | |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace blink | 143 } // namespace blink |
| OLD | NEW |