Commit graph

98 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
2f18b67ce1
style: Make resolutions more like the rest of the CSS values.
Bug: 1460655
Reviewed-by: xidorn
MozReview-Commit-ID: 3Gt8VX1KhjC
2018-05-19 10:15:17 +02:00
Xidorn Quan
8c322b9c1e
style: Make KTableEntry an independent type.
Bug: 1448759
Reviewed-by: heycam
MozReview-Commit-ID: oZfJAigThN
2018-05-05 16:19:46 +02:00
Bobby Holley
c99bcdd4b8 Run rustfmt on selectors, servo_arc, and style.
This was generated with:

./mach cargo fmt --package selectors &&
./mach cargo fmt --package servo_arc &&
./mach cargo fmt --package style

Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
2018-04-10 17:35:15 -07:00
Bobby Holley
f7ae1a37e3 Manual fixups so that the rustfmt output won't trigger tidy. 2018-04-10 17:33:25 -07:00
Nicholas Nethercote
8705fb3783 Convert StylePrefs to StaticPrefs. 2018-04-03 11:41:03 +10:00
Emilio Cobos Álvarez
55e2cd5dc3
style: Remove unsound Atom From implementations.
Fixes #20158
2018-03-19 11:06:53 +01:00
Xidorn Quan
458d94a67e Use atom for identifier media features. 2018-02-08 12:41:17 +11:00
janczer
661d234c3c Change debug assertions to specific ones 2018-02-07 09:21:24 +01:00
Emilio Cobos Álvarez
1804f135ec
style: Optimize @keyframes rule insertions.
Bug: 1435214
Reviewed-by: xidorn,hiro
MozReview-Commit-ID: AHwhZynLBv
2018-02-05 11:54:01 +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
Emilio Cobos Álvarez
75af7c0b41
style: Make Gecko's media query evaluation work with a document, not a pres context.
Returning a zero-sized viewport in the case there's no shell / pres context.

For now, no other change yet. After this we can start tweaking the ShadowRoot
Stylist setup, and even try to return computed styles without a document \o/.

Bug: 1430608
MozReview-Commit-ID: 3cT2PKQISri
2018-01-17 14:36:04 +01:00
Simon Sapin
e17697fb0e Update euclid, azure, skia, offscreen_gl_context, plane-split, webrender 2017-12-08 14:32:28 +01:00
Cameron McCormack
4a3fea1bd1 style: Stop using nsMediaExpression_Range. 2017-11-23 17:48:43 +08:00
Emilio Cobos Álvarez
c7a3c929f6
style: Enable chrome-only CSS features in user stylesheets.
MozReview-Commit-ID: FJ4vTiOrotH
Reviewed-by: heycam
Bug: 1418963
2017-11-21 10:59:47 +01:00
Emilio Cobos Álvarez
69ddb9501b
style: Remove some uses of unused unsafe. 2017-11-15 13:26:24 +01:00
Emilio Cobos Álvarez
8191853233
style: Support calc() in media queries.
Bug: 1396057
Reviewed-by: Manishearth
MozReview-Commit-ID: 6YbeqInC5Mw
2017-11-12 23:44:53 +01:00
Emilio Cobos Álvarez
a09f5208d4
style: Fix indentation of the media query code.
Bug: 1396057
Reviewed-by: Manishearth
MozReview-Commit-ID: BtdGHbQAzeS
2017-11-12 23:44:02 +01:00
Emilio Cobos Álvarez
92944cd5eb
style: Make css(dimension) apply to the variant. 2017-11-12 16:25:00 +01:00
Emilio Cobos Álvarez
4927786d90
style: Implement css(dimension) and derive ToCss for a bunch of stuff.
For css(dimension), it'd be nice to derive(Parse) too, I think...
2017-11-12 16:22:45 +01:00
CYBAI
0f57d250bb style: Move font-size outside of mako 2017-11-08 14:31:06 +08:00
Emilio Cobos Álvarez
3fa75bbdf6
style: Introduce SourceSizeList.
MozReview-Commit-ID: 9QMF45VcBFB
2017-11-06 16:36:41 +01:00
Emilio Cobos Álvarez
b721215a00
style: Update bindgen to 0.31.3.
Constified enums are default now. I think I want to introduce an option to
bindgen to allow setting the default enum behavior, but it doesn't need to block
this.

