Bug 268438

Summary: Remove `includePartialGlyphs` argument from SVGInlineTextBox::offsetForPositionInFragment since always true
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: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Ahmad Saleem
Reported 2024-01-30 21:40:43 PST
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!
Attachments
EWS
Comment 1 2024-01-31 09:46:33 PST
Committed 273833@main (c7afd1bc35e2): <https://commits.webkit.org/273833@main> Reviewed commits have been landed. Closing PR #23562 and removing active labels.
Radar WebKit Bug Importer
Comment 2 2024-01-31 09:47:16 PST
Note You need to log in before you can comment on or make changes to this bug.