Commit graph

2970 commits

Author SHA1 Message Date
Bobby Holley
1d6892afa3 Make it clearer that we never insert elements with preshints into the cache.
MozReview-Commit-ID: 9bdc0sNZeEy
2017-04-23 12:43:11 -07:00
Bobby Holley
60f846b2ca Remove unused StyleRelations.
MozReview-Commit-ID: ed0NiuY9Ek
2017-04-23 12:41:21 -07:00
Bobby Holley
bdb84c7539 Don't skip the style sharing cache if an element is affected by state.
All elements end up with AFFECTED_BY_STATE right now, presumably due to the UA
sheet, and some non-TS pseudo-classes we've added, which means that we currently
never insert anything into the cache.

MozReview-Commit-ID: 5IU4qrjeJFy
2017-04-23 12:40:31 -07:00
bors-servo
c65dea95d7 Auto merge of #16577 - emilio:adjust-overflow, r=Wafflespeanut
style: Refactor overflow fixup to account for overflow: clip.

This is the missing piece to make the remaining contain tests not assert on
Gecko.

<!-- 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/16577)
<!-- Reviewable:end -->
2017-04-23 06:33:08 -05:00
bors-servo
dfe0f4c201 Auto merge of #16575 - emilio:cleanup-matching, r=Wafflespeanut
style: trivially cleanup the matching code.

I'm reworking this, and found this cleanup that I think is worth to land.

<!-- 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/16575)
<!-- Reviewable:end -->
2017-04-23 04:55:34 -05:00
Emilio Cobos Álvarez
8b0e6ea46e
style: Refactor overflow fixup to account for overflow: clip.
This is the missing piece to make the remaining contain tests not assert on
Gecko.
2017-04-23 11:22:59 +02:00
bors-servo
33c6abb1a8 Auto merge of #16522 - chenpighead:stylo-border-reset-border-image, r=heycam
Reset longhands of border-image to their initial value while parsing border shorthand

To do so, we need to declare the border-image longhands as part of border
shorthand and always reset them.

Spec link: https://drafts.csswg.org/css-backgrounds-3/#the-border-shorthands

<!-- 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 #15202  (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- 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/16522)
<!-- Reviewable:end -->
2017-04-23 02:51:47 -05:00
Emilio Cobos Álvarez
7bdd614540
style: trivially cleanup the matching code.
I'm reworking this, and found this cleanup that I think is worth to land.
2017-04-23 01:52:22 +02:00
bors-servo
f795eb1a8b Auto merge of #16550 - froydnj:gecko-bindings-gecko-debug, r=froydnj
switch gecko_bindings over to the gecko_debug feature [DO NOT MERGE]

...so that they use the correct Gecko structs regardless of whether Rust
code is being compiled with debug assertions or not.

This is the second part of the Servo-side changes for https://bugzilla.mozilla.org/show_bug.cgi?id=1357556

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors

- [X] These changes do not require tests because building is a sufficient test.

<!-- 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/16550)
<!-- Reviewable:end -->
2017-04-22 18:40:47 -05:00
bors-servo
7ff803e322 Auto merge of #16467 - canaltinova:contain, r=emilio
stylo: Add glue for contain property

In gecko, `size` and `content` values aren't implemented yet. So I had to disable these parts with mako. We will need to update the property and the glue once these are implemented in gecko.

---
<!-- 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 [Bug 1354998](https://bugzilla.mozilla.org/show_bug.cgi?id=1354998)

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so tha
t 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/16467)
<!-- Reviewable:end -->
2017-04-22 16:58:24 -05:00
Nathan Froyd
7c6fda8ea9 switch gecko_bindings over to the gecko_debug feature
...so that they use the correct Gecko structs regardless of whether Rust
code is being compiled with debug assertions or not.
2017-04-22 17:00:24 -04:00
Nazım Can Altınova
65b6a89978
stylo: Add glue for contain property 2017-04-22 23:23:02 +03:00
bors-servo
55e2caba4c Auto merge of #16563 - nox:transition, r=hiikezoe
Use all for the default value of transition-property in transition

