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

Side by Side Diff: Source/core/svg/SVGNumber.cpp

Issue 208133002: [SVG] Remove "New" prefix from properties implementation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGNumber.h ('k') | Source/core/svg/SVGNumberList.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 19 matching lines...) Expand all
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/svg/SVGNumber.h" 32 #include "core/svg/SVGNumber.h"
33 33
34 #include "core/svg/SVGAnimationElement.h" 34 #include "core/svg/SVGAnimationElement.h"
35 #include "core/svg/SVGParserUtilities.h" 35 #include "core/svg/SVGParserUtilities.h"
36 36
37 namespace WebCore { 37 namespace WebCore {
38 38
39 SVGNumber::SVGNumber(float value) 39 SVGNumber::SVGNumber(float value)
40 : NewSVGPropertyBase(classType()) 40 : SVGPropertyBase(classType())
41 , m_value(value) 41 , m_value(value)
42 { 42 {
43 } 43 }
44 44
45 PassRefPtr<SVGNumber> SVGNumber::clone() const 45 PassRefPtr<SVGNumber> SVGNumber::clone() const
46 { 46 {
47 return create(m_value); 47 return create(m_value);
48 } 48 }
49 49
50 PassRefPtr<NewSVGPropertyBase> SVGNumber::cloneForAnimation(const String& value) const 50 PassRefPtr<SVGPropertyBase> SVGNumber::cloneForAnimation(const String& value) co nst
51 { 51 {
52 RefPtr<SVGNumber> svgNumber = create(); 52 RefPtr<SVGNumber> svgNumber = create();
53 svgNumber->setValueAsString(value, IGNORE_EXCEPTION); 53 svgNumber->setValueAsString(value, IGNORE_EXCEPTION);
54 return svgNumber.release(); 54 return svgNumber.release();
55 } 55 }
56 56
57 String SVGNumber::valueAsString() const 57 String SVGNumber::valueAsString() const
58 { 58 {
59 return String::number(m_value); 59 return String::number(m_value);
60 } 60 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 const UChar* end = ptr + string.length(); 92 const UChar* end = ptr + string.length();
93 valid = parse(ptr, end); 93 valid = parse(ptr, end);
94 } 94 }
95 95
96 if (!valid) { 96 if (!valid) {
97 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + string + "') is invalid."); 97 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + string + "') is invalid.");
98 m_value = 0; 98 m_value = 0;
99 } 99 }
100 } 100 }
101 101
102 void SVGNumber::add(PassRefPtr<NewSVGPropertyBase> other, SVGElement*) 102 void SVGNumber::add(PassRefPtr<SVGPropertyBase> other, SVGElement*)
103 { 103 {
104 setValue(m_value + toSVGNumber(other)->value()); 104 setValue(m_value + toSVGNumber(other)->value());
105 } 105 }
106 106
107 void SVGNumber::calculateAnimatedValue(SVGAnimationElement* animationElement, fl oat percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> from, PassR efPtr<NewSVGPropertyBase> to, PassRefPtr<NewSVGPropertyBase> toAtEndOfDuration, SVGElement*) 107 void SVGNumber::calculateAnimatedValue(SVGAnimationElement* animationElement, fl oat percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> from, PassRefP tr<SVGPropertyBase> to, PassRefPtr<SVGPropertyBase> toAtEndOfDuration, SVGElemen t*)
108 { 108 {
109 ASSERT(animationElement); 109 ASSERT(animationElement);
110 110
111 RefPtr<SVGNumber> fromNumber = toSVGNumber(from); 111 RefPtr<SVGNumber> fromNumber = toSVGNumber(from);
112 RefPtr<SVGNumber> toNumber = toSVGNumber(to); 112 RefPtr<SVGNumber> toNumber = toSVGNumber(to);
113 RefPtr<SVGNumber> toAtEndOfDurationNumber = toSVGNumber(toAtEndOfDuration); 113 RefPtr<SVGNumber> toAtEndOfDurationNumber = toSVGNumber(toAtEndOfDuration);
114 114
115 animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumber- >value(), toNumber->value(), toAtEndOfDurationNumber->value(), m_value); 115 animationElement->animateAdditiveNumber(percentage, repeatCount, fromNumber- >value(), toNumber->value(), toAtEndOfDurationNumber->value(), m_value);
116 } 116 }
117 117
118 float SVGNumber::calculateDistance(PassRefPtr<NewSVGPropertyBase> other, SVGElem ent*) 118 float SVGNumber::calculateDistance(PassRefPtr<SVGPropertyBase> other, SVGElement *)
119 { 119 {
120 return fabsf(m_value - toSVGNumber(other)->value()); 120 return fabsf(m_value - toSVGNumber(other)->value());
121 } 121 }
122 122
123 PassRefPtr<SVGNumber> SVGNumberAcceptPercentage::clone() const 123 PassRefPtr<SVGNumber> SVGNumberAcceptPercentage::clone() const
124 { 124 {
125 return create(m_value); 125 return create(m_value);
126 } 126 }
127 127
128 void SVGNumberAcceptPercentage::setValueAsString(const String& string, Exception State& exceptionState) 128 void SVGNumberAcceptPercentage::setValueAsString(const String& string, Exception State& exceptionState)
(...skipping 14 matching lines...) Expand all
143 143
144 SVGNumber::setValueAsString(string, exceptionState); 144 SVGNumber::setValueAsString(string, exceptionState);
145 } 145 }
146 146
147 SVGNumberAcceptPercentage::SVGNumberAcceptPercentage(float value) 147 SVGNumberAcceptPercentage::SVGNumberAcceptPercentage(float value)
148 : SVGNumber(value) 148 : SVGNumber(value)
149 { 149 {
150 } 150 }
151 151
152 } 152 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGNumber.h ('k') | Source/core/svg/SVGNumberList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698