Commit graph

4096 commits

Author SHA1 Message Date
bors-servo
f93fccac57 Auto merge of #17523 - emilio:cleanup-traversal, r=nox
style: Cleanup traversal.rs

Mostly reflowing comments that have become too long or two short with
refactorings, and using consistent indentation.

<!-- 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/17523)
<!-- Reviewable:end -->
2017-06-27 07:08:42 -07:00
Boris Zbarsky
746f245f32 Fix style computation for first-letter pseudo-elements with inline ancestors.
We should inherit from the inline, not its parent block.

Gecko bug 1324618 part 10 servo bits: https://bugzilla.mozilla.org/show_bug.cgi?id=1324618
2017-06-26 23:29:18 -07:00
Boris Zbarsky
d40e27d6e5 Reframe less on restyles that involve nonexistent first-letter frames in Gecko.
Gecko bug 1324618 part 9 servo bits: https://bugzilla.mozilla.org/show_bug.cgi?id=1324618
2017-06-26 23:27:39 -07:00
Boris Zbarsky
40dd807df3 Assert that compute_style_difference is only called with eager pseudos.
Gecko bug 1324618 part 3: https://bugzilla.mozilla.org/show_bug.cgi?id=1324618
2017-06-26 23:24:56 -07:00
Boris Zbarsky
18ab0087ae Add some comments to may_generate_pseudo; no real behavior changes for now.
Gecko bug 1324618 part 2: https://bugzilla.mozilla.org/show_bug.cgi?id=1324618
2017-06-26 23:24:08 -07:00
Boris Zbarsky
acb27de71c Fix dynamic restyling that changes whether our element may generate a pseudo to clear out stale pseudo styles.
Gecko bug 1324618 part 1: https://bugzilla.mozilla.org/show_bug.cgi?id=1324618
2017-06-26 23:23:04 -07:00
Hiroyuki Ikezoe
ae1ccdd456 Check has_new_animation_style along with for_css_rule_changes() in needs_animations_update(). 2017-06-27 08:26:16 +09:00
Emilio Cobos Álvarez
5a481547b8
style: Cleanup traversal.rs
Mostly reflowing comments that have become too long or two short with
refactorings, and using consistent indentation.
2017-06-26 22:48:17 +02:00
Emilio Cobos Álvarez
6f57a9b4ba
style: Fix rem computation on the root element.
Bug: 1375930
Reviewed-By: heycam
MozReview-Commit-ID: DK98SS1w5nO
2017-06-25 02:45:56 +02:00
bors-servo
946c9aede1 Auto merge of #17508 - servo:derive-all-the-things, r=emilio
Use generics for SimpleShadow

<!-- 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/17508)
<!-- Reviewable:end -->
2017-06-24 04:46:56 -07:00
Anthony Ramine
81a01f6ce1 Use generics for SimpleShadow 2017-06-24 13:01:20 +02:00
Emilio Cobos Álvarez
26f4e2bf51
style: Fix misindented code in font.mako.rs. 2017-06-24 09:31:07 +02:00
bors-servo
a29261dec1 Auto merge of #17504 - bholley:arc_pseudos, r=bholley
Make EagerPseudoStyles use an Arc, not a Box

Reviewed in https://bugzilla.mozilla.org/show_bug.cgi?id=1371049

Fixes #17300

<!-- 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/17504)
<!-- Reviewable:end -->
2017-06-23 20:07:45 -07:00
bors-servo
c586a241bb Auto merge of #17494 - servo:derive-all-the-things, r=emilio
Marginally improve shadows

<!-- 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/17494)
<!-- Reviewable:end -->
2017-06-23 17:45:58 -07:00
Bobby Holley
eeb62edfea Use an Arc for eager pseudo styles.
MozReview-Commit-ID: BdYkXxYvUQ3
2017-06-23 16:19:06 -07:00
Bobby Holley
af89c74ab7 Use a newtype within EagerPseudoValues.
MozReview-Commit-ID: IIDxBJ8mqvJ
2017-06-23 16:19:05 -07:00
bors-servo
bb9391ba2c Auto merge of #17493 - froydnj:rust-117-fixes, r=jdm
remove various things now that Rust 1.17 is required

std::ptr::eq and Arc::ptr_eq are now usuable, and we can replace a
panic!() with abort().

- [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 they are trivial replacements.

<!-- 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/17493)
<!-- Reviewable:end -->
2017-06-23 16:01:02 -07:00
bors-servo
3e4021ef1a Auto merge of #17492 - glandium:master, r=emilio
Separate thread pool from global state for Gecko

When stylo is not enabled in Gecko, the global state initialization
still creates the style thread pool, even when it's not going to be
used. This wastes address space and a little memory.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1374824#c38 and
following comment.

