Bug 1827009 - Don't assume the textrun has necessarily been created already. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D175108
This commit is contained in:
@@ -3032,14 +3032,15 @@ nscoord nsLineLayout::GetHangFrom(const PerSpanData* aSpan, bool aLineIsRTL) {
|
|||||||
return GetHangFrom(childSpan, aLineIsRTL);
|
return GetHangFrom(childSpan, aLineIsRTL);
|
||||||
}
|
}
|
||||||
if (pfd->mIsTextFrame) {
|
if (pfd->mIsTextFrame) {
|
||||||
const auto* lastText = static_cast<const nsTextFrame*>(pfd->mFrame);
|
auto* lastText = static_cast<nsTextFrame*>(pfd->mFrame);
|
||||||
result = lastText->GetHangableISize();
|
result = lastText->GetHangableISize();
|
||||||
if (result) {
|
if (result) {
|
||||||
// If the hangable space will be at the start edge of the line, due to
|
// If the hangable space will be at the start edge of the line, due to
|
||||||
// its bidi direction being against the line direction, we flag this by
|
// its bidi direction being against the line direction, we flag this by
|
||||||
// negating the advance.
|
// negating the advance.
|
||||||
if (lastText->GetTextRun(nsTextFrame::eInflated)->IsRightToLeft() !=
|
lastText->EnsureTextRun(nsTextFrame::eInflated);
|
||||||
aLineIsRTL) {
|
auto* textRun = lastText->GetTextRun(nsTextFrame::eInflated);
|
||||||
|
if (textRun && textRun->IsRightToLeft() != aLineIsRTL) {
|
||||||
result = -result;
|
result = -result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user