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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp
index 97ca82c6c64343e01cc3a24ed2ee8df1d20ea80e..4c2aa337f765e18065ee0ab92ce2a11dc7046bf0 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp
@@ -45,6 +45,17 @@
namespace blink {
+void LayoutSVGShape::adjustVisualRectForRasterEffects(
+ LayoutRect& visualRect) const {
+ // Account for raster expansions due to SVG stroke hairline raster effects.
+ 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.
+ 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.
+ if (styleRef().svgStyle().capStyle() != ButtCap)
+ pad += 0.5f;
+ visualRect.inflate(LayoutUnit(pad));
+ }
+}
+
LayoutSVGShape::LayoutSVGShape(SVGGeometryElement* node)
: LayoutSVGModelObject(node),
// Default is false, the cached rects are empty from the beginning.

Powered by Google App Engine
This is Rietveld 408576698