The ServoBindings.toml changes are somewhat hacky, but that's because of
https://github.com/rust-lang-nursery/rust-bindgen/issues/1125.

Also, the fixups now need to account for whitespace, since quote generates stuff
like root :: nsString, and we don't rustfmt the bindings if there's no rustfmt
installed.

Bug: 1412486
Reviewed-by: xidorn
MozReview-Commit-ID: EY5eNnCiTIw
2017-10-31 20:09:18 +01:00
Nicholas Nethercote
5866b820e0 Introduce nsStaticAtom.
It's a sub-class of nsAtom, useful for cases where you know you are dealing
exclusively with static atoms. The nice thing about it is that you can use
raw nsStaticAtom pointers instead of RefPtr<>. (In fact, the AddRef/Release
implementations ensure that we'll crash if we use RefPtr<nsStaticAtom>.)
2017-10-27 20:33:40 +11: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
c0f8f15f39 Update to cssparser 0.22 (source location in error types) 2017-10-10 13:28:17 +02:00
Emilio Cobos Álvarez
b0706d5cf0
stylo: Add a mechanism to restrict media-features to UA and chrome sheets.
Reviewed-by: xidorn
Bug: 1396066
MozReview-Commit-ID: 38jRV6mPbE3
2017-10-07 13:13:36 +02:00
Xidorn Quan
8fc24bc5fa Backout #18759 2017-10-07 12:27:04 +11:00
bors-servo
6421332fb3 Auto merge of #18764 - bradwerth:onlyDPPX, r=heycam
Change MediaExpressionValue::from_css_value to only accept pixels

MozReview-Commit-ID: Hn3twVa8xLo

<!-- Please describe your changes on the following line: -->
https://bugzilla.mozilla.org/show_bug.cgi?id=1404097
https://reviewboard.mozilla.org/r/184746/

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because existing tests provide coverage.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/18764)
<!-- Reviewable:end -->
2017-10-06 03:39:42 -05:00
Emilio Cobos Álvarez
43636e676d
stylo: Restrict system-metric media features to UA and chrome sheets only. r=xidorn
Reviewed-by: xidorn
Bug: 1396066
MozReview-Commit-ID: 38jRV6mPbE3
2017-10-05 20:51:21 +02:00
Brad Werth
61b9b68278 Change MediaExpressionValue::from_css_value to only accept one type of unit (pixels).
MozReview-Commit-ID: Hn3twVa8xLo
2017-10-05 11:12:56 -07:00
Brad Werth
b8e78d20bf Change resolution queries to compare in unconverted dppx units.
MozReview-Commit-ID: 7wYlixTQTIC
2017-10-03 13:56:14 -07:00
Nicholas Nethercote
7019d42523 Devirtualize nsIAtom. 2017-09-27 12:40:31 +10:00
Emilio Cobos Álvarez
4e6fd5693a
style: Cleanup some media-query-related code. 2017-09-26 14:49:25 +02:00
Manish Goregaokar
c2fcc9ce1a stylo: Add keyword info to computed value of font-size 2017-09-23 10:51:21 -07:00
Brad Werth
52dc4f438a Bug 1399941 Part 1: Prevent aspect-ratio media queries from causing multiplication overflow by extending values to u64.
MozReview-Commit-ID: e4kfxMDvZh
2017-09-15 10:34:35 -07:00
Emilio Cobos Álvarez
8c3c56909e
style: Implement the body text color quirk in a more straight-forward way.
This avoids grabbing the document when values that inherit from the body,
whatever that means, aren't under the body.

