Commit graph

26502 commits

Author SHA1 Message Date
J. Ryan Stinnett
a7882cfeb9 Match and cascade visited styles
To support visited styles, we match and cascade a separate set of styles any
time we notice that an element has a relevant link.

The visited rules and values are held in `ComputedStyle` alongside the
regular rules and values, which simplifies supporting various APIs like
`cascade_primary_and_pseudos` which expect easy access to previously matched
rules.

To simplify passing the additional values around, an additional reference to the
visited `ComputedValues` is placed inside the regular `ComputedValues`.

MozReview-Commit-ID: 2ebbjcfkfWf
2017-05-24 18:07:44 -05:00
J. Ryan Stinnett
e3a256803d Look for relevant links while matching
Adjust the matching process to look for a "relevant link" while matching.  A
"relevant link" is the element being matched if it is a link or the nearest
ancestor link.

Matching for links now depends on the `VisitedHandlingMode`, which determines
whether all links match as if they are unvisited (the default) or if the
relevant link matches as visited (and all others remain unvisited).

If a relevant link is ever found for any selector, track this as part of the
`MatchingContext` object.  This is used in the next patch to determine if an
additional match and cascade should be performed to compute the styles when
visited.

MozReview-Commit-ID: 3xUbRo7vpuD
2017-05-24 18:07:24 -05:00
bors-servo
e457d22f81 Auto merge of #17016 - upsuper:bug1366735, r=heycam
Use struct rather than nsCSSValue::Array to store counter functions in Gecko

This is the Servo side change for [bug 1366735](https://bugzilla.mozilla.org/show_bug.cgi?id=1366735).

<!-- 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/17016)
<!-- Reviewable:end -->
2017-05-24 17:26:03 -05:00
Brad Werth
31584e3c14 Deep clone ServoStyleSheets.
MozReview-Commit-ID: 6hYIcOa86Y
2017-05-24 15:05:26 -07:00
bors-servo
8ae546f7ea Auto merge of #17027 - Manishearth:rollup, r=Manishearth
Rollup of 9 pull requests

- Successful merges: #16993, #17000, #17010, #17013, #17014, #17017, #17019, #17020, #17022
- Failed merges:

<!-- 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/17027)
<!-- Reviewable:end -->
2017-05-24 16:08:02 -05:00
Boris Zbarsky
8125cf89b4 mathvariant attributes should affect computed font style and weight in stylo. 2017-05-24 16:29:50 -04:00
Manish Goregaokar
8c9c506f90 Rollup merge of #17022 - bholley:atom_fast_path, r=nox
Add a fast path for eq_ignore_ascii_case

Per https://bugzilla.mozilla.org/show_bug.cgi?id=1363778#c6

<!-- 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/17022)
<!-- Reviewable:end -->
2017-05-24 11:59:34 -07:00
Manish Goregaokar
8a133ab9a1 Rollup merge of #17020 - MaloJaffre:no_transmute, r=nox
Don't use mem::transmute in from_gecko-weight

Fixes #16966.

- [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 it's a minor refactor

<!-- 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/17020)
<!-- Reviewable:end -->
2017-05-24 11:59:33 -07:00
Manish Goregaokar
d24613dc83 Rollup merge of #17019 - upsuper:background-shorthand, r=nox
Background shorthand parsing issues

Two issues around background shorthand:
1. color should be only allowed in the last element of background shorthand
2. text should not be allowed in background shorthand

<!-- 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/17019)
<!-- Reviewable:end -->
2017-05-24 11:59:31 -07:00
Manish Goregaokar
5c655bb650 Rollup merge of #17017 - behnam:textinput, r=nox
[script/textinput] Fix warning: unreachable pattern

The `cfg` attribute in use resulted in two match arms for two cases on
`macos`. Since both arms had a main functionality in common, I merged
them and conditions the extra `macos` part.

```
warning: unreachable pattern
   -->
/Users/behnam/code/servo/servo/components/script/textinput.rs:696:13
    |
696 |             (None, Key::Home) => {
    |             ^^^^^^^^^^^^^^^^^
    |
    = note: #[warn(unreachable_patterns)] on by default

warning: unreachable pattern
   -->
/Users/behnam/code/servo/servo/components/script/textinput.rs:700:13
    |
700 |             (None, Key::End) => {
    |             ^^^^^^^^^^^^^^^^
    |
    = note: #[warn(unreachable_patterns)] on by default
```

<!-- 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
- [ ] These changes fix #__ (github issue number if applicable). [N/A]

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because fixes compile-time warnings.

<!-- 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/17017)
<!-- Reviewable:end -->
2017-05-24 11:59:30 -07:00
Manish Goregaokar
a19dd8142e Rollup merge of #17014 - hiikezoe:animation-rules-in-norma-restyle, r=emilio,birtles
Animation rules in norma restyle

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

This is a PR for https://bugzilla.mozilla.org/show_bug.cgi?id=1366631 and https://bugzilla.mozilla.org/show_bug.cgi?id=1367225

