This will be used as a base both for parsing text-shadow and box-shadow
properties. The type is private, as there's no real use in exporting
this in a public API.
https://bugzilla.gnome.org/show_bug.cgi?id=649314
This has mostly two advantages:
- the most obvious one is the theme can render a border around the
sidebar if it wants to.
- we also can avoid hardcoding a container border width for the sidebar,
and just use a padding from the theme. This also allows different
themes to define a different padding, etc.
The drawback is we must draw the background ourselves, but it's easy
enough.
https://bugzilla.gnome.org/show_bug.cgi?id=650530
Lots of code calls gtk_menu_popup() and we don't want to resize the
window needlessly.
In this particular case, keyboard navigation to submenus caused those
submenus to shrink.
Note: I'm not sure this fix doesn't have nasty side effects, as I'm not
a specialist on menu popup code, so if it does, we'll need to revert it.
Until then, let's keep it, it fixes a bug.
If props == NULL in gtk_symbolic_color_resolve(), fail sanely for named
colors. The docs used to say it was not allowed to pass NULL for named
color, but that had problems:
1) You do not know if a color was created that way. This is especially
hard for generic users (like language bindings).
2) It wasn't even true. Colors using other symbolic colors would also
fail when trying to resolve their named colors, but the docs didn't
say so.
And because I want to use the function to resolve static colors early
where possible, I changed things.
This provides a huge speedup as we only need to preprocess style
properties when they are indeed inherited. This roughly doubles the
performance of the CSS matcher and brings the time taken by
gtk_css_provider_get_style() from 19% to 7% in my favorite benchmark.
One for the style properties, one for the widget style properties.
This way we can make one hash table by pspec which means we don't have
to repeat the pspec lookup.
Keep rulesets as an on-stack/heap structure instead of allocating all
instances separately.
Also, pass a ruleset to the ruleset parser, so we can make the ruleset
parser do lots of fancy things that might be useful for performance.
The code used the quarked name before, but when we already have the
pspec we want to have a lookup that does not involve quarking. And
lookup is equally fast if we only have the name.
Previously we got the list of all matching rules and then iterated it to
find the first one that had the property. Now we look while matching
rules, so we don't lookup rules that we don't need.
Instead of relying on GScanner and its idea of syntax, code up a parser
that obeys the CSS spec.
This also has the great side effect of reporting correct line numbers
and positions.
Also included is a reorganization of the returned error values. Instead
of error values describing what type of syntax error was returned, the
code just returns SYNTAX_ERROR. Other messages exist for when actual
values don't work or when errors shouldn't be fatal due to backwards
compatibility.
This is pretty important, because otherwise recursions cause crashes.
And if you accidentally change your theme to one that crashes on load,
all your gonna SEGV and then on reboot, gdm tries to load the theme...
Call gtk_css_provider_load_from_file() instead of the internal function.
This has two advantages:
1) It simplifies the code a lot
2) It gets rid of GMappedFile usage. GMappedFile does not work
everywhere, so this is finally portable.
This way, we achieve two things:
1) We can unify file loading to one location
2) We can emit the error from file loading using the parsing-error
signal. This is very useful for @import handling in particular.
Emits the error without the need for a scanner. Also simplifies
gtk_css_provider_take_error() because we now can assert an available
scanner at all times.
Instead of having an error member in the CSS provider's private struct,
connect a signal handler when an error is passed in. This has two
advantages:
1) It makes the code clearer as we don't have to keep track of an error
member anywhere.
2) It causes a non-emission of the g_warning() when an error was passed
in, because it only triggers when no signal handlers are connected.
So we get identical behavior to GTK 3.0 where warnings where only
emitted when no error was passed in.
Instead of aborting a parse whenever we encounter an error, parse to the
end. But if a GError was passed in, reset the provider completely as if
nothing had been parsed.
Value parsing only sometimes emitted errors. Sometimes it didn't emit
errors but ignored the value, sometimes it took a default, sometimes it
converted it to something it deemed suitable.
While refactoring, I moved the whole GValue <=> char * conversion
routines to a separate file, to make navigating the core css provider
easier.
Previously, we only checked for errors after parsing the full
declaration. Now we detect errors with the property before even
attempting to parse its value.
The benefit here is that the error reporting reports the correct line
and position numbers.
The previous code failed to account for all child visibility and paned
mapedness invariants which could cause stray GDK windows to appear.
Not good.
Credit goes to Xan for triggering it.