Commit graph

15240 commits

Author SHA1 Message Date
bors-servo
af48b42c57 Auto merge of #17706 - glennw:linux-fonts, r=stshine,emilio
Improve font layout in Linux / Freetype platforms.

This patch contains two small changes:

* Fix the font size calculation that is passed to Freetype. This
  now matches exactly how Webrender and Gecko calculate font size
  to pass to layout.
* Enable light hinting by default for fonts when using Freetype.
  We should make this configurable in the future, but this is a
  better default than no hinting (and matches what most Linux
  distros default to).

These two changes (along with the pending WR update) fix a lot
of the font layout issues on Linux. There is still at least one
remaining issue with hidpi displays on Linux that will be fixed
in a follow up patch.

<!-- 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/17706)
<!-- Reviewable:end -->
2017-07-13 16:13:41 -07:00
Glenn Watson
83e5a82388 Improve font layout in Linux / Freetype platforms.
This patch contains two small changes:

* Fix the font size calculation that is passed to Freetype. This
  now matches exactly how Webrender and Gecko calculate font size
  to pass to layout.
* Enable light hinting by default for fonts when using Freetype.
  We should make this configurable in the future, but this is a
  better default than no hinting (and matches what most Linux
  distros default to).

These two changes (along with the pending WR update) fix a lot
of the font layout issues on Linux. There is still at least one
remaining issue with hidpi displays on Linux that will be fixed
in a follow up patch.
2017-07-14 08:40:10 +10:00
bors-servo
788ba8ccf0 Auto merge of #17717 - emilio:style-sharing-stop, r=bzbarsky
style: Don't stop looking at the sharing cache for various reasons.

All the information that made those failures expensive is now lazily computed
and cached, or eagerly computed anyway, so seems not worth to stop iteration.

<!-- 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/17717)
<!-- Reviewable:end -->
2017-07-13 15:05:07 -07:00
bors-servo
559c0d1d90 Auto merge of #17501 - jyc:Text-children_changed, r=emilio
Have CharacterData call children_changed on its parent when data is set.

**Can't run WPT on my computer, so pushing here to run tests 😢**

Have CharacterData.SetData call children_changed on its parent when
data is set (if it is a Text node) so that HTMLStyleElement parents can
re-parse. Add variant ChildrenMutation::Text for it to use as the
mutation.

This fixes an issue where an empty <style> element's data is set but the
style is not updated. An HTMLStyleElement parent re-parses in its
children_changed implementation.

<!-- 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 are part of a series to fix #17182 (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/17501)
<!-- Reviewable:end -->
2017-07-13 14:00:13 -07:00
Jonathan Chan
4142665282 Have CharacterData call children_changed on its parent when data is set.
Have CharacterData.SetData call children_changed on its parent when
data is set (if it is a Text node) so that HTMLStyleElement parents can
re-parse. Add variant ChildrenMutation::Text for it to use as the
mutation.

This fixes an issue where an empty <style> element's data is set but the
style is not updated. An HTMLStyleElement parent re-parses in its
children_changed implementation.
2017-07-13 13:02:27 -07:00
bors-servo
51c94954d1 Auto merge of #17714 - servo:rustup, r=SimonSapin
Update to rustc 1.20.0-nightly (f85579d4a 2017-07-12)

<!-- 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/17714)
<!-- Reviewable:end -->
2017-07-13 12:56:56 -07:00
bors-servo
14d5e4cc55 Auto merge of #17712 - mrobinson:overflow-scroll-clip, r=emilio
Fix the size and position of overflow:scroll clip

The clip for overflow:scroll clip was not including the space for
padding, which could lead to some content being clipped when it
shouldn't. This changes fixes that issue.

A test is skipped because this fix also stops hiding a failure due to
mispositioned text.

Fixes #16576.

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

<!-- Either: -->
- [x] 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/17712)
<!-- Reviewable:end -->
2017-07-13 11:52:06 -07:00
bors-servo
a287271486 Auto merge of #17709 - paulrouget:new_pipeline_before_add_pending_changes, r=cbrewster
always call new_pipeline() before add_pending_changes()

There are some changes we want to make in `add_pending_changes` which require pipelines to be registered in self.pipelines.

---
<!-- 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/17709)
<!-- Reviewable:end -->
2017-07-13 10:50:07 -07:00
bors-servo
95bad3f33a Auto merge of #17690 - stshine:no-inorder, r=emilio
layout: Stop in-order traversal on children of InlineFlow

No need to do in-order traversal for children of InlineFlow, since
they are either inline-block or absolutely positioned elements, which
are guaranteed to be block formatting context.

<!-- 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
- [X] These changes do not require tests because cleanup

<!-- 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/17690)
<!-- Reviewable:end -->
2017-07-13 09:53:39 -07:00
bors-servo
68ae7ceff6 Auto merge of #17703 - servo:code-size, r=emilio
Reduce amount of Mako-generated code in style

In multiple places, instead of generated similar code for each CSS property, have a single code path that uses an enum such as `LonghandId`.

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

