Commit graph

58 commits

Author SHA1 Message Date
Ravi Shankar
dc7c1c6270 Some impls for Either<A, B> 2016-11-22 22:59:03 +05:30
bors-servo
0c55d461f1 Auto merge of #14261 - Wafflespeanut:lon, r=SimonSapin
Prefer Either type for LengthOrNumber

<!-- Please describe your changes on the following line: -->

This adds `impl GeckoStyleCoordConvertible for Either<A, B>` and makes `LengthOrNumber` prefer `Either<A, B>`.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach build-geckolib` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] These changes do not require tests because it's a refactor

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

r? @SimonSapin

<!-- 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/14261)
<!-- Reviewable:end -->
2016-11-18 22:20:04 -06:00
Nazım Can Altınova
fdbadcdce2 Implement ToCss serialization for CSSRules 2016-11-18 12:17:53 +03:00
Ravi Shankar
6ac3fcbfeb Prefer Either<A, B> for LengthOrNumber 2016-11-18 09:14:09 +05:30
Emilio Cobos Álvarez
913c874cb5
Urlmageddon: Use refcounted urls more often. 2016-11-17 18:34:23 +01:00
Emilio Cobos Álvarez
6c3458767b
style: Refactor and add infrastructure for font metrics in style.
This commit itself only moves things around and adds an extra parameter to the
`apply_declarations` function to eventually handle #14079 correctly.

Probably needs a more granular API to query fonts, á la nsFontMetrics, but
that's trivial to do once this is landed.

Then we should make the font provider mandatory, and implement the missing stylo
bits.
2016-11-13 11:54:10 +01:00
Artem Biryukov
9564673b5a Fix related to #14101
Add Parse trait implementation for some structures
2016-11-12 05:26:15 +03:00
Emilio Cobos Álvarez
5f2e7af864
style: Centralize specified url value handling, and refcount urls. 2016-11-10 13:15:21 +01:00
Ravi Shankar
c4fc49c559 Make use of Either<A, B> for LengthOrNone 2016-11-09 13:04:26 +05:30
Ravi Shankar
5df250bc05 Add unit structs for representing keywords: auto, none, normal 2016-11-09 13:04:24 +05:30
Ravi Shankar
f36a573d2d Add an Either<A, B> type for sharing specified and computed CSS types 2016-11-09 13:04:17 +05:30
Ravi Shankar
6061985898 Prefer Servo-specific ToCss for all types 2016-11-07 09:14:22 +05:30
Ravi Shankar
5dbc8d02c9 Move Servo-specific ToCss to style_traits 2016-11-07 00:00:28 +05:30
Nazım Can Altınova
7720fe4d9c Move LengthOrNumber to style/values and implement GeckoStyleCoordConvertible 2016-11-06 20:08:31 +03:00
Nazım Can Altınova
da27b61352 Implement parsing/serialization for border-image-* longhands 2016-11-06 20:08:16 +03:00
Yuki Izumi
f33f5605ba
Refactor style lengths per #13584 2016-11-06 14:11:37 +11:00
Emilio Cobos Álvarez
de4fe6e2b6 Concurrent rule tree, v1
This patch introduces infrastructure for the rule tree, and constructs it.

We don't use it yet, nor have good heuristics for GC'ing it, but this should not
happen anymore once we store the rule node reference in the node.

I haven't messed up with memory orders because I want to do a try run with it,
then mess with them.

Take down the ApplicableDeclarationsCache, use the rule tree for doing the cascade.
2016-11-05 17:29:52 +01:00
Ting-Yu Lin
0fc38f79d6 Use enum BorderWidth as SpecifiedValue
Use enum BorderWidth instead of a tuple-like struct to store the specified
value. BorderWidth is needed to be used in both longhand and shorthand
border width properties, so I put it in `specified` module.

Fixed #13869.
2016-10-26 16:24:12 +08:00
bors-servo
9e3cf3189b Auto merge of #13804 - canaltinova:gradient-parsing, r=Manishearth
Fix radial gradient's <size>/<ending-shape> parsing

<!-- Please describe your changes on the following line: -->
Parsing now handles sizes and shapes in various order.
I had to delete `EndingShape`'s parse implementation and mix it with `Position` in `parse_radial`. It became a bit complicated to read but I couldn't make it simpler.
r? @Manishearth

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

<!-- Either: -->
- [X] There are tests for these changes

<!-- 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/13804)
<!-- Reviewable:end -->
2016-10-19 09:10:15 -05:00
Nazım Can Altınova
89850e6efa Fix radial gradient's <size>/<ending-shape> parsing 2016-10-19 13:15:28 +03:00
Cameron McCormack
75e97c02dc Factor out a UrlOrNone value type and make -moz-binding use it.
MozReview-Commit-ID: L57QEf40e2m
2016-10-16 11:32:57 +08:00
Manish Goregaokar
2bde9462b1 Add safer bindings for RefPtr 2016-10-14 00:44:06 +05:30
Nazım Can Altınova
26c98edd68 Implement parsing of all gradients 2016-10-09 22:53:15 +03:00
Manish Goregaokar
d81c6af59c Add from_computed_value() function for converting computed values to specified 2016-09-23 09:44:32 +05:30
Manish Goregaokar
2f69e7ff8c Use ComputedValueAsSpecified wherever possible 2016-09-22 18:45:34 +05:30
Manish Goregaokar
7138ad7d7e Bug 1300731 - stylo: Implement mask-image; r?heycam 2016-09-10 15:27:45 +08:00
UK992
93a103ba73 Reorder use statements 2016-09-09 04:55:19 +02:00
bors-servo
51bb125189 Auto merge of #13159 - emilio:negative-calc, r=notriddle
style: Don't incorrectly clamp values in calc that might not be only lengths.

<!-- Please describe your changes on the following line: -->

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

<!-- Either: -->
- [x] There are tests for these changes OR

<!-- 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/13159)
<!-- Reviewable:end -->
2016-09-02 11:10:01 -05:00
Emilio Cobos Álvarez
d02c5b0281
style: Don't incorrectly clamp values in calc that might not be only lengths.
Expressions with percentages may be negative or positive at computed value time.

So, we can only clamp lengths at computed value time, which is what the other
browsers do.
2016-09-01 23:39:40 -07:00
bors-servo
6c68680581 Auto merge of #13122 - Manishearth:basic-shape-position-redux, r=SimonSapin
Handle specialized serialization of <position> in basic shapes

Fixes #13083

We temporarily broke basic-shape serialization in #13042 when 4-value positions were implemented, since I didn't want to increase the scope of that PR too much.

This fixes it.

r? @SimonSapin

cc @canaltinova

<!-- 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/13122)
<!-- Reviewable:end -->
2016-09-01 12:50:32 -05:00
Manish Goregaokar
7c9aff33c5 Handle specialized serialization of <position> in basic shapes (fixes #13083) 2016-09-01 13:59:59 +05:30
Emilio Cobos Álvarez
2617d15ed6
style: Properly track whether negative values of calc() are allowed
In order to clamp them at computed value time.
2016-08-30 19:17:16 -07:00
Emilio Cobos Álvarez
be7a44315d
style: Allow calc in media queries. 2016-08-30 13:48:55 -07:00
Nazım Can Altınova
8372f295b3 Change parsing behavior and implement to_computed_value function 2016-08-27 22:56:46 +03:00
Nazım Can Altınova
4eb93c85bc Handle 3- and 4- valued <position>s in specified style 2016-08-26 00:06:56 +03:00
bors-servo
609d47b44f Auto merge of #12878 - Manishearth:clip-path, r=heycam
stylo: Support clip-path

Todo:

 - [x] `set_clip_path` (probably needs a bunch of gecko bindings for running constructors/destructors)
 - [ ] Ensure that I've ordered the coordinates correctly
 - [ ] Check that it works
 - [x] Might want to convert NS_STYLE_FILL_RULE and NS_RADIUS to enum classes

Depends on:

 - https://github.com/servo/rust-bindgen/pull/29
 - https://github.com/Manishearth/gecko-dev/compare/servo:stylo...Manishearth:clip-path

<!-- 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/12878)
<!-- Reviewable:end -->
2016-08-19 14:24:08 -05:00
Manish Goregaokar
3895b7118e
Handle clip-path in stylo 2016-08-19 23:36:37 +05:30
Manish Goregaokar
254900bd1a
Add ShapeSource to basic-shape values 2016-08-18 11:38:33 +05:30
David Raifaizen
3831c0650c Adding support for correct shorthand serialization 2016-08-16 22:28:51 -04:00
Emilio Cobos Álvarez
40c04b4c6b
style: Correcly track whether calc values support viewport sizes. 2016-08-14 01:37:28 -07:00
bors-servo
3b676bc85d Auto merge of #12783 - Wafflespeanut:word_spacing, r=Manishearth
Prefer length and percentage for word spacing

<!-- Please describe your changes on the following line: -->
The goal is to make use of `LengthOrPercentage` for word spacing in `ShapingOptions`, but since it makes use of `f32` which doesn't implement `Hash`, we're going for `NotNan<f32>` from [ordered-float](https://github.com/reem/rust-ordered-float/), which supports hashing. Instead of implementing `Hash` for `LengthOrPercentage` and thereby the inner types like `CSSFloat`, `CalcLengthOrPercentage`, etc., we convert it to `(Au, NotNan<f32>)`.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [ ] There are tests for these changes

<!-- 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/12783)
<!-- Reviewable:end -->
2016-08-09 10:13:30 -05:00
Ravi Shankar
a04028eede Prefer length and percentage for word spacing 2016-08-09 17:53:40 +05:30
Anthony Ramine
2c7d1ddfa1 Fix basic_shape warnings (fixes #12762) 2016-08-08 15:55:22 +02:00
bors-servo
414204c909 Auto merge of #12712 - servo:rustup, r=Ms2ger
Update Rust to 1.12.0-nightly (545a3a94f 2016-08-04)

<!-- 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/12712)
<!-- Reviewable:end -->
2016-08-05 07:46:27 -05:00
Anthony Ramine
f88302ebf3 Update Rust to 1.12.0-nightly (545a3a94f 2016-08-04) 2016-08-05 14:45:32 +02:00
Manish Goregaokar
234219cd84 Address review comments 2016-08-05 16:58:38 +05:30
Manish Goregaokar
d1e45f78af
Add serialize_four_sides, use for serializing BorderRadius 2016-08-02 19:22:03 +05:30
Manish Goregaokar
973796b989
Various fixes in basic-shape parsing/serialization found by unit tests 2016-08-02 15:57:34 +05:30
Manish Goregaokar
e69f6396e2
Remove unused imports 2016-08-02 15:57:32 +05:30
Manish Goregaokar
1e7973263f
Fix tidy 2016-08-02 15:57:30 +05:30