Last Comment Bug 699592 - Would like a way to ask if a property is inherited by default
: Would like a way to ask if a property is inherited by default
Product: Core
Classification: Components
Component: CSS Parsing and Computation (show other bugs)
: unspecified
: x86 Mac OS X
: -- normal (vote)
: mozilla10
Assigned To: Dave Camp (:dcamp)
Depends on:
  Show dependency treegraph
Reported: 2011-11-03 14:49 PDT by Dave Camp (:dcamp)
Modified: 2011-11-06 04:50 PST (History)
2 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

maybe this will work (1.69 KB, patch)
2011-11-03 14:49 PDT, Dave Camp (:dcamp)
bzbarsky: review-
Details | Diff | Splinter Review
v2 (3.63 KB, patch)
2011-11-04 15:07 PDT, Dave Camp (:dcamp)
bzbarsky: review+
Details | Diff | Splinter Review

Description Dave Camp (:dcamp) 2011-11-03 14:49:13 PDT
Created attachment 571788 [details] [diff] [review]
maybe this will work

We're working on a developer tool (similar to firebug's) that shows the css rules that apply to an element. It shows properties from cssText for rules returned from nsIDOMUtils::getCSSStyleRules(). For parent elements, we want to show only properties whose value might be inherited.
Comment 1 Boris Zbarsky [:bz] (TPAC) 2011-11-03 22:45:06 PDT
Comment on attachment 571788 [details] [diff] [review]
maybe this will work

>+++ b/layout/inspector/src/inDOMUtils.cpp
>+  *_retval = (sid < nsStyleStructID_Reset_Start);

How about:

  *_retval = !nsCachedStyleData::IsReset(sid);

?  You'll need to include nsRuleNode.h.

r=me with that.
Comment 2 Boris Zbarsky [:bz] (TPAC) 2011-11-03 22:47:12 PDT
Comment on attachment 571788 [details] [diff] [review]
maybe this will work

Actually, wait.  This will break for shorthands because kSIDTable only goes up to eCSSProperty_COUNT_no_shorthands.

You need to handle shorthands specially (e.g by setting |prop| to one of the longhands the shorthand expands to).

And please add some tests (including for the above) and a commit message?
Comment 3 Dave Camp (:dcamp) 2011-11-04 15:07:56 PDT
Created attachment 572093 [details] [diff] [review]
Comment 4 Boris Zbarsky [:bz] (TPAC) 2011-11-04 15:16:29 PDT
Comment on attachment 572093 [details] [diff] [review]

Comment 6 Rob Campbell [:rc] (:robcee) 2011-11-06 04:50:39 PST

Note You need to log in before you can comment on or make changes to this bug.