<!-- 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/16563)
<!-- Reviewable:end -->
2017-04-22 07:24:25 -05:00
Anthony Ramine
6e36a62c8c Use all for the default value of transition-property in transition 2017-04-22 14:23:59 +02:00
Bobby Holley
1d6763c8e9 Avoid pointer-chasing to check whether there are any declarations. 2017-04-21 17:28:10 -07:00
Nazım Can Altınova
fe47726b7c
contain: paint should update overflow and display properties 2017-04-22 03:15:54 +03:00
Manish Goregaokar
8bfcc6992e tidy and test fixes 2017-04-21 14:53:27 -07:00
Manish Goregaokar
5a07227db5 Bug 1349417 - Part 8: stylo: Serialize system fonts correctly; r?xidorn
MozReview-Commit-ID: 4q1zZUcw6zF
2017-04-21 14:53:25 -07:00
Manish Goregaokar
795ab74f04 stylo: System font support for bitflag properties and font-language-override 2017-04-21 14:53:23 -07:00
Manish Goregaokar
83484c7054 stylo: System font support for font-size-adjust 2017-04-21 14:53:21 -07:00
Manish Goregaokar
5184f29e10 stylo: System font support for font-weight 2017-04-21 14:53:20 -07:00
Manish Goregaokar
b0dcb72722 stylo: System font support for keyword font longhands 2017-04-21 14:53:18 -07:00
Manish Goregaokar
c1c4c8fa59 stylo: Add basic system font support, use for font-size and font-family 2017-04-21 14:53:09 -07:00
bors-servo
dcbb3c7eb9 Auto merge of #16548 - nox:webkit-gradients, r=emilio
Improve parsing of gradients

