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

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

Issue 1165393005: Add helper for computing outset for 'outline' (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 | « Source/core/layout/svg/SVGLayoutSupport.cpp ('k') | Source/core/style/ComputedStyle.h » ('j') | 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/InlinePainter.h" 6 #include "core/paint/InlinePainter.h"
7 7
8 #include "core/layout/LayoutBlock.h" 8 #include "core/layout/LayoutBlock.h"
9 #include "core/layout/LayoutInline.h" 9 #include "core/layout/LayoutInline.h"
10 #include "core/layout/LayoutTheme.h" 10 #include "core/layout/LayoutTheme.h"
(...skipping 13 matching lines...) Expand all
24 // FIXME: When Skia supports annotation rect covering (https://code.google.c om/p/skia/issues/detail?id=3872), 24 // FIXME: When Skia supports annotation rect covering (https://code.google.c om/p/skia/issues/detail?id=3872),
25 // this rect may be covered by foreground and descendant drawings. Then we m ay need a dedicated paint phase. 25 // this rect may be covered by foreground and descendant drawings. Then we m ay need a dedicated paint phase.
26 if (paintInfo.phase == PaintPhaseForeground && paintInfo.context->printing() ) 26 if (paintInfo.phase == PaintPhaseForeground && paintInfo.context->printing() )
27 ObjectPainter(m_layoutInline).addPDFURLRectIfNeeded(paintInfo, paintOffs et); 27 ObjectPainter(m_layoutInline).addPDFURLRectIfNeeded(paintInfo, paintOffs et);
28 28
29 LineBoxListPainter(*m_layoutInline.lineBoxes()).paint(&m_layoutInline, paint Info, paintOffset); 29 LineBoxListPainter(*m_layoutInline.lineBoxes()).paint(&m_layoutInline, paint Info, paintOffset);
30 } 30 }
31 31
32 LayoutRect InlinePainter::outlinePaintRect(const Vector<LayoutRect>& outlineRect s, const LayoutPoint& paintOffset) const 32 LayoutRect InlinePainter::outlinePaintRect(const Vector<LayoutRect>& outlineRect s, const LayoutPoint& paintOffset) const
33 { 33 {
34 const ComputedStyle& style = m_layoutInline.styleRef(); 34 int outlineOutset = m_layoutInline.styleRef().outlineOutset();
35 int outlineOutset;
36 if (style.outlineStyleIsAuto())
37 outlineOutset = GraphicsContext::focusRingOutsetExtent(style.outlineOffs et(), style.outlineWidth());
38 else
39 outlineOutset = style.outlineSize();
40 LayoutRect outlineRect; 35 LayoutRect outlineRect;
41 for (const LayoutRect& rect : outlineRects) { 36 for (const LayoutRect& rect : outlineRects) {
42 LayoutRect inflatedRect(rect); 37 LayoutRect inflatedRect(rect);
43 // Inflate the individual rects instead of the union, to avoid losing 38 // Inflate the individual rects instead of the union, to avoid losing
44 // rects which have degenerate width/height (== isEmpty() true.) 39 // rects which have degenerate width/height (== isEmpty() true.)
45 inflatedRect.inflate(outlineOutset); 40 inflatedRect.inflate(outlineOutset);
46 outlineRect.unite(inflatedRect); 41 outlineRect.unite(inflatedRect);
47 } 42 }
48 outlineRect.moveBy(paintOffset); 43 outlineRect.moveBy(paintOffset);
49 return outlineRect; 44 return outlineRect;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 pixelSnappedBox.maxX() + outlineWidth, 213 pixelSnappedBox.maxX() + outlineWidth,
219 pixelSnappedBox.maxY() + outlineWidth, 214 pixelSnappedBox.maxY() + outlineWidth,
220 BSBottom, outlineColor, outlineStyle, 215 BSBottom, outlineColor, outlineStyle,
221 outlineWidth, 216 outlineWidth,
222 outlineWidth, 217 outlineWidth,
223 antialias); 218 antialias);
224 } 219 }
225 } 220 }
226 221
227 } // namespace blink 222 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/svg/SVGLayoutSupport.cpp ('k') | Source/core/style/ComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698