Implement the functions described in the "Mathematical
Expressions" section of the "CSS Values and Units Module
Level 4" spec, https://www.w3.org/TR/css-values-4/.
Beyond calc(), which we already had, this includes
min(), max(), clamp(),
round(), rem(), mod(),
sin(), cos(), tan(), asin(), acos(), atan(), atan2(),
pow(), sqrt(), hypot(), log(), exp(),
abs(), sign(),
e, pi, infinity and NaN.
Some tests included.
Allows the application to handle "Dock icon > Quit" the same as
"Application menu > Quit".
Requires GtkApplication's `register-session` property.
Suitable replacement for gtk-mac-integration's
`NSApplicationBlockTermination` signal.
Extract the "user filter" code from the `GtkFontChooserWidget`, for a
couple of reasons:
* If we want to expand the filter in the future (e.g. to filter on
variable fonts, or check for multiple languages), we have a nice place
to put this.
* It simplifies the font chooser widget a tiny bit, as it's a pretty big
file which can be hard to follow.
* With a custom `GtkFilter` subclass, we can actually avoid doing a bit
of work when initially showing the widget, as we can return
`GTK_FILTER_MATCH_ALL` when nothing is selected yet (which is not
possible with a `GtkCustomFilter'). It's not much, but it's still nice
'XPointerUngrabInfo' appears unused since
commit 26cbf87d7d ("New approach for grab tracking code")
Remove it.
Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
Copy what gcc's libstdc++ does for vectors to avoid overflows:
1. Define a max size macro and assert against it
Note that we don't assert but actually check, because this needs
to abort even if assertions are disabled.
2. Don't do fancy math to compute new capacity.
Just size *= 2 instead and be careful about overflow.
Emit errors for all the variables that were being expanded
if an error occurs while parsing a property value at compute time.
Include the variables that are being expanded in the error message.
Pass the bytes we're parsing to the sections, and keep a pointer
to them around, so we can compare them in the has_section
implementation.
This commit also corrects some of the location information that
we add into the section for variables to be more accurate.
We were doing it in one case, but forgetting it in another.
These sections are necessary to report meaningful error locations
when parsing property values at compute time.
When we compute values, the provider we use ends up being the
style cascade. If we hit a parser error when parsing variable-bearing
property values at compute time, we emit the error on that provider.
By making the cascade propagate the error back to the proper css
provider that contains the section in question, we get it reported
back to the css editor in the inspector.