⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 249191 in webkit


Ignore:
Timestamp:
Aug 28, 2019, 12:10:44 AM (7 years ago)
Author:
commit-queue@webkit.org
Message:

SVG2: Add length, item getter and item setter to all SVG lists
https://bugs.webkit.org/show_bug.cgi?id=199526

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2019-08-28
Reviewed by Simon Fraser.

Source/WebCore:

-- Implement the SVG2 specs for SVG lists:
https://svgwg.org/svg2-draft/types.html#TermListInterface.

-- Match the arguments' names in the IDL files with the specs.

Tests: svg/dom/SVGLengthList-length-indexed-access.xhtml

svg/dom/SVGPathSegList-length-indexed-access.xhtml

  • svg/SVGLengthList.idl:
  • svg/SVGNumberList.idl:
  • svg/SVGPathSegList.h:
  • svg/SVGPathSegList.idl:
  • svg/SVGPointList.idl:
  • svg/SVGStringList.idl:
  • svg/SVGTransformList.idl:
  • svg/properties/SVGList.h:

(WebCore::SVGList::length const):
(WebCore::SVGList::setItem):

LayoutTests:

  • svg/custom/polyline-points-crash-expected.txt:
  • svg/dom/SVGLengthList-basics-expected.txt:
  • svg/dom/SVGLengthList-length-indexed-access-expected.txt: Added.
  • svg/dom/SVGLengthList-length-indexed-access.xhtml: Added.
  • svg/dom/SVGNumberList-basics-expected.txt:
  • svg/dom/SVGPathSegList-length-indexed-access-expected.txt: Added.
  • svg/dom/SVGPathSegList-length-indexed-access.xhtml: Added.
  • svg/dom/SVGPointList-basics-expected.txt:
  • svg/dom/SVGTransformList-basics-expected.txt:
