Bug 1539366 - Avoid calling AreOnSameLine once we know we've already changed lines since it can be expensive to compute. r=mats

Differential Revision: https://phabricator.services.mozilla.com/D26650

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Woodrow 2019-05-27 20:38:46 +00:00
Родитель 65c3bca864
Коммит a5c50d9eeb
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -349,6 +349,7 @@ struct InlineBackgroundData {
// Start with the previous flow frame as our continuation point
// is the total of the widths of the previous frames.
nsIFrame* inlineFrame = GetPrevContinuation(aFrame);
bool changedLines = false;
while (inlineFrame) {
if (!mPIStartBorderData.mFrame &&
!(mVertical ? inlineFrame->GetSkipSides().Top()
@ -357,8 +358,9 @@ struct InlineBackgroundData {
}
nsRect rect = inlineFrame->GetRect();
mContinuationPoint += mVertical ? rect.height : rect.width;
if (mBidiEnabled && !AreOnSameLine(aFrame, inlineFrame)) {
if (mBidiEnabled && (changedLines || !AreOnSameLine(aFrame, inlineFrame))) {
mLineContinuationPoint += mVertical ? rect.height : rect.width;
changedLines = true;
}
mUnbrokenMeasure += mVertical ? rect.height : rect.width;
mBoundingBox.UnionRect(mBoundingBox, rect);