| Summary: | InlineIterator::TextBox::offsetForPosition and positionForOffset should be layout path independent | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Antti Koivisto <koivisto> | ||||
| Component: | Layout and Rendering | Assignee: | Antti Koivisto <koivisto> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | bfulgham, changseok, dino, esprehn+autocc, ews-watchlist, fmalita, glenn, gyuyoung.kim, kondapallykalyan, mmaxfield, pdr, sabouhallawa, schenney, sergio, simon.fraser, webkit-bug-importer, zalan | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | WebKit Nightly Build | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
|
Description
Antti Koivisto
2021-11-17 09:48:13 PST
Created attachment 444530 [details]
Patch
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. 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]. |