Location:
trunk
Files:
4 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r249188 r249191  
     12019-08-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        SVG2: Add length, item getter and item setter to all SVG lists
     4        https://bugs.webkit.org/show_bug.cgi?id=199526
     5
     6        Reviewed by Simon Fraser.
     7
     8        * svg/custom/polyline-points-crash-expected.txt:
     9        * svg/dom/SVGLengthList-basics-expected.txt:
     10        * svg/dom/SVGLengthList-length-indexed-access-expected.txt: Added.
     11        * svg/dom/SVGLengthList-length-indexed-access.xhtml: Added.
     12        * svg/dom/SVGNumberList-basics-expected.txt:
     13        * svg/dom/SVGPathSegList-length-indexed-access-expected.txt: Added.
     14        * svg/dom/SVGPathSegList-length-indexed-access.xhtml: Added.
     15        * svg/dom/SVGPointList-basics-expected.txt:
     16        * svg/dom/SVGTransformList-basics-expected.txt:
     17
    1182019-08-27  Fujii Hironori  <Hironori.Fujii@sony.com>
    219
  • trunk/LayoutTests/svg/custom/polyline-points-crash-expected.txt

    r208308 r249191  
    1 Caught exception: TypeError: Argument 1 ('item') to SVGPointList.appendItem must be an instance of SVGPoint
     1Caught exception: TypeError: Argument 1 ('newItem') to SVGPointList.appendItem must be an instance of SVGPoint
    22PASSED -- WebKit did not crash!
  • trunk/LayoutTests/svg/dom/SVGLengthList-basics-expected.txt

    r243515 r249191  
    1313
    1414Test uncommon arguments for initialize()
    15 PASS text1.x.baseVal.initialize(30) threw exception TypeError: Argument 1 ('item') to SVGLengthList.initialize must be an instance of SVGLength.
    16 PASS text1.x.baseVal.initialize('aString') threw exception TypeError: Argument 1 ('item') to SVGLengthList.initialize must be an instance of SVGLength.
    17 PASS text1.x.baseVal.initialize(text1) threw exception TypeError: Argument 1 ('item') to SVGLengthList.initialize must be an instance of SVGLength.
    18 PASS text1.x.baseVal.initialize(null) threw exception TypeError: Argument 1 ('item') to SVGLengthList.initialize must be an instance of SVGLength.
     15PASS text1.x.baseVal.initialize(30) threw exception TypeError: Argument 1 ('newItem') to SVGLengthList.initialize must be an instance of SVGLength.
     16PASS text1.x.baseVal.initialize('aString') threw exception TypeError: Argument 1 ('newItem') to SVGLengthList.initialize must be an instance of SVGLength.
     17PASS text1.x.baseVal.initialize(text1) threw exception TypeError: Argument 1 ('newItem') to SVGLengthList.initialize must be an instance of SVGLength.
     18PASS text1.x.baseVal.initialize(null) threw exception TypeError: Argument 1 ('newItem') to SVGLengthList.initialize must be an instance of SVGLength.
    1919
    2020Test uncommon arguments for getItem()
     
    5757PASS text1.x.baseVal.getItem(2).value is 1500
    5858PASS text1.getAttribute('x') is "500 1000 1500"
    59 PASS text1.x.baseVal.insertItemBefore(30, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.insertItemBefore must be an instance of SVGLength.
    60 PASS text1.x.baseVal.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.insertItemBefore must be an instance of SVGLength.
    61 PASS text1.x.baseVal.insertItemBefore(text1, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.insertItemBefore must be an instance of SVGLength.
    62 PASS text1.x.baseVal.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.insertItemBefore must be an instance of SVGLength.
     59PASS text1.x.baseVal.insertItemBefore(30, 0) threw exception TypeError: Argument 1 ('newItem') to SVGLengthList.insertItemBefore must be an instance of SVGLength.
     60PASS text1.x.baseVal.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('newItem') to SVGLengthList.insertItemBefore must be an instance of SVGLength.
     61PASS text1.x.baseVal.insertItemBefore(text1, 0) threw exception TypeError: Argument 1 ('newItem') to SVGLengthList.insertItemBefore must be an instance of SVGLength.
     62PASS text1.x.baseVal.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('newItem') to SVGLengthList.insertItemBefore must be an instance of SVGLength.
    6363
    6464Set x='1 2 3 4' for text1
     
    9090PASS text1.x.baseVal.replaceItem(text1) threw exception TypeError: Not enough arguments.
    9191PASS text1.x.baseVal.replaceItem(null) threw exception TypeError: Not enough arguments.
    92 PASS text1.x.baseVal.replaceItem(30, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.replaceItem must be an instance of SVGLength.
    93 PASS text1.x.baseVal.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.replaceItem must be an instance of SVGLength.
    94 PASS text1.x.baseVal.replaceItem(text1, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.replaceItem must be an instance of SVGLength.
    95 PASS text1.x.baseVal.replaceItem(null, 0) threw exception TypeError: Argument 1 ('item') to SVGLengthList.replaceItem must be an instance of SVGLength.
     92PASS text1.x.baseVal.replaceItem(30, 0) threw exception TypeError: Argument 1 ('newItem') to SVGLengthList.replaceItem must be an instance of SVGLength.
     93PASS text1.x.baseVal.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('newItem') to SVGLengthList.replaceItem must be an instance of SVGLength.
     94PASS text1.x.baseVal.replaceItem(text1, 0) threw exception TypeError: Argument 1 ('newItem') to SVGLengthList.replaceItem must be an instance of SVGLength.
     95PASS text1.x.baseVal.replaceItem(null, 0) threw exception TypeError: Argument 1 ('newItem') to SVGLengthList.replaceItem must be an instance of SVGLength.
    9696PASS text1.x.baseVal.replaceItem(text1.x.baseVal.getItem(0), 0) is text1.x.baseVal.getItem(0)
    9797PASS text1.x.baseVal.numberOfItems is 4
     
    162162
    163163Test uncommon arguments for appendItem()
    164 PASS text1.x.baseVal.appendItem(30) threw exception TypeError: Argument 1 ('item') to SVGLengthList.appendItem must be an instance of SVGLength.
    165 PASS text1.x.baseVal.appendItem('aString') threw exception TypeError: Argument 1 ('item') to SVGLengthList.appendItem must be an instance of SVGLength.
    166 PASS text1.x.baseVal.appendItem(text1) threw exception TypeError: Argument 1 ('item') to SVGLengthList.appendItem must be an instance of SVGLength.
    167 PASS text1.x.baseVal.appendItem(null) threw exception TypeError: Argument 1 ('item') to SVGLengthList.appendItem must be an instance of SVGLength.
     164PASS text1.x.baseVal.appendItem(30) threw exception TypeError: Argument 1 ('newItem') to SVGLengthList.appendItem must be an instance of SVGLength.
     165PASS text1.x.baseVal.appendItem('aString') threw exception TypeError: Argument 1 ('newItem') to SVGLengthList.appendItem must be an instance of SVGLength.
     166PASS text1.x.baseVal.appendItem(text1) threw exception TypeError: Argument 1 ('newItem') to SVGLengthList.appendItem must be an instance of SVGLength.
     167PASS text1.x.baseVal.appendItem(null) threw exception TypeError: Argument 1 ('newItem') to SVGLengthList.appendItem must be an instance of SVGLength.
    168168
    169169Testing animVal clear throws
  • trunk/LayoutTests/svg/dom/SVGNumberList-basics-expected.txt

    r243362 r249191  
    1010
    1111Test uncommon arguments for initialize()
    12 PASS text1.rotate.baseVal.initialize(30) threw exception TypeError: Argument 1 ('item') to SVGNumberList.initialize must be an instance of SVGNumber.
    13 PASS text1.rotate.baseVal.initialize('aString') threw exception TypeError: Argument 1 ('item') to SVGNumberList.initialize must be an instance of SVGNumber.
    14 PASS text1.rotate.baseVal.initialize(text1) threw exception TypeError: Argument 1 ('item') to SVGNumberList.initialize must be an instance of SVGNumber.
    15 PASS text1.rotate.baseVal.initialize(null) threw exception TypeError: Argument 1 ('item') to SVGNumberList.initialize must be an instance of SVGNumber.
     12PASS text1.rotate.baseVal.initialize(30) threw exception TypeError: Argument 1 ('newItem') to SVGNumberList.initialize must be an instance of SVGNumber.
     13PASS text1.rotate.baseVal.initialize('aString') threw exception TypeError: Argument 1 ('newItem') to SVGNumberList.initialize must be an instance of SVGNumber.
     14PASS text1.rotate.baseVal.initialize(text1) threw exception TypeError: Argument 1 ('newItem') to SVGNumberList.initialize must be an instance of SVGNumber.
     15PASS text1.rotate.baseVal.initialize(null) threw exception TypeError: Argument 1 ('newItem') to SVGNumberList.initialize must be an instance of SVGNumber.
    1616
    1717Test uncommon arguments for getItem()
     
    5454PASS text1.rotate.baseVal.getItem(2).value is 270
    5555PASS text1.getAttribute('rotate') is "90 180 270"
    56 PASS text1.rotate.baseVal.insertItemBefore(30, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.insertItemBefore must be an instance of SVGNumber.
    57 PASS text1.rotate.baseVal.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.insertItemBefore must be an instance of SVGNumber.
    58 PASS text1.rotate.baseVal.insertItemBefore(text1, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.insertItemBefore must be an instance of SVGNumber.
    59 PASS text1.rotate.baseVal.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.insertItemBefore must be an instance of SVGNumber.
     56PASS text1.rotate.baseVal.insertItemBefore(30, 0) threw exception TypeError: Argument 1 ('newItem') to SVGNumberList.insertItemBefore must be an instance of SVGNumber.
     57PASS text1.rotate.baseVal.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('newItem') to SVGNumberList.insertItemBefore must be an instance of SVGNumber.
     58PASS text1.rotate.baseVal.insertItemBefore(text1, 0) threw exception TypeError: Argument 1 ('newItem') to SVGNumberList.insertItemBefore must be an instance of SVGNumber.
     59PASS text1.rotate.baseVal.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('newItem') to SVGNumberList.insertItemBefore must be an instance of SVGNumber.
    6060
    6161Set rotate='1 2 3 4' for text1
     
    7373PASS text1.rotate.baseVal.replaceItem(text1) threw exception TypeError: Not enough arguments.
    7474PASS text1.rotate.baseVal.replaceItem(null) threw exception TypeError: Not enough arguments.
    75 PASS text1.rotate.baseVal.replaceItem(30, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.replaceItem must be an instance of SVGNumber.
    76 PASS text1.rotate.baseVal.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.replaceItem must be an instance of SVGNumber.
    77 PASS text1.rotate.baseVal.replaceItem(text1, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.replaceItem must be an instance of SVGNumber.
    78 PASS text1.rotate.baseVal.replaceItem(null, 0) threw exception TypeError: Argument 1 ('item') to SVGNumberList.replaceItem must be an instance of SVGNumber.
     75PASS text1.rotate.baseVal.replaceItem(30, 0) threw exception TypeError: Argument 1 ('newItem') to SVGNumberList.replaceItem must be an instance of SVGNumber.
     76PASS text1.rotate.baseVal.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('newItem') to SVGNumberList.replaceItem must be an instance of SVGNumber.
     77PASS text1.rotate.baseVal.replaceItem(text1, 0) threw exception TypeError: Argument 1 ('newItem') to SVGNumberList.replaceItem must be an instance of SVGNumber.
     78PASS text1.rotate.baseVal.replaceItem(null, 0) threw exception TypeError: Argument 1 ('newItem') to SVGNumberList.replaceItem must be an instance of SVGNumber.
    7979PASS text1.rotate.baseVal.replaceItem(text1.rotate.baseVal.getItem(0), 0) is text1.rotate.baseVal.getItem(0)
    8080PASS text1.rotate.baseVal.numberOfItems is 4
     
    120120
    121121Test uncommon arguments for appendItem()
    122 PASS text1.rotate.baseVal.appendItem(30) threw exception TypeError: Argument 1 ('item') to SVGNumberList.appendItem must be an instance of SVGNumber.
    123 PASS text1.rotate.baseVal.appendItem('aString') threw exception TypeError: Argument 1 ('item') to SVGNumberList.appendItem must be an instance of SVGNumber.
    124 PASS text1.rotate.baseVal.appendItem(text1) threw exception TypeError: Argument 1 ('item') to SVGNumberList.appendItem must be an instance of SVGNumber.
    125 PASS text1.rotate.baseVal.appendItem(null) threw exception TypeError: Argument 1 ('item') to SVGNumberList.appendItem must be an instance of SVGNumber.
     122PASS text1.rotate.baseVal.appendItem(30) threw exception TypeError: Argument 1 ('newItem') to SVGNumberList.appendItem must be an instance of SVGNumber.
     123PASS text1.rotate.baseVal.appendItem('aString') threw exception TypeError: Argument 1 ('newItem') to SVGNumberList.appendItem must be an instance of SVGNumber.
     124PASS text1.rotate.baseVal.appendItem(text1) threw exception TypeError: Argument 1 ('newItem') to SVGNumberList.appendItem must be an instance of SVGNumber.
     125PASS text1.rotate.baseVal.appendItem(null) threw exception TypeError: Argument 1 ('newItem') to SVGNumberList.appendItem must be an instance of SVGNumber.
    126126
    127127Testing animVal clear throws
  • trunk/LayoutTests/svg/dom/SVGPointList-basics-expected.txt

    r243336 r249191  
    2121PASS dumpPoint(poly1.points.getItem(0)) is "x=200 y=100"
    2222PASS poly1.getAttribute('points').formatPointsAttribute() is "200 100"
    23 PASS poly1.points.initialize(poly1) threw exception TypeError: Argument 1 ('item') to SVGPointList.initialize must be an instance of SVGPoint.
    24 PASS poly1.points.initialize(0) threw exception TypeError: Argument 1 ('item') to SVGPointList.initialize must be an instance of SVGPoint.
    25 PASS poly1.points.initialize('aString') threw exception TypeError: Argument 1 ('item') to SVGPointList.initialize must be an instance of SVGPoint.
     23PASS poly1.points.initialize(poly1) threw exception TypeError: Argument 1 ('newItem') to SVGPointList.initialize must be an instance of SVGPoint.
     24PASS poly1.points.initialize(0) threw exception TypeError: Argument 1 ('newItem') to SVGPointList.initialize must be an instance of SVGPoint.
     25PASS poly1.points.initialize('aString') threw exception TypeError: Argument 1 ('newItem') to SVGPointList.initialize must be an instance of SVGPoint.
    2626
    2727Reset points attribute to 0 0 100 0 100 100 0 100
     
    7676PASS dumpPoint(poly1.points.getItem(3)) is "x=0 y=100"
    7777PASS poly1.getAttribute('points').formatPointsAttribute() is "0 0 100 0 100 100 0 100"
    78 PASS poly1.points.insertItemBefore(30, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.insertItemBefore must be an instance of SVGPoint.
    79 PASS poly1.points.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.insertItemBefore must be an instance of SVGPoint.
    80 PASS poly1.points.insertItemBefore(poly1, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.insertItemBefore must be an instance of SVGPoint.
    81 PASS poly1.points.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.insertItemBefore must be an instance of SVGPoint.
     78PASS poly1.points.insertItemBefore(30, 0) threw exception TypeError: Argument 1 ('newItem') to SVGPointList.insertItemBefore must be an instance of SVGPoint.
     79PASS poly1.points.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('newItem') to SVGPointList.insertItemBefore must be an instance of SVGPoint.
     80PASS poly1.points.insertItemBefore(poly1, 0) threw exception TypeError: Argument 1 ('newItem') to SVGPointList.insertItemBefore must be an instance of SVGPoint.
     81PASS poly1.points.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('newItem') to SVGPointList.insertItemBefore must be an instance of SVGPoint.
    8282
    8383Test uncommon arguments for replaceItem()
     
    8585PASS poly1.points.replaceItem('aString') threw exception TypeError: Not enough arguments.
    8686PASS poly1.points.replaceItem(poly1) threw exception TypeError: Not enough arguments.
    87 PASS poly1.points.replaceItem(null, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.replaceItem must be an instance of SVGPoint.
    88 PASS poly1.points.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.replaceItem must be an instance of SVGPoint.
    89 PASS poly1.points.replaceItem(poly1, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.replaceItem must be an instance of SVGPoint.
    90 PASS poly1.points.replaceItem(1, 0) threw exception TypeError: Argument 1 ('item') to SVGPointList.replaceItem must be an instance of SVGPoint.
     87PASS poly1.points.replaceItem(null, 0) threw exception TypeError: Argument 1 ('newItem') to SVGPointList.replaceItem must be an instance of SVGPoint.
     88PASS poly1.points.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('newItem') to SVGPointList.replaceItem must be an instance of SVGPoint.
     89PASS poly1.points.replaceItem(poly1, 0) threw exception TypeError: Argument 1 ('newItem') to SVGPointList.replaceItem must be an instance of SVGPoint.
     90PASS poly1.points.replaceItem(1, 0) threw exception TypeError: Argument 1 ('newItem') to SVGPointList.replaceItem must be an instance of SVGPoint.
    9191
    9292Test uncommon arguments for replaceItem() and xml-dom synchronization
     
    144144
    145145Test uncommon arguments for appendItem()
    146 PASS poly1.points.appendItem(30) threw exception TypeError: Argument 1 ('item') to SVGPointList.appendItem must be an instance of SVGPoint.
    147 PASS poly1.points.appendItem('aString') threw exception TypeError: Argument 1 ('item') to SVGPointList.appendItem must be an instance of SVGPoint.
    148 PASS poly1.points.appendItem(poly1) threw exception TypeError: Argument 1 ('item') to SVGPointList.appendItem must be an instance of SVGPoint.
    149 PASS poly1.points.appendItem(null) threw exception TypeError: Argument 1 ('item') to SVGPointList.appendItem must be an instance of SVGPoint.
     146PASS poly1.points.appendItem(30) threw exception TypeError: Argument 1 ('newItem') to SVGPointList.appendItem must be an instance of SVGPoint.
     147PASS poly1.points.appendItem('aString') threw exception TypeError: Argument 1 ('newItem') to SVGPointList.appendItem must be an instance of SVGPoint.
     148PASS poly1.points.appendItem(poly1) threw exception TypeError: Argument 1 ('newItem') to SVGPointList.appendItem must be an instance of SVGPoint.
     149PASS poly1.points.appendItem(null) threw exception TypeError: Argument 1 ('newItem') to SVGPointList.appendItem must be an instance of SVGPoint.
    150150PASS dumpPoint(poly1.points.appendItem(point)) is "x=200 y=100"
    151151PASS poly1.points.numberOfItems is 2
  • trunk/LayoutTests/svg/dom/SVGTransformList-basics-expected.txt

    r243730 r249191  
    1111
    1212Test uncommon arguments for initialize()
    13 PASS circle1.transform.baseVal.initialize(30) threw exception TypeError: Argument 1 ('item') to SVGTransformList.initialize must be an instance of SVGTransform.
    14 PASS circle1.transform.baseVal.initialize('aString') threw exception TypeError: Argument 1 ('item') to SVGTransformList.initialize must be an instance of SVGTransform.
    15 PASS circle1.transform.baseVal.initialize(circle1) threw exception TypeError: Argument 1 ('item') to SVGTransformList.initialize must be an instance of SVGTransform.
    16 PASS circle1.transform.baseVal.initialize(null) threw exception TypeError: Argument 1 ('item') to SVGTransformList.initialize must be an instance of SVGTransform.
     13PASS circle1.transform.baseVal.initialize(30) threw exception TypeError: Argument 1 ('newItem') to SVGTransformList.initialize must be an instance of SVGTransform.
     14PASS circle1.transform.baseVal.initialize('aString') threw exception TypeError: Argument 1 ('newItem') to SVGTransformList.initialize must be an instance of SVGTransform.
     15PASS circle1.transform.baseVal.initialize(circle1) threw exception TypeError: Argument 1 ('newItem') to SVGTransformList.initialize must be an instance of SVGTransform.
     16PASS circle1.transform.baseVal.initialize(null) threw exception TypeError: Argument 1 ('newItem') to SVGTransformList.initialize must be an instance of SVGTransform.
    1717
    1818Test uncommon arguments for getItem()
     
    5151PASS dumpTransform(circle1.transform.baseVal.getItem(1)) is "type=SVG_TRANSFORM_TRANSLATE matrix=[1.0 0.0 0.0 1.0 10.0 10.0]"
    5252PASS circle1.getAttribute('transform') is "scale(2 2) translate(10 10)"
    53 PASS circle1.transform.baseVal.insertItemBefore(30, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.insertItemBefore must be an instance of SVGTransform.
    54 PASS circle1.transform.baseVal.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.insertItemBefore must be an instance of SVGTransform.
    55 PASS circle1.transform.baseVal.insertItemBefore(circle1, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.insertItemBefore must be an instance of SVGTransform.
    56 PASS circle1.transform.baseVal.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.insertItemBefore must be an instance of SVGTransform.
     53PASS circle1.transform.baseVal.insertItemBefore(30, 0) threw exception TypeError: Argument 1 ('newItem') to SVGTransformList.insertItemBefore must be an instance of SVGTransform.
     54PASS circle1.transform.baseVal.insertItemBefore('aString', 0) threw exception TypeError: Argument 1 ('newItem') to SVGTransformList.insertItemBefore must be an instance of SVGTransform.
     55PASS circle1.transform.baseVal.insertItemBefore(circle1, 0) threw exception TypeError: Argument 1 ('newItem') to SVGTransformList.insertItemBefore must be an instance of SVGTransform.
     56PASS circle1.transform.baseVal.insertItemBefore(null, 0) threw exception TypeError: Argument 1 ('newItem') to SVGTransformList.insertItemBefore must be an instance of SVGTransform.
    5757
    5858Test overlapping edge cases for removeItem()
     
    7777PASS circle1.transform.baseVal.replaceItem(circle1) threw exception TypeError: Not enough arguments.
    7878PASS circle1.transform.baseVal.replaceItem(null) threw exception TypeError: Not enough arguments.
    79 PASS circle1.transform.baseVal.replaceItem(30, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.replaceItem must be an instance of SVGTransform.
    80 PASS circle1.transform.baseVal.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.replaceItem must be an instance of SVGTransform.
    81 PASS circle1.transform.baseVal.replaceItem(circle1, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.replaceItem must be an instance of SVGTransform.
    82 PASS circle1.transform.baseVal.replaceItem(null, 0) threw exception TypeError: Argument 1 ('item') to SVGTransformList.replaceItem must be an instance of SVGTransform.
     79PASS circle1.transform.baseVal.replaceItem(30, 0) threw exception TypeError: Argument 1 ('newItem') to SVGTransformList.replaceItem must be an instance of SVGTransform.
     80PASS circle1.transform.baseVal.replaceItem('aString', 0) threw exception TypeError: Argument 1 ('newItem') to SVGTransformList.replaceItem must be an instance of SVGTransform.
     81PASS circle1.transform.baseVal.replaceItem(circle1, 0) threw exception TypeError: Argument 1 ('newItem') to SVGTransformList.replaceItem must be an instance of SVGTransform.
     82PASS circle1.transform.baseVal.replaceItem(null, 0) threw exception TypeError: Argument 1 ('newItem') to SVGTransformList.replaceItem must be an instance of SVGTransform.
    8383PASS circle1.transform.baseVal.replaceItem(circle1.transform.baseVal.getItem(0), 0) is circle1.transform.baseVal.getItem(0)
    8484PASS circle1.transform.baseVal.numberOfItems is 4
     
    128128
    129129Test uncommon arguments for appendItem()
    130 PASS circle1.transform.baseVal.appendItem(30) threw exception TypeError: Argument 1 ('item') to SVGTransformList.appendItem must be an instance of SVGTransform.
    131 PASS circle1.transform.baseVal.appendItem('aString') threw exception TypeError: Argument 1 ('item') to SVGTransformList.appendItem must be an instance of SVGTransform.
    132 PASS circle1.transform.baseVal.appendItem(circle1) threw exception TypeError: Argument 1 ('item') to SVGTransformList.appendItem must be an instance of SVGTransform.
    133 PASS circle1.transform.baseVal.appendItem(null) threw exception TypeError: Argument 1 ('item') to SVGTransformList.appendItem must be an instance of SVGTransform.
     130PASS circle1.transform.baseVal.appendItem(30) threw exception TypeError: Argument 1 ('newItem') to SVGTransformList.appendItem must be an instance of SVGTransform.
     131PASS circle1.transform.baseVal.appendItem('aString') threw exception TypeError: Argument 1 ('newItem') to SVGTransformList.appendItem must be an instance of SVGTransform.
     132PASS circle1.transform.baseVal.appendItem(circle1) threw exception TypeError: Argument 1 ('newItem') to SVGTransformList.appendItem must be an instance of SVGTransform.
     133PASS circle1.transform.baseVal.appendItem(null) threw exception TypeError: Argument 1 ('newItem') to SVGTransformList.appendItem must be an instance of SVGTransform.
    134134
    135135Testing animVal clear throws
  • trunk/Source/WebCore/ChangeLog

    r249188 r249191  
     12019-08-28  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        SVG2: Add length, item getter and item setter to all SVG lists
     4        https://bugs.webkit.org/show_bug.cgi?id=199526
     5
     6        Reviewed by Simon Fraser.
     7
     8        -- Implement the SVG2 specs for SVG lists:
     9        https://svgwg.org/svg2-draft/types.html#TermListInterface.
     10
     11        -- Match the arguments' names in the IDL files with the specs.
     12
     13        Tests: svg/dom/SVGLengthList-length-indexed-access.xhtml
     14               svg/dom/SVGPathSegList-length-indexed-access.xhtml
     15
     16        * svg/SVGLengthList.idl:
     17        * svg/SVGNumberList.idl:
     18        * svg/SVGPathSegList.h:
     19        * svg/SVGPathSegList.idl:
     20        * svg/SVGPointList.idl:
     21        * svg/SVGStringList.idl:
     22        * svg/SVGTransformList.idl:
     23        * svg/properties/SVGList.h:
     24        (WebCore::SVGList::length const):
     25        (WebCore::SVGList::setItem):
     26
    1272019-08-27  John Wilander  <wilander@apple.com>  and  Fujii Hironori  <Hironori.Fujii@sony.com>
    228
  • trunk/Source/WebCore/svg/SVGLengthList.idl

    r208863 r249191  
    2828    SkipVTableValidation
    2929] interface SVGLengthList {
     30    readonly attribute unsigned long length;
    3031    readonly attribute unsigned long numberOfItems;
    3132
    3233    [MayThrowException] void clear();
    33     [MayThrowException] SVGLength initialize(SVGLength item);
    34     [MayThrowException] SVGLength getItem(unsigned long index);
    35     [MayThrowException] SVGLength insertItemBefore(SVGLength item, unsigned long index);
    36     [MayThrowException] SVGLength replaceItem(SVGLength item, unsigned long index);
     34    [MayThrowException] SVGLength initialize(SVGLength newItem);
     35    [MayThrowException] getter SVGLength getItem(unsigned long index);
     36    [MayThrowException] SVGLength insertItemBefore(SVGLength newItem, unsigned long index);
     37    [MayThrowException] SVGLength replaceItem(SVGLength newItem, unsigned long index);
    3738    [MayThrowException] SVGLength removeItem(unsigned long index);
    38     [MayThrowException] SVGLength appendItem(SVGLength item);
     39    [MayThrowException] SVGLength appendItem(SVGLength newItem);
     40    [MayThrowException] setter void (unsigned long index, SVGLength newItem);
    3941};
  • trunk/Source/WebCore/svg/SVGNumberList.idl

    r207716 r249191  
    2626
    2727interface SVGNumberList {
     28    readonly attribute unsigned long length;
    2829    readonly attribute unsigned long numberOfItems;
    2930
    3031    [MayThrowException] void clear();
    31     [MayThrowException] SVGNumber initialize(SVGNumber item);
    32     [MayThrowException] SVGNumber getItem(unsigned long index);
    33     [MayThrowException] SVGNumber insertItemBefore(SVGNumber item, unsigned long index);
    34     [MayThrowException] SVGNumber replaceItem(SVGNumber item, unsigned long index);
     32    [MayThrowException] SVGNumber initialize(SVGNumber newItem);
     33    [MayThrowException] getter SVGNumber getItem(unsigned long index);
     34    [MayThrowException] SVGNumber insertItemBefore(SVGNumber newItem, unsigned long index);
     35    [MayThrowException] SVGNumber replaceItem(SVGNumber newItem, unsigned long index);
    3536    [MayThrowException] SVGNumber removeItem(unsigned long index);
    36     [MayThrowException] SVGNumber appendItem(SVGNumber item);
     37    [MayThrowException] SVGNumber appendItem(SVGNumber newItem);
     38    [MayThrowException] setter void (unsigned long index, SVGNumber newItem);
    3739};
  • trunk/Source/WebCore/svg/SVGPathSegList.h

    r243555 r249191  
    5959    }
    6060
     61    // Override SVGList::length() because numberOfItems() isn't virtual.
     62    unsigned length() const { return numberOfItems(); }
     63
    6164    unsigned numberOfItems() const
    6265    {
     
    110113        clearPath();
    111114        return Base::appendItem(WTFMove(newItem));
     115    }
     116
     117    // Override SVGList::setItem() because replaceItem() isn't virtual.
     118    ExceptionOr<void> setItem(unsigned index, Ref<SVGPathSeg>&& newItem)
     119    {
     120        auto result = replaceItem(WTFMove(newItem), index);
     121        if (result.hasException())
     122            return result.releaseException();
     123        return { };
    112124    }
    113125
  • trunk/Source/WebCore/svg/SVGPathSegList.idl

    r219712 r249191  
    2626
    2727interface SVGPathSegList {
     28    readonly attribute unsigned long length;
    2829    readonly attribute unsigned long numberOfItems;
    2930
    3031    [MayThrowException] void clear();
    3132    [MayThrowException] SVGPathSeg initialize(SVGPathSeg newItem);
    32     [MayThrowException] SVGPathSeg getItem(unsigned long index);
     33    [MayThrowException] getter SVGPathSeg getItem(unsigned long index);
    3334    [MayThrowException] SVGPathSeg insertItemBefore(SVGPathSeg newItem, unsigned long index);
    3435    [MayThrowException] SVGPathSeg replaceItem(SVGPathSeg newItem, unsigned long index);
    3536    [MayThrowException] SVGPathSeg removeItem(unsigned long index);
    3637    [MayThrowException] SVGPathSeg appendItem(SVGPathSeg newItem);
     38    [MayThrowException] setter void (unsigned long index, SVGPathSeg newItem);
    3739};
  • trunk/Source/WebCore/svg/SVGPointList.idl

    r207716 r249191  
    2525
    2626interface SVGPointList {
     27    readonly attribute unsigned long length;
    2728    readonly attribute unsigned long numberOfItems;
    2829
    2930    [MayThrowException] void clear();
    30     [MayThrowException] SVGPoint initialize(SVGPoint item);
    31     [MayThrowException] SVGPoint getItem(unsigned long index);
    32     [MayThrowException] SVGPoint insertItemBefore(SVGPoint item, unsigned long index);
    33     [MayThrowException] SVGPoint replaceItem(SVGPoint item, unsigned long index);
     31    [MayThrowException] SVGPoint initialize(SVGPoint newItem);
     32    [MayThrowException] getter SVGPoint getItem(unsigned long index);
     33    [MayThrowException] SVGPoint insertItemBefore(SVGPoint newItem, unsigned long index);
     34    [MayThrowException] SVGPoint replaceItem(SVGPoint newItem, unsigned long index);
    3435    [MayThrowException] SVGPoint removeItem(unsigned long index);
    35     [MayThrowException] SVGPoint appendItem(SVGPoint item);
     36    [MayThrowException] SVGPoint appendItem(SVGPoint newItem);
     37    [MayThrowException] setter void (unsigned long index, SVGPoint newItem);
    3638};
  • trunk/Source/WebCore/svg/SVGStringList.idl

    r207716 r249191  
    2525
    2626interface SVGStringList {
     27    readonly attribute unsigned long length;
    2728    readonly attribute unsigned long numberOfItems;
    2829
    2930    [MayThrowException] void clear();
    30     [MayThrowException] DOMString initialize(DOMString item);
    31     [MayThrowException] DOMString getItem(unsigned long index);
    32     [MayThrowException] DOMString insertItemBefore(DOMString item, unsigned long index);
    33     [MayThrowException] DOMString replaceItem(DOMString item, unsigned long index);
     31    [MayThrowException] DOMString initialize(DOMString newItem);
     32    [MayThrowException] getter DOMString getItem(unsigned long index);
     33    [MayThrowException] DOMString insertItemBefore(DOMString newItem, unsigned long index);
     34    [MayThrowException] DOMString replaceItem(DOMString newItem, unsigned long index);
    3435    [MayThrowException] DOMString removeItem(unsigned long index);
    35     [MayThrowException] DOMString appendItem(DOMString item);
     36    [MayThrowException] DOMString appendItem(DOMString newItem);
     37    [MayThrowException] setter void (unsigned long index, DOMString newItem);
    3638};
  • trunk/Source/WebCore/svg/SVGTransformList.idl

    r243730 r249191  
    2626
    2727interface SVGTransformList {
     28    readonly attribute unsigned long length;
    2829    readonly attribute unsigned long numberOfItems;
    2930
    3031    [MayThrowException] void clear();
    31     [MayThrowException] SVGTransform initialize(SVGTransform item);
    32     [MayThrowException] SVGTransform getItem(unsigned long index);
    33     [MayThrowException] SVGTransform insertItemBefore(SVGTransform item, unsigned long index);
    34     [MayThrowException] SVGTransform replaceItem(SVGTransform item, unsigned long index);
     32    [MayThrowException] SVGTransform initialize(SVGTransform newItem);
     33    [MayThrowException] getter SVGTransform getItem(unsigned long index);
     34    [MayThrowException] SVGTransform insertItemBefore(SVGTransform newItem, unsigned long index);
     35    [MayThrowException] SVGTransform replaceItem(SVGTransform newItem, unsigned long index);
    3536    [MayThrowException] SVGTransform removeItem(unsigned long index);
    36     [MayThrowException] SVGTransform appendItem(SVGTransform item);
     37    [MayThrowException] SVGTransform appendItem(SVGTransform newItem);
     38    [MayThrowException] setter void (unsigned long index, SVGTransform newItem);
    3739
    3840    [MayThrowException, NewObject] SVGTransform createSVGTransformFromMatrix(SVGMatrix matrix);
  • trunk/Source/WebCore/svg/properties/SVGList.h

    r243163 r249191  
    3434class SVGList : public SVGProperty {
    3535public:
     36    unsigned length() const { return numberOfItems(); }
     37
    3638    unsigned numberOfItems() const
    3739    {
     
    126128        commitChange();
    127129        return item;
     130    }
     131
     132    ExceptionOr<void> setItem(unsigned index, ItemType&& newItem)
     133    {
     134        auto result = replaceItem(WTFMove(newItem), index);
     135        if (result.hasException())
     136            return result.releaseException();
     137        return { };
    128138    }
    129139
Note: See TracChangeset for help on using the changeset viewer.