Source/WebCore/ChangeLog

 12018-04-18 Dirk Schulze <krit@webbkit.org>
 2
 3 Introduce SVGGeometryElement interface
 4 https://bugs.webkit.org/show_bug.cgi?id=184768
 5
 6 Reviewed by Antti Koivisto.
 7
 8 Start implementing SVGGeometryElement interface from SVG2.
 9 https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement
 10
 11 Start with SVGPathElement only for now. Also, just inferface gets implemented
 12 by this patch. No new functionality like isPointInFill yet.
 13 Fix getPointAtLength and make it more restrictive. This follows the spec and
 14 all other implementations.
 15
 16 Added additional test scenarios to existing tests.
 17
 18 * CMakeLists.txt:
 19 * DerivedSources.make:
 20 * Sources.txt:
 21 * WebCore.xcodeproj/project.pbxproj:
 22 * bindings/scripts/CodeGeneratorJS.pm:
 23 (GetGnuVTableOffsetForType):
 24 * svg/SVGAllInOne.cpp:
 25 * svg/SVGGeometryElement.cpp: Added.
 26 (WebCore::SVGGeometryElement::SVGGeometryElement):
 27 (WebCore::SVGGeometryElement::isSupportedAttribute):
 28 (WebCore::SVGGeometryElement::parseAttribute):
 29 (WebCore::SVGGeometryElement::svgAttributeChanged):
 30 (WebCore::SVGGeometryElement::createElementRenderer):
 31 * svg/SVGGeometryElement.h: Added.
 32 * svg/SVGGeometryElement.idl: Added.
 33 * svg/SVGGradientElement.cpp:
 34 * svg/SVGPathElement.cpp:
 35 (WebCore::SVGPathElement::SVGPathElement):
 36 (WebCore::SVGPathElement::parseAttribute):
 37 (WebCore::SVGPathElement::svgAttributeChanged):
 38 (WebCore::SVGPathElement::insertedIntoAncestor):
 39 (WebCore::SVGPathElement::removedFromAncestor):
 40 * svg/SVGPathElement.h:
 41 * svg/SVGPathElement.idl:
 42
1432018-04-16 Antoine Quint <graouts@apple.com>
244
345 [Web Animations] Ensure we never return -0 through the API

Source/WebCore/CMakeLists.txt

@@set(WebCore_SVG_IDL_FILES
939939 svg/SVGFontFaceUriElement.idl
940940 svg/SVGForeignObjectElement.idl
941941 svg/SVGGElement.idl
 942 svg/SVGGeometryElement.idl
942943 svg/SVGGlyphElement.idl
943944 svg/SVGGlyphRefElement.idl
944945 svg/SVGGradientElement.idl

Source/WebCore/DerivedSources.make

@@JS_BINDING_IDLS = \
867867 $(WebCore)/svg/SVGFontFaceUriElement.idl \
868868 $(WebCore)/svg/SVGForeignObjectElement.idl \
869869 $(WebCore)/svg/SVGGElement.idl \
 870 $(WebCore)/svg/SVGGeometryElement.idl \
870871 $(WebCore)/svg/SVGGlyphElement.idl \
871872 $(WebCore)/svg/SVGGlyphRefElement.idl \
872873 $(WebCore)/svg/SVGGradientElement.idl \

Source/WebCore/Sources.txt

@@svg/SVGFontFaceSrcElement.cpp
21442144svg/SVGFontFaceUriElement.cpp
21452145svg/SVGForeignObjectElement.cpp
21462146svg/SVGGElement.cpp
 2147svg/SVGGeometryElement.cpp
21472148svg/SVGGlyphElement.cpp
21482149svg/SVGGlyphRefElement.cpp
21492150svg/SVGGradientElement.cpp

@@JSSVGFontFaceSrcElement.cpp
29172918JSSVGFontFaceUriElement.cpp
29182919JSSVGForeignObjectElement.cpp
29192920JSSVGGElement.cpp
 2921JSSVGGeometryElement.cpp
29202922JSSVGGlyphElement.cpp
29212923JSSVGGlyphRefElement.cpp
29222924JSSVGGradientElement.cpp

Source/WebCore/WebCore.xcodeproj/project.pbxproj

48124812 FABE72F71059C1EB00D999DD /* MathMLPresentationElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FABE72F01059C1EB00D999DD /* MathMLPresentationElement.h */; };
48134813 FABE72F91059C1EB00D999DD /* MathMLMathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FABE72F21059C1EB00D999DD /* MathMLMathElement.h */; };
48144814 FABE72FE1059C21100D999DD /* MathMLNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FABE72FC1059C21100D999DD /* MathMLNames.cpp */; };
 4815 FB273E822086E6C700A54E87 /* SVGGeometryElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FB273E7F2086E6A300A54E87 /* SVGGeometryElement.h */; };
 4816 FB273E852086E74D00A54E87 /* JSSVGGeometryElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FB273E842086E73E00A54E87 /* JSSVGGeometryElement.h */; };
