Bug 1926732 - Relax assertion in FindLineClampTarget because line-clamp may already have been evaluated by a descendant block. r=layout-reviewers,emilio

Differential Revision: https://phabricator.services.mozilla.com/D228579
This commit is contained in:
Jonathan Kew
2024-11-11 14:37:59 +00:00
parent 22d083baba
commit fd6b390c9b

View File

@@ -2055,8 +2055,6 @@ std::pair<nsBlockFrame*, nsLineBox*> FindLineClampTarget(
nsBlockFrame* const aRootFrame, const nsBlockFrame* const aStopAtFrame,
StyleLineClamp aLineNumber) {
MOZ_ASSERT(aLineNumber > 0);
MOZ_ASSERT(!aRootFrame->HasLineClampEllipsis(),
"Should have been removed earlier");
nsLineBox* targetLine = nullptr;
nsBlockFrame* targetFrame = nullptr;
@@ -2090,12 +2088,19 @@ std::pair<nsBlockFrame*, nsLineBox*> FindLineClampTarget(
}
if (!foundFollowingLine) {
MOZ_ASSERT(!aRootFrame->HasLineClampEllipsis(),
"should have been removed earlier");
return std::pair(nullptr, nullptr);
}
MOZ_ASSERT(targetLine);
MOZ_ASSERT(targetFrame);
// If targetFrame is not the same as the line-clamp root, any ellipsis on the
// root should have been previously cleared.
MOZ_ASSERT(targetFrame == aRootFrame || !aRootFrame->HasLineClampEllipsis(),
"line-clamp target mismatch");
return std::pair(targetFrame, targetLine);
}