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

Side by Side Diff: Source/core/svg/SVGAngle.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/SVGAngle.h ('k') | Source/core/svg/SVGAngleTearOff.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) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 SVGMarkerOrientEnumeration::~SVGMarkerOrientEnumeration() 52 SVGMarkerOrientEnumeration::~SVGMarkerOrientEnumeration()
53 { 53 {
54 } 54 }
55 55
56 void SVGMarkerOrientEnumeration::notifyChange() 56 void SVGMarkerOrientEnumeration::notifyChange()
57 { 57 {
58 ASSERT(m_angle); 58 ASSERT(m_angle);
59 m_angle->orientTypeChanged(); 59 m_angle->orientTypeChanged();
60 } 60 }
61 61
62 void SVGMarkerOrientEnumeration::add(PassRefPtr<NewSVGPropertyBase>, SVGElement* ) 62 void SVGMarkerOrientEnumeration::add(PassRefPtr<SVGPropertyBase>, SVGElement*)
63 { 63 {
64 // SVGMarkerOrientEnumeration is only animated via SVGAngle 64 // SVGMarkerOrientEnumeration is only animated via SVGAngle
65 ASSERT_NOT_REACHED(); 65 ASSERT_NOT_REACHED();
66 } 66 }
67 67
68 void SVGMarkerOrientEnumeration::calculateAnimatedValue(SVGAnimationElement*, fl oat percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> from, PassR efPtr<NewSVGPropertyBase> to, PassRefPtr<NewSVGPropertyBase> toAtEndOfDurationVa lue, SVGElement* contextElement) 68 void SVGMarkerOrientEnumeration::calculateAnimatedValue(SVGAnimationElement*, fl oat percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> from, PassRefP tr<SVGPropertyBase> to, PassRefPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGE lement* contextElement)
69 { 69 {
70 // SVGMarkerOrientEnumeration is only animated via SVGAngle 70 // SVGMarkerOrientEnumeration is only animated via SVGAngle
71 ASSERT_NOT_REACHED(); 71 ASSERT_NOT_REACHED();
72 } 72 }
73 73
74 float SVGMarkerOrientEnumeration::calculateDistance(PassRefPtr<NewSVGPropertyBas e> to, SVGElement* contextElement) 74 float SVGMarkerOrientEnumeration::calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElement* contextElement)
75 { 75 {
76 // SVGMarkerOrientEnumeration is only animated via SVGAngle 76 // SVGMarkerOrientEnumeration is only animated via SVGAngle
77 ASSERT_NOT_REACHED(); 77 ASSERT_NOT_REACHED();
78 return -1.0; 78 return -1.0;
79 } 79 }
80 80
81 SVGAngle::SVGAngle() 81 SVGAngle::SVGAngle()
82 : NewSVGPropertyBase(classType()) 82 : SVGPropertyBase(classType())
83 , m_unitType(SVG_ANGLETYPE_UNSPECIFIED) 83 , m_unitType(SVG_ANGLETYPE_UNSPECIFIED)
84 , m_valueInSpecifiedUnits(0) 84 , m_valueInSpecifiedUnits(0)
85 , m_orientType(SVGMarkerOrientEnumeration::create(this)) 85 , m_orientType(SVGMarkerOrientEnumeration::create(this))
86 { 86 {
87 } 87 }
88 88
89 SVGAngle::SVGAngle(SVGAngleType unitType, float valueInSpecifiedUnits, SVGMarker OrientType orientType) 89 SVGAngle::SVGAngle(SVGAngleType unitType, float valueInSpecifiedUnits, SVGMarker OrientType orientType)
90 : NewSVGPropertyBase(classType()) 90 : SVGPropertyBase(classType())
91 , m_unitType(unitType) 91 , m_unitType(unitType)
92 , m_valueInSpecifiedUnits(valueInSpecifiedUnits) 92 , m_valueInSpecifiedUnits(valueInSpecifiedUnits)
93 , m_orientType(SVGMarkerOrientEnumeration::create(this)) 93 , m_orientType(SVGMarkerOrientEnumeration::create(this))
94 { 94 {
95 m_orientType->setEnumValue(orientType); 95 m_orientType->setEnumValue(orientType);
96 } 96 }
97 97
98 SVGAngle::~SVGAngle() 98 SVGAngle::~SVGAngle()
99 { 99 {
100 } 100 }
101 101
102 PassRefPtr<SVGAngle> SVGAngle::clone() const 102 PassRefPtr<SVGAngle> SVGAngle::clone() const
103 { 103 {
104 return adoptRef(new SVGAngle(m_unitType, m_valueInSpecifiedUnits, m_orientTy pe->enumValue())); 104 return adoptRef(new SVGAngle(m_unitType, m_valueInSpecifiedUnits, m_orientTy pe->enumValue()));
105 } 105 }
106 106
107 PassRefPtr<NewSVGPropertyBase> SVGAngle::cloneForAnimation(const String& value) const 107 PassRefPtr<SVGPropertyBase> SVGAngle::cloneForAnimation(const String& value) con st
108 { 108 {
109 RefPtr<SVGAngle> point = create(); 109 RefPtr<SVGAngle> point = create();
110 point->setValueAsString(value, IGNORE_EXCEPTION); 110 point->setValueAsString(value, IGNORE_EXCEPTION);
111 return point.release(); 111 return point.release();
112 } 112 }
113 113
114 float SVGAngle::value() const 114 float SVGAngle::value() const
115 { 115 {
116 switch (m_unitType) { 116 switch (m_unitType) {
117 case SVG_ANGLETYPE_GRAD: 117 case SVG_ANGLETYPE_GRAD:
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 break; 322 break;
323 case SVG_ANGLETYPE_UNKNOWN: 323 case SVG_ANGLETYPE_UNKNOWN:
324 ASSERT_NOT_REACHED(); 324 ASSERT_NOT_REACHED();
325 break; 325 break;
326 } 326 }
327 327
328 m_unitType = unitType; 328 m_unitType = unitType;
329 m_orientType->setEnumValue(SVGMarkerOrientAngle); 329 m_orientType->setEnumValue(SVGMarkerOrientAngle);
330 } 330 }
331 331
332 void SVGAngle::add(PassRefPtr<NewSVGPropertyBase> other, SVGElement*) 332 void SVGAngle::add(PassRefPtr<SVGPropertyBase> other, SVGElement*)
333 { 333 {
334 RefPtr<SVGAngle> otherAngle = toSVGAngle(other); 334 RefPtr<SVGAngle> otherAngle = toSVGAngle(other);
335 335
336 // Only respect by animations, if from and by are both specified in angles ( and not eg. 'auto'). 336 // Only respect by animations, if from and by are both specified in angles ( and not eg. 'auto').
337 if (orientType()->enumValue() != SVGMarkerOrientAngle || otherAngle->orientT ype()->enumValue() != SVGMarkerOrientAngle) 337 if (orientType()->enumValue() != SVGMarkerOrientAngle || otherAngle->orientT ype()->enumValue() != SVGMarkerOrientAngle)
338 return; 338 return;
339 339
340 setValue(value() + otherAngle->value()); 340 setValue(value() + otherAngle->value());
341 } 341 }
342 342
343 void SVGAngle::calculateAnimatedValue(SVGAnimationElement* animationElement, flo at percentage, unsigned repeatCount, PassRefPtr<NewSVGPropertyBase> from, PassRe fPtr<NewSVGPropertyBase> to, PassRefPtr<NewSVGPropertyBase> toAtEndOfDuration, S VGElement*) 343 void SVGAngle::calculateAnimatedValue(SVGAnimationElement* animationElement, flo at percentage, unsigned repeatCount, PassRefPtr<SVGPropertyBase> from, PassRefPt r<SVGPropertyBase> to, PassRefPtr<SVGPropertyBase> toAtEndOfDuration, SVGElement *)
344 { 344 {
345 ASSERT(animationElement); 345 ASSERT(animationElement);
346 bool isToAnimation = animationElement->animationMode() == ToAnimation; 346 bool isToAnimation = animationElement->animationMode() == ToAnimation;
347 347
348 RefPtr<SVGAngle> fromAngle = isToAnimation ? this : toSVGAngle(from); 348 RefPtr<SVGAngle> fromAngle = isToAnimation ? this : toSVGAngle(from);
349 RefPtr<SVGAngle> toAngle = toSVGAngle(to); 349 RefPtr<SVGAngle> toAngle = toSVGAngle(to);
350 RefPtr<SVGAngle> toAtEndOfDurationAngle = toSVGAngle(toAtEndOfDuration); 350 RefPtr<SVGAngle> toAtEndOfDurationAngle = toSVGAngle(toAtEndOfDuration);
351 351
352 SVGMarkerOrientType fromOrientType = fromAngle->orientType()->enumValue(); 352 SVGMarkerOrientType fromOrientType = fromAngle->orientType()->enumValue();
353 SVGMarkerOrientType toOrientType = toAngle->orientType()->enumValue(); 353 SVGMarkerOrientType toOrientType = toAngle->orientType()->enumValue();
(...skipping 30 matching lines...) Expand all
384 return; 384 return;
385 } 385 }
386 386
387 // Regular from angle to angle animation, with all features like additive et c. 387 // Regular from angle to angle animation, with all features like additive et c.
388 float animatedValue = value(); 388 float animatedValue = value();
389 animationElement->animateAdditiveNumber(percentage, repeatCount, fromAngle-> value(), toAngle->value(), toAtEndOfDurationAngle->value(), animatedValue); 389 animationElement->animateAdditiveNumber(percentage, repeatCount, fromAngle-> value(), toAngle->value(), toAtEndOfDurationAngle->value(), animatedValue);
390 orientType()->setEnumValue(SVGMarkerOrientAngle); 390 orientType()->setEnumValue(SVGMarkerOrientAngle);
391 setValue(animatedValue); 391 setValue(animatedValue);
392 } 392 }
393 393
394 float SVGAngle::calculateDistance(PassRefPtr<NewSVGPropertyBase> other, SVGEleme nt*) 394 float SVGAngle::calculateDistance(PassRefPtr<SVGPropertyBase> other, SVGElement* )
395 { 395 {
396 return fabsf(value() - toSVGAngle(other)->value()); 396 return fabsf(value() - toSVGAngle(other)->value());
397 } 397 }
398 398
399 void SVGAngle::orientTypeChanged() 399 void SVGAngle::orientTypeChanged()
400 { 400 {
401 if (orientType()->enumValue() == SVGMarkerOrientAuto) { 401 if (orientType()->enumValue() == SVGMarkerOrientAuto) {
402 m_unitType = SVG_ANGLETYPE_UNSPECIFIED; 402 m_unitType = SVG_ANGLETYPE_UNSPECIFIED;
403 m_valueInSpecifiedUnits = 0; 403 m_valueInSpecifiedUnits = 0;
404 } 404 }
405 } 405 }
406 406
407 } 407 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGAngle.h ('k') | Source/core/svg/SVGAngleTearOff.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698