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

Side by Side Diff: Source/core/layout/svg/SVGPathData.cpp

Issue 947983002: Move zoom handling for x and y properties to svg (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: move function Created 5 years, 9 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
« no previous file with comments | « Source/core/layout/svg/LayoutSVGRect.cpp ('k') | Source/core/svg/SVGLengthContext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 SVGLengthContext lengthContext(element); 109 SVGLengthContext lengthContext(element);
110 float width = rect->width()->currentValue()->value(lengthContext); 110 float width = rect->width()->currentValue()->value(lengthContext);
111 if (width < 0) 111 if (width < 0)
112 return; 112 return;
113 float height = rect->height()->currentValue()->value(lengthContext); 113 float height = rect->height()->currentValue()->value(lengthContext);
114 if (height < 0) 114 if (height < 0)
115 return; 115 return;
116 if (!width && !height) 116 if (!width && !height)
117 return; 117 return;
118 118
119 const SVGLayoutStyle& style = rect->renderer()->style()->svgStyle(); 119 const LayoutStyle& style = rect->renderer()->styleRef();
120 float x = lengthContext.valueForLength(style.x(), LengthModeWidth); 120 float x = lengthContext.valueForLength(style.svgStyle().x(), style, LengthMo deWidth);
121 float y = lengthContext.valueForLength(style.y(), LengthModeHeight); 121 float y = lengthContext.valueForLength(style.svgStyle().y(), style, LengthMo deHeight);
122 float rx = rect->rx()->currentValue()->value(lengthContext); 122 float rx = rect->rx()->currentValue()->value(lengthContext);
123 float ry = rect->ry()->currentValue()->value(lengthContext); 123 float ry = rect->ry()->currentValue()->value(lengthContext);
124 bool hasRx = rx > 0; 124 bool hasRx = rx > 0;
125 bool hasRy = ry > 0; 125 bool hasRy = ry > 0;
126 if (hasRx || hasRy) { 126 if (hasRx || hasRy) {
127 if (!hasRx) 127 if (!hasRx)
128 rx = ry; 128 rx = ry;
129 else if (!hasRy) 129 else if (!hasRy)
130 ry = rx; 130 ry = rx;
131 131
(...skipping 20 matching lines...) Expand all
152 map->set(polygonTag.localName().impl(), updatePathFromPolygonElement); 152 map->set(polygonTag.localName().impl(), updatePathFromPolygonElement);
153 map->set(polylineTag.localName().impl(), updatePathFromPolylineElement); 153 map->set(polylineTag.localName().impl(), updatePathFromPolylineElement);
154 map->set(rectTag.localName().impl(), updatePathFromRectElement); 154 map->set(rectTag.localName().impl(), updatePathFromRectElement);
155 } 155 }
156 156
157 if (PathUpdateFunction pathUpdateFunction = map->get(element->localName().im pl())) 157 if (PathUpdateFunction pathUpdateFunction = map->get(element->localName().im pl()))
158 (*pathUpdateFunction)(element, path); 158 (*pathUpdateFunction)(element, path);
159 } 159 }
160 160
161 } // namespace blink 161 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/svg/LayoutSVGRect.cpp ('k') | Source/core/svg/SVGLengthContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698