[webkit-changes] [WebKit/WebKit] 25e8d8: getStartPositionOfChar(n) on an element with 'n' c...

Ahmad Saleem noreply at github.com
Mon Apr 17 18:18:21 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 25e8d8240b8ffbd6fc44357718028b00792aea2f
      https://github.com/WebKit/WebKit/commit/25e8d8240b8ffbd6fc44357718028b00792aea2f
  Author: Ahmad Saleem <ahmad.saleem792+github at gmail.com>
  Date:   2023-04-17 (Mon, 17 Apr 2023)

  Changed paths:
    A LayoutTests/svg/text/svgtextcontentelement-equality-methods-parameters-expected.txt
    A LayoutTests/svg/text/svgtextcontentelement-equality-methods-parameters.html
    M Source/WebCore/svg/SVGTextContentElement.cpp

  Log Message:
  -----------
  getStartPositionOfChar(n) on an element with 'n' characters of text doesn't throw IndexSizeError

https://bugs.webkit.org/show_bug.cgi?id=255500
rdar://problem/108115821

Reviewed by Said Abou-Hallawa.

This patch aligns WebKit to Blink / Chromium, Gecko / Firefox and Web-Spec.

Cherry-Pick: https://src.chromium.org/viewvc/blink?view=revision&revision=201411

According to the spec [1], IndexSizeError should be thrown if:

"...the charnum is negative or if charnum is greater than or equal to
 the number of characters at this node."

[1] http://www.w3.org/TR/SVG11/text.html#__svg__SVGTextContentElement__getStartPositionOfChar
    The current SVG2 draft has a different formulation:

     SVG2 - https://svgwg.org/svg2-draft/text.html#__svg__SVGTextContentElement__getStartPositionOfChar
     "If cluster is null, then then throw a DOMException with code
      INDEX_SIZE_ERR."

    but will have the same result.

* Source/WebCore/svg/SVGTextContentElement.cpp:
(SVGTextContentElement::getStartPositionOfChar):
(SVGTextContentElement::getEndPositionOfChar):
(SVGTextContentElement::getExtentOfChar):
(SVGTextContentElement::getRotationOfChar):
* LayoutTests/svg/text/svgtextcontentelement-equality-methods-parameters.html: Add Test
* LayoutTests/svg/text/svgtextcontentelement-equality-methods-parameters-expected.txt: Add Test Expectation

Canonical link: https://commits.webkit.org/263049@main




More information about the webkit-changes mailing list