Commit Graph

44 Commits

Author SHA1 Message Date
Timm Bäder
9ef700b161 css parser: Reuse one GString
Instead of creating a new one for every ident, name and string, just
create one GString and reuse it. This means the GString we keep around
will grow to the maximum size of any ident, name or string we parse,
which is still not terribly large.
2018-01-02 08:10:06 +01:00
Matthias Clasen
a08e2b5692 Drop code parsing deprecated forms of url
We no longer allow whitespace between url and (.
2017-09-17 17:01:29 -04:00
Benjamin Otte
fb47a8d714 css: Remove deprecated number-as-pixels compatibility
Previously, for compatibility with GTK 3.0, we allowed specifying
numbers without units and interpreted them as pixels, even when the CSS
specification didn't.

Remove that now that we can break API.
2017-01-18 04:13:56 +01:00
Benjamin Otte
3056d793a4 cssparser: Make _gtk_css_parser_has_number() a bit smarter
Previously we just checked the first character. And if that was a "-" as
in "-gtk-some-special-value", we assumed it was a number. Which it
clearly wasn't.

Test included
2016-02-23 04:22:19 +01:00
Benjamin Otte
b246d55472 css: Turn number values into a virtual type
GtkCssNumberValue is now a base class for numbers.

Actual numbers are now implemented in GtkCssDimensionValue. The name is
borrowed from the CSS spec, so there.
2016-02-13 04:49:07 +01:00
Benjamin Otte
0e7691c12e css: Add rem unit
Good luck, Lapo.
2016-02-04 19:37:44 +01:00
Matthias Clasen
3c54fbd3ac Use stupid quotes instead of dumb quotes
Following a similar change in GLib a while ago.

'bla' may by stupid, but it looks less dumb than `bla'.
2015-09-23 07:01:16 -04:00
Benjamin Otte
b90802f7e4 css: Actually break at end of the string
Introduced in 65c4c1555d.

Found by gnome-continuous running the testsuite.

Includes fixing a broken test in the testsuite.
2014-05-22 02:13:49 +02:00
Benjamin Otte
65c4c1555d css: Fix printing code for CSS strings and idents
It used to infloop on special characters.
2014-05-05 15:48:02 +02:00
Benjamin Otte
b356d81410 css: Split out a common function
It's used in two places already, and Iwant to use it in a third one.
2014-05-05 15:48:02 +02:00
Marcus Kraßmann
7f3595a6be cssparser: Don't detect /*/ as a comment 2012-11-28 21:11:48 +01:00
Benjamin Otte
12683da8f7 gtk: Make functions static that don't need to be non-static
Also remove the starting underscore from function names where
appropriate, as those functions are static now and not exported anymore.

This is part of a bunch of fixes for gcc complaining about
-Wmissing-declarations.
2012-10-02 19:32:51 +02:00
Benjamin Otte
c69e30d65a cssparser: Don't use a free'd string in error messages 2012-09-17 20:39:11 +02:00
Benjamin Otte
e1317268a3 cssparser: Change APIs that work with files
Now that we keep track of the parser's file, we don't require it to be
passed anymore.
2012-05-11 16:42:12 +02:00
Benjamin Otte
a65780902a cssparser: Keep track of the file 2012-05-11 16:42:11 +02:00
Benjamin Otte
1223d53a82 cssparser: Move symbolic color parser to gtksymboliccolor.c 2012-04-17 08:59:19 +02:00
Benjamin Otte
dcd54e20d1 css: Remove GtkCssNumber
It's completely replaced by GtkCssNumberValue now.
2012-04-17 08:59:19 +02:00
Benjamin Otte
662d6787f3 css: Add <time> type to css number stuff 2012-04-17 08:59:16 +02:00
Benjamin Otte
b0e764000f cssparser: Use _gtk_css_parser_error_full() 2012-04-17 08:59:12 +02:00
Benjamin Otte
e7acdec220 cssparser: Add _gtk_css_parser_error_full() 2012-04-17 08:59:11 +02:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Benjamin Otte
0c140daff2 css: Implement support for angles 2012-02-02 03:14:00 +01:00
Benjamin Otte
893807bee0 css: Add GtkCssNumber 2012-02-02 03:14:00 +01:00
Alexander Larsson
e46971306a Ensure we can load images via resource:// uris from CSS 2012-01-16 14:19:19 +01:00
Cosimo Cecchi
e0efeba27e parser: remove unused _gtk_css_parser_read_uri()
It's not used anymore now.
2012-01-13 18:09:30 -05:00
Cosimo Cecchi
d1f3fe4342 parser: remove a duplicate copy of gtk_css_parse_url()
Move the function to gtkcssparser.c and use it in both places.
2012-01-13 17:55:53 -05:00
Paolo Borelli
fee09e726f Introduce _gtk_css_parser_try_length
This starts to introduce the proper API abstraction for when we will
support different units
2012-01-09 18:37:58 +01:00
Benjamin Otte
38be9fe879 css: Add _gtk_css_parser_has_prefix() 2012-01-09 18:37:56 +01:00
Benjamin Otte
f5fafb18c9 css: 'transparent' is a valid color everywhere 2012-01-09 18:37:53 +01:00
Paolo Borelli
7c779a0bee Plug tiny leak in the css parser 2011-12-03 17:52:24 +01:00
Alexander Larsson
1a68afffaf css: Add _gtk_css_parser_try_enum
This helps parsing GType enums in CSS, properly handling
CSS being case insensitive.
2011-11-25 15:36:08 +01:00
Alexander Larsson
3309639c1c Add support for win32 theme colors as symbolic colors 2011-11-18 10:16:38 +01:00
Benjamin Otte
8d6b560ff3 cssparser: Fix cases where we could overrun the terminating 0 2011-08-26 16:26:28 +02:00
Benjamin Otte
62d231aeff cssparser: Make lines and positions 0-indexed 2011-08-26 16:26:28 +02:00
Benjamin Otte
014165151f css: Use the correct free function 2011-07-20 02:36:44 +02:00
Benjamin Otte
0d253b67f4 css: Make font property a shorthand
... and implement the CSS font properties:
- font-size
- font-style
- font-family
- font-weight
- font-variant

This is the second try at this. The first was backed out previously due
to bugginess. Let's hope this one survives a bit longer.

Also makes the font-family CSS test work again.
2011-06-15 12:52:53 +02:00
Benjamin Otte
9e2ebdee07 cssparser: Actually send an error in an error case
The error case was excess commas in rgb/rgba colors, such as
rgba(0,255,0,0,0.5)
2011-06-13 15:01:52 +02:00
Benjamin Otte
2e6bb2a0c9 Revert "css: Make font property a shorthand"
The hack in gtk_style_context_get_font() was causing segfaults in
combobox code. This is not acceptable and I'm not awake enough to fix
it, so just reverting until it's fixed sanely is easiest.

This reverts commit cf6bfbdb17.
2011-06-02 02:31:44 +02:00
Benjamin Otte
cf6bfbdb17 css: Make font property a shorthand
... and implement the CSS font properties:
- font-size
- font-style
- font-family
- font-weight
- font-variant
2011-06-02 02:03:52 +02:00
Benjamin Otte
b1aa59d385 css: Don't infloop when resyncing over a slash 2011-06-02 02:03:51 +02:00
Benjamin Otte
beccec296b css: We want to unescape backslashes, not slashes 2011-06-02 02:03:51 +02:00
Benjamin Otte
4c6721d096 cssparser: Fix typo where we used "uint" for a type
Interestingly this works for gcc, but breaks on MSVC.
2011-05-22 06:07:45 +02:00
Benjamin Otte
d2ef71627b css: Make property parsing functions take a css parser
Instead of reading a string and then passing that in, let the parse
functions use the full power of the parser.
2011-05-18 22:17:59 +02:00
Benjamin Otte
7ccb9db79e css: Rewrite the parser
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.
2011-05-18 22:17:55 +02:00