Closed Bug 1049052 Opened 5 years ago Closed 5 years ago

Optimize CSS 'rem' unit computation by using document element's primary frame, when available

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla34

People

(Reporter: dholbert, Assigned: dholbert)

References

Details

(Keywords: perf)

Attachments

(1 file, 1 obsolete file)

Spinning this off from bug 1045858 comment 4 - 5:
> dbaron suggests that we can speed up rem unit computation here
> by using the doc element's primary frame instead of re-resolving
> style here:
http://mxr.mozilla.org/mozilla-central/source/layout/style/nsRuleNode.cpp?rev=a94b21d8308c#450

(I'm spinning this off as its own bug since it sounds like this helps a bit but doesn't entirely address bug 1045858.)
Attached patch fix v1 (obsolete) — Splinter Review
Attachment #8467943 - Flags: review?(dbaron)
(Sorry, last patch didn't compile -- I'd tried to simplify it using the ternary operator, but that doesn't work, because the types involved are subtly different.  In particular, rootFrame->StyleContext() returns nsStyleContext*, whereas ResolveStyleFor() returns already_AddRefed<nsStyleContext>.  It might be possible to hack around this difference by forcing the types to match with a temporary wrapper or something, but it's probably cleaner to just use standard if/else, as done in this new version.)
Attachment #8467943 - Attachment is obsolete: true
Attachment #8467943 - Flags: review?(dbaron)
Attachment #8467955 - Flags: review?(dbaron)
Attachment #8467955 - Flags: review?(dbaron) → review+
https://hg.mozilla.org/mozilla-central/rev/969587e6bfcf
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
QA Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.