In that case we'll get a semi-random value, but that's also mishandled by Gecko
anyways (and probably Blink, though haven't tested), and doesn't really make
much sense.
2017-09-15 10:34:42 +02:00
Cameron McCormack
1cde26eacb style: Record the property we are computing on computed::Context, if it's a non-inherited one. 2017-09-14 17:13:42 +08:00
Emilio Cobos Álvarez
c34c92e904 style: Add a TLS-based style struct caching mechanism. 2017-09-14 17:13:39 +08:00
Boris Chiou
a949e2a057 Introduce CSSPixelLength and update NonNegativeLength.
First, we define computed::CSSPixelLength which contains a CSSFloat, a
pixel value, and then we replace computed::Length with CSSPixelLength.
Therefore, the |ComputedValue| of NoCalcLength, AbsoluteLength,
FontRelativeLength, ViewportPercentageLength, CharacterWidth, and
PhysicalLength is CSSPixelLength.

Besides, we drop NonNegativeAu, and replace computed::NonNegativeLength
with NonNegative<computed::Length>. (i.e. NonNegative<CSSPixelLength>)
2017-09-13 18:05:14 +08:00
bors-servo
9c0abfea23 Auto merge of #18422 - emilio:stale-todo, r=bholley
style: Remove stale todo about handling scrollbars in viewport units.

This is effectively not going to happen, per
https://github.com/w3c/csswg-drafts/issues/1766

<!-- 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/18422)
<!-- Reviewable:end -->
2017-09-08 16:30:26 -05:00
Emilio Cobos Álvarez
9a55b1e469
style: Remove stale todo about handling scrollbars in viewport units.
This is effectively not going to happen, per
https://github.com/w3c/csswg-drafts/issues/1766
2017-09-08 23:24:12 +02:00
Fernando Jiménez Moreno
337a90329c stylo: Error reporting for unknown media features 2017-09-08 12:48:50 +02:00
bors-servo
c60dd53210 Auto merge of #18355 - servo:no-fmt, r=emilio
Reduce usage of fmt in serialization and error reporting

`format!` and `write!` create a somewhat-heavyweight `Formatting` struct and use dynamic dispatch to call into impls of `Dispaly` and related traits. The former also allocates an intermediate string that is sometimes unnecessary.

I started looking into this from https://bugzilla.mozilla.org/show_bug.cgi?id=1355599, but I expect the impact there will be small to insignificant. It might be a slightly less so on parsing (error reporting).

<!-- 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/18355)
<!-- Reviewable:end -->
2017-09-04 13:14:44 -05:00
Simon Sapin
5d06c9959f Replace some more uses of write! in components/style 2017-09-04 19:01:43 +02:00
Nazım Can Altınova
7ba0667ed9 Remove calc support from media queries
Gecko currently doesn't support calc inside media queries. We should
also remove the calc support temporarily for parity with gecko. We can
add this support back in next releases.
2017-09-01 13:22:18 -07:00
Emilio Cobos Álvarez
15e71c5670
style: Don't look for viewport units in stylesheets.
Use whether we've computed any viewport unit instead.

This is more accurate (we avoid restyling unnecessarily if we've found anything
ever on the stylesheet, but that hasn't matched).

This has the benefit of also matching Gecko, and simplify some code and
fishyness around, and also hopefully speeding up stylesheet parsing.
2017-08-28 12:05:22 +02: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
Xidorn Quan
7e92c15e00 Replace write! with to_css and write_str in some ToCss impls 2017-08-20 17:21:08 +10:00
Daisuke Akatsuka
c05baa2327 Implement clone_content method 2017-08-15 15:25:05 +09:00
Brad Werth
557ffa979d Rework MediaType to be an atom-based struct instead of an enum.
MozReview-Commit-ID: 1Tfrs9PBkhA
2017-08-09 13:25:30 -07:00