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 "config.h" | 5 #include "config.h" |
6 #include "core/paint/PartPainter.h" | 6 #include "core/paint/PartPainter.h" |
7 | 7 |
8 #include "core/paint/BoxPainter.h" | 8 #include "core/paint/BoxPainter.h" |
9 | 9 |
| 10 #include "core/paint/ScrollableAreaPainter.h" |
10 #include "core/rendering/GraphicsContextAnnotator.h" | 11 #include "core/rendering/GraphicsContextAnnotator.h" |
11 #include "core/rendering/PaintInfo.h" | 12 #include "core/rendering/PaintInfo.h" |
12 #include "core/rendering/RenderLayer.h" | 13 #include "core/rendering/RenderLayer.h" |
13 #include "core/rendering/RenderPart.h" | 14 #include "core/rendering/RenderPart.h" |
14 | 15 |
15 namespace blink { | 16 namespace blink { |
16 | 17 |
17 void PartPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) | 18 void PartPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) |
18 { | 19 { |
19 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderPart); | 20 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderPart); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 paintInfo.context->restore(); | 58 paintInfo.context->restore(); |
58 | 59 |
59 // Paint a partially transparent wash over selected widgets. | 60 // Paint a partially transparent wash over selected widgets. |
60 if (m_renderPart.isSelected() && !m_renderPart.document().printing()) { | 61 if (m_renderPart.isSelected() && !m_renderPart.document().printing()) { |
61 LayoutRect rect = m_renderPart.localSelectionRect(); | 62 LayoutRect rect = m_renderPart.localSelectionRect(); |
62 rect.moveBy(adjustedPaintOffset); | 63 rect.moveBy(adjustedPaintOffset); |
63 paintInfo.context->fillRect(pixelSnappedIntRect(rect), m_renderPart.sele
ctionBackgroundColor()); | 64 paintInfo.context->fillRect(pixelSnappedIntRect(rect), m_renderPart.sele
ctionBackgroundColor()); |
64 } | 65 } |
65 | 66 |
66 if (m_renderPart.canResize()) | 67 if (m_renderPart.canResize()) |
67 m_renderPart.layer()->scrollableArea()->paintResizer(paintInfo.context,
roundedIntPoint(adjustedPaintOffset), paintInfo.rect); | 68 ScrollableAreaPainter(*m_renderPart.layer()->scrollableArea()).paintResi
zer(paintInfo.context, roundedIntPoint(adjustedPaintOffset), paintInfo.rect); |
68 } | 69 } |
69 | 70 |
70 void PartPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& p
aintOffset) | 71 void PartPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& p
aintOffset) |
71 { | 72 { |
72 LayoutPoint adjustedPaintOffset = paintOffset + m_renderPart.location(); | 73 LayoutPoint adjustedPaintOffset = paintOffset + m_renderPart.location(); |
73 | 74 |
74 Widget* widget = m_renderPart.widget(); | 75 Widget* widget = m_renderPart.widget(); |
75 RELEASE_ASSERT(widget); | 76 RELEASE_ASSERT(widget); |
76 | 77 |
77 // Tell the widget to paint now. This is the only time the widget is allowed | 78 // Tell the widget to paint now. This is the only time the widget is allowed |
(...skipping 10 matching lines...) Expand all Loading... |
88 paintInfo.context->translate(widgetPaintOffset.width(), widgetPaintOffse
t.height()); | 89 paintInfo.context->translate(widgetPaintOffset.width(), widgetPaintOffse
t.height()); |
89 paintRect.move(-widgetPaintOffset); | 90 paintRect.move(-widgetPaintOffset); |
90 } | 91 } |
91 widget->paint(paintInfo.context, paintRect); | 92 widget->paint(paintInfo.context, paintRect); |
92 | 93 |
93 if (!widgetPaintOffset.isZero()) | 94 if (!widgetPaintOffset.isZero()) |
94 paintInfo.context->translate(-widgetPaintOffset.width(), -widgetPaintOff
set.height()); | 95 paintInfo.context->translate(-widgetPaintOffset.width(), -widgetPaintOff
set.height()); |
95 } | 96 } |
96 | 97 |
97 } // namespace blink | 98 } // namespace blink |
OLD | NEW |