Closed Bug 870845 Opened 11 years ago Closed 11 years ago

API for helping get all CSS property names missing a bunch of properties

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: miker, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

In bug 839443 platform created domUtils.getCSSPropertyNames() but the output is missing a bunch of properties (the full list would be the properties returned by getComputedStyle()).

STR:
1. Ensure that devtools.chrome.enabled is true
2. Open the web console
3. Open Scratchpad
4. From Environment menu select Browser.
5. Paste the following code into Scratchpad:
############################
let domUtils = Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);

let names = domUtils.getCSSPropertyNames(domUtils.INCLUDE_ALIASES & domUtils.EXCLUDE_SHORTHANDS);

content.console.log(names.length + " properties from getCSSPropertyNames():");
content.console.log(names.sort());

let computed = content.getComputedStyle(content.document.body);
content.console.log("There are " + computed.length + " properties from getComputedStyle()");
content.console.log(computed);

let missingFromGetCSSPropertyNames = [];
for (let prop of computed) {
  if (names.indexOf(prop) == -1) {
    missingFromGetCSSPropertyNames.push(prop);
  }
}
content.console.log(missingFromGetCSSPropertyNames.length + " properties missing from getCSSPropertyNames():");
content.console.log(missingFromGetCSSPropertyNames);
############################
6. Run the code and you will see that 146 property names are missing when using getCSSPropertyNames().
Ouch.  PARSE_INACCESSIBLE doesn't work the way I thought it worked.  Fix coming up.
Assignee: nobody → bzbarsky
Whiteboard: [need review]
Comment on attachment 748020 [details] [diff] [review]
Correctly check or parse-inaccessible properties in inDOMUtils::GetCSSPropertyNames.

Since it doesn't make sense to treat the CSS_PROPERTY_PARSE_* values as flags, can you add an assertion to nsCSSProps::PropHasFlags that it doesn't have any of those bits set in aFlags?  And similar assertions in PropertyParseType and ValueRestrictions to maek sure we only pass in values that have bits set in the right places.  r=me with that.
Attachment #748020 - Flags: review?(cam) → review+
PropertyParseType and PropertyParseType don't take flags; they just return them.

I added an assert to PropHasFlags.

https://hg.mozilla.org/integration/mozilla-inbound/rev/267fe0d9c201
Flags: in-testsuite?
Whiteboard: [need review]
Target Milestone: --- → mozilla24
Backed out for mochitest-bc, mochitest-other, and xpcshell orange.
https://hg.mozilla.org/integration/mozilla-inbound/rev/9182c3e6a967
https://hg.mozilla.org/mozilla-central/rev/1835839d5a61
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: