FindNearestCommonAncestor does more work than BuildTextRunsScanner::ContinueTextRunAcrossFrames needs
Categories
(Core :: Layout: Text and Fonts, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox79 | --- | fixed |
People
(Reporter: heycam, Assigned: heycam)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
Profiling a page with a lot of text, I find 2.5% of Reflow time spent under nsLayoutUtils::FindNearestCommonAncestor
. That function loops all the way up to the root frame for the two arguments, but for its use in BuildTextRunsScanner::ContinueTextRunAcrossFrames
, we know that the two text frames are within the same block. We can add a variation of FindNearestCommonAncestor
that only looks up to the closest block.
Assignee | ||
Comment 1•5 years ago
|
||
Assignee | ||
Comment 2•5 years ago
|
||
Assignee | ||
Comment 3•5 years ago
|
||
Assignee | ||
Comment 4•5 years ago
|
||
There's a case that this patch crashes on, due to the two text frames being in different blocks as they're fragmented across columns: layout/base/crashtests/538267-1.html. It means that we return null from FindNearestCommonAncestorFrameWithinBlock
and then we assert. It seems like it should be safe to return false from ContinueTextRunAcrossFrames
in this case, rather than trying harder to find a common ancestor to check styles up the tree. Does that sound right, Jonathan?
Assignee | ||
Comment 5•5 years ago
|
||
Comment 6•5 years ago
|
||
There's a case that this patch crashes on, due to the two text frames being in different blocks as they're fragmented across columns
Ugh... should've known there'd be some case that would complicate life! That suggests the same thing can happen across a page break, too.
In theory, we shouldn't allow that to interrupt text run creation, as there could be contextual shaping effects that depend on context and should be maintained even across the break; but I think that's such an obscure edge case that it's OK to ignore it for now. In almost all cases, interrupting shaping will be the right thing to do, and I'm not even sure how easily we'd be able to tell if it wasn't. (We have more serious issues to worry about regarding how line-breaks interact with shaping, anyhow.)
Please leave a comment in the code noting this case, though, to remind us if/when we ever revisit this.
Comment 8•5 years ago
|
||
bugherder |
Updated•5 years ago
|
Description
•