1d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)/* 2d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * Copyright (C) 2014 Google Inc. All rights reserved. 3d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * 4d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without 5d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * modification, are permitted provided that the following conditions are 6d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * met: 7d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * 8d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * * Redistributions of source code must retain the above copyright 9d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * notice, this list of conditions and the following disclaimer. 10d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * * Redistributions in binary form must reproduce the above 11d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * copyright notice, this list of conditions and the following disclaimer 12d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * in the documentation and/or other materials provided with the 13d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * distribution. 14d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * * Neither the name of Google Inc. nor the names of its 15d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * contributors may be used to endorse or promote products derived from 16d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * this software without specific prior written permission. 17d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * 18d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) */ 30d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 31d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)#ifndef SVGAngleTearOff_h 32d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)#define SVGAngleTearOff_h 33d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 34197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#include "bindings/core/v8/ScriptWrappable.h" 35d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)#include "core/svg/SVGAngle.h" 3607a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch#include "core/svg/properties/SVGPropertyTearOff.h" 37d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 38c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink { 39d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 4007a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdochclass SVGAngleTearOff FINAL : public SVGPropertyTearOff<SVGAngle>, public ScriptWrappable { 417242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci DEFINE_WRAPPERTYPEINFO(); 42d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)public: 435d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles) static PassRefPtr<SVGAngleTearOff> create(PassRefPtr<SVGAngle> target, SVGElement* contextElement, PropertyIsAnimValType propertyIsAnimVal, const QualifiedName& attributeName = QualifiedName::null()) 44d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) { 45d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) return adoptRef(new SVGAngleTearOff(target, contextElement, propertyIsAnimVal, attributeName)); 46d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) } 47d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 48d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) enum { 49d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) SVG_ANGLETYPE_UNKNOWN = SVGAngle::SVG_ANGLETYPE_UNKNOWN, 50d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) SVG_ANGLETYPE_UNSPECIFIED = SVGAngle::SVG_ANGLETYPE_UNSPECIFIED, 51d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) SVG_ANGLETYPE_DEG = SVGAngle::SVG_ANGLETYPE_DEG, 52d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) SVG_ANGLETYPE_RAD = SVGAngle::SVG_ANGLETYPE_RAD, 53d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) SVG_ANGLETYPE_GRAD = SVGAngle::SVG_ANGLETYPE_GRAD 54d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) }; 55d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 56d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) virtual ~SVGAngleTearOff(); 57d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 585d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles) unsigned short unitType() { return hasExposedAngleUnit() ? target()->unitType() : SVGAngle::SVG_ANGLETYPE_UNKNOWN; } 59d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 60d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) void setValue(float, ExceptionState&); 61d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float value() { return target()->value(); } 62d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 63d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) void setValueInSpecifiedUnits(float, ExceptionState&); 64d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float valueInSpecifiedUnits() { return target()->valueInSpecifiedUnits(); } 65d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 66d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) void newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits, ExceptionState&); 67d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) void convertToSpecifiedUnits(unsigned short unitType, ExceptionState&); 68d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 695d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles) String valueAsString() { return hasExposedAngleUnit() ? target()->valueAsString() : String::number(0); } 70d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) void setValueAsString(const String&, ExceptionState&); 71d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 72d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)private: 73d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) SVGAngleTearOff(PassRefPtr<SVGAngle>, SVGElement*, PropertyIsAnimValType, const QualifiedName&); 745d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles) 755d92fedcae5e801a8b224de090094f2d9df0b54aTorne (Richard Coles) bool hasExposedAngleUnit() { return target()->unitType() <= SVGAngle::SVG_ANGLETYPE_GRAD; } 76d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)}; 77d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 78c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)} // namespace blink 79d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 807242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci#endif // SVGAngleTearOff_h 81