<!-- 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/16548)
<!-- Reviewable:end -->
2017-04-21 14:40:02 -05:00
bors-servo
e9658bb5b4 Auto merge of #16558 - nox:placement, r=emilio
Properly parse alignment shorthands (fixes #16391)

<!-- 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/16558)
<!-- Reviewable:end -->
2017-04-21 14:03:43 -05:00
Anthony Ramine
88f682a5d5 Properly parse alignment shorthands (fixes #16391) 2017-04-21 21:03:16 +02:00
Jeremy Chen
43525819f4 Stylo - reset longhands of border-image to their initial value while parsing border shorthand.
To do so, we need to declare the border-image longhands as part of border
shorthand and always reset them. This could fix couple stylo test failures.
See Gecko Bug 1357350 for the test update patches.

Spec link: https://drafts.csswg.org/css-backgrounds-3/#the-border-shorthands

Note that two unit tests have been fixed as well:

1. border_should_serialize_correctly
To verify the correctness of serialization of 'border' shorthand, we need
to reset 'border-image' as well.

2. same_longhands_should_serialize_correctly
Due to the same reason as above, since the 'border-image' is not reset,
the test expectation should be fixed.
2017-04-21 18:52:39 +08:00
Hiroyuki Ikezoe
3af69cf9bf Servo does not need to support -moz-keyframes 2017-04-21 18:12:11 +09:00
Anthony Ramine
0854df922d Fix parsing of -webkit-linear-gradient()
No code can actually be shared between WebKit and modern gradients. :(
2017-04-21 11:08:44 +02:00
bors-servo
350d9c6c47 Auto merge of #16554 - BorisChiou:stylo/animation/compute_distance, r=emilio
stylo: Bug 1332633 - Implement ComputeDistance trait.

These patches implement ComputeDistance trait, so we can use it for SMIL animation and for testing test_transitions_per_property.html, which uses nsDOMWindowUtils::ComputeAnimationDistance() to get the the distance between two AnimationValues.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix Bug 1332633.
- [X] These changes do not require tests because we have test cases in Gecko. (If Servo wants to use this feature, we can add more tests in Servo in the future.)

<!-- 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/16554)
<!-- Reviewable:end -->
2017-04-21 00:52:13 -05:00
Boris Chiou
f8ac48b78d Bug 1332633 - Part 2: Implement the FFI for compute distance.
This FFI will be used by nsDOMWindowUtils::ComputeAnimationDistance,
which will be implemented in another bug.

MozReview-Commit-ID: 6KmMmRiYIew
2017-04-21 11:58:57 +08:00
Boris Chiou
57f87007f2 Bug 1332633 - Part 1: Implement ComputeDistance trait.
Introduce ComputeDistance trait, which implement compute_distance and
compute_squared_distance.

For vector, compute_squared_distance is necessary because we use Euclidean
distance as the distance between two values. The easier way to implement
compute_squared_distance is to square the result from compute_distance, but
for some property values, they may have many components, e.g. (v1, v2, v3).
If we just square the result from compute_distance, the computation is
(sqrt(v1^2 + v2^2 + v3^2))^2. There are two redundant operators:
"square-root" and then "square". In order to avoid this, we should
implement compute_squared_distance separately for these types.

MozReview-Commit-ID: LmmrUXYlDb6
2017-04-21 11:37:57 +08:00
Hiroyuki Ikezoe
973d8287a9 Support vendor prefix keyframes rule.
If there are multiple prefixed/non-prefixed @keyframes with the same name;

* non-prefixed rule overrides earlier rules.
* prefixed rule overrides earlier prefixed rules.
2017-04-21 12:18:12 +09:00
Bobby Holley
cebacc7faa Rename SimpleSelector to Component.
MozReview-Commit-ID: JfaZpHSkG8h
2017-04-20 15:04:48 -07:00
Bobby Holley
cf06e2bf1e Use Boxed slices for Empty and MozAny.
MozReview-Commit-ID: CmVK3u0vYn0
2017-04-20 15:00:50 -07:00
Bobby Holley
6d66ec5e11 Store selectors and combinators inline in a single sequence.
This improves cache locality and reduces allocations during parsing.

Note that this reverses the iteration order within a sequence of simple selectors,
but that shouldn't matter.
2017-04-20 15:00:43 -07:00
Anthony Ramine
2ac57a7d8f Fix parsing of -webkit-radial-gradient()
It's either keywords or lengths, but not a mix of two.
2017-04-20 22:46:18 +02:00
Nathan Froyd
7249d5f4f1 add the gecko_debug feature
debug_assertions is not a reliable guide to whether Gecko C++ code is
being compiled with debugging assertions, since we can now compile Gecko
with --enable-optimize --disable-debug --enable-rust-debug: Gecko will
be compiled without debugging assertions (and debugging struct layouts)
and Rust code will be compiled with debug_assertions.  The struct
mismatches in the binding layer lead to startup crashes.

This feature is not presently used, but will be set by some Gecko-side
changes and then used by some Servo-side changes.  These changes need to
be made first so that CI on both sides works correctly at all
intermediate stages along the way.
2017-04-20 16:13:15 -04:00
Anthony Ramine
de1fb76ac1 Properly forbid legacy keywords in modern gradient syntax 2017-04-20 13:11:13 +02:00
Anthony Ramine
efdc67d5a1 Properly parse background-size in background longhand (fixes #15199) 2017-04-20 12:18:41 +02:00
bors-servo
7f825d2119 Auto merge of #16511 - nox:webkit-gradients, r=emilio
Implement -webkit-radial-gradient() (fixes #15441)

<!-- 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/16511)
<!-- Reviewable:end -->
2017-04-20 04:27:33 -05:00
Anthony Ramine
d5cd34dec8 Implement -webkit-radial-gradient() (fixes #15441) 2017-04-20 11:26:47 +02:00
Anthony Ramine
50c25f3221 Extract the shape parsing code from GradientKind::parse_radial 2017-04-20 11:15:40 +02:00
Manish Goregaokar
3162babada stylo: Support scriptlevel computation and scriptminsize
scriptlevel is a property that affects how font-size is inherited. If scriptlevel is
+1, for example, it will inherit as the script size multiplier times
the parent font. This does not affect cases where the font-size is
explicitly set.

However, this transformation is not allowed to reduce the size below
scriptminsize. If this inheritance will reduce it to below
scriptminsize, it will be set to scriptminsize or the parent size,
whichever is smaller (the parent size could be smaller than the min size
because it was explicitly specified).

Now, within a node that has inherited a font-size which was
crossing scriptminsize once the scriptlevel was applied, a negative
scriptlevel may be used to increase the size again.

This should work, however if we have already been capped by the
scriptminsize multiple times, this can lead to a jump in the size.

For example, if we have text of the form:

huge large medium small tiny reallytiny tiny small medium huge

which is represented by progressive nesting and scriptlevel values of
+1 till the center after which the scriptlevel is -1, the "tiny"s should
be the same size, as should be the "small"s and "medium"s, etc.

However, if scriptminsize kicked it at around "medium", then
medium/tiny/reallytiny will all be the same size (the min size).
A -1 scriptlevel change after this will increase the min size by the
multiplier, making the second tiny larger than medium.

Instead, we wish for the second "tiny" to still be capped by the script
level, and when we reach the second "large", it should be the same size
as the original one.

We do this by cascading two separate font sizes. The font size (mSize)
is the actual displayed font size. The unconstrained font size
(mScriptUnconstrainedSize) is the font size in the situation where
scriptminsize never applied.

We calculate the proposed inherited font size based on scriptlevel and
the parent unconstrained size, instead of using the parent font size.
This is stored in the node's unconstrained size and will also be stored
in the font size provided that it is above the min size.

All of this only applies when inheriting. When the font size is
manually set, scriptminsize does not apply, and both the real and
unconstrained size are set to the explicit value. However, if the font
size is manually set to an em or percent unit, the unconstrained size
will be set to the value of that unit computed against the parent
unconstrained size, whereas the font size will be set computing against
the parent font size.

MozReview-Commit-ID: 820BIWqno3L
2017-04-19 22:19:55 -07:00
Manish Goregaokar
1b8458598e stylo: Support computing font-size against an arbitrary base size
MozReview-Commit-ID: 4jWcugvXR65
2017-04-19 22:10:43 -07:00
bors-servo
f74f1fb592 Auto merge of #16537 - KuoE0:add-inline-axis-and-block-axis-for-moz-box-orient, r=KuoE0
Add `inline-axis` and `block-axis` aliases for `-moz-box-orient`.

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

This issue is reported at https://bugzilla.mozilla.org/show_bug.cgi?id=1355005.

spec: https://developer.mozilla.org/en-US/docs/Web/CSS/box-orient

---
<!-- 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 [Bug 1355005](https://bugzilla.mozilla.org/show_bug.cgi?id=1355005)

<!-- Either: -->
- [X] These changes do not require tests in Gecko.

<!-- 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/16537)
<!-- Reviewable:end -->
2017-04-19 23:19:48 -05:00
KuoE0
d43e151499 Add inline-axis and block-axis aliases for -moz-box-orient.
Ref: Bug 1355005 - stylo: Support -moz-box-orient: {block,inline}-axis
2017-04-20 11:55:29 +08:00
Boris Chiou
0dcee472c1 Change the animation_type of column-count to normal. 2017-04-20 11:28:57 +08:00
Nazım Can Altınova
f9225d84aa
Implement moz-transform property 2017-04-19 22:11:54 +03:00
Nazım Can Altınova
67799f9445
Create a generic flag system for properties 2017-04-19 22:08:50 +03:00