Bug 1645713 - Do less work when finding common ancestor for text run creation. r=jfkthame

Differential Revision: https://phabricator.services.mozilla.com/D79625
This commit is contained in:
Cameron McCormack
2020-06-16 23:40:37 +00:00
parent a2ef9fa679
commit 3107a7b3a8
3 changed files with 62 additions and 2 deletions

View File

@@ -1914,8 +1914,16 @@ bool BuildTextRunsScanner::ContinueTextRunAcrossFrames(nsTextFrame* aFrame1,
};
const nsIFrame* ancestor =
nsLayoutUtils::FindNearestCommonAncestorFrame(aFrame1, aFrame2);
MOZ_ASSERT(ancestor);
nsLayoutUtils::FindNearestCommonAncestorFrameWithinBlock(aFrame1,
aFrame2);
if (!ancestor) {
// The two frames are within different blocks, e.g. due to block
// fragmentation. In theory we shouldn't prevent cross-frame shaping
// here, but it's an edge case where we should rarely decide to allow
// cross-frame shaping, so we don't try harder here.
return false;
}
// Map inline-end and inline-start to physical sides for checking presence
// of non-zero margin/border/padding.