Changeset 231266 in webkit


Ignore:
Timestamp:
May 2, 2018 2:38:53 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

getCharNumAtPosition should take DOMPointInit as argument
https://bugs.webkit.org/show_bug.cgi?id=184695

Patch by Dirk Schulze <dschulze@chromium.org> on 2018-05-02
Reviewed by Antti Koivisto.

Source/WebCore:

Extend existing tests for getCharNumAtPosition.

  • svg/SVGTextContentElement.cpp:

(WebCore::SVGTextContentElement::getCharNumAtPosition):

  • svg/SVGTextContentElement.h:
  • svg/SVGTextContentElement.idl: Use DOMPointInit argument.

LayoutTests:

  • svg/text/lengthAdjust-text-metrics.html: Run tests with dictionary.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r231263 r231266  
     12018-05-02  Dirk Schulze  <dschulze@chromium.org>
     2
     3        getCharNumAtPosition should take DOMPointInit as argument
     4        https://bugs.webkit.org/show_bug.cgi?id=184695
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * svg/text/lengthAdjust-text-metrics.html: Run tests with dictionary.
     9
    1102018-05-02  Youenn Fablet  <youenn@apple.com>
    211
  • trunk/LayoutTests/svg/text/lengthAdjust-text-metrics-expected.txt

    r180271 r231266  
    5353> Testing point=(0.0,10.0)
    5454PASS svgText.getCharNumAtPosition(point) is -1
     55PASS svgText.getCharNumAtPosition(pointDict) is -1
    5556> Testing point=(9.9,10.0)
    5657PASS svgText.getCharNumAtPosition(point) is -1
     58PASS svgText.getCharNumAtPosition(pointDict) is -1
    5759> Testing point=(10.1,10.0)
    5860PASS svgText.getCharNumAtPosition(point) is 0
     61PASS svgText.getCharNumAtPosition(pointDict) is 0
    5962> Testing point=(71.4,10.0)
    6063PASS svgText.getCharNumAtPosition(point) is 0
     
    6366> Testing point=(127.8,10.0)
    6467PASS svgText.getCharNumAtPosition(point) is 1
     68PASS svgText.getCharNumAtPosition(pointDict) is 1
    6569> Testing point=(128.0,10.0)
    6670PASS svgText.getCharNumAtPosition(point) is 1
    6771> Testing point=(179.1,10.0)
    6872PASS svgText.getCharNumAtPosition(point) is 3
     73PASS svgText.getCharNumAtPosition(pointDict) is 3
    6974> Testing point=(179.3,10.0)
    7075PASS svgText.getCharNumAtPosition(point) is 3
  • trunk/LayoutTests/svg/text/lengthAdjust-text-metrics.html

    r217390 r231266  
    132132
    133133var point = svgRoot.createSVGPoint();
     134var pointDict;
    134135point.y = 10.0;
    135136
     
    141142debug("> Testing point=" + pointToString(point));
    142143shouldBe("svgText.getCharNumAtPosition(point)", "-1");
     144pointDict = {x: point.x, y: point.y};
     145shouldBe("svgText.getCharNumAtPosition(pointDict)", "-1");
    143146
    144147point.x = 9.9;
     
    146149debug("> Testing point=" + pointToString(point));
    147150shouldBe("svgText.getCharNumAtPosition(point)", "-1");
     151pointDict = {x: point.x, y: point.y};
     152shouldBe("svgText.getCharNumAtPosition(pointDict)", "-1");
    148153
    149154point.x = 10.1;
     
    151156debug("> Testing point=" + pointToString(point));
    152157shouldBe("svgText.getCharNumAtPosition(point)", "0");
     158pointDict = {x: point.x, y: point.y};
     159shouldBe("svgText.getCharNumAtPosition(pointDict)", "0");
    153160
    154161point.x = 71.4;
     
    166173debug("> Testing point=" + pointToString(point));
    167174shouldBe("svgText.getCharNumAtPosition(point)", "1");
     175pointDict = {x: point.x, y: point.y};
     176shouldBe("svgText.getCharNumAtPosition(pointDict)", "1");
    168177
    169178point.x = 128.0;
     
    176185debug("> Testing point=" + pointToString(point));
    177186shouldBe("svgText.getCharNumAtPosition(point)", "3");
     187pointDict = {x: point.x, y: point.y};
     188shouldBe("svgText.getCharNumAtPosition(pointDict)", "3");
    178189
    179190point.x = 179.3;
  • trunk/Source/WebCore/ChangeLog

    r231263 r231266  
     12018-05-02  Dirk Schulze  <dschulze@chromium.org>
     2
     3        getCharNumAtPosition should take DOMPointInit as argument
     4        https://bugs.webkit.org/show_bug.cgi?id=184695
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Extend existing tests for getCharNumAtPosition.
     9
     10        * svg/SVGTextContentElement.cpp:
     11        (WebCore::SVGTextContentElement::getCharNumAtPosition):
     12        * svg/SVGTextContentElement.h:
     13        * svg/SVGTextContentElement.idl: Use DOMPointInit argument.
     14
    1152018-05-02  Youenn Fablet  <youenn@apple.com>
    216
  • trunk/Source/WebCore/svg/SVGTextContentElement.cpp

    r229694 r231266  
    2424#include "CSSPropertyNames.h"
    2525#include "CSSValueKeywords.h"
     26#include "DOMPoint.h"
    2627#include "Frame.h"
    2728#include "FrameSelection.h"
     
    159160}
    160161
    161 int SVGTextContentElement::getCharNumAtPosition(SVGPoint& point)
     162int SVGTextContentElement::getCharNumAtPosition(DOMPointInit&& pointInit)
    162163{
    163164    document().updateLayoutIgnorePendingStylesheets();
    164     return SVGTextQuery(renderer()).characterNumberAtPosition(point.propertyReference());
     165    FloatPoint transformPoint {static_cast<float>(pointInit.x), static_cast<float>(pointInit.y)};
     166    return SVGTextQuery(renderer()).characterNumberAtPosition(transformPoint);
    165167}
    166168
  • trunk/Source/WebCore/svg/SVGTextContentElement.h

    r229694 r231266  
    2828
    2929namespace WebCore {
     30
     31struct DOMPointInit;
    3032
    3133enum SVGLengthAdjustType {
     
    7981    ExceptionOr<Ref<SVGRect>> getExtentOfChar(unsigned charnum);
    8082    ExceptionOr<float> getRotationOfChar(unsigned charnum);
    81     int getCharNumAtPosition(SVGPoint&);
     83    int getCharNumAtPosition(DOMPointInit&&);
    8284    ExceptionOr<void> selectSubString(unsigned charnum, unsigned nchars);
    8385
  • trunk/Source/WebCore/svg/SVGTextContentElement.idl

    r208705 r231266  
    4040    [MayThrowException, NewObject] SVGRect getExtentOfChar(optional unsigned long offset = 0);
    4141    [MayThrowException] unrestricted float getRotationOfChar(optional unsigned long offset = 0);
    42     long getCharNumAtPosition(SVGPoint point);
     42    long getCharNumAtPosition(DOMPointInit point);
    4343    [MayThrowException] void selectSubString(optional unsigned long offset = 0, optional unsigned long length = 0);
    4444};
Note: See TracChangeset for help on using the changeset viewer.