Machine code size is measured with [bloaty](https://github.com/google/bloaty), looking at the total "VM size" in order to exclude debug info (which is stripped in binaries shipped to users).

```
mach build-geckolib --release
bloaty target/geckolib/release/libgeckoservo.a
```

Initial size was 9.56Mi. Successive commits in this PR bring it to 9.55Mi, 9.51Mi, 9.44Mi, 9.31Mi, 8.89Mi, 8.89Mi, and 7.54Mi. Total savings: 2.02 MiB.

In an optimized Firefox build with `mach build && mach package`, the size of `obj-x86_64-pc-linux-gnu/dist/firefox/libxul.so` goes from 109.11 MiB to 107.49 MiB, saving 1.62 MiB. I don’t really know how to explain the difference. Does `libgeckoservo.a` contain code that ends up not being used in `libxul.so`?

<!-- 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/17703)
<!-- Reviewable:end -->
2017-07-13 08:51:55 -07:00
Pu Xingyu
71fcdf683a layout: Stop in-order on children of InlineFlow
No need to do in-order traversal for children of InlineFlow, since
they are either inline-block or absolutely positioned elements, which
are guaranteed to be block formatting context.
2017-07-13 23:50:01 +08:00
Simon Sapin
09d6c83c50 Use match instead of if let of one-line branches. 2017-07-13 16:58:19 +02:00
bors-servo
43e2720f86 Auto merge of #17685 - paulrouget:rm_InitializeCompositing, r=jdm
remove no-op InitializeCompositing message

I think this is no-op.

---
<!-- 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/17685)
<!-- Reviewable:end -->
2017-07-13 07:46:32 -07:00
Emilio Cobos Álvarez
8667cea4ca
style: Don't stop looking at the sharing cache for various reasons.
All the information that made those failures expensive is now lazily computed
and cached, or eagerly computed anyway, so seems not worth to stop iteration.
2017-07-13 16:23:56 +02:00
Simon Sapin
34c5a21691 Merge per-property substitute_variables* functions into one. 2017-07-13 16:23:36 +02:00
Simon Sapin
3d3c196d90 Fix shorthand parsing pushing declarations when parse_entirely returns Err 2017-07-13 16:23:35 +02:00
Simon Sapin
66c357feef Fix handling of all shorthand with var() functions 2017-07-13 16:23:14 +02:00
Simon Sapin
42813bc813 Move property value parsing from longhand/shorthand ID into separate methods. 2017-07-13 16:23:13 +02:00
Simon Sapin
54f1325a49 var() functions in longhands: use a single code path with IDs
… rather than generating similar code for every longhand property
2017-07-13 16:23:12 +02:00
Simon Sapin
252e52e24e var() functions in shorthands: use a single code path with IDs
… rather than generating similar code for each shorthand.
2017-07-13 16:23:11 +02:00
Simon Sapin
8a8614eccd CSS-wide keywords parsing in longhands: use a single code path with IDs
… rather than generating similar code for every longhand property.
2017-07-13 16:23:10 +02:00
Simon Sapin
a5b80e2d75 CSS-wide keywords parsing in shorthand: use a single code path with IDs
… rather than generating similar code for each shorthand.
2017-07-13 16:23:09 +02:00
Simon Sapin
3075746edd Property validity checks: generated tables rather than genrated code 2017-07-13 16:23:08 +02:00
Simon Sapin
db1a3e54b0 Use heap API from std rather than the alloc crate 2017-07-13 15:26:40 +02:00
Anthony Ramine
612dbb868d Update to rustc 1.20.0-nightly (f85579d4a 2017-07-12) 2017-07-13 15:20:51 +02:00
bors-servo
347cbb0635 Auto merge of #17711 - ferjm:bug1367274.linear.gradient, r=xidorn
Implement serialization of linear-gradient the same ways as in Gecko

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

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

<!-- 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/17711)
<!-- Reviewable:end -->
2017-07-13 05:17:06 -07:00
Martin Robinson
39a98d4ff1 Fix the size and position of overflow:scroll clip
The clip for overflow:scroll clip was not including the space for
padding, which could lead to some content being clipped when it
shouldn't. This changes fixes that issue.

A test is skipped because this fix also stops hiding a failure due to
mispositioned text.

Fixes #16576.
2017-07-13 13:50:03 +02:00
bors-servo
9515abbca3 Auto merge of #17707 - emilio:invalidation-less-memory, r=heycam
stylo: Waste less memory in invalidation stuff and style rules.

This should help a lot with https://bugzilla.mozilla.org/show_bug.cgi?id=1380488.

<!-- 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/17707)
<!-- Reviewable:end -->
2017-07-13 04:15:15 -07:00
Fernando Jiménez Moreno
6ae4bf6ee8 Implement serialization of linear-gradient the same ways as in Gecko 2017-07-13 12:20:30 +02:00
bors-servo
9d74ae890b Auto merge of #17710 - emilio:revert-bloom-sharing, r=heycam
Revert "Auto merge of #17701 - bholley:reuse_allocations, r=emilio"

