Changeset 230829 in webkit


Ignore:
Timestamp:
Apr 19, 2018 6:00:40 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

Introduce SVGGeometryElement interface
https://bugs.webkit.org/show_bug.cgi?id=184768

Source/WebCore:

Patch by Dirk Schulze <krit@webbkit.org> on 2018-04-19
Reviewed by Antti Koivisto.

Start implementing SVGGeometryElement interface from SVG2.
https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement

Start with SVGPathElement only for now. Also, just inferface gets implemented
by this patch. No new functionality like isPointInFill yet.
Fix getPointAtLength and make it more restrictive. This follows the spec and
all other implementations.

Added additional test scenarios to existing tests.

  • CMakeLists.txt:
  • DerivedSources.make:
  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/scripts/CodeGeneratorJS.pm:

(GetGnuVTableOffsetForType):

  • svg/SVGAllInOne.cpp:
  • svg/SVGGeometryElement.cpp: Added.

(WebCore::SVGGeometryElement::SVGGeometryElement):
(WebCore::SVGGeometryElement::isSupportedAttribute):
(WebCore::SVGGeometryElement::parseAttribute):
(WebCore::SVGGeometryElement::svgAttributeChanged):
(WebCore::SVGGeometryElement::createElementRenderer):

  • svg/SVGGeometryElement.h: Added.
  • svg/SVGGeometryElement.idl: Added.
  • svg/SVGGradientElement.cpp:
  • svg/SVGPathElement.cpp:

(WebCore::SVGPathElement::SVGPathElement):
(WebCore::SVGPathElement::parseAttribute):
(WebCore::SVGPathElement::svgAttributeChanged):
(WebCore::SVGPathElement::insertedIntoAncestor):
(WebCore::SVGPathElement::removedFromAncestor):

  • svg/SVGPathElement.h:
  • svg/SVGPathElement.idl:

LayoutTests:

Patch by Dirk Schulze <krit@webkit.org> on 2018-04-19
Reviewed by Antti Koivisto.

Start implementing SVGGeometryElement interface from SVG2.

  • svg/dom/SVGPolygonElement-baseVal-list-removal-crash.html: pointAtLength requires value now.
  • svg/dom/path-pointAtLength-expected.txt:
  • svg/dom/path-pointAtLength.html: Added throw tests for pointAtLength.
  • svg/dom/svg2-inheritance-expected.txt: Inheritance fixed for SVGPathElement only for now.
