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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGAngle.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) 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 visitor->trace(m_angle); 59 visitor->trace(m_angle);
60 SVGEnumeration<SVGMarkerOrientType>::trace(visitor); 60 SVGEnumeration<SVGMarkerOrientType>::trace(visitor);
61 } 61 }
62 62
63 void SVGMarkerOrientEnumeration::notifyChange() 63 void SVGMarkerOrientEnumeration::notifyChange()
64 { 64 {
65 ASSERT(m_angle); 65 ASSERT(m_angle);
66 m_angle->orientTypeChanged(); 66 m_angle->orientTypeChanged();
67 } 67 }
68 68
69 void SVGMarkerOrientEnumeration::add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SV GElement*) 69 void SVGMarkerOrientEnumeration::add(RawPtr<SVGPropertyBase>, SVGElement*)
70 { 70 {
71 // SVGMarkerOrientEnumeration is only animated via SVGAngle 71 // SVGMarkerOrientEnumeration is only animated via SVGAngle
72 ASSERT_NOT_REACHED(); 72 ASSERT_NOT_REACHED();
73 } 73 }
74 74
75 void SVGMarkerOrientEnumeration::calculateAnimatedValue(SVGAnimationElement*, fl oat percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> fr om, PassRefPtrWillBeRawPtr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGProper tyBase> toAtEndOfDurationValue, SVGElement* contextElement) 75 void SVGMarkerOrientEnumeration::calculateAnimatedValue(SVGAnimationElement*, fl oat percentage, unsigned repeatCount, RawPtr<SVGPropertyBase> from, RawPtr<SVGPr opertyBase> to, RawPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement* cont extElement)
76 { 76 {
77 // SVGMarkerOrientEnumeration is only animated via SVGAngle 77 // SVGMarkerOrientEnumeration is only animated via SVGAngle
78 ASSERT_NOT_REACHED(); 78 ASSERT_NOT_REACHED();
79 } 79 }
80 80
81 float SVGMarkerOrientEnumeration::calculateDistance(PassRefPtrWillBeRawPtr<SVGPr opertyBase> to, SVGElement* contextElement) 81 float SVGMarkerOrientEnumeration::calculateDistance(RawPtr<SVGPropertyBase> to, SVGElement* contextElement)
82 { 82 {
83 // SVGMarkerOrientEnumeration is only animated via SVGAngle 83 // SVGMarkerOrientEnumeration is only animated via SVGAngle
84 ASSERT_NOT_REACHED(); 84 ASSERT_NOT_REACHED();
85 return -1.0; 85 return -1.0;
86 } 86 }
87 87
88 SVGAngle::SVGAngle() 88 SVGAngle::SVGAngle()
89 : m_unitType(SVG_ANGLETYPE_UNSPECIFIED) 89 : m_unitType(SVG_ANGLETYPE_UNSPECIFIED)
90 , m_valueInSpecifiedUnits(0) 90 , m_valueInSpecifiedUnits(0)
91 , m_orientType(SVGMarkerOrientEnumeration::create(this)) 91 , m_orientType(SVGMarkerOrientEnumeration::create(this))
(...skipping 11 matching lines...) Expand all
103 SVGAngle::~SVGAngle() 103 SVGAngle::~SVGAngle()
104 { 104 {
105 } 105 }
106 106
107 DEFINE_TRACE(SVGAngle) 107 DEFINE_TRACE(SVGAngle)
108 { 108 {
109 visitor->trace(m_orientType); 109 visitor->trace(m_orientType);
110 SVGPropertyHelper<SVGAngle>::trace(visitor); 110 SVGPropertyHelper<SVGAngle>::trace(visitor);
111 } 111 }
112 112
113 PassRefPtrWillBeRawPtr<SVGAngle> SVGAngle::clone() const 113 RawPtr<SVGAngle> SVGAngle::clone() const
114 { 114 {
115 return adoptRefWillBeNoop(new SVGAngle(m_unitType, m_valueInSpecifiedUnits, m_orientType->enumValue())); 115 return new SVGAngle(m_unitType, m_valueInSpecifiedUnits, m_orientType->enumV alue());
116 } 116 }
117 117
118 float SVGAngle::value() const 118 float SVGAngle::value() const
119 { 119 {
120 switch (m_unitType) { 120 switch (m_unitType) {
121 case SVG_ANGLETYPE_GRAD: 121 case SVG_ANGLETYPE_GRAD:
122 return grad2deg(m_valueInSpecifiedUnits); 122 return grad2deg(m_valueInSpecifiedUnits);
123 case SVG_ANGLETYPE_RAD: 123 case SVG_ANGLETYPE_RAD:
124 return rad2deg(m_valueInSpecifiedUnits); 124 return rad2deg(m_valueInSpecifiedUnits);
125 case SVG_ANGLETYPE_TURN: 125 case SVG_ANGLETYPE_TURN:
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 break; 359 break;
360 case SVG_ANGLETYPE_UNKNOWN: 360 case SVG_ANGLETYPE_UNKNOWN:
361 ASSERT_NOT_REACHED(); 361 ASSERT_NOT_REACHED();
362 break; 362 break;
363 } 363 }
364 364
365 m_unitType = unitType; 365 m_unitType = unitType;
366 m_orientType->setEnumValue(SVGMarkerOrientAngle); 366 m_orientType->setEnumValue(SVGMarkerOrientAngle);
367 } 367 }
368 368
369 void SVGAngle::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement*) 369 void SVGAngle::add(RawPtr<SVGPropertyBase> other, SVGElement*)
370 { 370 {
371 RefPtrWillBeRawPtr<SVGAngle> otherAngle = toSVGAngle(other); 371 RawPtr<SVGAngle> otherAngle = toSVGAngle(other);
372 372
373 // Only respect by animations, if from and by are both specified in angles ( and not eg. 'auto'). 373 // Only respect by animations, if from and by are both specified in angles ( and not eg. 'auto').
374 if (orientType()->enumValue() != SVGMarkerOrientAngle || otherAngle->orientT ype()->enumValue() != SVGMarkerOrientAngle) 374 if (orientType()->enumValue() != SVGMarkerOrientAngle || otherAngle->orientT ype()->enumValue() != SVGMarkerOrientAngle)
375 return; 375 return;
376 376
377 setValue(value() + otherAngle->value()); 377 setValue(value() + otherAngle->value());
378 } 378 }
379 379
380 void SVGAngle::assign(const SVGAngle& other) 380 void SVGAngle::assign(const SVGAngle& other)
381 { 381 {
382 SVGMarkerOrientType otherOrientType = other.orientType()->enumValue(); 382 SVGMarkerOrientType otherOrientType = other.orientType()->enumValue();
383 if (otherOrientType == SVGMarkerOrientAngle) 383 if (otherOrientType == SVGMarkerOrientAngle)
384 newValueSpecifiedUnits(other.unitType(), other.valueInSpecifiedUnits()); 384 newValueSpecifiedUnits(other.unitType(), other.valueInSpecifiedUnits());
385 else 385 else
386 m_orientType->setEnumValue(otherOrientType); 386 m_orientType->setEnumValue(otherOrientType);
387 } 387 }
388 388
389 void SVGAngle::calculateAnimatedValue(SVGAnimationElement* animationElement, flo at percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> fro m, PassRefPtrWillBeRawPtr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGPropert yBase> toAtEndOfDuration, SVGElement*) 389 void SVGAngle::calculateAnimatedValue(SVGAnimationElement* animationElement, flo at percentage, unsigned repeatCount, RawPtr<SVGPropertyBase> from, RawPtr<SVGPro pertyBase> to, RawPtr<SVGPropertyBase> toAtEndOfDuration, SVGElement*)
390 { 390 {
391 ASSERT(animationElement); 391 ASSERT(animationElement);
392 bool isToAnimation = animationElement->getAnimationMode() == ToAnimation; 392 bool isToAnimation = animationElement->getAnimationMode() == ToAnimation;
393 393
394 RefPtrWillBeRawPtr<SVGAngle> fromAngle = isToAnimation ? PassRefPtrWillBeRaw Ptr<SVGAngle>(this) : toSVGAngle(from); 394 RawPtr<SVGAngle> fromAngle = isToAnimation ? RawPtr<SVGAngle>(this) : toSVGA ngle(from);
395 RefPtrWillBeRawPtr<SVGAngle> toAngle = toSVGAngle(to); 395 RawPtr<SVGAngle> toAngle = toSVGAngle(to);
396 SVGMarkerOrientType fromOrientType = fromAngle->orientType()->enumValue(); 396 SVGMarkerOrientType fromOrientType = fromAngle->orientType()->enumValue();
397 SVGMarkerOrientType toOrientType = toAngle->orientType()->enumValue(); 397 SVGMarkerOrientType toOrientType = toAngle->orientType()->enumValue();
398 398
399 if (fromOrientType != toOrientType) { 399 if (fromOrientType != toOrientType) {
400 // Fall back to discrete animation. 400 // Fall back to discrete animation.
401 assign(percentage < 0.5f ? *fromAngle : *toAngle); 401 assign(percentage < 0.5f ? *fromAngle : *toAngle);
402 return; 402 return;
403 } 403 }
404 404
405 switch (fromOrientType) { 405 switch (fromOrientType) {
406 // From 'auto' to 'auto', or 'auto-start-reverse' to 'auto-start-reverse' 406 // From 'auto' to 'auto', or 'auto-start-reverse' to 'auto-start-reverse'
407 case SVGMarkerOrientAuto: 407 case SVGMarkerOrientAuto:
408 case SVGMarkerOrientAutoStartReverse: 408 case SVGMarkerOrientAutoStartReverse:
409 orientType()->setEnumValue(fromOrientType); 409 orientType()->setEnumValue(fromOrientType);
410 return; 410 return;
411 411
412 // Regular from angle to angle animation, with all features like additive et c. 412 // Regular from angle to angle animation, with all features like additive et c.
413 case SVGMarkerOrientAngle: 413 case SVGMarkerOrientAngle:
414 { 414 {
415 float animatedValue = value(); 415 float animatedValue = value();
416 RefPtrWillBeRawPtr<SVGAngle> toAtEndOfDurationAngle = toSVGAngle(toA tEndOfDuration); 416 RawPtr<SVGAngle> toAtEndOfDurationAngle = toSVGAngle(toAtEndOfDurati on);
417 417
418 animationElement->animateAdditiveNumber(percentage, repeatCount, fro mAngle->value(), toAngle->value(), toAtEndOfDurationAngle->value(), animatedValu e); 418 animationElement->animateAdditiveNumber(percentage, repeatCount, fro mAngle->value(), toAngle->value(), toAtEndOfDurationAngle->value(), animatedValu e);
419 orientType()->setEnumValue(SVGMarkerOrientAngle); 419 orientType()->setEnumValue(SVGMarkerOrientAngle);
420 setValue(animatedValue); 420 setValue(animatedValue);
421 } 421 }
422 return; 422 return;
423 423
424 // If the enumeration value is not angle or auto, its unknown. 424 // If the enumeration value is not angle or auto, its unknown.
425 default: 425 default:
426 m_valueInSpecifiedUnits = 0; 426 m_valueInSpecifiedUnits = 0;
427 orientType()->setEnumValue(SVGMarkerOrientUnknown); 427 orientType()->setEnumValue(SVGMarkerOrientUnknown);
428 return; 428 return;
429 } 429 }
430 } 430 }
431 431
432 float SVGAngle::calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement*) 432 float SVGAngle::calculateDistance(RawPtr<SVGPropertyBase> other, SVGElement*)
433 { 433 {
434 return fabsf(value() - toSVGAngle(other)->value()); 434 return fabsf(value() - toSVGAngle(other)->value());
435 } 435 }
436 436
437 void SVGAngle::orientTypeChanged() 437 void SVGAngle::orientTypeChanged()
438 { 438 {
439 if (orientType()->enumValue() == SVGMarkerOrientAuto || orientType()->enumVa lue() == SVGMarkerOrientAutoStartReverse) { 439 if (orientType()->enumValue() == SVGMarkerOrientAuto || orientType()->enumVa lue() == SVGMarkerOrientAutoStartReverse) {
440 m_unitType = SVG_ANGLETYPE_UNSPECIFIED; 440 m_unitType = SVG_ANGLETYPE_UNSPECIFIED;
441 m_valueInSpecifiedUnits = 0; 441 m_valueInSpecifiedUnits = 0;
442 } 442 }
443 } 443 }
444 444
445 } // namespace blink 445 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAngle.h ('k') | third_party/WebKit/Source/core/svg/SVGAngle.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698