48154817 FB2C15C3165D649D0039C9F8 /* CachedSVGDocumentReference.h in Headers */ = {isa = PBXBuildFile; fileRef = FB2C15C2165D64900039C9F8 /* CachedSVGDocumentReference.h */; settings = {ATTRIBUTES = (Private, ); }; };
48164818 FB3056C2169E5DAC0096A232 /* CSSGroupingRule.h in Headers */ = {isa = PBXBuildFile; fileRef = FB3056C1169E5DAC0096A232 /* CSSGroupingRule.h */; settings = {ATTRIBUTES = (Private, ); }; };
48174819 FB484F4D171F821E00040755 /* TransformFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = FB484F4B171F821E00040755 /* TransformFunctions.h */; };

1450314505 FABE72F31059C1EB00D999DD /* mathtags.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mathtags.in; sourceTree = "<group>"; };
1450414506 FABE72FB1059C21100D999DD /* MathMLElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLElementFactory.cpp; sourceTree = "<group>"; };
1450514507 FABE72FC1059C21100D999DD /* MathMLNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLNames.cpp; sourceTree = "<group>"; };
 14508 FB273E7E2086E6A300A54E87 /* SVGGeometryElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGGeometryElement.cpp; sourceTree = "<group>"; };
 14509 FB273E7F2086E6A300A54E87 /* SVGGeometryElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGGeometryElement.h; sourceTree = "<group>"; };
 14510 FB273E802086E6A300A54E87 /* SVGGeometryElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SVGGeometryElement.idl; sourceTree = "<group>"; };
 14511 FB273E832086E73E00A54E87 /* JSSVGGeometryElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGGeometryElement.cpp; sourceTree = SOURCE_ROOT; };
 14512 FB273E842086E73E00A54E87 /* JSSVGGeometryElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSVGGeometryElement.h; sourceTree = SOURCE_ROOT; };
1450614513 FB2C15C2165D64900039C9F8 /* CachedSVGDocumentReference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedSVGDocumentReference.h; sourceTree = "<group>"; };
1450714514 FB3056C1169E5DAC0096A232 /* CSSGroupingRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSGroupingRule.h; sourceTree = "<group>"; };
1450814515 FB484F4A171F821E00040755 /* TransformFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TransformFunctions.cpp; sourceTree = "<group>"; };

2190721914 B2FA3CB10AB75A6E000E5AC4 /* JSSVGForeignObjectElement.h */,
2190821915 B2FA3CB20AB75A6E000E5AC4 /* JSSVGGElement.cpp */,
2190921916 B2FA3CB30AB75A6E000E5AC4 /* JSSVGGElement.h */,
 21917 FB273E832086E73E00A54E87 /* JSSVGGeometryElement.cpp */,
 21918 FB273E842086E73E00A54E87 /* JSSVGGeometryElement.h */,
