Commit graph

99 commits

Author SHA1 Message Date
Anthony Ramine
ca45695db1 Introduce #[css(skip)] 2018-03-05 15:53:15 +01:00
Jonathan Kew
33ead015b1 style: Make 'font' shorthand reset the 'font-variation-settings' property.
As required by the spec: https://drafts.csswg.org/css-fonts-4/#font-prop

See https://bugzilla.mozilla.org/show_bug.cgi?id=1435983

Basically, make font-variation-settings work in the same way as font-feature-settings
already does.
2018-03-04 12:26:32 +00:00
Xidorn Quan
ea8a952d51 Remove initial values from font-face descriptors
They are not used anyway.
2018-02-14 17:35:57 +11:00
Xidorn Quan
6ffa888dd6 Integrate font-variation-settings descriptor with stylo 2018-02-14 11:15:58 +11:00
bors-servo
dcd13b857c
Auto merge of #19918 - emilio:font-stuff-is-a-mess, r=nox
style: Refactor font-feature-settings and font-variation-settings.

This fixes all known issues with serialization and parsing of these two
properties, and in particular calc handling and such:

  https://bugzilla.mozilla.org/show_bug.cgi?id=1434692
  https://bugzilla.mozilla.org/show_bug.cgi?id=1434724

Also does a fair amount of cleanup and all that, which was needed, this code
was a mess.

There are further cleanups that can be done, like renaming the
font-variation-settings animation stuff.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19918)
<!-- Reviewable:end -->
2018-02-01 06:45:20 -06:00
Emilio Cobos Álvarez
3b34d734e6
style: Refactor font-feature-settings and font-variation-settings.
This fixes all known issues with serialization and parsing of these two
properties, and in particular calc handling and such:

  https://bugzilla.mozilla.org/show_bug.cgi?id=1434692
  https://bugzilla.mozilla.org/show_bug.cgi?id=1434724

Also does a fair amount of cleanup and all that, which was needed.
2018-02-01 12:54:45 +01:00
Anthony Ramine
3d99a4489c Don't use define_css_keyword_enum in style anymore 2018-02-01 12:43:48 +01:00
Anthony Ramine
cd8f96cc9e Change ToCss to take a CssWriter<W>
This more concrete wrapper type can write a prefix the very first time something
is written to it. This allows removing plenty of useless monomorphisations caused
by the former W/SequenceWriter<W> pair of types.
2018-01-23 10:41:42 +01:00
Bobby Holley
5526947500 Avoid the generic writer parameter for PropertyDeclaration serialization.
MozReview-Commit-ID: JR3IcL1NRHO
2018-01-22 14:58:05 -08:00
CYBAI
a470ebd501 style: Move font-family outside of mako 2017-11-26 00:36:00 +08:00
Matt Brubeck
efc3683cc7 Fix commonmark Markdown warnings in docs, part 1
Fixes warnings from rust-lang/rust#44229 when `--enable-commonmark` is
passed to rustdoc.

This is mostly a global find-and-replace for bare URIs on lines by
themselves in doc comments.
2017-10-17 11:24:57 -07:00
Simon Sapin
46ea99d54b CSS parsing error types: flatten nested enums somewhat 2017-10-10 13:28:30 +02:00
Simon Sapin
c64374bc58 Use the location in the error value when reporting a CSS error 2017-10-10 13:28:29 +02:00
Simon Sapin
c0f8f15f39 Update to cssparser 0.22 (source location in error types) 2017-10-10 13:28:17 +02:00
Simon Sapin
056e599562 Use the current parser location for CSS error
… rather than the start location of the current construct.
This likely places the error just *after* of the unexpected token
whereas before would be best, but that’s likely a much bigger change.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1378861
2017-10-10 13:27:01 +02:00
Corey Farwell
9cd4535364 Implement size_hint for more iterators.
```
implement size hint for
more iterators because why
not we like fast things
```
2017-09-13 20:29:27 -04:00
Xidorn Quan
2bca62045f Parse at-rule without block in two stages 2017-09-01 16:21:22 +10:00
bors-servo
d4ddec8d33 Auto merge of #18209 - jdm:devirtualize, r=mbrubeck
Devirtualize CSS error reporting.

This removes a trait object from the path of reporting a CSS error.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18209)
<!-- Reviewable:end -->
2017-08-24 13:19:25 -05:00
Josh Matthews
1297c0ff51 Devirtualize CSS error reporting. 2017-08-24 10:41:06 -07:00
Clément DAVID
c5fe235112 order derivable traits lists
Ignoring :
 - **generated**.rs
 - python/tidy/servo_tidy_tests/rust_tidy.rs
