Commit graph

6718 commits

Author SHA1 Message Date
bors-servo
0653f3097c
Auto merge of #20019 - paavininanda:deriveToCss, r=emilio
Added derive(ToCss) annotation : WIP

<!-- 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: -->
<!--
- [ ] `./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
- [ ] 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/20019)
<!-- Reviewable:end -->
2018-02-11 14:10:48 -05:00
Nupur Baghel
8116962298 Added derive ToCss for Content and removed manual Impl 2018-02-12 00:35:56 +05:30
Emilio Cobos Álvarez
4913d9c900
style: Handle quirks-mode changes correctly.
The reason why bug 1355721 regressed this is because in non-e10s we definitely
flush before parsing the standards quirks-mode. And bug 1355721 introduced an
unconditional UpdateStylistIfNeeded, unless the counter style / font
equivalents.

That means that the stylist wouldn't remain on its initial state after the first
flush, which itself means that when the compat mode changed, the UA and user
rules were already on the stylist with the quirks mode keys. That makes
class-names be keyed in ascii lowercase.

After that no user style changed, so no rebuild happens for the cascade data in
the user origin, so we keep looking at the wrong keys indefinitely.

We should try to avoid the flush there and ensure that by the time we create a
pres shell the quirks mode is already up-to-date...

Bug: 1394233
Reviewed-by: xidorn
MozReview-Commit-ID: 25dD2bca3tN
2018-02-11 19:16:34 +01:00
Anthony Ramine
c92d0a8902 Implement Clone for AnimationValue by hand 🐉🐲
We use the same trick as in PropertyDeclaration::clone.
2018-02-11 09:47:14 +01:00
Anthony Ramine
b95b6c66f3 Implement PartialEq for AnimationValue by hand 🐉🐲
We use the same trick as in PropertyDeclaration::eq.
2018-02-11 09:38:37 +01:00
Jonathan Kew
81ecc25619 Remove reference to the Gecko pref svg.paint-order.enabled 2018-02-10 21:31:42 +00:00
bors-servo
2f4362e0c1
Auto merge of #20014 - servo:by-the-power-of-void, r=emilio
Optimise some AnimationValue methods for size 🐉🐲

This shaves 40KB off of libxul.

<!-- 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/20014)
<!-- Reviewable:end -->
2018-02-10 10:32:21 -05:00
Anthony Ramine
b9505ae72b Merge similar arms in AnimationValue::compute_squared_distance 🐉🐲
This uses the same trick as in PropertyDeclaration::eq.
2018-02-10 16:31:50 +01:00
Anthony Ramine
fc24cf34c5 Merge similar arms in AnimationValue::animate 🐉🐲
This uses the same trick as in PropertyDeclaration::eq and removes
roughly 10KB off of libxul.
2018-02-10 16:31:49 +01:00
Anthony Ramine
38520af970 Merge similar arms in AnimationValue::uncompute 🐉🐲
This uses the same kind of trick as PropertyDeclaration::clone and
removes 15KB off of libxul according to bloaty.
2018-02-10 16:31:48 +01:00
Anthony Ramine
aa7cc261f8 Determine animated types from specified types 2018-02-10 16:31:48 +01:00
Anthony Ramine
a90e660eac Kill AnimatedValueAsComputed 2018-02-10 16:31:47 +01:00
Anthony Ramine
57daf06c71 Make PropertyDeclaration::id and AnimationValue::id inline 2018-02-10 16:31:46 +01:00
Anthony Ramine
921d1aeeba Make AnimationValue::id be just a pointer cast 🐉🐲
Now that PropertyDeclaration and AnimationValue have the same discriminants,
that means the trick found in PropertyDeclaration::id can be done in
AnimationValue::id.
2018-02-10 16:31:45 +01:00
bors-servo
2cc75a783d
Auto merge of #20010 - emilio:pres-hints-cascade, r=bholley
style: Cascade pres hints after normal user rules.

Per https://drafts.csswg.org/css-cascade/#preshint and
https://html.spec.whatwg.org/#presentational-hints.

This was causing failures in the link color reftests with the preferences sheet
as a User sheet.

Bug: 1436782
Reviewed-by: bholley
MozReview-Commit-ID: 9iwEqPBw4CF

<!-- 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/20010)
<!-- Reviewable:end -->
2018-02-10 07:46:38 -05:00
Emilio Cobos Álvarez
69c018c70d
style: Cascade pres hints after normal user rules.
Per https://drafts.csswg.org/css-cascade/#preshint and
https://html.spec.whatwg.org/multipage/#presentational-hints.

This was causing failures in the link color reftests with the preferences sheet
as a User sheet.

Bug: 1436782
Reviewed-by: bholley
MozReview-Commit-ID: 9iwEqPBw4CF
2018-02-10 13:12:30 +01:00
bors-servo
0098d51903
Auto merge of #20011 - emilio:cleanup-for-declarations-stuff, r=Manishearth
style: Tidy Stylist::compute_for_declarations.

<!-- 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/20011)
<!-- Reviewable:end -->
2018-02-10 06:45:52 -05:00
Anthony Ramine
79775541f2 Make AnimationValue have the same variants as PropertyDeclaration
By making AnimationValue have the same representation as PropertyDeclaration
and Void variants for non-animatable properties, we know by constructions
that all properties have the same discriminant in both.
2018-02-10 12:37:30 +01:00
Xidorn Quan
b9ef2bbdd5 Return whether property was removed from Servo_DeclarationBlock_RemoveProperty. 2018-02-10 19:58:30 +11:00
Emilio Cobos Álvarez
8e3da86636
style: Tidy Stylist::compute_for_declarations. 2018-02-10 03:39:56 +01:00
bors-servo
6b1a74672d
Auto merge of #20004 - emilio:author-sheet-collection, r=nox
style: Add infrastructure to have a standalone author stylesheet collection

Right now Gecko uses a whole `Stylist` for stuff like XBL / Shadow DOM.

That's not great, because it has tons of unrelated logic, and also eats up a lot of memory. Also, it prevents us to optimize style changes in shadow hosts the same way we do for the document.

These patches mostly rejigger stuff around so that you can define a `DocumentStylesheetSet` and then an `AuthorStylesheetSet`, which would contain just the Shadow DOM sheets / XBL resource sheets.

It still doesn't introduce any use for the later, but that will come later.

There's a patch in this PR that requires Gecko changes, posted in https://bugzilla.mozilla.org/show_bug.cgi?id=1436798.

<!-- 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/20004)
<!-- Reviewable:end -->
2018-02-09 17:18:08 -05:00
bors-servo
41fb6ed1ff
Auto merge of #19980 - servo:derive-all-the-things, r=emilio
Merge all keyword arms in Clone for PropertyDeclaration 🐉🐲

<!-- 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/19980)
<!-- Reviewable:end -->
2018-02-09 16:17:01 -05:00
Emilio Cobos Álvarez
f16e699db5
style: Update bindings. 2018-02-09 19:46:26 +01:00
Emilio Cobos Álvarez
88cc2798c4
style: Move more stuff to the place it belongs to.
In particular, `rebuild` is now done entirely by CascadeData, which simplifies
more stuff.

The eventual final state for this is that the data structure we use to store the
XBL / Shadow DOM stuff will be something like:

  struct AuthorStyles { CascadeData, AuthorSheetCollection }

MozReview-Commit-ID: 8TExtP58L4X
2018-02-09 19:45:04 +01:00
Emilio Cobos Álvarez
7edd25890d
style: Introduce AuthorStyleSheetSet.
MozReview-Commit-ID: K3ciocPJuz3
2018-02-09 19:45:03 +01:00
Emilio Cobos Álvarez
5e8dd8a2d4
style: Move the stylesheet set methods under a macro to reuse it soon.
MozReview-Commit-ID: 50Srw4Mjw18
2018-02-09 19:45:02 +01:00
Emilio Cobos Álvarez
a254dc12a4
style: Move author-style-disabled handling to push_applicable_declarations.
This will make it easier to handle it properly for Shadow DOM, though this patch
doesn't do that.

This also makes some method inline and infallible for convenience, since nobody
checks the errors anyway.

Bug: 1436798
Reviewed-by: bholley
MozReview-Commit-ID: Hq3erAUs5tf
2018-02-09 19:44:53 +01:00
bors-servo
e19bab84cf
Auto merge of #20001 - Manishearth:compute-damage, r=mbrubeck
Autogenerate compute_damage

fixes #10622

<!-- 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/20001)
<!-- Reviewable:end -->
2018-02-09 12:02:04 -05:00
Manish Goregaokar
daea6d0f75 Set restyle_damage = reflow for some more properties 2018-02-09 08:48:07 -08:00
Manish Goregaokar
11fb2e644a Use restyle_damage=rebuild_and_reflow for list types 2018-02-09 08:48:06 -08:00
Manish Goregaokar
7e928b02f2 Make individual transform properties have restyle_damage = reflow_out_of_flow 2018-02-09 08:48:05 -08:00
Manish Goregaokar
6ba23fe58a Set damage for min/max width/height to reflow_and_bubble 2018-02-09 08:48:05 -08:00
Manish Goregaokar
8c2b7b41ef Autogenerate compute_damage (fixes #10622) 2018-02-09 08:48:04 -08:00
Emilio Cobos Álvarez
438251cbfc
style: Make AuthorStylesEnabled an enum.
Chances are we need to pass it around in a bit.

Also invert the boolean because I don't want to reason about double negations,
even if they're simple.

MozReview-Commit-ID: KhX4lDKwDoj
2018-02-09 13:27:35 +01:00
Emilio Cobos Álvarez
4cc5717116
style: Save some work if the origin is not dirty.
MozReview-Commit-ID: EGHztVLj9i3
2018-02-09 13:27:34 +01:00
Emilio Cobos Álvarez
bbc6857c06
style: Rename OriginValidity to DataValidity.
MozReview-Commit-ID: FpsYUlWLWTt
2018-02-09 13:27:33 +01:00
Emilio Cobos Álvarez
01915d84db
style: Assert we don't try to do dumb stuff.
MozReview-Commit-ID: 6DpkiwUdccD
2018-02-09 13:27:33 +01:00
Emilio Cobos Álvarez
c88d339db2
style: Move the dirty bit to SheetCollection.
MozReview-Commit-ID: DO9vv9vmSzF
2018-02-09 13:27:31 +01:00
Emilio Cobos Álvarez
f1516d228f
style: Rename StylesheetSet to DocumentStylesheetSet.
MozReview-Commit-ID: 5Xl1eRLu1VF
2018-02-09 13:27:30 +01:00
Emilio Cobos Álvarez
655e0c6beb
style: Remove unneeded clone. 2018-02-09 12:30:20 +01:00
Anthony Ramine
5d8e70dc27 Avoid pattern matching to clone Copy variants of PropertyDeclaration 🐉🐲 2018-02-09 12:10:42 +01:00
bors-servo
e654afbc3e
Auto merge of #19994 - Manishearth:rm-telemetry, r=upsuper
Remove traversal telemetry

<!-- 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/19994)
<!-- Reviewable:end -->
2018-02-08 08:10:09 -05:00
bors-servo
c22baf58d0
Auto merge of #19985 - servo:derive-these-things-too, r=emilio
Derive ComputeSquaredDistance for animated filters

<!-- 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/19985)
<!-- Reviewable:end -->
2018-02-08 06:41:22 -05:00
Manish Goregaokar
9d23962d8e Remove traversal telemetry 2018-02-08 03:04:34 -08:00
Gecko Backout
1231868663 Backed out changeset 24f85c628472 for failing in layout/style/test/test_value_storage.html on a CLOSED TREE
Backs out https://github.com/servo/servo/pull/19983
2018-02-08 09:43:28 +00:00
bors-servo
0d7c2271c2
Auto merge of #19984 - upsuper:media-ident-atom, r=emilio
Use atom for identifier media features

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

<!-- 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/19984)
<!-- Reviewable:end -->
2018-02-07 21:43:36 -05:00
Anthony Ramine
f017743a55 Derive ComputeSquaredDistance for animated filters 2018-02-08 03:14:23 +01:00
Xidorn Quan
458d94a67e Use atom for identifier media features. 2018-02-08 12:41:17 +11:00
bors-servo
f317075147
Auto merge of #19983 - emilio:simplify-font-family-serialize, r=xidorn
style: Tweak font-family serialization so that it is simpler.

In particular, every time that there's at least more than one identifier, switch
to quoted family name, since the reconstruction of the serialization will be
lossy anyway.

This allows us to avoid copies and all that.

What Chrome implements doesn't make much sense in the sense that they always
serialize:

  font-family: "foo";  -> font-family: foo;
  font-family: foo bar;  -> font-family: "foo bar";
  font-family: foo\ bar; -> font-family: "foo bar";

This patch makes us match on the second case, but not on the rest, because I
think Gecko's behavior is preferable in those cases.

Bug: 1434802
Reviewed-by: xidorn
MozReview-Commit-ID: JwBECA93lfi

<!-- 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/19983)
<!-- Reviewable:end -->
2018-02-07 19:39:54 -05:00
Emilio Cobos Álvarez
9490786876
style: Tweak font-family serialization so that it is simpler.
In particular, every time that there's at least more than one identifier, switch
to quoted family name, since the reconstruction of the serialization will be
lossy anyway.

This allows us to avoid copies and all that.

What Chrome implements doesn't make much sense in the sense that they always
serialize:

  font-family: "foo";  -> font-family: foo;
  font-family: foo bar;  -> font-family: "foo bar";
  font-family: foo\ bar; -> font-family: "foo bar";

This patch makes us match on the second case, but not on the rest, because I
think Gecko's behavior is preferable in those cases.

Bug: 1434802
Reviewed-by: xidorn
MozReview-Commit-ID: JwBECA93lfi
2018-02-08 01:09:39 +01:00