2191021919 B27B28210CEF0C0700D39D54 /* JSSVGGlyphElement.cpp */,
2191121920 B27B28220CEF0C0700D39D54 /* JSSVGGlyphElement.h */,
2191221921 24D9129713CA96DE00D21915 /* JSSVGGlyphRefElement.cpp */,

2285922868 B22278900D00BF200071B782 /* SVGGElement.cpp */,
2286022869 B22278910D00BF200071B782 /* SVGGElement.h */,
2286122870 B22278920D00BF200071B782 /* SVGGElement.idl */,
 22871 FB273E7E2086E6A300A54E87 /* SVGGeometryElement.cpp */,
 22872 FB273E7F2086E6A300A54E87 /* SVGGeometryElement.h */,
 22873 FB273E802086E6A300A54E87 /* SVGGeometryElement.idl */,
2286222874 B2A1F2A40CEF0ABF00442F6A /* SVGGlyphElement.cpp */,
2286322875 B2A1F2A50CEF0ABF00442F6A /* SVGGlyphElement.h */,
2286422876 B2A1F2A60CEF0ABF00442F6A /* SVGGlyphElement.idl */,

2871228724 A83B78FC0CCAFF15000B0825 /* JSSVGFontFaceUriElement.h in Headers */,
2871328725 B2FA3D990AB75A6F000E5AC4 /* JSSVGForeignObjectElement.h in Headers */,
2871428726 B2FA3D9B0AB75A6F000E5AC4 /* JSSVGGElement.h in Headers */,
 28727 FB273E852086E74D00A54E87 /* JSSVGGeometryElement.h in Headers */,
2871528728 B27B28280CEF0C0700D39D54 /* JSSVGGlyphElement.h in Headers */,
2871628729 24D9129A13CA971400D21915 /* JSSVGGlyphRefElement.h in Headers */,
2871728730 B2FA3D9D0AB75A6F000E5AC4 /* JSSVGGradientElement.h in Headers */,

3011330126 B2227A210D00BF220071B782 /* SVGFontFaceUriElement.h in Headers */,
3011430127 B2227A240D00BF220071B782 /* SVGForeignObjectElement.h in Headers */,
3011530128 B2227A270D00BF220071B782 /* SVGGElement.h in Headers */,
 30129 FB273E822086E6C700A54E87 /* SVGGeometryElement.h in Headers */,
3011630130 B2A1F2AE0CEF0ABF00442F6A /* SVGGlyphElement.h in Headers */,
3011730131 24D912BE13CA9A9700D21915 /* SVGGlyphRefElement.h in Headers */,
3011830132 B2227A2A0D00BF220071B782 /* SVGGradientElement.h in Headers */,

Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

@@sub GetGnuVTableOffsetForType
35513551 || $typename eq "SVGPolylineElement"
35523552 || $typename eq "SVGRectElement"
35533553 || $typename eq "SVGSVGElement"
 3554 || $typename eq "SVGGeometryElement"
35543555 || $typename eq "SVGGraphicsElement"
35553556 || $typename eq "SVGSwitchElement"
35563557 || $typename eq "SVGTextElement"

Source/WebCore/svg/SVGAllInOne.cpp

102102#include "SVGFontFaceUriElement.cpp"
103103#include "SVGForeignObjectElement.cpp"
104104#include "SVGGElement.cpp"
 105#include "SVGGeometryElement.cpp"
105106#include "SVGGlyphElement.cpp"
106107#include "SVGGlyphRefElement.cpp"
107108#include "SVGGradientElement.cpp"

