1 /* 2 * Copyright (C) 2014 Google Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: 7 * 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above 11 * copyright notice, this list of conditions and the following disclaimer 12 * in the documentation and/or other materials provided with the 13 * distribution. 14 * * Neither the name of Google Inc. nor the names of its 15 * contributors may be used to endorse or promote products derived from 16 * this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_SVG_SVG_ANIMATED_NUMBER_H_ 32 #define THIRD_PARTY_BLINK_RENDERER_CORE_SVG_SVG_ANIMATED_NUMBER_H_ 33 34 #include "third_party/blink/renderer/core/svg/properties/svg_animated_property.h" 35 #include "third_party/blink/renderer/core/svg/svg_number_tear_off.h" 36 #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" 37 #include "third_party/blink/renderer/platform/heap/handle.h" 38 #include "third_party/blink/renderer/platform/heap/heap.h" 39 40 namespace blink { 41 42 class SVGAnimatedNumberOptionalNumber; 43 44 // SVG Spec: http://www.w3.org/TR/SVG11/types.html#InterfaceSVGAnimatedNumber 45 class SVGAnimatedNumber : public ScriptWrappable, 46 public SVGAnimatedProperty<SVGNumber> { 47 DEFINE_WRAPPERTYPEINFO(); 48 49 public: SVGAnimatedNumber(SVGElement * context_element,const QualifiedName & attribute_name,float initial_number)50 SVGAnimatedNumber(SVGElement* context_element, 51 const QualifiedName& attribute_name, 52 float initial_number) 53 : SVGAnimatedNumber(context_element, 54 attribute_name, 55 MakeGarbageCollected<SVGNumber>(initial_number)) {} 56 SVGAnimatedNumber(SVGElement * context_element,const QualifiedName & attribute_name,SVGNumber * initial_value)57 SVGAnimatedNumber(SVGElement* context_element, 58 const QualifiedName& attribute_name, 59 SVGNumber* initial_value) 60 : SVGAnimatedProperty<SVGNumber>( 61 context_element, 62 attribute_name, 63 initial_value, 64 CSSPropertyID::kInvalid, 65 static_cast<unsigned>(initial_value->Value())), 66 parent_number_optional_number_(nullptr) {} 67 68 void SynchronizeAttribute() override; 69 SetParentOptionalNumber(SVGAnimatedNumberOptionalNumber * number_optional_number)70 void SetParentOptionalNumber( 71 SVGAnimatedNumberOptionalNumber* number_optional_number) { 72 parent_number_optional_number_ = number_optional_number; 73 } 74 75 void Trace(Visitor*) const override; 76 77 protected: 78 Member<SVGAnimatedNumberOptionalNumber> parent_number_optional_number_; 79 }; 80 81 } // namespace blink 82 83 #endif // THIRD_PARTY_BLINK_RENDERER_CORE_SVG_SVG_ANIMATED_NUMBER_H_ 84