Location:
trunk
Files:
3 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r230828 r230829  
     12018-04-19  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-19  Tadeu Zagallo  <tzagallo@apple.com>
    216
  • trunk/LayoutTests/svg/dom/SVGPolygonElement-baseVal-list-removal-crash.html

    r124380 r230829  
    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);
  • trunk/LayoutTests/svg/dom/path-pointAtLength-expected.txt

    r66979 r230829  
    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
  • trunk/LayoutTests/svg/dom/path-pointAtLength.html

    r217390 r230829  
    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;
  • trunk/LayoutTests/svg/dom/svg2-inheritance-expected.txt

    r179810 r230829  
    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
     
    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
  • trunk/Source/WebCore/CMakeLists.txt

    r230715 r230829  
    941941    svg/SVGForeignObjectElement.idl
    942942    svg/SVGGElement.idl
     943    svg/SVGGeometryElement.idl
    943944    svg/SVGGlyphElement.idl
    944945    svg/SVGGlyphRefElement.idl
  • trunk/Source/WebCore/ChangeLog

    r230828 r230829  
     12018-04-19  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-19  Tadeu Zagallo  <tzagallo@apple.com>
    244
  • trunk/Source/WebCore/DerivedSources.make

    r230715 r230829  
    869869    $(WebCore)/svg/SVGForeignObjectElement.idl \
    870870    $(WebCore)/svg/SVGGElement.idl \
     871    $(WebCore)/svg/SVGGeometryElement.idl \
    871872    $(WebCore)/svg/SVGGlyphElement.idl \
    872873    $(WebCore)/svg/SVGGlyphRefElement.idl \
  • trunk/Source/WebCore/Sources.txt

    r230794 r230829  
    21482148svg/SVGForeignObjectElement.cpp
    21492149svg/SVGGElement.cpp
     2150svg/SVGGeometryElement.cpp
    21502151svg/SVGGlyphElement.cpp
    21512152svg/SVGGlyphRefElement.cpp
     
    29222923JSSVGForeignObjectElement.cpp
    29232924JSSVGGElement.cpp
     2925JSSVGGeometryElement.cpp
    29242926JSSVGGlyphElement.cpp
    29252927JSSVGGlyphRefElement.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r230812 r230829  
    48164816                FABE72F91059C1EB00D999DD /* MathMLMathElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FABE72F21059C1EB00D999DD /* MathMLMathElement.h */; };
    48174817                FABE72FE1059C21100D999DD /* MathMLNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FABE72FC1059C21100D999DD /* MathMLNames.cpp */; };
     4818                FB273E822086E6C700A54E87 /* SVGGeometryElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FB273E7F2086E6A300A54E87 /* SVGGeometryElement.h */; };
     4819                FB273E852086E74D00A54E87 /* JSSVGGeometryElement.h in Headers */ = {isa = PBXBuildFile; fileRef = FB273E842086E73E00A54E87 /* JSSVGGeometryElement.h */; };
    48184820                FB2C15C3165D649D0039C9F8 /* CachedSVGDocumentReference.h in Headers */ = {isa = PBXBuildFile; fileRef = FB2C15C2165D64900039C9F8 /* CachedSVGDocumentReference.h */; settings = {ATTRIBUTES = (Private, ); }; };
    48194821                FB3056C2169E5DAC0096A232 /* CSSGroupingRule.h in Headers */ = {isa = PBXBuildFile; fileRef = FB3056C1169E5DAC0096A232 /* CSSGroupingRule.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    1451614518                FABE72FB1059C21100D999DD /* MathMLElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLElementFactory.cpp; sourceTree = "<group>"; };
    1451714519                FABE72FC1059C21100D999DD /* MathMLNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLNames.cpp; sourceTree = "<group>"; };
     14520                FB273E7E2086E6A300A54E87 /* SVGGeometryElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGGeometryElement.cpp; sourceTree = "<group>"; };
     14521                FB273E7F2086E6A300A54E87 /* SVGGeometryElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGGeometryElement.h; sourceTree = "<group>"; };
     14522                FB273E802086E6A300A54E87 /* SVGGeometryElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SVGGeometryElement.idl; sourceTree = "<group>"; };
     14523                FB273E832086E73E00A54E87 /* JSSVGGeometryElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGGeometryElement.cpp; sourceTree = SOURCE_ROOT; };
     14524                FB273E842086E73E00A54E87 /* JSSVGGeometryElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSVGGeometryElement.h; sourceTree = SOURCE_ROOT; };
    1451814525                FB2C15C2165D64900039C9F8 /* CachedSVGDocumentReference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedSVGDocumentReference.h; sourceTree = "<group>"; };
    1451914526                FB3056C1169E5DAC0096A232 /* CSSGroupingRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSGroupingRule.h; sourceTree = "<group>"; };
     
    2192521932                                B2FA3CB20AB75A6E000E5AC4 /* JSSVGGElement.cpp */,
    2192621933                                B2FA3CB30AB75A6E000E5AC4 /* JSSVGGElement.h */,
     21934                                FB273E832086E73E00A54E87 /* JSSVGGeometryElement.cpp */,
     21935                                FB273E842086E73E00A54E87 /* JSSVGGeometryElement.h */,
    2192721936                                B27B28210CEF0C0700D39D54 /* JSSVGGlyphElement.cpp */,
    2192821937                                B27B28220CEF0C0700D39D54 /* JSSVGGlyphElement.h */,
     
    2287722886                                B22278910D00BF200071B782 /* SVGGElement.h */,
    2287822887                                B22278920D00BF200071B782 /* SVGGElement.idl */,
     22888                                FB273E7E2086E6A300A54E87 /* SVGGeometryElement.cpp */,
     22889                                FB273E7F2086E6A300A54E87 /* SVGGeometryElement.h */,
     22890                                FB273E802086E6A300A54E87 /* SVGGeometryElement.idl */,
    2287922891                                B2A1F2A40CEF0ABF00442F6A /* SVGGlyphElement.cpp */,
    2288022892                                B2A1F2A50CEF0ABF00442F6A /* SVGGlyphElement.h */,
     
    2874028752                                B2FA3D990AB75A6F000E5AC4 /* JSSVGForeignObjectElement.h in Headers */,
    2874128753                                B2FA3D9B0AB75A6F000E5AC4 /* JSSVGGElement.h in Headers */,
     28754                                FB273E852086E74D00A54E87 /* JSSVGGeometryElement.h in Headers */,
    2874228755                                B27B28280CEF0C0700D39D54 /* JSSVGGlyphElement.h in Headers */,
    2874328756                                24D9129A13CA971400D21915 /* JSSVGGlyphRefElement.h in Headers */,
     
    3014130154                                B2227A240D00BF220071B782 /* SVGForeignObjectElement.h in Headers */,
    3014230155                                B2227A270D00BF220071B782 /* SVGGElement.h in Headers */,
     30156                                FB273E822086E6C700A54E87 /* SVGGeometryElement.h in Headers */,
    3014330157                                B2A1F2AE0CEF0ABF00442F6A /* SVGGlyphElement.h in Headers */,
    3014430158                                24D912BE13CA9A9700D21915 /* SVGGlyphRefElement.h in Headers */,
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r230789 r230829  
    35613561        || $typename eq "SVGRectElement"
    35623562        || $typename eq "SVGSVGElement"
     3563        || $typename eq "SVGGeometryElement"
    35633564        || $typename eq "SVGGraphicsElement"
    35643565        || $typename eq "SVGSwitchElement"
  • trunk/Source/WebCore/svg/SVGAllInOne.cpp

    r219712 r230829  
    103103#include "SVGForeignObjectElement.cpp"
    104104#include "SVGGElement.cpp"
     105#include "SVGGeometryElement.cpp"
    105106#include "SVGGlyphElement.cpp"
    106107#include "SVGGlyphRefElement.cpp"
  • trunk/Source/WebCore/svg/SVGGradientElement.cpp

    r229694 r230829  
    2525#include "ElementIterator.h"
    2626#include "RenderSVGHiddenContainer.h"
    27 #include "RenderSVGPath.h"
    2827#include "RenderSVGResourceLinearGradient.h"
    2928#include "RenderSVGResourceRadialGradient.h"
  • trunk/Source/WebCore/svg/SVGPathElement.cpp

    r229830 r230829  
    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)
     
    241241    }
    242242
    243     SVGGraphicsElement::parseAttribute(name, value);
     243    SVGGeometryElement::parseAttribute(name, value);
    244244    SVGExternalResourcesRequired::parseAttribute(name, value);
    245245}
     
    248248{
    249249    if (!isSupportedAttribute(attrName)) {
    250         SVGGraphicsElement::svgAttributeChanged(attrName);
     250        SVGGeometryElement::svgAttributeChanged(attrName);
    251251        return;
    252252    }
     
    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;
     
    294294void SVGPathElement::removedFromAncestor(RemovalType removalType, ContainerNode& oldParentOfRemovedTree)
    295295{
    296     SVGGraphicsElement::removedFromAncestor(removalType, oldParentOfRemovedTree);
     296    SVGGeometryElement::removedFromAncestor(removalType, oldParentOfRemovedTree);
    297297    invalidateMPathDependencies();
    298298}
  • trunk/Source/WebCore/svg/SVGPathElement.h

    r229694 r230829  
    2525#include "SVGAnimatedNumber.h"
    2626#include "SVGExternalResourcesRequired.h"
    27 #include "SVGGraphicsElement.h"
     27#include "SVGGeometryElement.h"
    2828#include "SVGNames.h"
    2929#include "SVGPathByteStream.h"
     
    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
  • trunk/Source/WebCore/svg/SVGPathElement.idl

    r208705 r230829  
    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
Note: See TracChangeset for help on using the changeset viewer.