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

Side by Side Diff: Source/core/svg/SVGLengthContext.cpp

Issue 18421006: Resolve em units against the specified font size in SVG (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/svg/zoom/text/zoom-em-units-expected.html ('k') | no next file » | 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) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2007 Apple Inc. All rights reserved.
5 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 221 }
222 222
223 float SVGLengthContext::convertValueFromUserUnitsToEMS(float value, ExceptionCod e& ec) const 223 float SVGLengthContext::convertValueFromUserUnitsToEMS(float value, ExceptionCod e& ec) const
224 { 224 {
225 RenderStyle* style = renderStyleForLengthResolving(m_context); 225 RenderStyle* style = renderStyleForLengthResolving(m_context);
226 if (!style) { 226 if (!style) {
227 ec = NotSupportedError; 227 ec = NotSupportedError;
228 return 0; 228 return 0;
229 } 229 }
230 230
231 float fontSize = style->fontSize(); 231 float fontSize = style->specifiedFontSize();
232 if (!fontSize) { 232 if (!fontSize) {
233 ec = NotSupportedError; 233 ec = NotSupportedError;
234 return 0; 234 return 0;
235 } 235 }
236 236
237 return value / fontSize; 237 return value / fontSize;
238 } 238 }
239 239
240 float SVGLengthContext::convertValueFromEMSToUserUnits(float value, ExceptionCod e& ec) const 240 float SVGLengthContext::convertValueFromEMSToUserUnits(float value, ExceptionCod e& ec) const
241 { 241 {
242 RenderStyle* style = renderStyleForLengthResolving(m_context); 242 RenderStyle* style = renderStyleForLengthResolving(m_context);
243 if (!style) { 243 if (!style) {
244 ec = NotSupportedError; 244 ec = NotSupportedError;
245 return 0; 245 return 0;
246 } 246 }
247 247
248 return value * style->fontSize(); 248 return value * style->specifiedFontSize();
249 } 249 }
250 250
251 float SVGLengthContext::convertValueFromUserUnitsToEXS(float value, ExceptionCod e& ec) const 251 float SVGLengthContext::convertValueFromUserUnitsToEXS(float value, ExceptionCod e& ec) const
252 { 252 {
253 RenderStyle* style = renderStyleForLengthResolving(m_context); 253 RenderStyle* style = renderStyleForLengthResolving(m_context);
254 if (!style) { 254 if (!style) {
255 ec = NotSupportedError; 255 ec = NotSupportedError;
256 return 0; 256 return 0;
257 } 257 }
258 258
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 FloatSize viewportSize = svg->currentViewBoxRect().size(); 305 FloatSize viewportSize = svg->currentViewBoxRect().size();
306 if (viewportSize.isEmpty()) 306 if (viewportSize.isEmpty())
307 viewportSize = svg->currentViewportSize(); 307 viewportSize = svg->currentViewportSize();
308 308
309 width = viewportSize.width(); 309 width = viewportSize.width();
310 height = viewportSize.height(); 310 height = viewportSize.height();
311 return true; 311 return true;
312 } 312 }
313 313
314 } 314 }
OLDNEW
« no previous file with comments | « LayoutTests/svg/zoom/text/zoom-em-units-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698