GNOME Bugzilla – Bug 649798
Css selection problems
Last modified: 2014-05-22 00:29:42 UTC
Created attachment 187511 [details] Test case I'm playing around with CSS, and i have found two problems: 1) A single element matcher: "Foo { }" matches all Foo widgets and all the widgets inside it. This isn't what you expect from css, which only matches the element, and lets you use "Foo, Foo * {}" for the above behaviour. This is problematic because it means there is no way to only select the Foo 2) widget name selectors don't seem to work at all. Attaching a testcase
Ahh, the name selector works, i was just using it wrong ("GtkLabel #name" instead of "GtkLabel#name").
As for 1), it was rather considered a "feature", since GtkCssProvider considers all properties to be inherited by default so, given a label within a button, these 3 selectors are ordered by priority: GtkButton GtkLabel { ... } GtkLabel { ... } GtkButton { ... } With the parent objects' rules yielding less priority, these properties serve as a fallback to more specific rules within the same GtkStyleProvider. However, I know Benjamin was rewriting the parser so it's more CSS3 compliant, not sure if he has plans about having inheritance to be figured out per property there.
Yeah, inherit by default was "ok", but there's problems with it: 1) You don't want inherit almost all of the time - see http://www.w3.org/TR/CSS21/propidx.html - for our code I think we just want inherit for color and font properties. 2) I think the parser didn't get the priorities right, so it could happen that a parent's rule would overwrite a rule applying to the child directly
we have more spec-compliant inheritance now