Source/WebCore/svg/SVGGeometryElement.cpp

 1/*
 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
 4 * Copyright (C) 2018 Apple Inc. All rights reserved.
 5 * Copyright (C) 2018 Adobe Systems Incorporated. All rights reserved.
 6 *
 7 * This library is free software; you can redistribute it and/or
 8 * modify it under the terms of the GNU Library General Public
 9 * License as published by the Free Software Foundation; either
 10 * version 2 of the License, or (at your option) any later version.
 11 *
 12 * This library is distributed in the hope that it will be useful,
 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 15 * Library General Public License for more details.
 16 *
 17 * You should have received a copy of the GNU Library General Public License
 18 * along with this library; see the file COPYING.LIB. If not, write to
 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 20 * Boston, MA 02110-1301, USA.
 21 */
 22
 23#include "config.h"
 24#include "SVGGeometryElement.h"
 25
 26#include "RenderSVGPath.h"
 27#include "RenderSVGResource.h"
 28#include "SVGDocumentExtensions.h"
 29#include "SVGMPathElement.h"
 30#include "SVGNames.h"
 31#include "SVGPathUtilities.h"
 32#include "SVGPoint.h"
 33#include <wtf/IsoMallocInlines.h>
 34#include <wtf/NeverDestroyed.h>
 35
 36namespace WebCore {
 37
 38WTF_MAKE_ISO_ALLOCATED_IMPL(SVGGeometryElement);
 39
 40// Animated property definitions
 41DEFINE_ANIMATED_NUMBER(SVGGeometryElement, SVGNames::pathLengthAttr, PathLength, pathLength)
 42
 43BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGeometryElement)
 44 REGISTER_LOCAL_ANIMATED_PROPERTY(pathLength)
 45 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
 46END_REGISTER_ANIMATED_PROPERTIES
 47
 48SVGGeometryElement::SVGGeometryElement(const QualifiedName& tagName, Document& document)
 49 : SVGGraphicsElement(tagName, document)
 50{
 51 registerAnimatedPropertiesForSVGGeometryElement();
 52}
 53
 54bool SVGGeometryElement::isSupportedAttribute(const QualifiedName& attrName)
 55{
 56 static const auto supportedAttributes = makeNeverDestroyed([] {
 57 HashSet<QualifiedName> set;
 58 SVGLangSpace::addSupportedAttributes(set);
 59 SVGExternalResourcesRequired::addSupportedAttributes(set);
 60 set.add({ SVGNames::pathLengthAttr.get() });
 61 return set;
 62 }());
 63 return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
 64}
 65
 66void SVGGeometryElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 67{
 68 if (name == SVGNames::pathLengthAttr) {
 69 setPathLengthBaseValue(value.toFloat());
 70 if (pathLengthBaseValue() < 0)
 71 document().accessSVGExtensions().reportError("A negative value for path attribute <pathLength> is not allowed");
 72 return;
 73 }
 74
 75 SVGGraphicsElement::parseAttribute(name, value);
 76}
 77
 78void SVGGeometryElement::svgAttributeChanged(const QualifiedName& attrName)
 79{
 80 if (!isSupportedAttribute(attrName)) {
 81 SVGGraphicsElement::svgAttributeChanged(attrName);
 82 return;
 83 }
 84
 85 InstanceInvalidationGuard guard(*this);
 86
 87 ASSERT_NOT_REACHED();
 88}
 89
 90RenderPtr<RenderElement> SVGGeometryElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
 91{
 92 return createRenderer<RenderSVGPath>(*this, WTFMove(style));
 93}
 94
 95}

