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

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

Issue 1685353004: Clean up Image::computeIntrinsicDimensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
4 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2011. 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 339 }
340 340
341 FrameView* SVGImage::frameView() const 341 FrameView* SVGImage::frameView() const
342 { 342 {
343 if (!m_page) 343 if (!m_page)
344 return nullptr; 344 return nullptr;
345 345
346 return toLocalFrame(m_page->mainFrame())->view(); 346 return toLocalFrame(m_page->mainFrame())->view();
347 } 347 }
348 348
349 void SVGImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrin sicHeight, FloatSize& intrinsicRatio) 349 void SVGImage::computeIntrinsicDimensions(FloatSize& intrinsicSize, FloatSize& i ntrinsicRatio)
350 { 350 {
351 SVGSVGElement* rootElement = svgRootElement(m_page.get()); 351 SVGSVGElement* rootElement = svgRootElement(m_page.get());
352 if (!rootElement) 352 if (!rootElement)
353 return; 353 return;
354 354
355 intrinsicWidth = rootElement->intrinsicWidth(); 355 intrinsicSize = FloatSize(rootElement->intrinsicWidth(), rootElement->intrin sicHeight());
356 intrinsicHeight = rootElement->intrinsicHeight();
357 if (rootElement->preserveAspectRatio()->currentValue()->align() == SVGPreser veAspectRatio::SVG_PRESERVEASPECTRATIO_NONE) 356 if (rootElement->preserveAspectRatio()->currentValue()->align() == SVGPreser veAspectRatio::SVG_PRESERVEASPECTRATIO_NONE)
358 return; 357 return;
359 358
360 intrinsicRatio = rootElement->viewBox()->currentValue()->value().size(); 359 intrinsicRatio = rootElement->viewBox()->currentValue()->value().size();
361 if (intrinsicRatio.isEmpty() && intrinsicWidth.isFixed() && intrinsicHeight. isFixed()) 360 if (intrinsicRatio.isEmpty())
362 intrinsicRatio = FloatSize(floatValueForLength(intrinsicWidth, 0), float ValueForLength(intrinsicHeight, 0)); 361 intrinsicRatio = intrinsicSize;
363 } 362 }
364 363
365 // FIXME: support CatchUpAnimation = CatchUp. 364 // FIXME: support CatchUpAnimation = CatchUp.
366 void SVGImage::startAnimation(CatchUpAnimation) 365 void SVGImage::startAnimation(CatchUpAnimation)
367 { 366 {
368 SVGSVGElement* rootElement = svgRootElement(m_page.get()); 367 SVGSVGElement* rootElement = svgRootElement(m_page.get());
369 if (!rootElement || !rootElement->animationsPaused()) 368 if (!rootElement || !rootElement->animationsPaused())
370 return; 369 return;
371 rootElement->unpauseAnimations(); 370 rootElement->unpauseAnimations();
372 } 371 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 499
501 return m_page; 500 return m_page;
502 } 501 }
503 502
504 String SVGImage::filenameExtension() const 503 String SVGImage::filenameExtension() const
505 { 504 {
506 return "svg"; 505 return "svg";
507 } 506 }
508 507
509 } // namespace blink 508 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698