mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1450208: Change nsRange::ExtractRectFromOffset to use simpler, hopefully safer logic to determine whether text is vertical. r=bz
Instead of checking nsIFrame::IsTextFrame() and then casting to nsTextFrame, the new code just checks the writing mode of the frame. Less casts; less chance of pointer errors. MozReview-Commit-ID: LrtthZjwYq6 --HG-- extra : rebase_source : 487ed4de272f514fe1f495ed1c2ddb9c8574d0a2
This commit is contained in:
parent
3a0c426d41
commit
19d279bd7d
@ -2911,16 +2911,15 @@ static void ExtractRectFromOffset(nsIFrame* aFrame,
|
||||
const int32_t aOffset, nsRect* aR,
|
||||
bool aFlushToOriginEdge, bool aClampToEdge)
|
||||
{
|
||||
MOZ_ASSERT(aFrame);
|
||||
MOZ_ASSERT(aR);
|
||||
|
||||
nsPoint point;
|
||||
aFrame->GetPointFromOffset(aOffset, &point);
|
||||
|
||||
// Determine if point was generated from a vertical text run, which will change
|
||||
// our math on the output rect.
|
||||
bool isVertical = false;
|
||||
if (aFrame->IsTextFrame()) {
|
||||
nsTextFrame* textFrame = static_cast<nsTextFrame*>(aFrame);
|
||||
isVertical = textFrame->GetTextRun(nsTextFrame::eInflated)->IsVertical();
|
||||
}
|
||||
// Determine if aFrame has a vertical writing mode, which will change our math
|
||||
// on the output rect.
|
||||
bool isVertical = aFrame->GetWritingMode().IsVertical();
|
||||
|
||||
if (!aClampToEdge && !aR->Contains(point)) {
|
||||
// If point is outside aR, and we aren't clamping, output an empty rect
|
||||
|
Loading…
Reference in New Issue
Block a user