Source/WebCore/svg/SVGGeometryElement.h

 1/*
 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
 4 * Copyright (C) 2018 Adobe Systems Incorporated. All rights reserved.
 5 *
 6 * This library is free software; you can redistribute it and/or
 7 * modify it under the terms of the GNU Library General Public
 8 * License as published by the Free Software Foundation; either
 9 * version 2 of the License, or (at your option) any later version.
 10 *
 11 * This library is distributed in the hope that it will be useful,
 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 14 * Library General Public License for more details.
 15 *
 16 * You should have received a copy of the GNU Library General Public License
 17 * along with this library; see the file COPYING.LIB. If not, write to
 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 19 * Boston, MA 02110-1301, USA.
 20 */
 21
 22#pragma once
 23
 24#include "Path.h"
 25#include "SVGAnimatedBoolean.h"
 26#include "SVGAnimatedNumber.h"
 27#include "SVGExternalResourcesRequired.h"
 28#include "SVGGraphicsElement.h"
 29#include "SVGNames.h"
 30
 31namespace WebCore {
 32
 33class SVGPoint;
 34
 35class SVGGeometryElement : public SVGGraphicsElement {
 36 WTF_MAKE_ISO_ALLOCATED(SVGGeometryElement);
 37public:
 38
 39 virtual float getTotalLength() const = 0;
 40 virtual Ref<SVGPoint> getPointAtLength(float distance) const = 0;
 41
 42protected:
 43 SVGGeometryElement(const QualifiedName&, Document&);
 44
 45 static bool isSupportedAttribute(const QualifiedName&);
 46 void parseAttribute(const QualifiedName&, const AtomicString&) override;
 47 void svgAttributeChanged(const QualifiedName&) override;
 48
 49 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGGeometryElement)
 50 DECLARE_ANIMATED_NUMBER(PathLength, pathLength)
 51 END_DECLARE_ANIMATED_PROPERTIES
 52
 53 RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
 54};
 55
 56} // namespace WebCore

Source/WebCore/svg/SVGGeometryElement.idl

 1/*
 2 * Copyright (C) 2018 Adobe Systems Incorporated. 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
 6 * are met:
 7 * 1. Redistributions of source code must retain the above copyright
 8 * notice, this list of conditions and the following disclaimer.
 9 * 2. Redistributions in binary form must reproduce the above copyright
 10 * notice, this list of conditions and the following disclaimer in the
 11 * documentation and/or other materials provided with the distribution.
 12 *
 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24 */
 25
 26// [Exposed=Window]
 27interface SVGGeometryElement : SVGGraphicsElement {
 28 readonly attribute SVGAnimatedNumber pathLength; // FIXME: Should be [SameObject].
 29
 30 // boolean isPointInFill(DOMPointInit point);
 31 // boolean isPointInStroke(DOMPointInit point);
 32 unrestricted float getTotalLength();
 33 [NewObject] SVGPoint getPointAtLength(float distance);
 34};

Source/WebCore/svg/SVGGradientElement.cpp

2424
2525#include "ElementIterator.h"
2626#include "RenderSVGHiddenContainer.h"
27 #include "RenderSVGPath.h"
2827#include "RenderSVGResourceLinearGradient.h"
2928#include "RenderSVGResourceRadialGradient.h"
3029#include "SVGNames.h"

Source/WebCore/svg/SVGPathElement.cpp

@@BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPathElement)
7979 REGISTER_LOCAL_ANIMATED_PROPERTY(d)
8080 REGISTER_LOCAL_ANIMATED_PROPERTY(pathLength)
8181 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
82  REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
 82 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGeometryElement)
8383END_REGISTER_ANIMATED_PROPERTIES
8484
8585inline SVGPathElement::SVGPathElement(const QualifiedName& tagName, Document& document)
86  : SVGGraphicsElement(tagName, document)
 86 : SVGGeometryElement(tagName, document)
