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

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

Issue 2342913003: Replace narrowPrecisionToFloat with clampTo<float> (Closed)
Patch Set: Created 4 years, 3 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, 2008, 2010 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 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) 2014 Google, Inc. 5 * Copyright (C) 2014 Google, Inc.
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "core/svg/SVGDocumentExtensions.h" 44 #include "core/svg/SVGDocumentExtensions.h"
45 #include "core/svg/SVGNumberTearOff.h" 45 #include "core/svg/SVGNumberTearOff.h"
46 #include "core/svg/SVGPreserveAspectRatio.h" 46 #include "core/svg/SVGPreserveAspectRatio.h"
47 #include "core/svg/SVGRectTearOff.h" 47 #include "core/svg/SVGRectTearOff.h"
48 #include "core/svg/SVGTransform.h" 48 #include "core/svg/SVGTransform.h"
49 #include "core/svg/SVGTransformList.h" 49 #include "core/svg/SVGTransformList.h"
50 #include "core/svg/SVGTransformTearOff.h" 50 #include "core/svg/SVGTransformTearOff.h"
51 #include "core/svg/SVGViewElement.h" 51 #include "core/svg/SVGViewElement.h"
52 #include "core/svg/SVGViewSpec.h" 52 #include "core/svg/SVGViewSpec.h"
53 #include "core/svg/animation/SMILTimeContainer.h" 53 #include "core/svg/animation/SMILTimeContainer.h"
54 #include "platform/FloatConversion.h"
55 #include "platform/LengthFunctions.h" 54 #include "platform/LengthFunctions.h"
56 #include "platform/geometry/FloatRect.h" 55 #include "platform/geometry/FloatRect.h"
57 #include "platform/transforms/AffineTransform.h" 56 #include "platform/transforms/AffineTransform.h"
57 #include "wtf/MathExtras.h"
58 #include "wtf/StdLibExtras.h" 58 #include "wtf/StdLibExtras.h"
59 59
60 namespace blink { 60 namespace blink {
61 61
62 inline SVGSVGElement::SVGSVGElement(Document& doc) 62 inline SVGSVGElement::SVGSVGElement(Document& doc)
63 : SVGGraphicsElement(SVGNames::svgTag, doc) 63 : SVGGraphicsElement(SVGNames::svgTag, doc)
64 , SVGFitToViewBox(this) 64 , SVGFitToViewBox(this)
65 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(SVG LengthMode::Width))) 65 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(SVG LengthMode::Width)))
66 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(SVG LengthMode::Height))) 66 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(SVG LengthMode::Height)))
67 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr eate(SVGLengthMode::Width))) 67 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr eate(SVGLengthMode::Width)))
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 m_timeContainer->resume(); 535 m_timeContainer->resume();
536 } 536 }
537 537
538 bool SVGSVGElement::animationsPaused() const 538 bool SVGSVGElement::animationsPaused() const
539 { 539 {
540 return m_timeContainer->isPaused(); 540 return m_timeContainer->isPaused();
541 } 541 }
542 542
543 float SVGSVGElement::getCurrentTime() const 543 float SVGSVGElement::getCurrentTime() const
544 { 544 {
545 return narrowPrecisionToFloat(m_timeContainer->elapsed()); 545 return clampTo<float>(m_timeContainer->elapsed());
546 } 546 }
547 547
548 void SVGSVGElement::setCurrentTime(float seconds) 548 void SVGSVGElement::setCurrentTime(float seconds)
549 { 549 {
550 ASSERT(std::isfinite(seconds)); 550 ASSERT(std::isfinite(seconds));
551 seconds = max(seconds, 0.0f); 551 seconds = max(seconds, 0.0f);
552 m_timeContainer->setElapsed(seconds); 552 m_timeContainer->setElapsed(seconds);
553 } 553 }
554 554
555 bool SVGSVGElement::selfHasRelativeLengths() const 555 bool SVGSVGElement::selfHasRelativeLengths() const
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 visitor->trace(m_width); 755 visitor->trace(m_width);
756 visitor->trace(m_height); 756 visitor->trace(m_height);
757 visitor->trace(m_translation); 757 visitor->trace(m_translation);
758 visitor->trace(m_timeContainer); 758 visitor->trace(m_timeContainer);
759 visitor->trace(m_viewSpec); 759 visitor->trace(m_viewSpec);
760 SVGGraphicsElement::trace(visitor); 760 SVGGraphicsElement::trace(visitor);
761 SVGFitToViewBox::trace(visitor); 761 SVGFitToViewBox::trace(visitor);
762 } 762 }
763 763
764 } // namespace blink 764 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAnimationElement.cpp ('k') | third_party/WebKit/Source/core/svg/SVGTransform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698