Open Bug 519787 Opened 15 years ago Updated 2 years ago

Implement nsLayoutUtils node-position-compare functions on top of nsContentUtils::ComparePosition

Categories

(Core :: Layout, defect)

defect

Tracking

()

People

(Reporter: sicking, Unassigned)

Details

nsLayoutUtils::CompareTreePosition and nsLayoutUtils::DoCompareTreePosition can and should be implemented on top of nsContentUtils::ComparePosition, in order to reduce code duplication. The only overhead would be an extra couple of conditional branches.
Note that the layout version has a common ancestor hint that's actually an important optimization for its callers....
Yeah, just noticed that. Looking at how it's used...
The only two callsites that take advantage of that optimization are Displaylists: IsContentLEQ [1] Forms: CompareFormControlPosition [2] I suspect that displaylists are more perf critical here. Maybe even critical enough that we need to keep this function? [1] http://mxr.mozilla.org/mozilla-central/source/layout/base/nsDisplayList.cpp#503 [2] http://mxr.mozilla.org/mozilla-central/source/content/html/content/src/nsHTMLFormElement.cpp#1303
Display lists are pretty critical. But I think we should generally be using this more, fwiw....
One solution would be to move the function to nsContentUtils and then factor things such that code could be shared once the parent-chains had been built.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.