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

Side by Side Diff: Source/core/svg/SVGIntegerOptionalInteger.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/SVGIntegerOptionalInteger.h ('k') | Source/core/svg/SVGLength.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/SVGIntegerOptionalInteger.h" 32 #include "core/svg/SVGIntegerOptionalInteger.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 SVGIntegerOptionalInteger::SVGIntegerOptionalInteger(PassRefPtr<SVGInteger> firs tInteger, PassRefPtr<SVGInteger> secondInteger) 39 SVGIntegerOptionalInteger::SVGIntegerOptionalInteger(PassRefPtr<SVGInteger> firs tInteger, PassRefPtr<SVGInteger> secondInteger)
40 : NewSVGPropertyBase(classType()) 40 : SVGPropertyBase(classType())
41 , m_firstInteger(firstInteger) 41 , m_firstInteger(firstInteger)
42 , m_secondInteger(secondInteger) 42 , m_secondInteger(secondInteger)
43 { 43 {
44 } 44 }
45 45
46 PassRefPtr<SVGIntegerOptionalInteger> SVGIntegerOptionalInteger::clone() const 46 PassRefPtr<SVGIntegerOptionalInteger> SVGIntegerOptionalInteger::clone() const
47 { 47 {
48 return SVGIntegerOptionalInteger::create(m_firstInteger->clone(), m_secondIn teger->clone()); 48 return SVGIntegerOptionalInteger::create(m_firstInteger->clone(), m_secondIn teger->clone());
49 } 49 }
50 50
51 PassRefPtr<NewSVGPropertyBase> SVGIntegerOptionalInteger::cloneForAnimation(cons t String& value) const 51 PassRefPtr<SVGPropertyBase> SVGIntegerOptionalInteger::cloneForAnimation(const S tring& value) const
52 { 52 {
53 float floatX, floatY; 53 float floatX, floatY;
54 if (!parseNumberOptionalNumber(value, floatX, floatY)) { 54 if (!parseNumberOptionalNumber(value, floatX, floatY)) {
55 return SVGIntegerOptionalInteger::create(SVGInteger::create(0), SVGInteg er::create(0)); 55 return SVGIntegerOptionalInteger::create(SVGInteger::create(0), SVGInteg er::create(0));
56 } 56 }
57 57
58 int x = static_cast<int>(roundf(floatX)); 58 int x = static_cast<int>(roundf(floatX));
59 int y = static_cast<int>(roundf(floatY)); 59 int y = static_cast<int>(roundf(floatY));
60 60
61 return SVGIntegerOptionalInteger::create(SVGInteger::create(x), SVGInteger:: create(y)); 61 return SVGIntegerOptionalInteger::create(SVGInteger::create(x), SVGInteger:: create(y));
(...skipping 13 matching lines...) Expand all
75 float x, y; 75 float x, y;
76 if (!parseNumberOptionalNumber(value, x, y)) { 76 if (!parseNumberOptionalNumber(value, x, y)) {
77 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + value + "') is invalid."); 77 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + value + "') is invalid.");
78 x = y = 0; 78 x = y = 0;
79 } 79 }
80 80
81 m_firstInteger->setValue(x); 81 m_firstInteger->setValue(x);
82 m_secondInteger->setValue(y); 82 m_secondInteger->setValue(y);
83 } 83 }
84 84
85 void SVGIntegerOptionalInteger::add(PassRefPtr<NewSVGPropertyBase> other, SVGEle ment*) 85 void SVGIntegerOptionalInteger::add(PassRefPtr<SVGPropertyBase> other, SVGElemen t*)
86 { 86 {
87 RefPtr<SVGIntegerOptionalInteger> otherIntegerOptionalInteger = toSVGInteger OptionalInteger(other); 87 RefPtr<SVGIntegerOptionalInteger> otherIntegerOptionalInteger = toSVGInteger OptionalInteger(other);
88 88
89 m_firstInteger->setValue(m_firstInteger->value() + otherIntegerOptionalInteg er->m_firstInteger->value()); 89 m_firstInteger->setValue(m_firstInteger->value() + otherIntegerOptionalInteg er->m_firstInteger->value());
90 m_secondInteger->setValue(m_secondInteger->value() + otherIntegerOptionalInt eger->m_secondInteger->value()); 90 m_secondInteger->setValue(m_secondInteger->value() + otherIntegerOptionalInt eger->m_secondInteger->value());
91 } 91 }
92 92
93 void SVGIntegerOptionalInteger::calculateAnimatedValue(SVGAnimationElement* anim ationElement, float percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyB ase> from, PassRefPtr<NewSVGPropertyBase> to, PassRefPtr<NewSVGPropertyBase> toA tEndOfDuration, SVGElement*) 93 void SVGIntegerOptionalInteger::calculateAnimatedValue(SVGAnimationElement* anim ationElement, float percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase > from, PassRefPtr<SVGPropertyBase> to, PassRefPtr<SVGPropertyBase> toAtEndOfDur ation, SVGElement*)
94 { 94 {
95 ASSERT(animationElement); 95 ASSERT(animationElement);
96 96
97 RefPtr<SVGIntegerOptionalInteger> fromInteger = toSVGIntegerOptionalInteger( from); 97 RefPtr<SVGIntegerOptionalInteger> fromInteger = toSVGIntegerOptionalInteger( from);
98 RefPtr<SVGIntegerOptionalInteger> toInteger = toSVGIntegerOptionalInteger(to ); 98 RefPtr<SVGIntegerOptionalInteger> toInteger = toSVGIntegerOptionalInteger(to );
99 RefPtr<SVGIntegerOptionalInteger> toAtEndOfDurationInteger = toSVGIntegerOpt ionalInteger(toAtEndOfDuration); 99 RefPtr<SVGIntegerOptionalInteger> toAtEndOfDurationInteger = toSVGIntegerOpt ionalInteger(toAtEndOfDuration);
100 100
101 float x = m_firstInteger->value(); 101 float x = m_firstInteger->value();
102 float y = m_secondInteger->value(); 102 float y = m_secondInteger->value();
103 animationElement->animateAdditiveNumber(percentage, repeatCount, fromInteger ->firstInteger()->value(), toInteger->firstInteger()->value(), toAtEndOfDuration Integer->firstInteger()->value(), x); 103 animationElement->animateAdditiveNumber(percentage, repeatCount, fromInteger ->firstInteger()->value(), toInteger->firstInteger()->value(), toAtEndOfDuration Integer->firstInteger()->value(), x);
104 animationElement->animateAdditiveNumber(percentage, repeatCount, fromInteger ->secondInteger()->value(), toInteger->secondInteger()->value(), toAtEndOfDurati onInteger->secondInteger()->value(), y); 104 animationElement->animateAdditiveNumber(percentage, repeatCount, fromInteger ->secondInteger()->value(), toInteger->secondInteger()->value(), toAtEndOfDurati onInteger->secondInteger()->value(), y);
105 m_firstInteger->setValue(static_cast<int>(roundf(x))); 105 m_firstInteger->setValue(static_cast<int>(roundf(x)));
106 m_secondInteger->setValue(static_cast<int>(roundf(y))); 106 m_secondInteger->setValue(static_cast<int>(roundf(y)));
107 } 107 }
108 108
109 float SVGIntegerOptionalInteger::calculateDistance(PassRefPtr<NewSVGPropertyBase > other, SVGElement*) 109 float SVGIntegerOptionalInteger::calculateDistance(PassRefPtr<SVGPropertyBase> o ther, SVGElement*)
110 { 110 {
111 // FIXME: Distance calculation is not possible for SVGIntegerOptionalInteger right now. We need the distance for every single value. 111 // FIXME: Distance calculation is not possible for SVGIntegerOptionalInteger right now. We need the distance for every single value.
112 return -1; 112 return -1;
113 } 113 }
114 114
115 } 115 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGIntegerOptionalInteger.h ('k') | Source/core/svg/SVGLength.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698