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/DetailsMarkerPainter.h" | 6 #include "core/paint/DetailsMarkerPainter.h" |
7 | 7 |
8 #include "core/paint/BlockPainter.h" | 8 #include "core/paint/BlockPainter.h" |
9 #include "core/paint/RenderDrawingRecorder.h" | |
9 #include "core/rendering/PaintInfo.h" | 10 #include "core/rendering/PaintInfo.h" |
10 #include "core/rendering/RenderDetailsMarker.h" | 11 #include "core/rendering/RenderDetailsMarker.h" |
11 #include "platform/geometry/LayoutPoint.h" | 12 #include "platform/geometry/LayoutPoint.h" |
12 #include "platform/graphics/Path.h" | 13 #include "platform/graphics/Path.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 | 16 |
16 void DetailsMarkerPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) | 17 void DetailsMarkerPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
17 { | 18 { |
18 if (paintInfo.phase != PaintPhaseForeground || m_renderDetailsMarker.style() ->visibility() != VISIBLE) { | 19 if (paintInfo.phase != PaintPhaseForeground || m_renderDetailsMarker.style() ->visibility() != VISIBLE) { |
19 BlockPainter(m_renderDetailsMarker).paint(paintInfo, paintOffset); | 20 BlockPainter(m_renderDetailsMarker).paint(paintInfo, paintOffset); |
20 return; | 21 return; |
21 } | 22 } |
22 | 23 |
23 LayoutPoint boxOrigin(paintOffset + m_renderDetailsMarker.location()); | 24 LayoutPoint boxOrigin(paintOffset + m_renderDetailsMarker.location()); |
24 LayoutRect overflowRect(m_renderDetailsMarker.visualOverflowRect()); | 25 LayoutRect overflowRect(m_renderDetailsMarker.visualOverflowRect()); |
25 overflowRect.moveBy(boxOrigin); | 26 overflowRect.moveBy(boxOrigin); |
26 | 27 |
27 if (!paintInfo.rect.intersects(pixelSnappedIntRect(overflowRect))) | 28 if (!paintInfo.rect.intersects(pixelSnappedIntRect(overflowRect))) |
28 return; | 29 return; |
29 | 30 |
31 RenderDrawingRecorder RenderDrawingRecorder(paintInfo.context, m_renderDetai lsMarker, paintInfo.phase, overflowRect); | |
jbroman
2015/02/03 02:15:04
Should we be checking canUseCachedDrawing() here?
chrishtr
2015/02/03 20:27:17
Done.
| |
32 | |
30 const Color color(m_renderDetailsMarker.resolveColor(CSSPropertyColor)); | 33 const Color color(m_renderDetailsMarker.resolveColor(CSSPropertyColor)); |
31 paintInfo.context->setStrokeColor(color); | 34 paintInfo.context->setStrokeColor(color); |
32 paintInfo.context->setStrokeStyle(SolidStroke); | 35 paintInfo.context->setStrokeStyle(SolidStroke); |
33 paintInfo.context->setStrokeThickness(1.0f); | 36 paintInfo.context->setStrokeThickness(1.0f); |
34 paintInfo.context->setFillColor(color); | 37 paintInfo.context->setFillColor(color); |
35 | 38 |
36 boxOrigin.move(m_renderDetailsMarker.borderLeft() + m_renderDetailsMarker.pa ddingLeft(), m_renderDetailsMarker.borderTop() + m_renderDetailsMarker.paddingTo p()); | 39 boxOrigin.move(m_renderDetailsMarker.borderLeft() + m_renderDetailsMarker.pa ddingLeft(), m_renderDetailsMarker.borderTop() + m_renderDetailsMarker.paddingTo p()); |
37 paintInfo.context->fillPath(getPath(boxOrigin)); | 40 paintInfo.context->fillPath(getPath(boxOrigin)); |
38 } | 41 } |
39 | 42 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 | 87 |
85 Path DetailsMarkerPainter::getPath(const LayoutPoint& origin) const | 88 Path DetailsMarkerPainter::getPath(const LayoutPoint& origin) const |
86 { | 89 { |
87 Path result = getCanonicalPath(); | 90 Path result = getCanonicalPath(); |
88 result.transform(AffineTransform().scale(m_renderDetailsMarker.contentWidth( ).toFloat(), m_renderDetailsMarker.contentHeight().toFloat())); | 91 result.transform(AffineTransform().scale(m_renderDetailsMarker.contentWidth( ).toFloat(), m_renderDetailsMarker.contentHeight().toFloat())); |
89 result.translate(FloatSize(origin.x().toFloat(), origin.y().toFloat())); | 92 result.translate(FloatSize(origin.x().toFloat(), origin.y().toFloat())); |
90 return result; | 93 return result; |
91 } | 94 } |
92 | 95 |
93 } // namespace paint | 96 } // namespace paint |
OLD | NEW |