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

Unified Diff: Source/core/rendering/svg/SVGPathData.cpp

Issue 896773002: [svg2] Make 'x' and 'y' presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: cleanup Created 5 years, 10 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: Source/core/rendering/svg/SVGPathData.cpp
diff --git a/Source/core/rendering/svg/SVGPathData.cpp b/Source/core/rendering/svg/SVGPathData.cpp
index bd94518746f05f83035834196656c19e5e9a72ea..3bf752d443423655081aa2133b79d488d38ae5c1 100644
--- a/Source/core/rendering/svg/SVGPathData.cpp
+++ b/Source/core/rendering/svg/SVGPathData.cpp
@@ -19,6 +19,8 @@
#include "config.h"
#include "core/rendering/svg/SVGPathData.h"
+#include "core/rendering/RenderObject.h"
fs 2015/02/04 13:24:53 These should go the list/block of includes below.
Erik Dahlström (inactive) 2015/02/05 16:09:01 Done.
+#include "core/rendering/style/SVGRenderStyle.h"
#include "core/SVGNames.h"
#include "core/svg/SVGCircleElement.h"
@@ -102,6 +104,9 @@ static void updatePathFromPolygonElement(SVGElement* element, Path& path)
static void updatePathFromRectElement(SVGElement* element, Path& path)
{
SVGRectElement* rect = toSVGRectElement(element);
+ RenderObject* renderer = rect->renderer();
+ if (!renderer)
fs 2015/02/04 13:24:53 For <rect>s, I believe there's only one way to rea
Erik Dahlström (inactive) 2015/02/05 16:09:02 Done.
+ return;
SVGLengthContext lengthContext(element);
float width = rect->width()->currentValue()->value(lengthContext);
@@ -112,8 +117,10 @@ static void updatePathFromRectElement(SVGElement* element, Path& path)
return;
if (!width && !height)
return;
- float x = rect->x()->currentValue()->value(lengthContext);
- float y = rect->y()->currentValue()->value(lengthContext);
+
+ const SVGRenderStyle& style = renderer->style()->svgStyle();
+ float x = lengthContext.valueForLength(style.x(), LengthModeWidth);
+ float y = lengthContext.valueForLength(style.y(), LengthModeHeight);
float rx = rect->rx()->currentValue()->value(lengthContext);
float ry = rect->ry()->currentValue()->value(lengthContext);
bool hasRx = rx > 0;

Powered by Google App Engine
This is Rietveld 408576698