Open Bug 119730 Opened 23 years ago Updated 2 years ago

computed CSSValues should be live

Categories

(Core :: DOM: CSS Object Model, defect, P5)

defect

Tracking

()

People

(Reporter: bzbarsky, Unassigned)

Details

(Keywords: arch, Whiteboard: [WAITING ON WG])

Computed CSSValues currently have a value set at creation time and do not change thereafter. They should be live and change as the element's style changes. So CSSValues should hold a pointer to the nsComputedDOMStyle object and call functions on it to get the actual value when asked for it. Alternately, we need lots of static callback functions that can be called and the content pointer needs to be held somewhere useful.... This is just here so I think about this for now.
Targeting at 1.0, though I doubt this is going to happen by then.
Keywords: arch
Target Milestone: --- → mozilla1.0
Not happening for 1.0.
Target Milestone: mozilla1.0 → mozilla1.1
let's be realistic here.... :)
Target Milestone: mozilla1.1alpha → mozilla1.2alpha
not gonna happen any time soon.
Target Milestone: mozilla1.2alpha → Future
OK. I was thinking about this last night, and wanted to get those thoughts down somewhere: 1) Ownership issues. This is only a problem if we want getPropertyCSSValue("foo") to always return the same object. That can be done, but for starters it's easier to just create a new object every time. The object would then own the declaration. Any "inner" cssvalues (eg those you can get by calling getRectValue() and getting .top or something) would own the "outer" cssvalue. 2) Information flow. The declaration has all the information. The CSSValue knows how to ask the declaration for information and how to process it for output. This means we don't need to have a system for observing style changes. Yes, it's slower than it could be. But I don't think we care that much about speed here. 3) nsDOMCSSValue. This would be a superclass that's a base by both readonly and writable cssvalues. It would own the declaration, have a css prop id that it corresponds to, and maybe a bool for whether it's readonly (but that could live on the decl, really). This class would know how to do things like unit conversions and the like. It's not clear how much functionality we'd really need outside this superclass; it's a matter of how we split the work between the declarations and the CSSValues. 4) nsDOMCSSDeclaration. We already have this as a class. We should have a common "internal" interface of some sort implemented by all CSSDeclaration objects (nsICSSDeclaration could maybe do) so that the cssvalues can use this interface to retrieve information. 5) Information transfer. The perfect chunk of style information is probably nsCSSValue. nsCSSDeclaration already has a way of getting one given a prop id; computed style should implement such a way. Then the nsDOMCSSValue object could just get this nsCSSValue and apply whatever transformations (eg unit conversions) it needs to. 6) Implement GetPropertyValue(prop, nsAString&) on computed style in terms of GetPropertyValue(prop, nsCSSValue&) for longhands and explicitly for shorthands. .cssText on a CSSValue should probably just call GetPropertyValue("prop", nsAString&) (here prop is a CSS property ID, not a string). 7) Outstanding issue: rect and color "subvalues". These would probably be separate classes from the "normal" cssvalue. The "normal" cssvalue needs an API it implements whereby these subvalues can fetch and store information (just simple GetColor/SetColor/GetRect/SetRect properties that throw exceptions on type errors would be perfectly appropriate, I think). 8) Outstanding issue: cssvaluelist -- I just don't remember enough about our implementation to say anything off the top of my head. I seem to recall nsCSSValue _does_ support value lists, though...
per conversation with hixie, this is now bottom dog.
Priority: -- → P5
Whiteboard: [WAITING ON WG]
No plans to work on this any time in the foreseeable future, so to default owner.
Assignee: bz-vacation → general
Priority: P5 → --
Target Milestone: Future → ---
Assignee: general → nobody
QA Contact: ian → general
QA Contact: general → style-system
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.