<!-- 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/17492)
<!-- Reviewable:end -->
2017-06-23 10:37:43 -07:00
Nathan Froyd
096cee8ebc remove various things now that Rust 1.17 is required
std::ptr::eq and Arc::ptr_eq are now usuable, and we can replace a
panic!() with abort().
2017-06-23 10:39:41 -04:00
Anthony Ramine
c9b123266d Unconditionally compile SimpleShadow even in Servo 2017-06-23 16:26:09 +02:00
Anthony Ramine
ae1c890c9e Rename DropShadow to SimpleShadow 2017-06-23 16:25:50 +02:00
bors-servo
92679480b1 Auto merge of #17469 - nox:empty-vs-initial, r=emilio
Distinguish the emptiness of a property from its initial value

<!-- 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/17469)
<!-- Reviewable:end -->
2017-06-23 05:59:49 -07:00
bors-servo
567f5e8985 Auto merge of #17477 - servo:closures-by-ref, r=emilio
Pass some 48-bytes closures by references instead of by value.

This reduced the generated code size by 74 KB: https://bugzilla.mozilla.org/show_bug.cgi?id=1375222#c4

<!-- 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/17477)
<!-- Reviewable:end -->
2017-06-23 03:51:23 -07:00
Anthony Ramine
f01ea53ac1 Distinguish the emptiness of a property from its initial value 2017-06-23 12:39:44 +02:00
Emilio Cobos Álvarez
12309543d3 style: fix the check for specified transitions.
Check both transition-property and transition-duration.
2017-06-23 12:37:36 +02:00
Mike Hommey
513833d9b9 Separate thread pool from global state for Gecko
When stylo is not enabled in Gecko, the global state initialization
still creates the style thread pool, even when it's not going to be
used. This wastes address space and a little memory.

See https://bugzilla.mozilla.org/show_bug.cgi?id=1374824#c38 and
following comment.
2017-06-23 19:36:58 +09:00
bors-servo
d2bc0ff631 Auto merge of #17467 - mantaroh:svg-zero-value, r=birtles
Add get_zero_value for IntermediateSVGPaint.

<!-- Please describe your changes on the following line: -->
This is a PR for https://bugzilla.mozilla.org/show_bug.cgi?id=1371199

---
<!-- 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, a test case will be landed in reftests in https://bugzilla.mozilla.org/show_bug.cgi?id=1371199

<!-- 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/17288)
<!-- Reviewable:end -->
2017-06-22 20:58:24 -07:00
bors-servo
6342a4b455 Auto merge of #17471 - aethanyc:fix-pseudo-element-matching-xbl, r=emilio
stylo: Fix pseudo element matching for rules in XBL stylesheets

This change was reviewed in https://bugzilla.mozilla.org/show_bug.cgi?id=1372876

<!-- 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/17471)
<!-- Reviewable:end -->
2017-06-22 19:53:37 -07:00
Mantaroh Yoshinaga
c89c938623 Add get_zero_value for IntermediateSVGPaint. 2017-06-23 10:32:50 +09:00
bors-servo
9ba71fcd57 Auto merge of #17481 - jryans:move-rule-node, r=bholley
Stylo: Move match and cascade temporaries to CurrentElementInfo

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

<!-- 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/17481)
<!-- Reviewable:end -->
2017-06-22 17:46:55 -07:00
bors-servo
efed75ae5a Auto merge of #17484 - canaltinova:upup, r=emilio
Bump cssparser version to 0.16.1 in toml files

<!-- 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

<!-- 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/17484)
<!-- Reviewable:end -->
2017-06-22 16:52:00 -07:00
Nazım Can Altınova
5362c5ee74 Bump cssparser version to 0.16.1 in toml files 2017-06-22 15:44:03 -07:00
bors-servo
7fbbfde278 Auto merge of #17462 - bholley:bloom_optimizations, r=emilio
various bloom filter optimizations

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

<!-- 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/17462)
<!-- Reviewable:end -->
2017-06-22 14:39:30 -07:00
J. Ryan Stinnett
87c51bd8bf Shrink ElementData by moving pseudo count to type
`ElementStyles` holds an optional list of values for each eager pseudo-element.
However, the type was declared as a slice instead of a fixed size array, so an
extra 8 bytes were being allocated to hold the size, even though it never
changes.

Moving the constant size into the type reduces `ElementStyles` and `ElementData`
by 8 bytes.

MozReview-Commit-ID: GaO6DKFxUMo
2017-06-22 15:47:34 -05:00
J. Ryan Stinnett
2b5c56e6a8 Move match and cascade temporaries to CurrentElementInfo
Before this change, the `ComputedStyle` struct that is part of permanent style
data per element holds 2 `StrongRuleNode`s (unvisited and visited) and 2
`Arc<ComputedValues>` (unvisited and visited).

Both rule nodes and the visited values don't actually need to be here.  This
patch moves these 3 to new temporary storage in `CascadeInputs` on
`CurrentElementInfo` during the match and cascade process.  Rule nodes are
pushed down inside the `ComputedValues` for later access after the cascade.
(Visited values were already available there.)

