Bug 262488 - Simplify range mapping computation in SVGTextQuery/SVGInlineTextBox
Summary: Simplify range mapping computation in SVGTextQuery/SVGInlineTextBox
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2023-10-02 09:37 PDT by Ahmad Saleem
Modified: 2023-10-17 14:00 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmad Saleem 2023-10-02 09:37:28 PDT
Simplify range mapping computation in SVGTextQuery/SVGInlineTextBox

Blink Merge: https://src.chromium.org/viewvc/blink?view=revision&revision=193017

_________

bool SVGInlineTextBox::mapStartEndPositionsIntoFragmentCoordinates(const SVGTextFragment& fragment, unsigned& startPosition, unsigned& endPosition) const
{
    unsigned fragmentOffsetInBox = fragment.characterOffset - start();

    // Compute positions relative to the fragment.
    startPosition -= fragmentOffsetInBox;
    endPosition -= fragmentOffsetInBox;

    // Intersect with the fragment range.
    startPosition = std::max<unsigned>(startPosition, 0);
    endPosition = std::min<unsigned>(endPosition, fragment.length);

    return startPosition < endPosition;
}

________

Just wanted to raise.
Comment 1 Ahmad Saleem 2023-10-02 17:55:18 PDT
This simplification require pre-requisite to make SVG Text code to respect RTL etc.

By doing 1-1 merge as below PR, it will leads to two failures:

https://github.com/WebKit/WebKit/pull/18514

Failing tests:

imported/mozilla/svg/text/textpath-selection.svg
imported/w3c/web-platform-tests/css/css-pseudo/textpath-selection-011.html

^ Both are genuine failures.

I am letting my PR run through EWS fully to document failures (if any else) but I will look into further future merges and see what else I can do.
Comment 2 Radar WebKit Bug Importer 2023-10-09 09:38:17 PDT
<rdar://problem/116683897>
Comment 3 EWS 2023-10-17 14:00:04 PDT
Committed 269425@main (8e69bb72e0ee): <https://commits.webkit.org/269425@main>

Reviewed commits have been landed. Closing PR #18514 and removing active labels.