Bug 257429

Summary: Handle multiple fragments in the getCharNumberAtPosition SVGTextQuery
Product: WebKit Reporter: Ahmad Saleem <ahmad.saleem792>
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: sabouhallawa, webkit-bug-importer, zimmermann
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   

Description Ahmad Saleem 2023-05-27 14:17:15 PDT
Hi Team,

We fail following test in WebKit ToT:

Testcase: https://jsfiddle.net/czgum406/show

Blink Commit: https://src.chromium.org/viewvc/blink?view=revision&revision=176936

WebKit Source: https://searchfox.org/wubkat/source/Source/WebCore/rendering/svg/SVGTextQuery.cpp#524

This works:

________

// Offset of the fragment within the text box.
    unsigned boxOffset = fragment.characterOffset - queryData->textBox->start();
    
    FloatRect extent;
    for (unsigned i = 0; i < fragment.length; ++i) {
        unsigned startPosition = data->processedCharacters + boxOffset + i;
        unsigned endPosition = startPosition + 1;
        if (!mapStartEndPositionsIntoFragmentCoordinates(queryData, fragment, startPosition, endPosition))
            continue;
        calculateGlyphBoundaries(queryData, fragment, startPosition, extent);
        if (extent.contains(data->position)) {
            data->processedCharacters += boxOffset + I;

_________

Just wanted to raise so we can fix it.

Thanks!
Comment 1 EWS 2023-06-01 09:56:18 PDT
Committed 264796@main (c01e3bafb0da): <https://commits.webkit.org/264796@main>

Reviewed commits have been landed. Closing PR #14433 and removing active labels.
Comment 2 Radar WebKit Bug Importer 2023-06-01 09:57:21 PDT
<rdar://problem/110119702>