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

Unified Diff: third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.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/SVGLayoutSupport.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp b/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
index 50d328daf0bee3da525922017531e90fa257ea63..3977ea3e4ce9815de5b580aac5f8880c334ce645 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
@@ -90,28 +90,6 @@ LayoutRect SVGLayoutSupport::transformPaintInvalidationRect(
const FloatRect& localRect) {
FloatRect adjustedRect = rootTransform.mapRect(localRect);
- if (object.isSVGShape() && object.styleRef().svgStyle().hasStroke()) {
- if (float strokeWidthForHairlinePadding =
- toLayoutSVGShape(object).strokeWidth()) {
- // For hairline strokes (stroke-width < 1 in device space), Skia
- // rasterizes up to 0.4(9) off the stroke center. That means
- // enclosingIntRect is not enough - we must also pad to 0.5.
- // This is still fragile as it misses out on CC/DSF CTM components.
- const FloatSize strokeSize = rootTransform.mapSize(FloatSize(
- strokeWidthForHairlinePadding, strokeWidthForHairlinePadding));
- if (strokeSize.width() < 1 || strokeSize.height() < 1) {
- float pad =
- 0.5f - std::min(strokeSize.width(), strokeSize.height()) / 2;
- DCHECK_GT(pad, 0);
- // Additionally, square/round caps can potentially introduce an outset
- // <= 0.5
- if (object.styleRef().svgStyle().capStyle() != ButtCap)
- pad += 0.5f;
- adjustedRect.inflate(pad);
- }
- }
- }
-
if (adjustedRect.isEmpty())
return LayoutRect();

Powered by Google App Engine
This is Rietveld 408576698