This reverts commit ebfc8f5858, reversing
changes made to 5585ff2c44.

Animation code can reenter and create a new TLS context from the traversal
SequentialTask, so this won't work as written, and it's making test fails.

<!-- 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/17710)
<!-- Reviewable:end -->
2017-07-13 01:26:34 -07:00
Emilio Cobos Álvarez
a34f288b98
Revert "Auto merge of #17701 - bholley:reuse_allocations, r=emilio"
This reverts commit ebfc8f5858, reversing
changes made to 5585ff2c44.

Animation code can reenter and create a new TLS context from the traversal
SequentialTask, so this won't work as written.
2017-07-13 09:58:08 +02:00
Paul Rouget
9ba1d32f9d always call new_pipeline() before add_pending_changes() 2017-07-13 09:52:02 +02:00
bors-servo
9451b41d33 Auto merge of #17702 - upsuper:python-addr-in-generated, r=emilio
Avoid random python address to be added to generated files

This would catch cases like #17691 and avoid regressing [bug 1380327](https://bugzilla.mozilla.org/show_bug.cgi?id=1380327) in this manner.

<!-- 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/17702)
<!-- Reviewable:end -->
2017-07-12 23:34:58 -07:00
bors-servo
173181a491 Auto merge of #17694 - glennw:webrender-update, r=glennw
Upgrade to the latest version of WebRender

<!-- 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/17694)
<!-- Reviewable:end -->
2017-07-12 21:52:27 -07:00
Emilio Cobos Álvarez
445b8fb3e8
style: Remove SelectorAndHashes. 2017-07-13 05:44:55 +02:00
Emilio Cobos Álvarez
dee4aea264
style: Remove hashes from style rules and dependencies.
Dependencies are very numerous, and now we shouldn't be getting so many of them.

Style rules just don't need them, so it's a waste of memory.
2017-07-13 05:44:53 +02:00
bors-servo
28abeab5a5 Auto merge of #17705 - emilio:neg-padding, r=bholley
style: Avoid parsing negative padding in the padding shorthand.

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

<!-- 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/17705)
<!-- Reviewable:end -->
2017-07-12 20:11:45 -07:00
Emilio Cobos Álvarez
1785fd66a4
style: Avoid parsing negative padding in the padding shorthand. 2017-07-13 04:58:21 +02:00
Paul Rouget
ff6dc856e6 remove no-op InitializeCompositing message 2017-07-13 04:30:08 +02:00
bors-servo
3e2f6dc870 Auto merge of #17693 - emilio:revert-rustup, r=nox
Revert "Auto merge of #17633 - servo:rustup, r=nox"

This reverts commit 327e72aa14, reversing
changes made to eec51cdd57.

This closes #17642.

<!-- 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/17693)
<!-- Reviewable:end -->
2017-07-12 19:04:21 -07:00
Emilio Cobos Álvarez
9394ea9644
style: Remove unneeded bounds in SelectorMap and related code.
MozReview-Commit-ID: CWwdVCwWijn
2017-07-13 03:34:33 +02:00
bors-servo
ebfc8f5858 Auto merge of #17701 - bholley:reuse_allocations, r=emilio
reuse the bloom filter and style sharing cache across traversals

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

<!-- 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/17701)
<!-- Reviewable:end -->
2017-07-12 16:48:19 -07:00
Bobby Holley
3bce0c7652 Stop using SendElement in StyleSharingCandiate.
MozReview-Commit-ID: AuNPDsq8bgk
2017-07-12 16:38:08 -07:00
Bobby Holley
ec6cca6d08 Reuse style sharing cache across traversals.
MozReview-Commit-ID: 9wCJtciqs6K
2017-07-12 16:38:07 -07:00
Bobby Holley
0614010552 Store the bloom filter in TLS and reuse it across traversals.
MozReview-Commit-ID: EbzDehr2Y2L
2017-07-12 16:38:06 -07:00
Bobby Holley
d1c31f7eaf Add owning_ref back as a style dep, and update parking_lot. 2017-07-12 16:37:50 -07:00
Xidorn Quan
455dffc919 Avoid random python address to be added to generated files 2017-07-13 09:06:35 +10:00
Martin Robinson
e58e8ab42e Upgrade to the latest version of WebRender 2017-07-13 07:44:08 +10:00
bors-servo
5585ff2c44 Auto merge of #17692 - canaltinova:grid-pls, r=wafflespeanut
stylo: Fix grid-template serialization in grid shorthand

Because of some unnecessary checks, it wasn't able to serialize the '40px / none' value properly before. That will fix one failure on `test_value_storage.html`

---
- [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/17692)
<!-- Reviewable:end -->
2017-07-12 14:38:14 -07:00
Nazım Can Altınova
8f12485d4b stylo: Fix grid-template serialization in grid shorthand
Because of some unnecessary checks, it wasn't able to serialize the '40px / none' value properly before.
2017-07-12 14:06:04 -07:00