| 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/layout/LayoutPart.h" | 7 #include "core/layout/LayoutPart.h" |
| 8 #include "core/paint/BoxPainter.h" | 8 #include "core/paint/BoxPainter.h" |
| 9 #include "core/paint/LayoutObjectDrawingRecorder.h" | 9 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 10 #include "core/paint/ObjectPainter.h" | 10 #include "core/paint/ObjectPainter.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 if (m_layoutPart.canResize()) | 111 if (m_layoutPart.canResize()) |
| 112 ScrollableAreaPainter(*m_layoutPart.layer()->getScrollableArea()) | 112 ScrollableAreaPainter(*m_layoutPart.layer()->getScrollableArea()) |
| 113 .paintResizer(paintInfo.context, roundedIntPoint(adjustedPaintOffset), | 113 .paintResizer(paintInfo.context, roundedIntPoint(adjustedPaintOffset), |
| 114 paintInfo.cullRect()); | 114 paintInfo.cullRect()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void PartPainter::paintContents(const PaintInfo& paintInfo, | 117 void PartPainter::paintContents(const PaintInfo& paintInfo, |
| 118 const LayoutPoint& paintOffset) { | 118 const LayoutPoint& paintOffset) { |
| 119 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutPart.location(); | 119 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutPart.location(); |
| 120 | 120 |
| 121 Widget* widget = m_layoutPart.widget(); | 121 FrameViewBase* frameViewBase = m_layoutPart.widget(); |
| 122 CHECK(widget); | 122 CHECK(frameViewBase); |
| 123 | 123 |
| 124 IntPoint paintLocation(roundedIntPoint( | 124 IntPoint paintLocation(roundedIntPoint( |
| 125 adjustedPaintOffset + m_layoutPart.replacedContentRect().location())); | 125 adjustedPaintOffset + m_layoutPart.replacedContentRect().location())); |
| 126 | 126 |
| 127 // Widgets don't support painting with a paint offset, but instead offset | 127 // FrameViewBases don't support painting with a paint offset, but instead |
| 128 // themselves using the frame rect location. To paint widgets at our desired | 128 // offset themselves using the frame rect location. To paint widgets at our |
| 129 // location, we need to apply paint offset as a transform, with the frame rect | 129 // desired location, we need to apply paint offset as a transform, with the |
| 130 // neutralized. | 130 // frame rect neutralized. |
| 131 IntSize widgetPaintOffset = paintLocation - widget->frameRect().location(); | 131 IntSize widgetPaintOffset = |
| 132 paintLocation - frameViewBase->frameRect().location(); |
| 132 TransformRecorder transform( | 133 TransformRecorder transform( |
| 133 paintInfo.context, m_layoutPart, | 134 paintInfo.context, m_layoutPart, |
| 134 AffineTransform::translation(widgetPaintOffset.width(), | 135 AffineTransform::translation(widgetPaintOffset.width(), |
| 135 widgetPaintOffset.height())); | 136 widgetPaintOffset.height())); |
| 136 CullRect adjustedCullRect(paintInfo.cullRect(), -widgetPaintOffset); | 137 CullRect adjustedCullRect(paintInfo.cullRect(), -widgetPaintOffset); |
| 137 widget->paint(paintInfo.context, adjustedCullRect); | 138 frameViewBase->paint(paintInfo.context, adjustedCullRect); |
| 138 } | 139 } |
| 139 | 140 |
| 140 } // namespace blink | 141 } // namespace blink |
| OLD | NEW |