Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: Source/core/paint/DetailsMarkerPainter.cpp

Issue 892343002: [Slimming Paint] Add a drawing recorder for DetailsMarkerPainter::paint, and add fast/html (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/virtual/slimmingpaint/fast/html/README.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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);
32 if (renderDrawingRecorder.canUseCachedDrawing())
33 return;
34
30 const Color color(m_renderDetailsMarker.resolveColor(CSSPropertyColor)); 35 const Color color(m_renderDetailsMarker.resolveColor(CSSPropertyColor));
31 paintInfo.context->setStrokeColor(color); 36 paintInfo.context->setStrokeColor(color);
32 paintInfo.context->setStrokeStyle(SolidStroke); 37 paintInfo.context->setStrokeStyle(SolidStroke);
33 paintInfo.context->setStrokeThickness(1.0f); 38 paintInfo.context->setStrokeThickness(1.0f);
34 paintInfo.context->setFillColor(color); 39 paintInfo.context->setFillColor(color);
35 40
36 boxOrigin.move(m_renderDetailsMarker.borderLeft() + m_renderDetailsMarker.pa ddingLeft(), m_renderDetailsMarker.borderTop() + m_renderDetailsMarker.paddingTo p()); 41 boxOrigin.move(m_renderDetailsMarker.borderLeft() + m_renderDetailsMarker.pa ddingLeft(), m_renderDetailsMarker.borderTop() + m_renderDetailsMarker.paddingTo p());
37 paintInfo.context->fillPath(getPath(boxOrigin)); 42 paintInfo.context->fillPath(getPath(boxOrigin));
38 } 43 }
39 44
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 89
85 Path DetailsMarkerPainter::getPath(const LayoutPoint& origin) const 90 Path DetailsMarkerPainter::getPath(const LayoutPoint& origin) const
86 { 91 {
87 Path result = getCanonicalPath(); 92 Path result = getCanonicalPath();
88 result.transform(AffineTransform().scale(m_renderDetailsMarker.contentWidth( ).toFloat(), m_renderDetailsMarker.contentHeight().toFloat())); 93 result.transform(AffineTransform().scale(m_renderDetailsMarker.contentWidth( ).toFloat(), m_renderDetailsMarker.contentHeight().toFloat()));
89 result.translate(FloatSize(origin.x().toFloat(), origin.y().toFloat())); 94 result.translate(FloatSize(origin.x().toFloat(), origin.y().toFloat()));
90 return result; 95 return result;
91 } 96 }
92 97
93 } // namespace paint 98 } // namespace paint
OLDNEW
« no previous file with comments | « LayoutTests/virtual/slimmingpaint/fast/html/README.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698