mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 10:15:41 +00:00
Bug 1548188 Part 1: Make nsRange::GetPartialTextRect use IsInlineReversed to determine whether start is before end. r=bzbarsky
The existing logic uses RightToLeft as a determinator of whether or not the start point is above-and-to-the-left of the end point. We can get that directly (and correctly) with IsInlineReversed. Differential Revision: https://phabricator.services.mozilla.com/D44701 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
7a49cd3dd7
commit
a99718cb94
@ -2561,16 +2561,19 @@ static nsresult GetPartialTextRect(nsLayoutUtils::RectCallback* aCallback,
|
||||
f->EnsureTextRun(nsTextFrame::eInflated);
|
||||
NS_ENSURE_TRUE(f->GetTextRun(nsTextFrame::eInflated),
|
||||
NS_ERROR_OUT_OF_MEMORY);
|
||||
bool rtl = f->GetTextRun(nsTextFrame::eInflated)->IsRightToLeft();
|
||||
bool topLeftToBottomRight =
|
||||
!f->GetTextRun(nsTextFrame::eInflated)->IsInlineReversed();
|
||||
nsRect r = f->GetRectRelativeToSelf();
|
||||
if (fstart < aStartOffset) {
|
||||
// aStartOffset is within this frame
|
||||
ExtractRectFromOffset(f, aStartOffset, &r, rtl, aClampToEdge);
|
||||
ExtractRectFromOffset(f, aStartOffset, &r, !topLeftToBottomRight,
|
||||
aClampToEdge);
|
||||
textContentStart = aStartOffset;
|
||||
}
|
||||
if (fend > aEndOffset) {
|
||||
// aEndOffset is in the middle of this frame
|
||||
ExtractRectFromOffset(f, aEndOffset, &r, !rtl, aClampToEdge);
|
||||
ExtractRectFromOffset(f, aEndOffset, &r, topLeftToBottomRight,
|
||||
aClampToEdge);
|
||||
textContentEnd = aEndOffset;
|
||||
}
|
||||
r = nsLayoutUtils::TransformFrameRectToAncestor(f, r, relativeTo);
|
||||
|
Loading…
Reference in New Issue
Block a user