Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (208479 => 208480)
--- trunk/Source/WebCore/CMakeLists.txt 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-11-09 21:30:41 UTC (rev 208480)
@@ -2680,7 +2680,7 @@
svg/SVGAltGlyphDefElement.cpp
svg/SVGAltGlyphElement.cpp
svg/SVGAltGlyphItemElement.cpp
- svg/SVGAngle.cpp
+ svg/SVGAngleValue.cpp
svg/SVGAnimateColorElement.cpp
svg/SVGAnimateElement.cpp
svg/SVGAnimateElementBase.cpp
Modified: trunk/Source/WebCore/ChangeLog (208479 => 208480)
--- trunk/Source/WebCore/ChangeLog 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/ChangeLog 2016-11-09 21:30:41 UTC (rev 208480)
@@ -1,3 +1,105 @@
+2016-11-09 Sam Weinig <[email protected]>
+
+ [SVG] Start moving special casing of SVG out of the bindings - SVGAngle
+ https://bugs.webkit.org/show_bug.cgi?id=164496
+
+ Reviewed by Darin Adler.
+
+ There is quite a bit of special casing of SVG types in the bindings that adds
+ a lot of complexity and is relatively fragile, as it is based on type naming.
+
+ Instead of keeping the complexity in the bindings, I am going to move it into
+ the implementation, where it has also longed to be.
+
+ Starting small, with just SVGAngle. It has been split in two, with the existing
+ SVGAngle being renamed SVGAngleValue, and the bound instance, which used to be name
+ SVGPropertyTearOff<SVGAngle>, taking the name SVGAngle (and inheriting from
+ SVGPropertyTearOff<SVGAngleValue>).
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ Add SVGAngleValue.cpp
+
+ * bindings/scripts/CodeGenerator.pm:
+ Remove SVGAngle as a special case.
+
+ * svg/SVGAngle.cpp: Removed.
+ * svg/SVGAngle.h:
+ Added. Implements the SVGAngle interface explicitly, getting to
+ the SVGAngleValue through propertyReference().
+
+ * svg/SVGAngle.idl:
+ * svg/SVGAngleValue.cpp: Copied from Source/WebCore/svg/SVGAngle.cpp.
+ * svg/SVGAngleValue.h: Copied from Source/WebCore/svg/SVGAngle.h.
+ Move old SVGAngle implementation to SVGAngleValue.
+
+ * svg/SVGAnimatedAngle.cpp:
+ Replace SVGAngle usage with SVGAngleValue.
+
+ * svg/SVGAnimatedAngle.h:
+ Switch SVGAnimatedAngle to be a type alias. This remains SVGAnimatedPropertyTearOff<SVGAngle>
+ as SVGAnimatedPropertyTearOff has been changed to take the TearOff type as its parameter.
+
+ * svg/SVGAnimatedLength.h:
+ * svg/SVGAnimatedPreserveAspectRatio.h:
+ * svg/SVGAnimatedRect.h:
+ Switch to using type aliases and pass the TearOff to SVGAnimatedPropertyTearOff.
+
+ * svg/SVGAnimatedType.cpp:
+ (WebCore::SVGAnimatedType::createAngleAndEnumeration):
+ * svg/SVGAnimatedType.h:
+ (WebCore::SVGAnimatedType::angleAndEnumeration):
+ Use SVGAngleValue.
+
+ * svg/SVGComponentTransferFunctionElement.h:
+ Add missing include of SVGElement.h (need because it removed from SVGPropertyTearOff).
+
+ * svg/SVGMarkerElement.cpp:
+ (WebCore::SVGMarkerElement::parseAttribute):
+ (WebCore::SVGMarkerElement::setOrient):
+ Switch to take an SVGAngleValue.
+
+ (WebCore::SVGMarkerElement::setOrientToAngle):
+ Update to pull the value out via propertyReference().
+
+ * svg/SVGMarkerElement.h:
+ Switch to take an SVGAngleValue.
+
+ * svg/SVGLengthList.h:
+ * svg/SVGNumberList.h:
+ * svg/SVGPathSegList.h:
+ * svg/SVGPointList.h:
+ * svg/SVGStringList.h:
+ * svg/SVGTransformList.h:
+ Switch to using type aliases in SVGPropertyTraits and add an alias for
+ ListItemTearOff.
+
+ * svg/SVGSVGElement.cpp:
+ (WebCore::SVGSVGElement::createSVGAngle):
+ * svg/SVGSVGElement.h:
+ Change createSVGAngle to return a Ref<SVGAngle> and create one.
+
+ * svg/SVGSVGElement.idl:
+ Annotate IDL to indicate that a new value is being returned.
+
+ * svg/SVGTransform.cpp:
+ Remove unnecessary include of SVGAngle.h.
+
+ * svg/SVGViewSpec.cpp:
+ Add missing include of SVGElement.h (need because it removed from SVGPropertyTearOff).
+
+ * svg/properties/SVGAnimatedPropertyTearOff.h:
+ Change to be parameterized on the TearOffType, rather than the PropertyType itself. Get the
+ Property type from the TearOffType.
+
+ * svg/properties/SVGListProperty.h:
+ * svg/properties/SVGListPropertyTearOff.h:
+ Fix assumption that all TearOffTypes are just a SVGPropertyTearOff templatized on a property
+ type. This is no longer true for SVGAngle. Instead, get the TearOffType for lists via SVGPropertyTraits.
+
+ * svg/properties/SVGPropertyTearOff.h:
+ Make the PropertyType available by exposing it as a type alias.
+
2016-11-09 Darin Adler <[email protected]>
Move Range from ExceptionCode to ExceptionOr
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (208479 => 208480)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-11-09 21:30:41 UTC (rev 208480)
@@ -2837,6 +2837,7 @@
7C7941E41C56C29300A4C58E /* DataDetectorsCoreSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C7941E21C56C29300A4C58E /* DataDetectorsCoreSoftLink.mm */; };
7C7941E51C56C29300A4C58E /* DataDetectorsCoreSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C7941E31C56C29300A4C58E /* DataDetectorsCoreSoftLink.h */; };
7C83DE861D04CC5D00FEBCF3 /* SpringSolver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C83DE851D04CBD400FEBCF3 /* SpringSolver.h */; };
+ 7C8F22441DD3C2F600E92DA3 /* SVGAngleValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C8F22421DD3B3B900E92DA3 /* SVGAngleValue.cpp */; };
7C93F3491AA6BA5E00A98BAB /* CompiledContentExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C93F3471AA6BA5E00A98BAB /* CompiledContentExtension.cpp */; };
7C93F34A1AA6BA5E00A98BAB /* CompiledContentExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C93F3481AA6BA5E00A98BAB /* CompiledContentExtension.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C93F34D1AA6BF0700A98BAB /* ContentExtensionCompiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C93F34B1AA6BF0700A98BAB /* ContentExtensionCompiler.cpp */; };
@@ -4470,7 +4471,6 @@
B22279720D00BF220071B782 /* RadialGradientAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = B22277DC0D00BF1F0071B782 /* RadialGradientAttributes.h */; };
B22279730D00BF220071B782 /* SVGAElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22277DD0D00BF1F0071B782 /* SVGAElement.cpp */; };
B22279740D00BF220071B782 /* SVGAElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22277DE0D00BF1F0071B782 /* SVGAElement.h */; };
- B22279760D00BF220071B782 /* SVGAngle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22277E00D00BF1F0071B782 /* SVGAngle.cpp */; };
B22279770D00BF220071B782 /* SVGAngle.h in Headers */ = {isa = PBXBuildFile; fileRef = B22277E10D00BF1F0071B782 /* SVGAngle.h */; settings = {ATTRIBUTES = (Private, ); }; };
B22279790D00BF220071B782 /* SVGAnimateColorElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22277E30D00BF1F0071B782 /* SVGAnimateColorElement.cpp */; };
B222797A0D00BF220071B782 /* SVGAnimateColorElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22277E40D00BF1F0071B782 /* SVGAnimateColorElement.h */; };
@@ -10207,6 +10207,8 @@
7C7941E21C56C29300A4C58E /* DataDetectorsCoreSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DataDetectorsCoreSoftLink.mm; sourceTree = "<group>"; };
7C7941E31C56C29300A4C58E /* DataDetectorsCoreSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataDetectorsCoreSoftLink.h; sourceTree = "<group>"; };
7C83DE851D04CBD400FEBCF3 /* SpringSolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpringSolver.h; sourceTree = "<group>"; };
+ 7C8F22421DD3B3B900E92DA3 /* SVGAngleValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAngleValue.cpp; sourceTree = "<group>"; };
+ 7C8F22431DD3B3B900E92DA3 /* SVGAngleValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAngleValue.h; sourceTree = "<group>"; };
7C93F3471AA6BA5E00A98BAB /* CompiledContentExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CompiledContentExtension.cpp; sourceTree = "<group>"; };
7C93F3481AA6BA5E00A98BAB /* CompiledContentExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompiledContentExtension.h; sourceTree = "<group>"; };
7C93F34B1AA6BF0700A98BAB /* ContentExtensionCompiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentExtensionCompiler.cpp; sourceTree = "<group>"; };
@@ -12062,7 +12064,6 @@
B22277DD0D00BF1F0071B782 /* SVGAElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAElement.cpp; sourceTree = "<group>"; };
B22277DE0D00BF1F0071B782 /* SVGAElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGAElement.h; sourceTree = "<group>"; };
B22277DF0D00BF1F0071B782 /* SVGAElement.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SVGAElement.idl; sourceTree = "<group>"; };
- B22277E00D00BF1F0071B782 /* SVGAngle.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAngle.cpp; sourceTree = "<group>"; };
B22277E10D00BF1F0071B782 /* SVGAngle.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SVGAngle.h; sourceTree = "<group>"; };
B22277E20D00BF1F0071B782 /* SVGAngle.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SVGAngle.idl; sourceTree = "<group>"; };
B22277E30D00BF1F0071B782 /* SVGAnimateColorElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimateColorElement.cpp; sourceTree = "<group>"; };
@@ -20687,9 +20688,10 @@
24D912B413CA9A6900D21915 /* SVGAltGlyphItemElement.cpp */,
24D912B513CA9A6900D21915 /* SVGAltGlyphItemElement.h */,
24D912B613CA9A6900D21915 /* SVGAltGlyphItemElement.idl */,
- B22277E00D00BF1F0071B782 /* SVGAngle.cpp */,
B22277E10D00BF1F0071B782 /* SVGAngle.h */,
B22277E20D00BF1F0071B782 /* SVGAngle.idl */,
+ 7C8F22421DD3B3B900E92DA3 /* SVGAngleValue.cpp */,
+ 7C8F22431DD3B3B900E92DA3 /* SVGAngleValue.h */,
B22277E30D00BF1F0071B782 /* SVGAnimateColorElement.cpp */,
B22277E40D00BF1F0071B782 /* SVGAnimateColorElement.h */,
B22277E50D00BF1F0071B782 /* SVGAnimateColorElement.idl */,
@@ -30929,7 +30931,6 @@
24D912B013CA9A1F00D21915 /* SVGAltGlyphDefElement.cpp in Sources */,
65653F2D0D9727D200CA9723 /* SVGAltGlyphElement.cpp in Sources */,
24D912B713CA9A6900D21915 /* SVGAltGlyphItemElement.cpp in Sources */,
- B22279760D00BF220071B782 /* SVGAngle.cpp in Sources */,
B22279790D00BF220071B782 /* SVGAnimateColorElement.cpp in Sources */,
4362C7B913AC6F1A00344BEB /* SVGAnimatedAngle.cpp in Sources */,
431A308813B8F978007791E4 /* SVGAnimatedBoolean.cpp in Sources */,
@@ -31134,6 +31135,7 @@
CECADFCD1537791D00E37068 /* TextInsertionBaseCommand.cpp in Sources */,
93309E1B099E64920056E581 /* TextIterator.cpp in Sources */,
E4D988B617BFEB210084FB88 /* TextNodeTraversal.cpp in Sources */,
+ 7C8F22441DD3C2F600E92DA3 /* SVGAngleValue.cpp in Sources */,
1C18DA58181AF6A500C4EF22 /* TextPainter.cpp in Sources */,
E4C91A101802343900A17F6D /* TextPaintStyle.cpp in Sources */,
93F19A9D08245E59001E9ABC /* TextResourceDecoder.cpp in Sources */,
Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (208479 => 208480)
--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2016-11-09 21:30:41 UTC (rev 208480)
@@ -119,7 +119,6 @@
);
my %svgTypeNeedingTearOff = (
- "SVGAngle" => "SVGPropertyTearOff<SVGAngle>",
"SVGLength" => "SVGPropertyTearOff<SVGLength>",
"SVGLengthList" => "SVGListPropertyTearOff<SVGLengthList>",
"SVGMatrix" => "SVGPropertyTearOff<SVGMatrix>",
Modified: trunk/Source/WebCore/svg/SVGAllInOne.cpp (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGAllInOne.cpp 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGAllInOne.cpp 2016-11-09 21:30:41 UTC (rev 208480)
@@ -29,7 +29,6 @@
#include "SVGAltGlyphDefElement.cpp"
#include "SVGAltGlyphElement.cpp"
#include "SVGAltGlyphItemElement.cpp"
-#include "SVGAngle.cpp"
#include "SVGAnimateColorElement.cpp"
#include "SVGAnimateElement.cpp"
#include "SVGAnimateElementBase.cpp"
Deleted: trunk/Source/WebCore/svg/SVGAngle.cpp (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGAngle.cpp 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGAngle.cpp 2016-11-09 21:30:41 UTC (rev 208480)
@@ -1,204 +0,0 @@
-/*
- * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <[email protected]>
- * Copyright (C) 2004, 2005, 2006 Rob Buis <[email protected]>
- * Copyright (C) Research In Motion Limited 2010. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "SVGAngle.h"
-
-#include "ExceptionCode.h"
-#include "SVGParserUtilities.h"
-#include <wtf/MathExtras.h>
-#include <wtf/text/StringView.h>
-
-namespace WebCore {
-
-float SVGAngle::value() const
-{
- switch (m_unitType) {
- case SVG_ANGLETYPE_GRAD:
- return grad2deg(m_valueInSpecifiedUnits);
- case SVG_ANGLETYPE_RAD:
- return rad2deg(m_valueInSpecifiedUnits);
- case SVG_ANGLETYPE_UNSPECIFIED:
- case SVG_ANGLETYPE_UNKNOWN:
- case SVG_ANGLETYPE_DEG:
- return m_valueInSpecifiedUnits;
- }
- ASSERT_NOT_REACHED();
- return 0;
-}
-
-void SVGAngle::setValue(float value)
-{
- switch (m_unitType) {
- case SVG_ANGLETYPE_GRAD:
- m_valueInSpecifiedUnits = deg2grad(value);
- return;
- case SVG_ANGLETYPE_RAD:
- m_valueInSpecifiedUnits = deg2rad(value);
- return;
- case SVG_ANGLETYPE_UNSPECIFIED:
- case SVG_ANGLETYPE_UNKNOWN:
- case SVG_ANGLETYPE_DEG:
- m_valueInSpecifiedUnits = value;
- return;
- }
- ASSERT_NOT_REACHED();
-}
-
-String SVGAngle::valueAsString() const
-{
- switch (m_unitType) {
- case SVG_ANGLETYPE_DEG:
- return String::number(m_valueInSpecifiedUnits) + "deg";
- case SVG_ANGLETYPE_RAD:
- return String::number(m_valueInSpecifiedUnits) + "rad";
- case SVG_ANGLETYPE_GRAD:
- return String::number(m_valueInSpecifiedUnits) + "grad";
- case SVG_ANGLETYPE_UNSPECIFIED:
- case SVG_ANGLETYPE_UNKNOWN:
- return String::number(m_valueInSpecifiedUnits);
- }
-
- ASSERT_NOT_REACHED();
- return String();
-}
-
-static inline SVGAngle::SVGAngleType parseAngleType(const UChar* ptr, const UChar* end)
-{
- switch (end - ptr) {
- case 0:
- return SVGAngle::SVG_ANGLETYPE_UNSPECIFIED;
- case 3:
- if (ptr[0] == 'd' && ptr[1] == 'e' && ptr[2] == 'g')
- return SVGAngle::SVG_ANGLETYPE_DEG;
- if (ptr[0] == 'r' && ptr[1] == 'a' && ptr[2] == 'd')
- return SVGAngle::SVG_ANGLETYPE_RAD;
- break;
- case 4:
- if (ptr[0] == 'g' && ptr[1] == 'r' && ptr[2] == 'a' && ptr[3] == 'd')
- return SVGAngle::SVG_ANGLETYPE_GRAD;
- break;
- }
- return SVGAngle::SVG_ANGLETYPE_UNKNOWN;
-}
-
-ExceptionOr<void> SVGAngle::setValueAsString(const String& value)
-{
- if (value.isEmpty()) {
- m_unitType = SVG_ANGLETYPE_UNSPECIFIED;
- return { };
- }
-
- auto upconvertedCharacters = StringView(value).upconvertedCharacters();
- const UChar* ptr = upconvertedCharacters;
- const UChar* end = ptr + value.length();
-
- float valueInSpecifiedUnits = 0;
- if (!parseNumber(ptr, end, valueInSpecifiedUnits, false))
- return Exception { SYNTAX_ERR };
-
- auto unitType = parseAngleType(ptr, end);
- if (unitType == SVG_ANGLETYPE_UNKNOWN)
- return Exception { SYNTAX_ERR };
-
- m_unitType = unitType;
- m_valueInSpecifiedUnits = valueInSpecifiedUnits;
- return { };
-}
-
-ExceptionOr<void> SVGAngle::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits)
-{
- if (unitType == SVG_ANGLETYPE_UNKNOWN || unitType > SVG_ANGLETYPE_GRAD)
- return Exception { NOT_SUPPORTED_ERR };
-
- m_unitType = static_cast<SVGAngleType>(unitType);
- m_valueInSpecifiedUnits = valueInSpecifiedUnits;
- return { };
-}
-
-ExceptionOr<void> SVGAngle::convertToSpecifiedUnits(unsigned short unitType)
-{
- if (unitType == SVG_ANGLETYPE_UNKNOWN || m_unitType == SVG_ANGLETYPE_UNKNOWN || unitType > SVG_ANGLETYPE_GRAD)
- return Exception { NOT_SUPPORTED_ERR };
-
- if (unitType == m_unitType)
- return { };
-
- switch (m_unitType) {
- case SVG_ANGLETYPE_RAD:
- switch (unitType) {
- case SVG_ANGLETYPE_GRAD:
- m_valueInSpecifiedUnits = rad2grad(m_valueInSpecifiedUnits);
- break;
- case SVG_ANGLETYPE_UNSPECIFIED:
- case SVG_ANGLETYPE_DEG:
- m_valueInSpecifiedUnits = rad2deg(m_valueInSpecifiedUnits);
- break;
- case SVG_ANGLETYPE_RAD:
- case SVG_ANGLETYPE_UNKNOWN:
- ASSERT_NOT_REACHED();
- break;
- }
- break;
- case SVG_ANGLETYPE_GRAD:
- switch (unitType) {
- case SVG_ANGLETYPE_RAD:
- m_valueInSpecifiedUnits = grad2rad(m_valueInSpecifiedUnits);
- break;
- case SVG_ANGLETYPE_UNSPECIFIED:
- case SVG_ANGLETYPE_DEG:
- m_valueInSpecifiedUnits = grad2deg(m_valueInSpecifiedUnits);
- break;
- case SVG_ANGLETYPE_GRAD:
- case SVG_ANGLETYPE_UNKNOWN:
- ASSERT_NOT_REACHED();
- break;
- }
- break;
- case SVG_ANGLETYPE_UNSPECIFIED:
- // Spec: For angles, a unitless value is treated the same as if degrees were specified.
- case SVG_ANGLETYPE_DEG:
- switch (unitType) {
- case SVG_ANGLETYPE_RAD:
- m_valueInSpecifiedUnits = deg2rad(m_valueInSpecifiedUnits);
- break;
- case SVG_ANGLETYPE_GRAD:
- m_valueInSpecifiedUnits = deg2grad(m_valueInSpecifiedUnits);
- break;
- case SVG_ANGLETYPE_UNSPECIFIED:
- case SVG_ANGLETYPE_DEG:
- break;
- case SVG_ANGLETYPE_UNKNOWN:
- ASSERT_NOT_REACHED();
- break;
- }
- break;
- case SVG_ANGLETYPE_UNKNOWN:
- ASSERT_NOT_REACHED();
- break;
- }
-
- m_unitType = static_cast<SVGAngleType>(unitType);
-
- return { };
-}
-
-}
Modified: trunk/Source/WebCore/svg/SVGAngle.h (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGAngle.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGAngle.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -1,34 +1,39 @@
/*
- * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <[email protected]>
- * Copyright (C) 2004, 2005, 2006 Rob Buis <[email protected]>
- * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
*/
-
#pragma once
-#include "ExceptionOr.h"
-#include "SVGPropertyTraits.h"
+#include "ExceptionCode.h"
+#include "SVGAngleValue.h"
+#include "SVGPropertyTearOff.h"
namespace WebCore {
-class SVGAngle {
- WTF_MAKE_FAST_ALLOCATED;
+class SVGAngle : public SVGPropertyTearOff<SVGAngleValue> {
public:
+ // FIXME: This is duplicated in SVGAngleValue. We should find someway to have
+ // only one copy, but for now, this one is needed to satisfy the bindings.
enum SVGAngleType {
SVG_ANGLETYPE_UNKNOWN = 0,
SVG_ANGLETYPE_UNSPECIFIED = 1,
@@ -37,28 +42,125 @@
SVG_ANGLETYPE_GRAD = 4
};
- SVGAngleType unitType() const { return m_unitType; }
+ static Ref<SVGAngle> create(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, SVGAngleValue& value)
+ {
+ ASSERT(animatedProperty);
+ return adoptRef(*new SVGAngle(animatedProperty, role, value));
+ }
- void setValue(float);
- float value() const;
+ static Ref<SVGAngle> create(const SVGAngleValue& initialValue = { })
+ {
+ return adoptRef(*new SVGAngle(initialValue));
+ }
- void setValueInSpecifiedUnits(float valueInSpecifiedUnits) { m_valueInSpecifiedUnits = valueInSpecifiedUnits; }
- float valueInSpecifiedUnits() const { return m_valueInSpecifiedUnits; }
+ static Ref<SVGAngle> create(const SVGAngleValue* initialValue)
+ {
+ return adoptRef(*new SVGAngle(initialValue));
+ }
- ExceptionOr<void> setValueAsString(const String&);
- String valueAsString() const;
+ template<typename T> static ExceptionOr<Ref<SVGAngle>> create(ExceptionOr<T>&& initialValue)
+ {
+ if (initialValue.hasException())
+ return initialValue.releaseException();
+ return create(initialValue.releaseReturnValue());
+ }
- ExceptionOr<void> newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits);
- ExceptionOr<void> convertToSpecifiedUnits(unsigned short unitType);
+ SVGAngleValue::Type unitType()
+ {
+ return propertyReference().unitType();
+ }
+ ExceptionOr<void> setValueForBindings(float value)
+ {
+ if (isReadOnly())
+ return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+ propertyReference().setValue(value);
+ commitChange();
+
+ return { };
+ }
+
+ float valueForBindings()
+ {
+ return propertyReference().value();
+ }
+
+ ExceptionOr<void> setValueInSpecifiedUnits(float valueInSpecifiedUnits)
+ {
+ if (isReadOnly())
+ return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+ propertyReference().setValueInSpecifiedUnits(valueInSpecifiedUnits);
+ commitChange();
+
+ return { };
+ }
+
+ float valueInSpecifiedUnits()
+ {
+ return propertyReference().valueInSpecifiedUnits();
+ }
+
+ ExceptionOr<void> setValueAsString(const String& value)
+ {
+ if (isReadOnly())
+ return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+ auto result = propertyReference().setValueAsString(value);
+ if (result.hasException())
+ return result;
+
+ commitChange();
+ return result;
+ }
+
+ String valueAsString()
+ {
+ return propertyReference().valueAsString();
+ }
+
+ ExceptionOr<void> newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits)
+ {
+ if (isReadOnly())
+ return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+ auto result = propertyReference().newValueSpecifiedUnits(unitType, valueInSpecifiedUnits);
+ if (result.hasException())
+ return result;
+
+ commitChange();
+ return result;
+ }
+
+ ExceptionOr<void> convertToSpecifiedUnits(unsigned short unitType)
+ {
+ if (isReadOnly())
+ return Exception { NO_MODIFICATION_ALLOWED_ERR };
+
+ auto result = propertyReference().convertToSpecifiedUnits(unitType);
+ if (result.hasException())
+ return result;
+
+ commitChange();
+ return result;
+ }
+
private:
- SVGAngleType m_unitType { SVG_ANGLETYPE_UNSPECIFIED };
- float m_valueInSpecifiedUnits { 0 };
-};
+ SVGAngle(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, SVGAngleValue& value)
+ : SVGPropertyTearOff<SVGAngleValue>(animatedProperty, role, value)
+ {
+ }
-template<> struct SVGPropertyTraits<SVGAngle> {
- static SVGAngle initialValue() { return SVGAngle(); }
- static String toString(const SVGAngle& type) { return type.valueAsString(); }
+ explicit SVGAngle(const SVGAngleValue& initialValue)
+ : SVGPropertyTearOff<SVGAngleValue>(initialValue)
+ {
+ }
+
+ explicit SVGAngle(const SVGAngleValue* initialValue)
+ : SVGPropertyTearOff<SVGAngleValue>(initialValue)
+ {
+ }
};
} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGAngle.idl (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGAngle.idl 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGAngle.idl 2016-11-09 21:30:41 UTC (rev 208480)
@@ -29,8 +29,8 @@
const unsigned short SVG_ANGLETYPE_GRAD = 4;
readonly attribute unsigned short unitType;
- attribute unrestricted float value;
- attribute unrestricted float valueInSpecifiedUnits;
+ [SetterMayThrowException, ImplementedAs=valueForBindings] attribute unrestricted float value;
+ [SetterMayThrowException] attribute unrestricted float valueInSpecifiedUnits;
[SetterMayThrowException] attribute DOMString valueAsString;
Copied: trunk/Source/WebCore/svg/SVGAngleValue.cpp (from rev 208479, trunk/Source/WebCore/svg/SVGAngle.cpp) (0 => 208480)
--- trunk/Source/WebCore/svg/SVGAngleValue.cpp (rev 0)
+++ trunk/Source/WebCore/svg/SVGAngleValue.cpp 2016-11-09 21:30:41 UTC (rev 208480)
@@ -0,0 +1,204 @@
+/*
+ * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <[email protected]>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <[email protected]>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "SVGAngleValue.h"
+
+#include "ExceptionCode.h"
+#include "SVGParserUtilities.h"
+#include <wtf/MathExtras.h>
+#include <wtf/text/StringView.h>
+
+namespace WebCore {
+
+float SVGAngleValue::value() const
+{
+ switch (m_unitType) {
+ case SVG_ANGLETYPE_GRAD:
+ return grad2deg(m_valueInSpecifiedUnits);
+ case SVG_ANGLETYPE_RAD:
+ return rad2deg(m_valueInSpecifiedUnits);
+ case SVG_ANGLETYPE_UNSPECIFIED:
+ case SVG_ANGLETYPE_UNKNOWN:
+ case SVG_ANGLETYPE_DEG:
+ return m_valueInSpecifiedUnits;
+ }
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+void SVGAngleValue::setValue(float value)
+{
+ switch (m_unitType) {
+ case SVG_ANGLETYPE_GRAD:
+ m_valueInSpecifiedUnits = deg2grad(value);
+ return;
+ case SVG_ANGLETYPE_RAD:
+ m_valueInSpecifiedUnits = deg2rad(value);
+ return;
+ case SVG_ANGLETYPE_UNSPECIFIED:
+ case SVG_ANGLETYPE_UNKNOWN:
+ case SVG_ANGLETYPE_DEG:
+ m_valueInSpecifiedUnits = value;
+ return;
+ }
+ ASSERT_NOT_REACHED();
+}
+
+String SVGAngleValue::valueAsString() const
+{
+ switch (m_unitType) {
+ case SVG_ANGLETYPE_DEG:
+ return String::number(m_valueInSpecifiedUnits) + "deg";
+ case SVG_ANGLETYPE_RAD:
+ return String::number(m_valueInSpecifiedUnits) + "rad";
+ case SVG_ANGLETYPE_GRAD:
+ return String::number(m_valueInSpecifiedUnits) + "grad";
+ case SVG_ANGLETYPE_UNSPECIFIED:
+ case SVG_ANGLETYPE_UNKNOWN:
+ return String::number(m_valueInSpecifiedUnits);
+ }
+
+ ASSERT_NOT_REACHED();
+ return String();
+}
+
+static inline SVGAngleValue::Type parseAngleType(const UChar* ptr, const UChar* end)
+{
+ switch (end - ptr) {
+ case 0:
+ return SVGAngleValue::SVG_ANGLETYPE_UNSPECIFIED;
+ case 3:
+ if (ptr[0] == 'd' && ptr[1] == 'e' && ptr[2] == 'g')
+ return SVGAngleValue::SVG_ANGLETYPE_DEG;
+ if (ptr[0] == 'r' && ptr[1] == 'a' && ptr[2] == 'd')
+ return SVGAngleValue::SVG_ANGLETYPE_RAD;
+ break;
+ case 4:
+ if (ptr[0] == 'g' && ptr[1] == 'r' && ptr[2] == 'a' && ptr[3] == 'd')
+ return SVGAngleValue::SVG_ANGLETYPE_GRAD;
+ break;
+ }
+ return SVGAngleValue::SVG_ANGLETYPE_UNKNOWN;
+}
+
+ExceptionOr<void> SVGAngleValue::setValueAsString(const String& value)
+{
+ if (value.isEmpty()) {
+ m_unitType = SVG_ANGLETYPE_UNSPECIFIED;
+ return { };
+ }
+
+ auto upconvertedCharacters = StringView(value).upconvertedCharacters();
+ const UChar* ptr = upconvertedCharacters;
+ const UChar* end = ptr + value.length();
+
+ float valueInSpecifiedUnits = 0;
+ if (!parseNumber(ptr, end, valueInSpecifiedUnits, false))
+ return Exception { SYNTAX_ERR };
+
+ auto unitType = parseAngleType(ptr, end);
+ if (unitType == SVG_ANGLETYPE_UNKNOWN)
+ return Exception { SYNTAX_ERR };
+
+ m_unitType = unitType;
+ m_valueInSpecifiedUnits = valueInSpecifiedUnits;
+ return { };
+}
+
+ExceptionOr<void> SVGAngleValue::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits)
+{
+ if (unitType == SVG_ANGLETYPE_UNKNOWN || unitType > SVG_ANGLETYPE_GRAD)
+ return Exception { NOT_SUPPORTED_ERR };
+
+ m_unitType = static_cast<Type>(unitType);
+ m_valueInSpecifiedUnits = valueInSpecifiedUnits;
+ return { };
+}
+
+ExceptionOr<void> SVGAngleValue::convertToSpecifiedUnits(unsigned short unitType)
+{
+ if (unitType == SVG_ANGLETYPE_UNKNOWN || m_unitType == SVG_ANGLETYPE_UNKNOWN || unitType > SVG_ANGLETYPE_GRAD)
+ return Exception { NOT_SUPPORTED_ERR };
+
+ if (unitType == m_unitType)
+ return { };
+
+ switch (m_unitType) {
+ case SVG_ANGLETYPE_RAD:
+ switch (unitType) {
+ case SVG_ANGLETYPE_GRAD:
+ m_valueInSpecifiedUnits = rad2grad(m_valueInSpecifiedUnits);
+ break;
+ case SVG_ANGLETYPE_UNSPECIFIED:
+ case SVG_ANGLETYPE_DEG:
+ m_valueInSpecifiedUnits = rad2deg(m_valueInSpecifiedUnits);
+ break;
+ case SVG_ANGLETYPE_RAD:
+ case SVG_ANGLETYPE_UNKNOWN:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+ break;
+ case SVG_ANGLETYPE_GRAD:
+ switch (unitType) {
+ case SVG_ANGLETYPE_RAD:
+ m_valueInSpecifiedUnits = grad2rad(m_valueInSpecifiedUnits);
+ break;
+ case SVG_ANGLETYPE_UNSPECIFIED:
+ case SVG_ANGLETYPE_DEG:
+ m_valueInSpecifiedUnits = grad2deg(m_valueInSpecifiedUnits);
+ break;
+ case SVG_ANGLETYPE_GRAD:
+ case SVG_ANGLETYPE_UNKNOWN:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+ break;
+ case SVG_ANGLETYPE_UNSPECIFIED:
+ // Spec: For angles, a unitless value is treated the same as if degrees were specified.
+ case SVG_ANGLETYPE_DEG:
+ switch (unitType) {
+ case SVG_ANGLETYPE_RAD:
+ m_valueInSpecifiedUnits = deg2rad(m_valueInSpecifiedUnits);
+ break;
+ case SVG_ANGLETYPE_GRAD:
+ m_valueInSpecifiedUnits = deg2grad(m_valueInSpecifiedUnits);
+ break;
+ case SVG_ANGLETYPE_UNSPECIFIED:
+ case SVG_ANGLETYPE_DEG:
+ break;
+ case SVG_ANGLETYPE_UNKNOWN:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+ break;
+ case SVG_ANGLETYPE_UNKNOWN:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+
+ m_unitType = static_cast<Type>(unitType);
+
+ return { };
+}
+
+}
Copied: trunk/Source/WebCore/svg/SVGAngleValue.h (from rev 208479, trunk/Source/WebCore/svg/SVGAngle.h) (0 => 208480)
--- trunk/Source/WebCore/svg/SVGAngleValue.h (rev 0)
+++ trunk/Source/WebCore/svg/SVGAngleValue.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <[email protected]>
+ * Copyright (C) 2004, 2005, 2006 Rob Buis <[email protected]>
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#include "ExceptionOr.h"
+#include "SVGPropertyTraits.h"
+
+namespace WebCore {
+
+class SVGAngleValue {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ enum Type {
+ SVG_ANGLETYPE_UNKNOWN = 0,
+ SVG_ANGLETYPE_UNSPECIFIED = 1,
+ SVG_ANGLETYPE_DEG = 2,
+ SVG_ANGLETYPE_RAD = 3,
+ SVG_ANGLETYPE_GRAD = 4
+ };
+
+ Type unitType() const { return m_unitType; }
+
+ void setValue(float);
+ float value() const;
+
+ void setValueInSpecifiedUnits(float valueInSpecifiedUnits) { m_valueInSpecifiedUnits = valueInSpecifiedUnits; }
+ float valueInSpecifiedUnits() const { return m_valueInSpecifiedUnits; }
+
+ ExceptionOr<void> setValueAsString(const String&);
+ String valueAsString() const;
+
+ ExceptionOr<void> newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits);
+ ExceptionOr<void> convertToSpecifiedUnits(unsigned short unitType);
+
+private:
+ Type m_unitType { SVG_ANGLETYPE_UNSPECIFIED };
+ float m_valueInSpecifiedUnits { 0 };
+};
+
+template<> struct SVGPropertyTraits<SVGAngleValue> {
+ static SVGAngleValue initialValue() { return SVGAngleValue(); }
+ static String toString(const SVGAngleValue& type) { return type.valueAsString(); }
+};
+
+}
Modified: trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp 2016-11-09 21:30:41 UTC (rev 208480)
@@ -32,10 +32,10 @@
std::unique_ptr<SVGAnimatedType> SVGAnimatedAngleAnimator::constructFromString(const String& string)
{
- auto animatedType = SVGAnimatedType::createAngleAndEnumeration(std::make_unique<std::pair<SVGAngle, unsigned>>());
- std::pair<SVGAngle, unsigned>& animatedPair = animatedType->angleAndEnumeration();
+ auto animatedType = SVGAnimatedType::createAngleAndEnumeration(std::make_unique<std::pair<SVGAngleValue, unsigned>>());
+ auto& animatedPair = animatedType->angleAndEnumeration();
- SVGAngle angle;
+ SVGAngleValue angle;
SVGMarkerOrientType orientType = SVGPropertyTraits<SVGMarkerOrientType>::fromString(string, angle);
if (orientType > 0)
animatedPair.second = orientType;
@@ -75,13 +75,13 @@
ASSERT(from->type() == AnimatedAngle);
ASSERT(from->type() == to->type());
- const std::pair<SVGAngle, unsigned>& fromAngleAndEnumeration = from->angleAndEnumeration();
- std::pair<SVGAngle, unsigned>& toAngleAndEnumeration = to->angleAndEnumeration();
+ const auto& fromAngleAndEnumeration = from->angleAndEnumeration();
+ auto& toAngleAndEnumeration = to->angleAndEnumeration();
// Only respect by animations, if from and by are both specified in angles (and not eg. 'auto').
if (fromAngleAndEnumeration.second != toAngleAndEnumeration.second || fromAngleAndEnumeration.second != SVGMarkerOrientAngle)
return;
- const SVGAngle& fromAngle = fromAngleAndEnumeration.first;
- SVGAngle& toAngle = toAngleAndEnumeration.first;
+ const auto& fromAngle = fromAngleAndEnumeration.first;
+ auto& toAngle = toAngleAndEnumeration.first;
toAngle.setValue(toAngle.value() + fromAngle.value());
}
@@ -90,10 +90,10 @@
ASSERT(m_animationElement);
ASSERT(m_contextElement);
- const std::pair<SVGAngle, unsigned>& fromAngleAndEnumeration = m_animationElement->animationMode() == ToAnimation ? animated->angleAndEnumeration() : from->angleAndEnumeration();
- const std::pair<SVGAngle, unsigned>& toAngleAndEnumeration = to->angleAndEnumeration();
- const std::pair<SVGAngle, unsigned>& toAtEndOfDurationAngleAndEnumeration = toAtEndOfDuration->angleAndEnumeration();
- std::pair<SVGAngle, unsigned>& animatedAngleAndEnumeration = animated->angleAndEnumeration();
+ const auto& fromAngleAndEnumeration = m_animationElement->animationMode() == ToAnimation ? animated->angleAndEnumeration() : from->angleAndEnumeration();
+ auto& toAngleAndEnumeration = to->angleAndEnumeration();
+ auto& toAtEndOfDurationAngleAndEnumeration = toAtEndOfDuration->angleAndEnumeration();
+ auto& animatedAngleAndEnumeration = animated->angleAndEnumeration();
if (fromAngleAndEnumeration.second != toAngleAndEnumeration.second) {
// Discrete animation - no linear interpolation possible between values (e.g. auto to angle).
@@ -117,8 +117,8 @@
// Regular from angle to angle animation, with support for smooth interpolation, and additive and accumulated animation.
animatedAngleAndEnumeration.second = SVGMarkerOrientAngle;
- SVGAngle& animatedSVGAngle = animatedAngleAndEnumeration.first;
- const SVGAngle& toAtEndOfDurationSVGAngle = toAtEndOfDurationAngleAndEnumeration.first;
+ auto& animatedSVGAngle = animatedAngleAndEnumeration.first;
+ const auto& toAtEndOfDurationSVGAngle = toAtEndOfDurationAngleAndEnumeration.first;
float animatedAngle = animatedSVGAngle.value();
m_animationElement->animateAdditiveNumber(percentage, repeatCount, fromAngleAndEnumeration.first.value(), toAngleAndEnumeration.first.value(), toAtEndOfDurationSVGAngle.value(), animatedAngle);
animatedSVGAngle.setValue(animatedAngle);
@@ -136,9 +136,9 @@
float SVGAnimatedAngleAnimator::calculateDistance(const String& fromString, const String& toString)
{
- SVGAngle from = SVGAngle();
+ auto from = SVGAngleValue();
from.setValueAsString(fromString);
- SVGAngle to = SVGAngle();
+ auto to = SVGAngleValue();
to.setValueAsString(toString);
return fabsf(to.value() - from.value());
}
Modified: trunk/Source/WebCore/svg/SVGAnimatedAngle.h (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGAnimatedAngle.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGAnimatedAngle.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -26,11 +26,11 @@
namespace WebCore {
-typedef SVGAnimatedPropertyTearOff<SVGAngle> SVGAnimatedAngle;
+using SVGAnimatedAngle = SVGAnimatedPropertyTearOff<SVGAngle>;
// Helper macros to declare/define a SVGAnimatedAngle object. SVGAnimatedAngle is only used in the SVG DOM for SVGMarkerElement.
#define DECLARE_ANIMATED_ANGLE(UpperProperty, LowerProperty) \
-DECLARE_ANIMATED_PROPERTY(SVGAnimatedAngle, SVGAngle, UpperProperty, LowerProperty, )
+DECLARE_ANIMATED_PROPERTY(SVGAnimatedAngle, SVGAngleValue, UpperProperty, LowerProperty, )
// Only used for SVGMarkerElements orientAttr, which maps to SVGAnimatedAngle orientAngle and SVGAnimatedEnumeration orientType.
#define DEFINE_ANIMATED_ANGLE_AND_ENUMERATION(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \
Modified: trunk/Source/WebCore/svg/SVGAnimatedLength.h (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGAnimatedLength.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGAnimatedLength.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -26,8 +26,11 @@
namespace WebCore {
-typedef SVGAnimatedPropertyTearOff<SVGLength> SVGAnimatedLength;
+template<typename T>
+class SVGPropertyTearOff;
+using SVGAnimatedLength = SVGAnimatedPropertyTearOff<SVGPropertyTearOff<SVGLength>>;
+
// Helper macros to declare/define a SVGAnimatedLength object
#define DECLARE_ANIMATED_LENGTH(UpperProperty, LowerProperty) \
DECLARE_ANIMATED_PROPERTY(SVGAnimatedLength, SVGLength, UpperProperty, LowerProperty, )
Modified: trunk/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.h (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGAnimatedPreserveAspectRatio.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -26,8 +26,11 @@
namespace WebCore {
-typedef SVGAnimatedPropertyTearOff<SVGPreserveAspectRatio> SVGAnimatedPreserveAspectRatio;
+template<typename T>
+class SVGPropertyTearOff;
+using SVGAnimatedPreserveAspectRatio = SVGAnimatedPropertyTearOff<SVGPropertyTearOff<SVGPreserveAspectRatio>>;
+
// Helper macros to declare/define a SVGAnimatedPreserveAspectRatio object
#define DECLARE_ANIMATED_PRESERVEASPECTRATIO(UpperProperty, LowerProperty) \
DECLARE_ANIMATED_PROPERTY(SVGAnimatedPreserveAspectRatio, SVGPreserveAspectRatio, UpperProperty, LowerProperty, )
Modified: trunk/Source/WebCore/svg/SVGAnimatedRect.h (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGAnimatedRect.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGAnimatedRect.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -27,8 +27,11 @@
namespace WebCore {
-typedef SVGAnimatedPropertyTearOff<FloatRect> SVGAnimatedRect;
+template<typename T>
+class SVGPropertyTearOff;
+using SVGAnimatedRect = SVGAnimatedPropertyTearOff<SVGPropertyTearOff<FloatRect>>;
+
// Helper macros to declare/define a SVGAnimatedRect object
#define DECLARE_ANIMATED_RECT(UpperProperty, LowerProperty) \
DECLARE_ANIMATED_PROPERTY(SVGAnimatedRect, FloatRect, UpperProperty, LowerProperty, )
Modified: trunk/Source/WebCore/svg/SVGAnimatedType.cpp (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGAnimatedType.cpp 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGAnimatedType.cpp 2016-11-09 21:30:41 UTC (rev 208480)
@@ -90,7 +90,7 @@
}
}
-std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createAngleAndEnumeration(std::unique_ptr<std::pair<SVGAngle, unsigned>> angleAndEnumeration)
+std::unique_ptr<SVGAnimatedType> SVGAnimatedType::createAngleAndEnumeration(std::unique_ptr<std::pair<SVGAngleValue, unsigned>> angleAndEnumeration)
{
ASSERT(angleAndEnumeration);
auto animatedType = std::make_unique<SVGAnimatedType>(AnimatedAngle);
Modified: trunk/Source/WebCore/svg/SVGAnimatedType.h (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGAnimatedType.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGAnimatedType.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -21,7 +21,7 @@
#define SVGAnimatedType_h
#include "FloatRect.h"
-#include "SVGAngle.h"
+#include "SVGAngleValue.h"
#include "SVGColor.h"
#include "SVGLength.h"
#include "SVGLengthList.h"
@@ -41,7 +41,7 @@
SVGAnimatedType(AnimatedPropertyType);
virtual ~SVGAnimatedType();
- static std::unique_ptr<SVGAnimatedType> createAngleAndEnumeration(std::unique_ptr<std::pair<SVGAngle, unsigned>>);
+ static std::unique_ptr<SVGAnimatedType> createAngleAndEnumeration(std::unique_ptr<std::pair<SVGAngleValue, unsigned>>);
static std::unique_ptr<SVGAnimatedType> createBoolean(std::unique_ptr<bool>);
static std::unique_ptr<SVGAnimatedType> createColor(std::unique_ptr<Color>);
static std::unique_ptr<SVGAnimatedType> createEnumeration(std::unique_ptr<unsigned>);
@@ -63,7 +63,7 @@
AnimatedPropertyType type() const { return m_type; }
// Non-mutable accessors.
- const std::pair<SVGAngle, unsigned>& angleAndEnumeration() const
+ const std::pair<SVGAngleValue, unsigned>& angleAndEnumeration() const
{
ASSERT(m_type == AnimatedAngle);
return *m_data.angleAndEnumeration;
@@ -166,7 +166,7 @@
}
// Mutable accessors.
- std::pair<SVGAngle, unsigned>& angleAndEnumeration()
+ std::pair<SVGAngleValue, unsigned>& angleAndEnumeration()
{
ASSERT(m_type == AnimatedAngle);
return *m_data.angleAndEnumeration;
@@ -280,7 +280,7 @@
{
}
- std::pair<SVGAngle, unsigned>* angleAndEnumeration;
+ std::pair<SVGAngleValue, unsigned>* angleAndEnumeration;
bool* boolean;
Color* color;
unsigned* enumeration;
Modified: trunk/Source/WebCore/svg/SVGComponentTransferFunctionElement.h (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGComponentTransferFunctionElement.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGComponentTransferFunctionElement.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -25,6 +25,7 @@
#include "SVGAnimatedEnumeration.h"
#include "SVGAnimatedNumber.h"
#include "SVGAnimatedNumberList.h"
+#include "SVGElement.h"
namespace WebCore {
Modified: trunk/Source/WebCore/svg/SVGLengthList.h (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGLengthList.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGLengthList.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -25,6 +25,9 @@
namespace WebCore {
+template<typename T>
+class SVGPropertyTearOff;
+
class SVGLengthList final : public Vector<SVGLength> {
public:
void parse(const String& value, SVGLengthMode);
@@ -32,7 +35,8 @@
};
template<> struct SVGPropertyTraits<SVGLengthList> {
- typedef SVGLength ListItemType;
+ using ListItemType = SVGLength;
+ using ListItemTearOff = SVGPropertyTearOff<SVGLength>;
static SVGLengthList initialValue() { return SVGLengthList(); }
static String toString(const SVGLengthList& type) { return type.valueAsString(); }
Modified: trunk/Source/WebCore/svg/SVGMarkerElement.cpp (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGMarkerElement.cpp 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGMarkerElement.cpp 2016-11-09 21:30:41 UTC (rev 208480)
@@ -132,7 +132,7 @@
}
if (name == SVGNames::orientAttr) {
- SVGAngle angle;
+ SVGAngleValue angle;
auto orientType = SVGPropertyTraits<SVGMarkerOrientType>::fromString(value, angle);
if (orientType > 0)
setOrientTypeBaseValue(orientType);
@@ -189,7 +189,7 @@
object->setNeedsLayout();
}
-void SVGMarkerElement::setOrient(SVGMarkerOrientType orientType, const SVGAngle& angle)
+void SVGMarkerElement::setOrient(SVGMarkerOrientType orientType, const SVGAngleValue& angle)
{
setOrientTypeBaseValue(orientType);
setOrientAngleBaseValue(angle);
@@ -206,9 +206,9 @@
setOrient(SVGMarkerOrientAuto, { });
}
-void SVGMarkerElement::setOrientToAngle(const SVGAngle& angle)
+void SVGMarkerElement::setOrientToAngle(SVGAngle& angle)
{
- setOrient(SVGMarkerOrientAngle, angle);
+ setOrient(SVGMarkerOrientAngle, angle.propertyReference());
}
RenderPtr<RenderElement> SVGMarkerElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
Modified: trunk/Source/WebCore/svg/SVGMarkerElement.h (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGMarkerElement.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGMarkerElement.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -86,7 +86,7 @@
// toString is not needed, synchronizeOrientType() handles this on its own.
- static SVGMarkerOrientType fromString(const String& value, SVGAngle& angle)
+ static SVGMarkerOrientType fromString(const String& value, SVGAngleValue& angle)
{
if (value == "auto")
return SVGMarkerOrientAuto;
@@ -122,7 +122,7 @@
AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
void setOrientToAuto();
- void setOrientToAngle(const SVGAngle&);
+ void setOrientToAngle(SVGAngle&);
static const SVGPropertyInfo* orientTypePropertyInfo();
@@ -141,7 +141,7 @@
bool selfHasRelativeLengths() const override;
- void setOrient(SVGMarkerOrientType, const SVGAngle&);
+ void setOrient(SVGMarkerOrientType, const SVGAngleValue&);
void synchronizeOrientType();
Modified: trunk/Source/WebCore/svg/SVGNumberList.h (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGNumberList.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGNumberList.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -25,6 +25,9 @@
namespace WebCore {
+template<typename T>
+class SVGPropertyTearOff;
+
class SVGNumberList final : public Vector<float> {
public:
void parse(const String&);
@@ -32,10 +35,11 @@
};
template<> struct SVGPropertyTraits<SVGNumberList> {
- typedef float ListItemType;
-
static SVGNumberList initialValue() { return SVGNumberList(); }
static String toString(const SVGNumberList& type) { return type.valueAsString(); }
+
+ using ListItemType = float;
+ using ListItemTearOff = SVGPropertyTearOff<float>;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGPathSegList.h (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGPathSegList.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGPathSegList.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -29,6 +29,9 @@
class SVGElement;
+template<typename T>
+class SVGPropertyTearOff;
+
class SVGPathSegList : public Vector<RefPtr<SVGPathSeg>> {
public:
explicit SVGPathSegList(SVGPathSegRole role)
@@ -47,7 +50,9 @@
template<> struct SVGPropertyTraits<SVGPathSegList> {
static SVGPathSegList initialValue() { return SVGPathSegList(PathSegUndefinedRole); }
- typedef RefPtr<SVGPathSeg> ListItemType;
+
+ using ListItemType = RefPtr<SVGPathSeg>;
+ using ListItemTearOff = SVGPropertyTearOff<RefPtr<SVGPathSeg>>;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGPointList.h (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGPointList.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGPointList.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -26,6 +26,9 @@
namespace WebCore {
+template<typename T>
+class SVGPropertyTearOff;
+
class SVGPointList final : public Vector<SVGPoint> {
public:
String valueAsString() const;
@@ -33,7 +36,9 @@
template<> struct SVGPropertyTraits<SVGPointList> {
static SVGPointList initialValue() { return SVGPointList(); }
- typedef SVGPoint ListItemType;
+
+ using ListItemType = SVGPoint;
+ using ListItemTearOff = SVGPropertyTearOff<SVGPoint>;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGSVGElement.cpp (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGSVGElement.cpp 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGSVGElement.cpp 2016-11-09 21:30:41 UTC (rev 208480)
@@ -33,6 +33,7 @@
#include "RenderSVGViewportContainer.h"
#include "RenderView.h"
#include "SMILTimeContainer.h"
+#include "SVGAngle.h"
#include "SVGViewElement.h"
#include "SVGViewSpec.h"
#include "StaticNodeList.h"
@@ -350,9 +351,9 @@
return { };
}
-SVGAngle SVGSVGElement::createSVGAngle()
+Ref<SVGAngle> SVGSVGElement::createSVGAngle()
{
- return { };
+ return SVGAngle::create();
}
SVGPoint SVGSVGElement::createSVGPoint()
Modified: trunk/Source/WebCore/svg/SVGSVGElement.h (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGSVGElement.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGSVGElement.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -33,6 +33,7 @@
namespace WebCore {
+class SVGAngle;
class SVGViewSpec;
class SMILTimeContainer;
@@ -90,7 +91,7 @@
static float createSVGNumber();
static SVGLength createSVGLength();
- static SVGAngle createSVGAngle();
+ static Ref<SVGAngle> createSVGAngle();
static SVGPoint createSVGPoint();
static SVGMatrix createSVGMatrix();
static FloatRect createSVGRect();
Modified: trunk/Source/WebCore/svg/SVGSVGElement.idl (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGSVGElement.idl 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGSVGElement.idl 2016-11-09 21:30:41 UTC (rev 208480)
@@ -64,7 +64,7 @@
SVGNumber createSVGNumber();
SVGLength createSVGLength();
- SVGAngle createSVGAngle();
+ [NewObject] SVGAngle createSVGAngle();
SVGPoint createSVGPoint();
SVGMatrix createSVGMatrix();
SVGRect createSVGRect();
Modified: trunk/Source/WebCore/svg/SVGStringList.h (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGStringList.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGStringList.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -28,6 +28,9 @@
class SVGElement;
+template<typename T>
+class SVGPropertyTearOff;
+
class SVGStringList final : public Vector<String> {
public:
SVGStringList(const QualifiedName& attributeName)
@@ -48,7 +51,8 @@
};
template<> struct SVGPropertyTraits<SVGStringList> {
- typedef String ListItemType;
+ using ListItemType = String;
+ using ListItemTearOff = SVGPropertyTearOff<String>;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGTransform.cpp (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGTransform.cpp 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGTransform.cpp 2016-11-09 21:30:41 UTC (rev 208480)
@@ -24,7 +24,6 @@
#include "FloatConversion.h"
#include "FloatPoint.h"
#include "FloatSize.h"
-#include "SVGAngle.h"
#include <wtf/MathExtras.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/text/StringBuilder.h>
Modified: trunk/Source/WebCore/svg/SVGTransformList.h (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGTransformList.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGTransformList.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -26,6 +26,9 @@
namespace WebCore {
+template<typename T>
+class SVGPropertyTearOff;
+
class SVGTransformList final : public Vector<SVGTransform, 1> {
public:
SVGTransform createSVGTransformFromMatrix(const SVGMatrix&) const;
@@ -40,7 +43,9 @@
template<> struct SVGPropertyTraits<SVGTransformList> {
static SVGTransformList initialValue() { return SVGTransformList(); }
static String toString(const SVGTransformList& type) { return type.valueAsString(); }
- typedef SVGTransform ListItemType;
+
+ using ListItemType = SVGTransform;
+ using ListItemTearOff = SVGPropertyTearOff<SVGTransform>;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/svg/SVGViewSpec.cpp (208479 => 208480)
--- trunk/Source/WebCore/svg/SVGViewSpec.cpp 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/SVGViewSpec.cpp 2016-11-09 21:30:41 UTC (rev 208480)
@@ -22,6 +22,7 @@
#include "Document.h"
#include "SVGAnimatedTransformList.h"
+#include "SVGElement.h"
#include "SVGFitToViewBox.h"
#include "SVGNames.h"
#include "SVGParserUtilities.h"
Modified: trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyTearOff.h (208479 => 208480)
--- trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyTearOff.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyTearOff.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -18,8 +18,7 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef SVGAnimatedPropertyTearOff_h
-#define SVGAnimatedPropertyTearOff_h
+#pragma once
#include "SVGAnimatedProperty.h"
#include "SVGPropertyTearOff.h"
@@ -26,11 +25,12 @@
namespace WebCore {
-template<typename PropertyType>
+template<typename T>
class SVGAnimatedPropertyTearOff final : public SVGAnimatedProperty {
public:
- typedef SVGPropertyTearOff<PropertyType> PropertyTearOff;
- typedef PropertyType ContentType;
+ using PropertyTearOff = T;
+ using PropertyType = typename PropertyTearOff::PropertyType;
+ using ContentType = PropertyType;
RefPtr<PropertyTearOff> baseVal()
{
@@ -62,10 +62,10 @@
m_animVal = nullptr;
}
- static Ref<SVGAnimatedPropertyTearOff<PropertyType>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& property)
+ static Ref<SVGAnimatedPropertyTearOff<PropertyTearOff>> create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, PropertyType& property)
{
ASSERT(contextElement);
- return adoptRef(*new SVGAnimatedPropertyTearOff<PropertyType>(contextElement, attributeName, animatedPropertyType, property));
+ return adoptRef(*new SVGAnimatedPropertyTearOff<PropertyTearOff>(contextElement, attributeName, animatedPropertyType, property));
}
PropertyType& currentAnimatedValue()
@@ -121,5 +121,3 @@
};
}
-
-#endif // SVGAnimatedPropertyTearOff_h
Modified: trunk/Source/WebCore/svg/properties/SVGListProperty.h (208479 => 208480)
--- trunk/Source/WebCore/svg/properties/SVGListProperty.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/properties/SVGListProperty.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -42,7 +42,7 @@
typedef SVGListProperty<PropertyType> Self;
using ListItemType = typename SVGPropertyTraits<PropertyType>::ListItemType;
- using ListItemTearOff = SVGPropertyTearOff<ListItemType>;
+ using ListItemTearOff = typename SVGPropertyTraits<PropertyType>::ListItemTearOff;
using PtrListItemTearOff = RefPtr<ListItemTearOff>;
using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<PropertyType>;
using ListWrapperCache = typename AnimatedListPropertyTearOff::ListWrapperCache;
Modified: trunk/Source/WebCore/svg/properties/SVGListPropertyTearOff.h (208479 => 208480)
--- trunk/Source/WebCore/svg/properties/SVGListPropertyTearOff.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/properties/SVGListPropertyTearOff.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -26,14 +26,14 @@
template<typename PropertyType>
class SVGListPropertyTearOff : public SVGListProperty<PropertyType> {
public:
- typedef SVGListProperty<PropertyType> Base;
- typedef SVGListPropertyTearOff<PropertyType> Self;
+ using Base = SVGListProperty<PropertyType>;
+ using Self = SVGListPropertyTearOff<PropertyType>;
- typedef typename SVGPropertyTraits<PropertyType>::ListItemType ListItemType;
- typedef SVGPropertyTearOff<ListItemType> ListItemTearOff;
- typedef RefPtr<ListItemTearOff> PtrListItemTearOff;
- typedef SVGAnimatedListPropertyTearOff<PropertyType> AnimatedListPropertyTearOff;
- typedef typename SVGAnimatedListPropertyTearOff<PropertyType>::ListWrapperCache ListWrapperCache;
+ using ListItemType = typename SVGPropertyTraits<PropertyType>::ListItemType;
+ using ListItemTearOff = typename SVGPropertyTraits<PropertyType>::ListItemTearOff;
+ using PtrListItemTearOff = RefPtr<ListItemTearOff>;
+ using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<PropertyType>;
+ using ListWrapperCache = typename SVGAnimatedListPropertyTearOff<PropertyType>::ListWrapperCache;
using Base::m_role;
using Base::m_values;
Modified: trunk/Source/WebCore/svg/properties/SVGPropertyTearOff.h (208479 => 208480)
--- trunk/Source/WebCore/svg/properties/SVGPropertyTearOff.h 2016-11-09 21:27:56 UTC (rev 208479)
+++ trunk/Source/WebCore/svg/properties/SVGPropertyTearOff.h 2016-11-09 21:30:41 UTC (rev 208480)
@@ -20,22 +20,25 @@
#pragma once
+#include "ExceptionOr.h"
#include "SVGAnimatedProperty.h"
-#include "SVGElement.h"
#include "SVGProperty.h"
#include <wtf/WeakPtr.h>
namespace WebCore {
+class SVGElement;
+
class SVGPropertyTearOffBase : public SVGProperty {
public:
virtual void detachWrapper() = 0;
};
-template<typename PropertyType>
+template<typename T>
class SVGPropertyTearOff : public SVGPropertyTearOffBase {
public:
- typedef SVGPropertyTearOff<PropertyType> Self;
+ using PropertyType = T;
+ using Self = SVGPropertyTearOff<PropertyType>;
// Used for child types (baseVal/animVal) of a SVGAnimated* property (for example: SVGAnimatedLength::baseVal()).
// Also used for list tear offs (for example: text.x.baseVal.getItem(0)).
@@ -56,7 +59,7 @@
return adoptRef(*new Self(initialValue));
}
- template<typename T> static ExceptionOr<Ref<Self>> create(ExceptionOr<T>&& initialValue)
+ template<typename U> static ExceptionOr<Ref<Self>> create(ExceptionOr<U>&& initialValue)
{
if (initialValue.hasException())
return initialValue.releaseException();