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

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

Issue 2230963002: SVG Image intrinsic size should be used if css style size is 'auto' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SVG intrinsic size should be used if css style size is 'auto' Created 4 years, 4 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) 2011 University of Szeged 2 * Copyright (C) 2011 University of Szeged
3 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> 3 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org>
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // Before creating a new object we need to clear the cached bounding box 47 // Before creating a new object we need to clear the cached bounding box
48 // to avoid using garbage. 48 // to avoid using garbage.
49 m_fillBoundingBox = FloatRect(); 49 m_fillBoundingBox = FloatRect();
50 m_strokeBoundingBox = FloatRect(); 50 m_strokeBoundingBox = FloatRect();
51 m_usePathFallback = false; 51 m_usePathFallback = false;
52 SVGRectElement* rect = toSVGRectElement(element()); 52 SVGRectElement* rect = toSVGRectElement(element());
53 ASSERT(rect); 53 ASSERT(rect);
54 54
55 SVGLengthContext lengthContext(rect); 55 SVGLengthContext lengthContext(rect);
56 FloatSize boundingBoxSize( 56 FloatSize boundingBoxSize(
57 lengthContext.valueForLength(styleRef().width(), styleRef(), SVGLengthMo de::Width), 57 styleRef().width().isAuto() ? rect->width()->currentValue()->value(lengt hContext) : lengthContext.valueForLength(styleRef().width(), styleRef(), SVGLeng thMode::Width),
fs 2016/08/10 18:01:34 I'd suggest to leave this alone for now. (Not sure
Shanmuga Pandi 2016/08/11 05:54:20 Acknowledged.
58 lengthContext.valueForLength(styleRef().height(), styleRef(), SVGLengthM ode::Height)); 58 styleRef().height().isAuto() ? rect->height()->currentValue()->value(len gthContext) : lengthContext.valueForLength(styleRef().height(), styleRef(), SVGL engthMode::Height));
59 59
60 // Spec: "A negative value is an error." 60 // Spec: "A negative value is an error."
61 if (boundingBoxSize.width() < 0 || boundingBoxSize.height() < 0) 61 if (boundingBoxSize.width() < 0 || boundingBoxSize.height() < 0)
62 return; 62 return;
63 63
64 // Spec: "A value of zero disables rendering of the element." 64 // Spec: "A value of zero disables rendering of the element."
65 if (!boundingBoxSize.isEmpty()) { 65 if (!boundingBoxSize.isEmpty()) {
66 // Fallback to LayoutSVGShape and path-based hit detection if the rect 66 // Fallback to LayoutSVGShape and path-based hit detection if the rect
67 // has rounded corners or a non-scaling or non-simple stroke. 67 // has rounded corners or a non-scaling or non-simple stroke.
68 if (lengthContext.valueForLength(styleRef().svgStyle().rx(), styleRef(), SVGLengthMode::Width) > 0 68 if (lengthContext.valueForLength(styleRef().svgStyle().rx(), styleRef(), SVGLengthMode::Width) > 0
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // An approximation of sqrt(2) is used here because at certain precise 137 // An approximation of sqrt(2) is used here because at certain precise
138 // miterlimits, the join style used might not be correct (e.g. a miterlimit 138 // miterlimits, the join style used might not be correct (e.g. a miterlimit
139 // of 1.4142135 should result in bevel joins, but may be drawn using miter 139 // of 1.4142135 should result in bevel joins, but may be drawn using miter
140 // joins). 140 // joins).
141 return svgStyle.strokeDashArray()->isEmpty() 141 return svgStyle.strokeDashArray()->isEmpty()
142 && svgStyle.joinStyle() == MiterJoin 142 && svgStyle.joinStyle() == MiterJoin
143 && svgStyle.strokeMiterLimit() >= 1.5; 143 && svgStyle.strokeMiterLimit() >= 1.5;
144 } 144 }
145 145
146 } // namespace blink 146 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698