The permanent style data per element now has just the `Arc<ComputedValues>` for
itself and eager pseudo-elements (plus the `RestyleHint`).

MozReview-Commit-ID: 3wq52ERMpdi
2017-06-22 15:47:32 -05:00
J. Ryan Stinnett
c3b2a2f4de Copy ComputedStyle to context
In the patch after this, the existing `ComputedStyle` type is renamed and
repurposed as temporary storage of inputs for the cascade.  To make it a bit
easier to follow what code is new, this patch starts by copying `ComputedStyle`
to context.rs without changes.

MozReview-Commit-ID: 41COA5rEoz7
2017-06-22 15:34:28 -05:00
Ting-Yu Lin
1795af5e57 stylo: Fix pseudo element matching for rules in XBL stylesheets (bug 1372876)
MozReview-Commit-ID: JeliK45G8MT
2017-06-22 22:37:51 +08:00
bors-servo
dfc44a0d35 Auto merge of #17455 - canaltinova:webkit-displays, r=Manishearth
Implement webkit prefixed values for display property

Added -webkit-{flex,inline-flex} values as flex, inline-flex. I didn't do this gecko only since that doesn't require anything in layout side.

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

<!-- 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/17455)
<!-- Reviewable:end -->
2017-06-22 06:35:41 -07:00
bors-servo
7d785e75cd Auto merge of #17447 - emilio:root-disconnected-subtree, r=heycam,Manishearth
style: Be more strict when setting the root font size.

Before this commit, we assumed that if the element had no parent element, it was
the root of the document, which is plain false, since we can arrive there from,
let's say, getComputedStyle on a detached node.

Bug: 1374062
Reviewed-By: heycam
MozReview-Commit-ID: 65DxdzXgd0J

<!-- 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/17447)
<!-- Reviewable:end -->
2017-06-22 04:17:04 -07:00
bors-servo
bd2df70c3c Auto merge of #17444 - hiikezoe:fnv-hashmap-for-animation, r=emilio
Use FnvHashmap instead of HashMap for AnimationValueMap.

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

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

<!-- 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/17444)
<!-- Reviewable:end -->
2017-06-22 02:22:34 -07:00
bors-servo
0913d65243 Auto merge of #17446 - servo:derive-all-the-things, r=emilio
Simplify machinery to serialise optional parts of CSS values

<!-- 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/17446)
<!-- Reviewable:end -->
2017-06-22 01:19:51 -07:00
bors-servo
6b99318f55 Auto merge of #17443 - emilio:smallwat, r=SimonSapin
style: Don't use SmallVec::into_iter to move into another vector.

See bug 1374848 for why.

<!-- 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/17443)
<!-- Reviewable:end -->
2017-06-22 00:14:38 -07:00
Bobby Holley
71e76a054d Be smarter when clearing the bloom filter. 2017-06-21 19:53:16 -07:00
Bobby Holley
5d5c715152 Switch the bloom element list to a SmallVec and track pushed hashes. 2017-06-21 19:53:15 -07:00
Bobby Holley
0f0e0d81fb Push elements in order in StyleBloom::rebuilds.
This is important because we're about to start storing a parallel list
of pushed hashes, and the current behavior here will cause mismatches
there.

We take the opportunity to bump the SmallVec size to 16, since each
entry is only a word and we really want to avoid heap-allocating. And
then we switch to drain(), because of
https://github.com/rust-lang/rust/issues/42763
2017-06-21 19:53:15 -07:00
Simon Sapin
837cb6ddb2 Pass some 48-bytes closures by references instead of by value. 2017-06-22 02:02:31 +02:00
Nazım Can Altınova
82ef35b7e8 Implement webkit prefixed values for display property 2017-06-21 12:00:08 -07:00
Emilio Cobos Álvarez
6fefe522a3
style: Assert we never style a root element from another document.
Right now when calling getComputedStyle with an element from another document,
we return the style using the pres context of that document, not of the document
of the window getComputedStyle was called on, so this holds.

But it will stop holding if we ever change this, so assert it doesn't happen.

Bug: 1374062
Reviewed-By: Manishearth
MozReview-Commit-ID: 3g8yQWWdsen
2017-06-21 19:55:02 +02:00
bors-servo
3e698340ac Auto merge of #17343 - ferjm:bug1355368.fontweight.keyword, r=upsuper
stylo: make font-weight descriptor in @font-face preserve keyword values

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix https://bugzilla.mozilla.org/show_bug.cgi?id=1355368

<!-- 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/17343)
<!-- Reviewable:end -->
2017-06-21 10:40:35 -07:00
bors-servo
b211664e87 Auto merge of #17439 - bholley:compound_left_to_right, r=SimonSapin
Match compound selectors left-to-right (second try)

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

<!-- 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/17439)
<!-- Reviewable:end -->
2017-06-21 09:28:43 -07:00