- [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 it's for stylo

<!-- 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/17014)
<!-- Reviewable:end -->
2017-05-24 11:59:28 -07:00
Manish Goregaokar
709912bcd3 Rollup merge of #17013 - mbrubeck:stylo, r=emilio
Bug 1363639 - stylo: Make interpolation of rect() match 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/17013)
<!-- Reviewable:end -->
2017-05-24 11:59:27 -07:00
Manish Goregaokar
c5b47f769e Rollup merge of #17010 - CJKu:bug-1348490, r=emilio
Stylo: match both ::placehoder & ::moz-placeholder for placeholder ps…

<!-- Please describe your changes on the following line: -->
The first patch of "Bug 1348490 - stylo: need support for ::-moz-placeholder pseudo element"

Part 2 need to be landed immediately after Part 1 be merged into servo repo:
https://reviewboard.mozilla.org/r/141264/diff/9#index_header

Bugzilla link:
https://bugzilla.mozilla.org/show_bug.cgi?id=1348490
---
<!-- 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
- [ ] These changes fix #__ (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/17010)
<!-- Reviewable:end -->
2017-05-24 11:59:25 -07:00
Manish Goregaokar
b34f1c8aa9 Rollup merge of #17000 - upsuper:webkit-media-feature, r=emilio
Add -webkit-prefix for serialization when necessary

<!-- 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/17000)
<!-- Reviewable:end -->
2017-05-24 11:59:24 -07:00
Manish Goregaokar
34b0eefff7 Rollup merge of #16993 - emilio:moz-placeholder, r=heycam
stylo: Parse but never match :-moz-placeholder as a pseudo-class.

Fixes bug 1366709.

<!-- 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/16993)
<!-- Reviewable:end -->
2017-05-24 11:59:23 -07:00
bors-servo
bb310efbb9 Auto merge of #17015 - glennw:fix-batching, r=jdm
Fix the -Z wr-no-batch option.

The DebugOpts struct uses the Default trait to set all the values
to false initialily. So bools in the DebugOpts struct must be
negative verbs to work correctly.

This drops the draw call count on HN from ~2000 back to ~5.

<!-- 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/17015)
<!-- Reviewable:end -->
2017-05-24 09:21:07 -05:00
Ravi Shankar
101e09e560 Add shorthand parsing and serialization for grid 2017-05-24 19:46:03 +05:30
Ravi Shankar
7b68d8d8bf Add shorthand parsing/serialization for grid-template 2017-05-24 19:45:34 +05:30
Bobby Holley
47fd83da57 Add a fast path for eq_ignore_ascii_case. 2017-05-24 15:48:43 +02:00
Malo Jaffré
f867d6b66d Don't use mem::transmute in from_gecko-weight
Fixes #16966.
2017-05-24 15:04:10 +02:00
bors-servo
df9286d67c Auto merge of #16974 - emilio:rule-tree-cleanup, r=heycam
style: Minor cleanups in the rule tree code.

<!-- 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/16974)
<!-- Reviewable:end -->
2017-05-24 07:12:25 -05:00
Xidorn Quan
7d48c9fa90 Only allow color value at the last element. 2017-05-24 21:53:52 +10:00
Xidorn Quan
766feec4c0 Reject "text" value in background shorthand. 2017-05-24 20:27:18 +10:00
bors-servo
98edf5d54d Auto merge of #17004 - nox:rollup, r=nox
Rollup of 7 pull requests

- Successful merges: #16885, #16886, #16932, #16939, #16948, #16986, #16995
- Failed merges:

<!-- 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/17004)
<!-- Reviewable:end -->
2017-05-24 04:26:19 -05:00
bors-servo
b4cebe1920 Auto merge of #17002 - servo:derive-all-the-things, r=emilio
Introduce style::values::generics::rect ▭

<!-- 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/17002)
<!-- Reviewable:end -->
2017-05-24 02:18:01 -05:00
Behnam Esfahbod
4df0ad2bc5 [script/textinput] Fix warning: unreachable pattern
The `cfg` attribute in use resulted in two match arms for two cases on
`macos`. Since both arms had a main functionality in common, I merged
them and conditions the extra `macos` part.

```
warning: unreachable pattern
   -->
/Users/behnam/code/servo/servo/components/script/textinput.rs:696:13
    |
696 |             (None, Key::Home) => {
    |             ^^^^^^^^^^^^^^^^^
    |
    = note: #[warn(unreachable_patterns)] on by default

warning: unreachable pattern
   -->
/Users/behnam/code/servo/servo/components/script/textinput.rs:700:13
    |
700 |             (None, Key::End) => {
    |             ^^^^^^^^^^^^^^^^
    |
    = note: #[warn(unreachable_patterns)] on by default
```
2017-05-24 01:42:10 -05:00
Xidorn Quan
4a53599647 Update binding files. 2017-05-24 16:18:19 +10:00
Xidorn Quan
737733eaae Use the new struct in stylo. 2017-05-24 15:54:13 +10:00
bors-servo
7f80d9cb45 Auto merge of #17001 - birtles:accumulative-animation, r=hiro
Support accumulative animation