8787 , m_pathSegList(PathSegUnalteredRole)
8888 , m_isAnimValObserved(false)
8989{

@@void SVGPathElement::parseAttribute(const QualifiedName& name, const AtomicStrin
240240 return;
241241 }
242242
243  SVGGraphicsElement::parseAttribute(name, value);
 243 SVGGeometryElement::parseAttribute(name, value);
244244 SVGExternalResourcesRequired::parseAttribute(name, value);
245245}
246246
247247void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName)
248248{
249249 if (!isSupportedAttribute(attrName)) {
250  SVGGraphicsElement::svgAttributeChanged(attrName);
 250 SVGGeometryElement::svgAttributeChanged(attrName);
251251 return;
252252 }
253253

@@void SVGPathElement::invalidateMPathDependencies()
286286
287287Node::InsertedIntoAncestorResult SVGPathElement::insertedIntoAncestor(InsertionType insertionType, ContainerNode& parentOfInsertedTree)
288288{
289  SVGGraphicsElement::insertedIntoAncestor(insertionType, parentOfInsertedTree);
 289 SVGGeometryElement::insertedIntoAncestor(insertionType, parentOfInsertedTree);
290290 invalidateMPathDependencies();
291291 return InsertedIntoAncestorResult::Done;
292292}
293293
294294void SVGPathElement::removedFromAncestor(RemovalType removalType, ContainerNode& oldParentOfRemovedTree)
295295{
296  SVGGraphicsElement::removedFromAncestor(removalType, oldParentOfRemovedTree);
 296 SVGGeometryElement::removedFromAncestor(removalType, oldParentOfRemovedTree);
297297 invalidateMPathDependencies();
298298}
299299

Source/WebCore/svg/SVGPathElement.h

2424#include "SVGAnimatedBoolean.h"
2525#include "SVGAnimatedNumber.h"
2626#include "SVGExternalResourcesRequired.h"
27 #include "SVGGraphicsElement.h"
 27#include "SVGGeometryElement.h"
2828#include "SVGNames.h"
2929#include "SVGPathByteStream.h"
3030#include "SVGPathSegListValues.h"

@@class SVGPathSegCurvetoQuadraticSmoothRel;
5353class SVGPathSegList;
5454class SVGPoint;
5555
56 class SVGPathElement final : public SVGGraphicsElement, public SVGExternalResourcesRequired {
 56class SVGPathElement final : public SVGGeometryElement, public SVGExternalResourcesRequired {
5757 WTF_MAKE_ISO_ALLOCATED(SVGPathElement);
5858public:
5959 static Ref<SVGPathElement> create(const QualifiedName&, Document&);
6060
61  float getTotalLength() const;
62  Ref<SVGPoint> getPointAtLength(float distance) const;
 61 float getTotalLength() const final;
 62 Ref<SVGPoint> getPointAtLength(float distance) const final;
6363 unsigned getPathSegAtLength(float distance) const;
6464
6565 Ref<SVGPathSegClosePath> createSVGPathSegClosePath(SVGPathSegRole = PathSegUndefinedRole);

Source/WebCore/svg/SVGPathElement.idl

2424 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525 */
2626
27 interface SVGPathElement : SVGGraphicsElement {
28  readonly attribute SVGAnimatedNumber pathLength;
29 
30  unrestricted float getTotalLength();
31  [NewObject] SVGPoint getPointAtLength(optional unrestricted float distance = NaN);
 27interface SVGPathElement : SVGGeometryElement {
3228 unsigned long getPathSegAtLength(optional unrestricted float distance = NaN);
3329
3430 SVGPathSegClosePath createSVGPathSegClosePath();

LayoutTests/ChangeLog

 12018-04-18 Dirk Schulze <krit@webkit.org>
 2
 3 Introduce SVGGeometryElement interface
 4 https://bugs.webkit.org/show_bug.cgi?id=184768
 5
 6 Reviewed by Antti Koivisto.
 7
 8 Start implementing SVGGeometryElement interface from SVG2.
 9
 10 * svg/dom/SVGPolygonElement-baseVal-list-removal-crash.html: pointAtLength requires value now.
 11 * svg/dom/path-pointAtLength-expected.txt:
 12 * svg/dom/path-pointAtLength.html: Added throw tests for pointAtLength.
 13 * svg/dom/svg2-inheritance-expected.txt: Inheritance fixed for SVGPathElement only for now.
 14
1152018-04-16 Per Arne Vollan <pvollan@apple.com>
216
317 Mark css3/filters/blur-various-radii.html as a crash on Windows.

LayoutTests/svg/dom/SVGPolygonElement-baseVal-list-removal-crash.html

@@if (window.testRunner)
77function go() {
88 var oSVGPolygon = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
99 var oSVGPath = document.createElementNS("http://www.w3.org/2000/svg", "path");
10  var oSVGPoint1 = oSVGPath.getPointAtLength();
 10 var oSVGPoint1 = oSVGPath.getPointAtLength(0);
1111 oSVGPolygon.points.initialize(oSVGPoint1);
1212 oSVGPolygon.points.removeItem(-9223372036854775802);
1313 alert("Accessing old oSVGPoint1.x: " + oSVGPoint1.x);

LayoutTests/svg/dom/path-pointAtLength-expected.txt

@@PASS pointAtLengthOfPath('M0,20 L400,20 L640,20') is '(640, 20)'
77PASS pointAtLengthOfPath('M0,20 L400,20 L640,20 z') is '(580, 20)'
88PASS pointAtLengthOfPath('M0,20 L400,20 z M 320,20 L640,20') is '(100, 20)'
99PASS pointAtLengthOfPath('M0,20 L20,40') is '(20, 40)'
 10PASS pathElement.getPointAtLength(Math.NaN) threw exception TypeError: The provided value is non-finite.
 11PASS pathElement.getPointAtLength() threw exception TypeError: Not enough arguments.
 12PASS pathElement.getPointAtLength(Math.Infinity) threw exception TypeError: The provided value is non-finite.
 13PASS pathElement.getPointAtLength('abc') threw exception TypeError: The provided value is non-finite.
1014PASS successfullyParsed is true
1115
1216TEST COMPLETE

LayoutTests/svg/dom/path-pointAtLength.html

@@shouldBe("pointAtLengthOfPath('M0,20 L400,20 L640,20')", "'(640, 20)'");
2222shouldBe("pointAtLengthOfPath('M0,20 L400,20 L640,20 z')", "'(580, 20)'");
2323shouldBe("pointAtLengthOfPath('M0,20 L400,20 z M 320,20 L640,20')", "'(100, 20)'");
2424shouldBe("pointAtLengthOfPath('M0,20 L20,40')", "'(20, 40)'");
 25shouldThrow("pathElement.getPointAtLength(Math.NaN)");
 26shouldThrow("pathElement.getPointAtLength()");
 27shouldThrow("pathElement.getPointAtLength(Math.Infinity)");
 28shouldThrow("pathElement.getPointAtLength('abc')");
2529
2630var successfullyParsed = true;
2731</script>

LayoutTests/svg/dom/svg2-inheritance-expected.txt

@@PASS SVGFontFaceSrcElement inherits SVGElement
4444PASS SVGFontFaceUriElement inherits SVGElement
4545PASS SVGForeignObjectElement inherits SVGGraphicsElement
4646PASS SVGGElement inherits SVGGraphicsElement
47 FAIL SVGGeometryElement is not defined
 47PASS SVGGeometryElement inherits SVGGraphicsElement
4848PASS SVGGlyphElement inherits SVGElement
4949PASS SVGGlyphRefElement inherits SVGElement
5050PASS SVGGradientElement inherits SVGElement

@@PASS SVGMetadataElement inherits SVGElement
6868PASS SVGMissingGlyphElement inherits SVGElement
6969PASS SVGNumber inherits Object
7070PASS SVGNumberList inherits Object
71 FAIL SVGPathElement should inherit SVGGeometryElement but got SVGGraphicsElement instead
 71PASS SVGPathElement inherits SVGGeometryElement
7272PASS SVGPathSeg inherits Object
7373PASS SVGPathSegArcAbs inherits SVGPathSeg
7474PASS SVGPathSegArcRel inherits SVGPathSeg