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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp

Issue 2444593002: Introduce Layout*::adjustVisualRectForRasterEffects and use it for SVG hairlines. (Closed)
Patch Set: none Created 4 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005, 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2005, 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. 5 * Copyright (C) 2009 Google, Inc.
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
8 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> 8 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com>
9 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> 9 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org>
10 * Copyright (C) 2011 University of Szeged 10 * Copyright (C) 2011 University of Szeged
(...skipping 27 matching lines...) Expand all
38 #include "core/svg/SVGGeometryElement.h" 38 #include "core/svg/SVGGeometryElement.h"
39 #include "core/svg/SVGLengthContext.h" 39 #include "core/svg/SVGLengthContext.h"
40 #include "core/svg/SVGPathElement.h" 40 #include "core/svg/SVGPathElement.h"
41 #include "platform/geometry/FloatPoint.h" 41 #include "platform/geometry/FloatPoint.h"
42 #include "platform/graphics/StrokeData.h" 42 #include "platform/graphics/StrokeData.h"
43 #include "wtf/MathExtras.h" 43 #include "wtf/MathExtras.h"
44 #include "wtf/PtrUtil.h" 44 #include "wtf/PtrUtil.h"
45 45
46 namespace blink { 46 namespace blink {
47 47
48 void LayoutSVGShape::adjustVisualRectForRasterEffects(
49 LayoutRect& visualRect) const {
50 // Account for raster expansions due to SVG stroke hairline raster effects.
51 if (styleRef().svgStyle().hasVisibleStroke()) {
Xianzhu 2016/10/24 16:17:30 We should add !visualRect.isEmpty() to avoid infla
chrishtr 2016/10/31 20:52:01 Verified done by wangxianzhu.
52 float pad = 0.5f;
Xianzhu 2016/10/24 16:17:30 Nit: s/float/LayoutUnit/
chrishtr 2016/10/31 20:52:01 Verified done by wangxianzhu.
53 if (styleRef().svgStyle().capStyle() != ButtCap)
54 pad += 0.5f;
55 visualRect.inflate(LayoutUnit(pad));
56 }
57 }
58
48 LayoutSVGShape::LayoutSVGShape(SVGGeometryElement* node) 59 LayoutSVGShape::LayoutSVGShape(SVGGeometryElement* node)
49 : LayoutSVGModelObject(node), 60 : LayoutSVGModelObject(node),
50 // Default is false, the cached rects are empty from the beginning. 61 // Default is false, the cached rects are empty from the beginning.
51 m_needsBoundariesUpdate(false), 62 m_needsBoundariesUpdate(false),
52 // Default is true, so we grab a Path object once from SVGGeometryElement. 63 // Default is true, so we grab a Path object once from SVGGeometryElement.
53 m_needsShapeUpdate(true), 64 m_needsShapeUpdate(true),
54 // Default is true, so we grab a AffineTransform object once from 65 // Default is true, so we grab a AffineTransform object once from
55 // SVGGeometryElement. 66 // SVGGeometryElement.
56 m_needsTransformUpdate(true) {} 67 m_needsTransformUpdate(true) {}
57 68
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 return lengthContext.valueForLength(style()->svgStyle().strokeWidth()); 327 return lengthContext.valueForLength(style()->svgStyle().strokeWidth());
317 } 328 }
318 329
319 LayoutSVGShapeRareData& LayoutSVGShape::ensureRareData() const { 330 LayoutSVGShapeRareData& LayoutSVGShape::ensureRareData() const {
320 if (!m_rareData) 331 if (!m_rareData)
321 m_rareData = wrapUnique(new LayoutSVGShapeRareData()); 332 m_rareData = wrapUnique(new LayoutSVGShapeRareData());
322 return *m_rareData.get(); 333 return *m_rareData.get();
323 } 334 }
324 335
325 } // namespace blink 336 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698