These are the Servo side changes for [Mozilla bug 1353202](https://bugzilla.mozilla.org/show_bug.cgi?id=1353202).

<!-- 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/17001)
<!-- Reviewable:end -->
2017-05-24 00:03:42 -05:00
Hiroyuki Ikezoe
976b3ba6e7 Don't process style attribute changes in animation-only restyle. 2017-05-24 14:00:31 +09:00
Hiroyuki Ikezoe
a921d1af22 Make replace_rules returning boolean.
We only use whether the return value is IMPORTANT_RULES_CHANGED or not, so we
can just return true if an important rules was changed in the function.
Also, we can just return false in case of animation rules changes sine for
animation we can ensure there is no importan rules.
Because of these changes, replace_rule_node does not borrow |result| so that
we can drop a scope there.
2017-05-24 14:00:17 +09:00
Glenn Watson
0235bf2c4d Fix the -Z wr-no-batch option.
The DebugOpts struct uses the Default trait to set all the values
to false initialily. So bools in the DebugOpts struct must be
negative verbs to work correctly.

This drops the draw call count on HN from ~2000 back to ~5.
2017-05-24 13:27:38 +10:00
Hiroyuki Ikezoe
fce7c2d885 Check ElementHasAnimations before trying to get animations rules.
In case of ::before and ::after element, the generated content has no
ElementHasAnimations flag, their parent has the flag.
2017-05-24 11:12:10 +09:00
Hiroyuki Ikezoe
4935d972e5 Use animation values that have been processed during animation-only restyle for normal restyle. 2017-05-24 11:11:57 +09:00
Hiroyuki Ikezoe
35e0e3aa11 Move AnimationRules into declaration_block.rs. 2017-05-24 11:11:42 +09:00
Hiroyuki Ikezoe
d30c4fe79d Use SMIL override value that has been processed during animation-only restyles for normal restyle.
In the case where we process an element which has SMIL animations in normal travesal
the SMIL styles must have been computed in animation-only restyles. So we
have only to pick the computed styles instead of recomputing it.
2017-05-24 11:11:26 +09:00
Brian Birtles
af919f4433 Add support for iteration composite modes 2017-05-24 11:08:52 +09:00
Brian Birtles
a408fd41df Rework Servo_AnimationCompose to rely less on pinned temporaries 2017-05-24 11:08:51 +09:00
Brian Birtles
795d8ad767 Apply accumulate composite mode when compositing animations 2017-05-24 11:08:51 +09:00
Brian Birtles
744290e6de Fix typo in comment in Servo_AnimationCompose 2017-05-24 11:08:51 +09:00
Brian Birtles
4d187524c6 Support addition of font-stretch
Although there are no specific tests for this yet if any code does try
to perform addition or accumulation with a font-stretch value it will
likely fail the bounds check in the Into trait. To avoid that this
patch provides an basic implementation of add_weighted for font-stretch
that should work correctly with portions whose sum is outside the [0.0,
1.0] range.
2017-05-24 11:08:51 +09:00
Brian Birtles
d45ee9d662 Support accumulation of transform lists 2017-05-24 11:08:50 +09:00
Brian Birtles
64b0d59d21 Define accumulate method on Animatable trait 2017-05-24 11:08:50 +09:00
Brian Birtles
2782c3391c Update bindings 2017-05-24 11:08:50 +09:00
bors-servo
f3a694a7b4 Auto merge of #16999 - bzbarsky:fix-text-overflow-handling, r=Manishearth
Fix stylo's text-overflow handling to match gecko.

A single value sets the text-overflow on the _end_ of the text, not both start and end.

<!-- 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
- [ ] These changes fix #__ (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/16999)
<!-- Reviewable:end -->
2017-05-23 20:39:24 -05:00
Matt Brubeck
a8cce41ba9 Bug 1363639 - stylo: Make interpolation of rect() match Gecko 2017-05-23 17:28:52 -07:00
bors-servo
96d6b30eff Auto merge of #16998 - bzbarsky:fix-contain-flags, r=emilio
The 'contain' property can affect whether a box is a fixed-pos containing block

This makes will-change:contain work correctly.

<!-- 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
- [ ] These changes fix #__ (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/16998)
<!-- Reviewable:end -->
2017-05-23 16:52:31 -05:00
Boris Zbarsky
9f482c1430 Fix stylo's text-overflow handling to match gecko.
A single value sets the text-overflow on the _end_ of the text, not both start and end.
2017-05-23 14:35:45 -04:00
cku
6143e95d74 Stylo: match both ::placehoder & ::moz-placeholder for placeholder pseudo-elements. 2017-05-24 00:34:52 +08:00
Ravi Shankar
7dbd17bf70 Fix parsing bugs in grid-gap and grid-line 2017-05-23 21:42:13 +05:30