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

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

Issue 1720853002: Remove Image::computeIntrinsicDimensions() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-and-use-updateconcretesize-upload
Patch Set: Avoid using the size of the error image. Null-check in ImageResource saved the day in previous patc… 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) 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 } 394 }
395 395
396 FrameView* SVGImage::frameView() const 396 FrameView* SVGImage::frameView() const
397 { 397 {
398 if (!m_page) 398 if (!m_page)
399 return nullptr; 399 return nullptr;
400 400
401 return toLocalFrame(m_page->mainFrame())->view(); 401 return toLocalFrame(m_page->mainFrame())->view();
402 } 402 }
403 403
404 void SVGImage::computeIntrinsicDimensions(FloatSize& intrinsicSize, FloatSize& i ntrinsicRatio)
405 {
406 SVGSVGElement* rootElement = svgRootElement(m_page.get());
407 if (!rootElement)
408 return;
409
410 intrinsicSize = FloatSize(rootElement->intrinsicWidth(), rootElement->intrin sicHeight());
411 if (rootElement->preserveAspectRatio()->currentValue()->align() == SVGPreser veAspectRatio::SVG_PRESERVEASPECTRATIO_NONE)
412 return;
413
414 intrinsicRatio = rootElement->viewBox()->currentValue()->value().size();
415 if (intrinsicRatio.isEmpty())
416 intrinsicRatio = intrinsicSize;
417 }
418
419 // FIXME: support CatchUpAnimation = CatchUp. 404 // FIXME: support CatchUpAnimation = CatchUp.
420 void SVGImage::startAnimation(CatchUpAnimation) 405 void SVGImage::startAnimation(CatchUpAnimation)
421 { 406 {
422 SVGSVGElement* rootElement = svgRootElement(m_page.get()); 407 SVGSVGElement* rootElement = svgRootElement(m_page.get());
423 if (!rootElement || !rootElement->animationsPaused()) 408 if (!rootElement || !rootElement->animationsPaused())
424 return; 409 return;
425 rootElement->unpauseAnimations(); 410 rootElement->unpauseAnimations();
426 } 411 }
427 412
428 void SVGImage::stopAnimation() 413 void SVGImage::stopAnimation()
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 539
555 return m_page; 540 return m_page;
556 } 541 }
557 542
558 String SVGImage::filenameExtension() const 543 String SVGImage::filenameExtension() const
559 { 544 {
560 return "svg"; 545 return "svg";
561 } 546 }
562 547
563 } // namespace blink 548 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698