2017-08-23 21:38:44 +02:00
Simon Sapin
7382dad939 Update to cssparser 0.19, count line numbers during tokenization 2017-08-09 22:37:16 +02:00
Xidorn Quan
df95a469a0 Make font-display descriptor behind the pref. 2017-08-03 19:07:12 +10:00
Nazım Can Altınova
c9e5cf0a28 Cleanup @font-face rule constructor
Passing SourceLocation into constructor instead of assigning
immediately after construction cleans up the code and helps to
prevent leaving an invalid SourceLocation in the future.
2017-07-26 11:55:22 -07:00
Simon Sapin
eb98ae6e04 Update cssparser to 0.18
https://github.com/servo/rust-cssparser/pull/171
2017-07-24 11:39:12 +02:00
Anthony Ramine
7995a9ed51 Derive ToCss for font-weight descriptors 2017-07-11 15:58:07 +02:00
Xidorn Quan
8b842f5417 Use integer for specified and computed font-weight 2017-07-06 15:31:24 +10:00
Anthony Ramine
17875b8a81 Introduce Separator::parse 2017-06-27 23:37:44 +02:00
Nazım Can Altınova
3421694f12 stylo: Implement font-language-override descriptor for @font-face rule 2017-06-25 18:51:18 -07:00
Fernando Jiménez Moreno
632c5571a9 stylo: make font-weight descriptor in @font-face preserve keyword values 2017-06-20 15:28:39 +02:00
Jonathan Chan
26179b3660 style: Have OneOrMoreSeparated replace OneOrMoreCommaSeparated.
A future patch series has some values that should be separated by spaces. This
allows us to re-use the code for serialization, but the types do get a little
clunky. The separator is now indicated with an associated type.
2017-06-19 16:09:37 -07:00
Anthony Ramine
3217d1404e Derive ToCss for font-face sources 2017-06-17 13:46:30 +02:00
Simon Sapin
b83afdedc8 Upgrade cssparser to 0.15 2017-06-16 15:05:46 +02:00
Josh Matthews
27ae1ef2e7 Thread ParseError return values through CSS parsing. 2017-06-09 16:46:25 -04:00
Josh Matthews
fd6e54d9e3 Report CSS parse errors via enum instead of strings. 2017-06-09 13:16:32 -04:00
Brad Werth
31584e3c14 Deep clone ServoStyleSheets.
MozReview-Commit-ID: 6hYIcOa86Y
2017-05-24 15:05:26 -07:00
Fernando Jiménez Moreno
96a23d9b73 stylo: Bug 1355345 - Support font-display descriptor in @font-face rule 2017-05-18 18:16:24 +02:00
Anthony Ramine
a0886213b6 Support font-feature-settings as a @font-face descriptor 2017-05-18 18:16:22 +02:00
Xidorn Quan
138fa4ca08 Change ToNsCssValue to take the ownership of value. 2017-05-16 14:42:42 +10:00
Fernando Jiménez Moreno
bc156cfe1c Stylo: Bug 1350175 - Support getting line / column number of CSS rules
Fix font_cache_thread test
2017-05-12 15:20:12 +02:00
Simon Sapin
131b12dc67 Reject @font-face descriptors with value value followed by more stuff. 2017-04-01 14:54:57 +02:00
Simon Sapin
b43e2fb0df Macroize conversion of @font-face values to Gecko types 2017-04-01 14:05:32 +02:00
Simon Sapin
61812d4d9d Make the parser accept @font-face rules without font-family or src.
Fix #16165.

Also, it turns out that the CSSFontFaceRule IDL specified in the
css-fonts spec is not web-compatible.
Instead browsers implement a .style attribute like in CSSStyleRule:
https://github.com/w3c/csswg-drafts/issues/825

This in turn requires preserving data about which descriptors
were set or not (distinguishing unset from set to a value that happens
to be the initial value),
so this commit also makes every field `Option<_>`.
2017-04-01 14:05:32 +02:00
Nazım Can Altınova
9991c496b3
Serialize unquoted font-family without quote 2017-03-30 23:40:23 +03:00
Xidorn Quan
2c0347ac5b Rename font_face::FontFaceRule to FontFaceData. 2017-03-30 11:41:07 +11:00
Simon Sapin
fe4e70c5f8 Introduce a ToCssWithGuard trait 2017-03-19 22:30:33 +01:00
Simon Sapin
8160490272 Remove some unused impls. 2017-03-07 23:37:28 +01:00
Simon Sapin
c3cad2d6c7 Update cssparser to 0.9 2017-02-15 12:42:14 +01:00
Simon Sapin
9ec8418d8c Rename CommaSeparated to OneOrMoreCommaSeparated, reflecting its behavior. 2017-02-03 13:15:53 +01:00
Simon Sapin
4701850f37 Add unicode-range descriptor to @font-face 2017-02-02 20:28:21 +01:00
Simon Sapin
0f351cb851 Fix incorrectly copy-pasted doc-comments. 2017-02-02 20:00:40 +01:00