John J. Barton wrote:
However, the rules are found if we "inspect" the element and the mouse is over the element. It is as if the result of getCSSStyleRules(element) depends on content state.

It does, indeed. It also depends on the attributes the element has, its position in the tree, and so forth. These are all no different from each other, really.

Well from the developer's viewpoint attributes and position are quite different from 'hover'. We need the mouse to run the debugger so we can't be hovering all day...

That's not that different from dealing with a page that is performing animation by setting a class attribute, say. That's a rarer case, but fundamentally the same.

Doing that would sorta work if you only twiddle the ESM-managed bits, but it would actually change the ESM's state (for example, you can't remove hover state by unsetting the hover bit this way, as far as I can tell). In general, the content state stuff in inspector utils is pretty broken and could use some serious work, imo.

What is an ESM?

EventStateManager.  The class that keeps track of things like hover state.

I guess Firebug needs to present 'what if' options to the user, at least for mouse-dependent rules. So imagine the element rules that are active followed grey-ed rules that would apply to the element if certain conditions are met, eg "hovered". The user can move the debugger mouse over the grey-ed rules and they will be activated temporarily so the developer can take a look. And if the mouse does hover, then the rules are activated.

That would require a getAllCSSStyleRules(element) as well as temporary get/set bits working.

Ok. Bugs filed? This would need new APIs into the selector-matching engine, and it's not obvious what the right APIs would look like. For example, what should happen with rules like "div:hover > p" when looking at paragraphs?

Is there anything like an 'onHover'? onContentStateChange? Firebug could at least reflect the hover change in its UI if it got an event.

onMouseOver, no?

There is no generic notification for content state changes (or even just event state changes; content state includes things like :default that are not managed by the ESM).

-Boris
_______________________________________________
dev-tech-layout mailing list
dev-tech-layout@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-layout

Reply via email to