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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 22 matching lines...) Expand all
33 #include "core/html/parser/HTMLParserIdioms.h" 33 #include "core/html/parser/HTMLParserIdioms.h"
34 #include "core/svg/SVGAnimationElement.h" 34 #include "core/svg/SVGAnimationElement.h"
35 35
36 namespace blink { 36 namespace blink {
37 37
38 SVGInteger::SVGInteger(int value) 38 SVGInteger::SVGInteger(int value)
39 : m_value(value) 39 : m_value(value)
40 { 40 {
41 } 41 }
42 42
43 PassRefPtrWillBeRawPtr<SVGInteger> SVGInteger::clone() const 43 RawPtr<SVGInteger> SVGInteger::clone() const
44 { 44 {
45 return create(m_value); 45 return create(m_value);
46 } 46 }
47 47
48 String SVGInteger::valueAsString() const 48 String SVGInteger::valueAsString() const
49 { 49 {
50 return String::number(m_value); 50 return String::number(m_value);
51 } 51 }
52 52
53 SVGParsingError SVGInteger::setValueAsString(const String& string) 53 SVGParsingError SVGInteger::setValueAsString(const String& string)
54 { 54 {
55 m_value = 0; 55 m_value = 0;
56 56
57 if (string.isEmpty()) 57 if (string.isEmpty())
58 return SVGParseStatus::NoError; 58 return SVGParseStatus::NoError;
59 59
60 bool valid = true; 60 bool valid = true;
61 m_value = stripLeadingAndTrailingHTMLSpaces(string).toIntStrict(&valid); 61 m_value = stripLeadingAndTrailingHTMLSpaces(string).toIntStrict(&valid);
62 // toIntStrict returns 0 if valid == false. 62 // toIntStrict returns 0 if valid == false.
63 return valid ? SVGParseStatus::NoError : SVGParseStatus::ExpectedInteger; 63 return valid ? SVGParseStatus::NoError : SVGParseStatus::ExpectedInteger;
64 } 64 }
65 65
66 void SVGInteger::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement*) 66 void SVGInteger::add(RawPtr<SVGPropertyBase> other, SVGElement*)
67 { 67 {
68 setValue(m_value + toSVGInteger(other)->value()); 68 setValue(m_value + toSVGInteger(other)->value());
69 } 69 }
70 70
71 void SVGInteger::calculateAnimatedValue(SVGAnimationElement* animationElement, f loat percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> f rom, PassRefPtrWillBeRawPtr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGPrope rtyBase> toAtEndOfDuration, SVGElement*) 71 void SVGInteger::calculateAnimatedValue(SVGAnimationElement* animationElement, f loat percentage, unsigned repeatCount, RawPtr<SVGPropertyBase> from, RawPtr<SVGP ropertyBase> to, RawPtr<SVGPropertyBase> toAtEndOfDuration, SVGElement*)
72 { 72 {
73 ASSERT(animationElement); 73 ASSERT(animationElement);
74 74
75 RefPtrWillBeRawPtr<SVGInteger> fromInteger = toSVGInteger(from); 75 RawPtr<SVGInteger> fromInteger = toSVGInteger(from);
76 RefPtrWillBeRawPtr<SVGInteger> toInteger = toSVGInteger(to); 76 RawPtr<SVGInteger> toInteger = toSVGInteger(to);
77 RefPtrWillBeRawPtr<SVGInteger> toAtEndOfDurationInteger = toSVGInteger(toAtE ndOfDuration); 77 RawPtr<SVGInteger> toAtEndOfDurationInteger = toSVGInteger(toAtEndOfDuration );
78 78
79 float animatedFloat = m_value; 79 float animatedFloat = m_value;
80 animationElement->animateAdditiveNumber(percentage, repeatCount, fromInteger ->value(), toInteger->value(), toAtEndOfDurationInteger->value(), animatedFloat) ; 80 animationElement->animateAdditiveNumber(percentage, repeatCount, fromInteger ->value(), toInteger->value(), toAtEndOfDurationInteger->value(), animatedFloat) ;
81 m_value = static_cast<int>(roundf(animatedFloat)); 81 m_value = static_cast<int>(roundf(animatedFloat));
82 } 82 }
83 83
84 float SVGInteger::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> othe r, SVGElement*) 84 float SVGInteger::calculateDistance(RawPtr<SVGPropertyBase> other, SVGElement*)
85 { 85 {
86 return abs(m_value - toSVGInteger(other)->value()); 86 return abs(m_value - toSVGInteger(other)->value());
87 } 87 }
88 88
89 } // namespace blink 89 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGInteger.h ('k') | third_party/WebKit/Source/core/svg/SVGIntegerOptionalInteger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698