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

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

Issue 1180713006: Use ComputedStyle::outlineOutset in ObjectPainter::outlineBounds (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | 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/ObjectPainter.h" 6 #include "core/paint/ObjectPainter.h"
7 7
8 #include "core/layout/LayoutObject.h" 8 #include "core/layout/LayoutObject.h"
9 #include "core/layout/LayoutTheme.h" 9 #include "core/layout/LayoutTheme.h"
10 #include "core/style/ComputedStyle.h" 10 #include "core/style/ComputedStyle.h"
11 #include "core/paint/LayoutObjectDrawingRecorder.h" 11 #include "core/paint/LayoutObjectDrawingRecorder.h"
12 #include "core/paint/PaintInfo.h" 12 #include "core/paint/PaintInfo.h"
13 #include "platform/geometry/LayoutPoint.h" 13 #include "platform/geometry/LayoutPoint.h"
14 #include "platform/graphics/GraphicsContextStateSaver.h" 14 #include "platform/graphics/GraphicsContextStateSaver.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 LayoutRect ObjectPainter::outlineBounds(const LayoutRect& objectBounds, const Co mputedStyle& style) 18 LayoutRect ObjectPainter::outlineBounds(const LayoutRect& objectBounds, const Co mputedStyle& style)
19 { 19 {
20 int outlineOutset;
21 if (style.outlineStyleIsAuto())
22 outlineOutset = GraphicsContext::focusRingOutsetExtent(style.outlineOffs et(), style.outlineWidth());
23 else
24 outlineOutset = style.outlineSize();
25 LayoutRect outlineBounds(objectBounds); 20 LayoutRect outlineBounds(objectBounds);
26 outlineBounds.inflate(outlineOutset); 21 outlineBounds.inflate(style.outlineOutset());
27 return outlineBounds; 22 return outlineBounds;
28 } 23 }
29 24
30 void ObjectPainter::paintFocusRing(const PaintInfo& paintInfo, const ComputedSty le& style, const Vector<LayoutRect>& focusRingRects) 25 void ObjectPainter::paintFocusRing(const PaintInfo& paintInfo, const ComputedSty le& style, const Vector<LayoutRect>& focusRingRects)
31 { 26 {
32 ASSERT(style.outlineStyleIsAuto()); 27 ASSERT(style.outlineStyleIsAuto());
33 Vector<IntRect> focusRingIntRects; 28 Vector<IntRect> focusRingIntRects;
34 for (size_t i = 0; i < focusRingRects.size(); ++i) 29 for (size_t i = 0; i < focusRingRects.size(); ++i)
35 focusRingIntRects.append(pixelSnappedIntRect(focusRingRects[i])); 30 focusRingIntRects.append(pixelSnappedIntRect(focusRingRects[i]));
36 paintInfo.context->drawFocusRing(focusRingIntRects, style.outlineWidth(), st yle.outlineOffset(), m_layoutObject.resolveColor(style, CSSPropertyOutlineColor) ); 31 paintInfo.context->drawFocusRing(focusRingIntRects, style.outlineWidth(), st yle.outlineOffset(), m_layoutObject.resolveColor(style, CSSPropertyOutlineColor) );
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 quad[1] = FloatPoint(x1, y2 - std::max(adjacentWidth2, 0)); 374 quad[1] = FloatPoint(x1, y2 - std::max(adjacentWidth2, 0));
380 quad[2] = FloatPoint(x2, y2 - std::max(-adjacentWidth2, 0)); 375 quad[2] = FloatPoint(x2, y2 - std::max(-adjacentWidth2, 0));
381 quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0)); 376 quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0));
382 break; 377 break;
383 } 378 }
384 379
385 graphicsContext->fillPolygon(4, quad, color, antialias); 380 graphicsContext->fillPolygon(4, quad, color, antialias);
386 } 381 }
387 382
388 } // namespace blink 383 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698