WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
233259
InlineIterator::TextBox::offsetForPosition and positionForOffset should be layout path independent
https://bugs.webkit.org/show_bug.cgi?id=233259
Summary
InlineIterator::TextBox::offsetForPosition and positionForOffset should be la...
Antti Koivisto
Reported
2021-11-17 09:48:13 PST
Fewer bugs by reducing duplication.
Attachments
Patch
(17.64 KB, patch)
2021-11-17 10:00 PST
,
Antti Koivisto
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Antti Koivisto
Comment 1
2021-11-17 10:00:03 PST
Created
attachment 444530
[details]
Patch
alan
Comment 2
2021-11-17 10:12:08 PST
Comment on
attachment 444530
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=444530&action=review
> Source/WebCore/rendering/LegacyInlineTextBox.cpp:-494 > -int LegacyInlineTextBox::offsetForPosition(float lineOffset, bool includePartialGlyphs) const > -{ > - if (isLineBreak()) > - return 0; > - if (lineOffset - logicalLeft() > logicalWidth()) > - return isLeftToRightDirection() ? len() : 0; > - if (lineOffset - logicalLeft() < 0) > - return isLeftToRightDirection() ? 0 : len(); > - bool ignoreCombinedText = true; > - bool ignoreHyphen = true; > - return lineFont().offsetForPosition(createTextRun(ignoreCombinedText, ignoreHyphen), lineOffset - logicalLeft(), includePartialGlyphs); > -} > - > -float LegacyInlineTextBox::positionForOffset(unsigned offset) const > -{ > - ASSERT(offset >= m_start); > - ASSERT(offset <= m_start + len()); > - > - if (isLineBreak()) > - return logicalLeft(); > - > - unsigned startOffset; > - unsigned endOffset; > - if (isLeftToRightDirection()) { > - startOffset = 0; > - endOffset = selectableRange().clamp(offset); > - } else { > - startOffset = selectableRange().clamp(offset); > - endOffset = m_len; > - } > - > - // FIXME: Do we need to add rightBearing here? > - LayoutRect selectionRect = LayoutRect(logicalLeft(), 0, 0, 0); > - bool ignoreCombinedText = true; > - bool ignoreHyphen = true; > - TextRun textRun = createTextRun(ignoreCombinedText, ignoreHyphen); > - lineFont().adjustSelectionRectForText(textRun, selectionRect, startOffset, endOffset); > - return snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), textRun.ltr()).maxX(); > -} > -
nice.
EWS
Comment 3
2021-11-17 10:51:24 PST
Committed
r285938
(
244347@main
): <
https://commits.webkit.org/244347@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 444530
[details]
.
Radar WebKit Bug Importer
Comment 4
2021-11-17 10:58:59 PST
<
rdar://problem/85511787
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug