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/ObjectPainter.h" | 6 #include "core/paint/ObjectPainter.h" |
7 | 7 |
8 #include "core/paint/RenderDrawingRecorder.h" | 8 #include "core/paint/RenderDrawingRecorder.h" |
9 #include "core/rendering/PaintInfo.h" | 9 #include "core/rendering/PaintInfo.h" |
10 #include "core/rendering/RenderObject.h" | 10 #include "core/rendering/RenderObject.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 focusRingIntRects.append(pixelSnappedIntRect(focusRingRects[i])); | 25 focusRingIntRects.append(pixelSnappedIntRect(focusRingRects[i])); |
26 paintInfo.context->drawFocusRing(focusRingIntRects, style->outlineWidth(), s
tyle->outlineOffset(), m_renderObject.resolveColor(style, CSSPropertyOutlineColo
r)); | 26 paintInfo.context->drawFocusRing(focusRingIntRects, style->outlineWidth(), s
tyle->outlineOffset(), m_renderObject.resolveColor(style, CSSPropertyOutlineColo
r)); |
27 } | 27 } |
28 | 28 |
29 void ObjectPainter::paintOutline(const PaintInfo& paintInfo, const LayoutRect& p
aintRect) | 29 void ObjectPainter::paintOutline(const PaintInfo& paintInfo, const LayoutRect& p
aintRect) |
30 { | 30 { |
31 RenderStyle* styleToUse = m_renderObject.style(); | 31 RenderStyle* styleToUse = m_renderObject.style(); |
32 if (!styleToUse->hasOutline()) | 32 if (!styleToUse->hasOutline()) |
33 return; | 33 return; |
34 | 34 |
35 RenderDrawingRecorder recorder(paintInfo.context, &m_renderObject, paintInfo
.phase, paintRect); | 35 RenderDrawingRecorder recorder(paintInfo.context, m_renderObject, paintInfo.
phase, paintRect); |
| 36 if (recorder.canUseCachedDrawing()) |
| 37 return; |
36 | 38 |
37 if (styleToUse->outlineStyleIsAuto()) { | 39 if (styleToUse->outlineStyleIsAuto()) { |
38 if (RenderTheme::theme().shouldDrawDefaultFocusRing(&m_renderObject)) { | 40 if (RenderTheme::theme().shouldDrawDefaultFocusRing(&m_renderObject)) { |
39 // Only paint the focus ring by hand if the theme isn't able to draw
the focus ring. | 41 // Only paint the focus ring by hand if the theme isn't able to draw
the focus ring. |
40 paintFocusRing(paintInfo, paintRect.location(), styleToUse); | 42 paintFocusRing(paintInfo, paintRect.location(), styleToUse); |
41 } | 43 } |
42 return; | 44 return; |
43 } | 45 } |
44 | 46 |
45 if (styleToUse->outlineStyle() == BNONE) | 47 if (styleToUse->outlineStyle() == BNONE) |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 quad[1] = FloatPoint(x1, y2 - std::max(adjacentWidth2, 0)); | 341 quad[1] = FloatPoint(x1, y2 - std::max(adjacentWidth2, 0)); |
340 quad[2] = FloatPoint(x2, y2 - std::max(-adjacentWidth2, 0)); | 342 quad[2] = FloatPoint(x2, y2 - std::max(-adjacentWidth2, 0)); |
341 quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0)); | 343 quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0)); |
342 break; | 344 break; |
343 } | 345 } |
344 | 346 |
345 graphicsContext->fillPolygon(4, quad, color, antialias); | 347 graphicsContext->fillPolygon(4, quad, color, antialias); |
346 } | 348 } |
347 | 349 |
348 } // namespace blink | 350 } // namespace blink |
OLD | NEW |