Closed
Bug 800983
Opened 12 years ago
Closed 12 years ago
Expose a way to get computed style taking only UA and user sheets into account (getDefaultComputedStyle)
Categories
(Core :: DOM: CSS Object Model, defect)
Tracking
()
RESOLVED
FIXED
mozilla19
People
(Reporter: bzbarsky, Assigned: bzbarsky)
Details
(Keywords: dev-doc-complete)
Attachments
(1 file)
I'm going to call this getDefaultComputedStyle.
Assignee | ||
Comment 1•12 years ago
|
||
versions of ResolveStyleFor and ResolvePseudoElementStyle and then
modify FileRules to support those, or use a cut-down custom version of
FileRules for them. That would be faster, but more complicated on the
style set side. We can always make that switch if we need to, I guess.
Attachment #670868 -
Flags: review?(dbaron)
Assignee | ||
Comment 2•12 years ago
|
||
Oh, an open question is whether preshints should be counted as "default" style or not. Either way is easy to implement. For now I did not include them. This is generally OK, modulo things like @hidden, for which we treat them as preshints but the spec technically treats them as UA rules or something.
Assignee | ||
Updated•12 years ago
|
Whiteboard: [need review]
Comment on attachment 670868 [details] [diff] [review]
Expose a getter for default computed style. alternative implementation strategy is to add "default-only"
Could you:
(1) replace the boolean with an enum (with useful names for the values)?
(2) append to an array, and then either (a) reverse into another array (preferably with SetCapacity first) or (b) add a Reverse method to nsTArray and use nsTArray<nsCOMPtr<nsIStyleRule> >
?
r=dbaron with that
Attachment #670868 -
Flags: review?(dbaron) → review+
Assignee | ||
Comment 4•12 years ago
|
||
For #2, I did a combination, because knowing that I have an nsTArray of nsCOMPtr means I can reverse without refcounting like so:
for (uint32_t i = 0, length = rules.Length(), stop = length / 2;
i < stop; ++i) {
rules[i].swap(rules[length - i - 1]);
}
Assignee | ||
Comment 5•12 years ago
|
||
Oh, and I can't use the enum in nsGlobalWindow function signatures, unfortunately, because I can't include nsComputedDOMStyle.h in nsGlobalWindow.h due to include hell. :(
Assignee | ||
Comment 6•12 years ago
|
||
Flags: in-testsuite+
Keywords: dev-doc-needed
Whiteboard: [need review]
Target Milestone: --- → mozilla19
Assignee | ||
Comment 7•12 years ago
|
||
I wrote some docs at https://developer.mozilla.org/en-US/docs/DOM/window.getDefaultComputedStyle
Keywords: dev-doc-needed → dev-doc-complete
Comment 8•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Summary: Expose a way to get computed style taking only UA and user sheets into account → Expose a way to get computed style taking only UA and user sheets into account (getDefaultComputedStyle)
You need to log in
before you can comment on or make changes to this bug.
Description
•