[Webkit-unassigned] [Bug 268438] New: Remove `includePartialGlyphs` argument from SVGInlineTextBox::offsetForPositionInFragment since always true

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jan 30 21:40:43 PST 2024


https://bugs.webkit.org/show_bug.cgi?id=268438

            Bug ID: 268438
           Summary: Remove `includePartialGlyphs` argument from
                    SVGInlineTextBox::offsetForPositionInFragment since
                    always true
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: SVG
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ahmad.saleem792 at gmail.com
                CC: sabouhallawa at apple.com, zimmermann at kde.org

Hi Team,

It is always true, so rather than argument, we can pass it as directly in function.

https://searchfox.org/wubkat/rev/3b0ecebf15c658e0e5ecd1e3e217ff02d491733f/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp#91

__

Current:

int SVGInlineTextBox::offsetForPositionInFragment(const SVGTextFragment& fragment, float position, bool includePartialGlyphs) const
{
    float scalingFactor = renderer().scalingFactor();
    ASSERT(scalingFactor);

    TextRun textRun = constructTextRun(renderer().style(), fragment);

    // Eventually handle lengthAdjust="spacingAndGlyphs".
    // FIXME: Handle vertical text.
    AffineTransform fragmentTransform;
    fragment.buildFragmentTransform(fragmentTransform);
    if (!fragmentTransform.isIdentity())
        textRun.setHorizontalGlyphStretch(narrowPrecisionToFloat(fragmentTransform.xScale()));

    return fragment.characterOffset - start() + renderer().scaledFont().offsetForPosition(textRun, position * scalingFactor, includePartialGlyphs);
}

To:

int SVGInlineTextBox::offsetForPositionInFragment(const SVGTextFragment& fragment, float position, ) const
{
    float scalingFactor = renderer().scalingFactor();
    ASSERT(scalingFactor);

    const bool includePartialGlyphs = true;

    TextRun textRun = constructTextRun(renderer().style(), fragment);

    // Eventually handle lengthAdjust="spacingAndGlyphs".
    // FIXME: Handle vertical text.
    AffineTransform fragmentTransform;
    fragment.buildFragmentTransform(fragmentTransform);
    if (!fragmentTransform.isIdentity())
        textRun.setHorizontalGlyphStretch(narrowPrecisionToFloat(fragmentTransform.xScale()));

    return fragment.characterOffset - start() + renderer().scaledFont().offsetForPosition(textRun, position * scalingFactor, includePartialGlyphs);
}

___

and also update the definition and also this call-site:

https://searchfox.org/wubkat/rev/3b0ecebf15c658e0e5ecd1e3e217ff02d491733f/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp#203

from:

int offset = closestDistanceBox->offsetForPositionInFragment(*closestDistanceFragment, absolutePoint.x() - closestDistancePosition, true);

To:

int offset = closestDistanceBox->offsetForPositionInFragment(*closestDistanceFragment, absolutePoint.x() - closestDistancePosition);

____

So just wanted to raise so we can fix it.

Thanks!

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240131/f36b2d53/attachment-0001.htm>


More information about the webkit-unassigned mailing list