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

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

Issue 1774943003: blink: Rename platform/ methods to prefix with get when they collide. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clash-platform: rebase-yayyyyyyyy Created 4 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
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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 ASSERT_NOT_REACHED(); 342 ASSERT_NOT_REACHED();
343 return 0; 343 return 0;
344 } 344 }
345 345
346 float SVGLengthContext::convertValueFromUserUnitsToCHS(float value) const 346 float SVGLengthContext::convertValueFromUserUnitsToCHS(float value) const
347 { 347 {
348 const ComputedStyle* style = computedStyleForLengthResolving(m_context); 348 const ComputedStyle* style = computedStyleForLengthResolving(m_context);
349 if (!style) 349 if (!style)
350 return 0; 350 return 0;
351 351
352 float zeroWidth = style->fontMetrics().zeroWidth() / style->effectiveZoom(); 352 float zeroWidth = style->getFontMetrics().zeroWidth() / style->effectiveZoom ();
353 if (!zeroWidth) 353 if (!zeroWidth)
354 return 0; 354 return 0;
355 355
356 return value / zeroWidth; 356 return value / zeroWidth;
357 } 357 }
358 358
359 float SVGLengthContext::convertValueFromCHSToUserUnits(float value) const 359 float SVGLengthContext::convertValueFromCHSToUserUnits(float value) const
360 { 360 {
361 const ComputedStyle* style = computedStyleForLengthResolving(m_context); 361 const ComputedStyle* style = computedStyleForLengthResolving(m_context);
362 if (!style) 362 if (!style)
363 return 0; 363 return 0;
364 364
365 return value * style->fontMetrics().zeroWidth() / style->effectiveZoom(); 365 return value * style->getFontMetrics().zeroWidth() / style->effectiveZoom();
366 } 366 }
367 367
368 float SVGLengthContext::convertValueFromUserUnitsToEXS(float value) const 368 float SVGLengthContext::convertValueFromUserUnitsToEXS(float value) const
369 { 369 {
370 const ComputedStyle* style = computedStyleForLengthResolving(m_context); 370 const ComputedStyle* style = computedStyleForLengthResolving(m_context);
371 if (!style) 371 if (!style)
372 return 0; 372 return 0;
373 373
374 // Use of ceil allows a pixel match to the W3Cs expected output of coords-un its-03-b.svg 374 // Use of ceil allows a pixel match to the W3Cs expected output of coords-un its-03-b.svg
375 // if this causes problems in real world cases maybe it would be best to rem ove this 375 // if this causes problems in real world cases maybe it would be best to rem ove this
376 float xHeight = ceilf(style->fontMetrics().xHeight() / style->effectiveZoom( )); 376 float xHeight = ceilf(style->getFontMetrics().xHeight() / style->effectiveZo om());
377 if (!xHeight) 377 if (!xHeight)
378 return 0; 378 return 0;
379 379
380 return value / xHeight; 380 return value / xHeight;
381 } 381 }
382 382
383 float SVGLengthContext::convertValueFromEXSToUserUnits(float value) const 383 float SVGLengthContext::convertValueFromEXSToUserUnits(float value) const
384 { 384 {
385 const ComputedStyle* style = computedStyleForLengthResolving(m_context); 385 const ComputedStyle* style = computedStyleForLengthResolving(m_context);
386 if (!style) 386 if (!style)
387 return 0; 387 return 0;
388 388
389 // Use of ceil allows a pixel match to the W3Cs expected output of coords-un its-03-b.svg 389 // Use of ceil allows a pixel match to the W3Cs expected output of coords-un its-03-b.svg
390 // if this causes problems in real world cases maybe it would be best to rem ove this 390 // if this causes problems in real world cases maybe it would be best to rem ove this
391 return value * ceilf(style->fontMetrics().xHeight() / style->effectiveZoom() ); 391 return value * ceilf(style->getFontMetrics().xHeight() / style->effectiveZoo m());
392 } 392 }
393 393
394 bool SVGLengthContext::determineViewport(FloatSize& viewportSize) const 394 bool SVGLengthContext::determineViewport(FloatSize& viewportSize) const
395 { 395 {
396 if (!m_context) 396 if (!m_context)
397 return false; 397 return false;
398 398
399 // Root <svg> element lengths are resolved against the top level viewport. 399 // Root <svg> element lengths are resolved against the top level viewport.
400 if (m_context->isOutermostSVGSVGElement()) { 400 if (m_context->isOutermostSVGSVGElement()) {
401 viewportSize = toSVGSVGElement(m_context)->currentViewportSize(); 401 viewportSize = toSVGSVGElement(m_context)->currentViewportSize();
402 return true; 402 return true;
403 } 403 }
404 404
405 // Take size from nearest viewport element. 405 // Take size from nearest viewport element.
406 SVGElement* viewportElement = m_context->viewportElement(); 406 SVGElement* viewportElement = m_context->viewportElement();
407 if (!isSVGSVGElement(viewportElement)) 407 if (!isSVGSVGElement(viewportElement))
408 return false; 408 return false;
409 409
410 const SVGSVGElement& svg = toSVGSVGElement(*viewportElement); 410 const SVGSVGElement& svg = toSVGSVGElement(*viewportElement);
411 viewportSize = svg.currentViewBoxRect().size(); 411 viewportSize = svg.currentViewBoxRect().size();
412 if (viewportSize.isEmpty()) 412 if (viewportSize.isEmpty())
413 viewportSize = svg.currentViewportSize(); 413 viewportSize = svg.currentViewportSize();
414 414
415 return true; 415 return true;
416 } 416 }
417 417
418 } // namespace blink 418 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGImageElement.cpp ('k') | third_party/WebKit/Source/core/svg/graphics/SVGImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698