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

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().hasStroke())
52 visualRect.expand(IntRectOutsets(2, 2, 2, 2));
chrishtr 2016/10/22 00:01:11 Because this code doesn't understand anything exce
Xianzhu 2016/10/22 00:35:46 It seems too much to expand by 2 pixels each side.
chrishtr 2016/10/22 06:21:04 Done.
53 }
54
48 LayoutSVGShape::LayoutSVGShape(SVGGeometryElement* node) 55 LayoutSVGShape::LayoutSVGShape(SVGGeometryElement* node)
49 : LayoutSVGModelObject(node), 56 : LayoutSVGModelObject(node),
50 // Default is false, the cached rects are empty from the beginning. 57 // Default is false, the cached rects are empty from the beginning.
51 m_needsBoundariesUpdate(false), 58 m_needsBoundariesUpdate(false),
52 // Default is true, so we grab a Path object once from SVGGeometryElement. 59 // Default is true, so we grab a Path object once from SVGGeometryElement.
53 m_needsShapeUpdate(true), 60 m_needsShapeUpdate(true),
54 // Default is true, so we grab a AffineTransform object once from 61 // Default is true, so we grab a AffineTransform object once from
55 // SVGGeometryElement. 62 // SVGGeometryElement.
56 m_needsTransformUpdate(true) {} 63 m_needsTransformUpdate(true) {}
57 64
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 return lengthContext.valueForLength(style()->svgStyle().strokeWidth()); 323 return lengthContext.valueForLength(style()->svgStyle().strokeWidth());
317 } 324 }
318 325
319 LayoutSVGShapeRareData& LayoutSVGShape::ensureRareData() const { 326 LayoutSVGShapeRareData& LayoutSVGShape::ensureRareData() const {
320 if (!m_rareData) 327 if (!m_rareData)
321 m_rareData = wrapUnique(new LayoutSVGShapeRareData()); 328 m_rareData = wrapUnique(new LayoutSVGShapeRareData());
322 return *m_rareData.get(); 329 return *m_rareData.get();
323 } 330 }
324 331
325 } // namespace blink 332 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698