Commit graph

2404 commits

Author SHA1 Message Date
bors-servo
eeb1ee9723 Auto merge of #16802 - emilio:slim-down-slc, r=bholley
style: Slim down SharedStyleContext, and do various other cleanups around the style crate.

This slims down SharedStyleContext, in preparation for a few things.

First, I would like to eventually move the stylist to the document in Servo, in
order for it to hold the StyleSheetSet.

Also, this gets rid of a fair amount of overhead while creating it in stylo.

Fixes bug 1363245.

<!-- 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/16802)
<!-- Reviewable:end -->
2017-05-12 08:56:47 -05:00
Imanol Fernandez
593e89086f Fix unsafe AtomicRefCell<PersistentLayoutData> transmute due to memory alignment differences 2017-05-12 12:48:13 +02:00
bors-servo
d1f2cdfb3d Auto merge of #16815 - Manishearth:cssup, r=metajack
Bump cssparser to 0.13.3

<!-- 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/16815)
<!-- Reviewable:end -->
2017-05-11 16:10:23 -05:00
Manish Goregaokar
1b9bac7e66 Bump cssparser to 0.13.3 2017-05-11 12:50:40 -07:00
Imanol Fernandez
273bcfbd8e Fix unsafe casting between PersistentLayoutData and PartialPersistentLayoutData 2017-05-11 21:30:59 +02:00
Emilio Cobos Álvarez
ebd9bf8181
style: Slim down SharedStyleContext.
This slims down SharedStyleContext, in preparation for a few things.

First, I would like to eventually move the stylist to the document in Servo, in
order for it to hold the StyleSheetSet.

Also, this gets rid of a fair amount of overhead while creating it in stylo.

Fixes bug 1363245.
2017-05-11 21:05:41 +02:00
Anthony Ramine
70ec61cf01 Refactor Position
A specified position is now a struct made of two values of different types,
the first one being PositionComponent<X>, and the second one PositionComponent<Y>.

A position component is represented by the new enum PositionComponent<Side>,
with the three values Center, Length(LengthOrPercentage), and
Side(Side, Option<LengthOrPercentage>).

Side keywords are represented by the X and Y enums, which don't include a value
for the center keyword anymore. They are accompanied by the Side trait, which
allows us to determine whether a side keyword is "left" or "top".

This refactor simplified the parsing and serialisation code and exposed bugs in it,
where it would reject valid <position> values followed by arbitrary tokens,
and where it would fail to prefer "left" to "right" when serialising positions
in basic shapes.
2017-05-10 16:56:01 +02:00
Martin Robinson
3236611aba Don't optimize display list for projective transforms
There are situations where elements are transformed from outside the
display list. With projective transforms it's currently difficult to
detect these. In those cases we just don't optimize the display list,
so that they will always be shown.

Fixes #13822.
2017-05-10 15:09:38 +02:00
bors-servo
fc3a7d03f2 Auto merge of #16303 - froydnj:rayon-version-bump, r=jdm
bump required rayon version to 0.7

...and bring jpeg-decoder along for the ride.  Minor tweaks were necessary because of rayon API changes.

- [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/16303)
<!-- Reviewable:end -->
2017-05-08 21:36:48 -05:00
bors-servo
19706085a7 Auto merge of #16756 - servo:rustup, r=jdm
Upgrade to rustc 1.19.0-nightly (ced823e26 2017-05-07)

<!-- 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/16756)
<!-- Reviewable:end -->
2017-05-08 16:06:56 -05:00
Simon Sapin
02e1901bc1 Upgrade to rustc 1.19.0-nightly (ced823e26 2017-05-07) 2017-05-08 12:46:03 +02:00
Emilio Cobos Álvarez
c9ab75b013
layout: Fix radius percentage resolution.
By resolving against the corresponding dimension of the border box, instead of
against the width.

Fixes #16764
2017-05-08 11:48:29 +02:00
Emilio Cobos Álvarez
39471cda1b
layout: Avoid a few dumb refcount bumps. 2017-05-08 11:48:28 +02:00
bors-servo
3f1ae64255 Auto merge of #16666 - pyfisch:gradients, r=emilio
Improvements to gradients.

This is a collection of commits improving the rendering of linear and radial gradients by making them conform more closely to the spec.

All commits are are independent and should work without the others.

These commits address the following issues:
* a956e3fd52 resolves #3908 but contains also some other necessary changes to `convert_gradient_stops`. The updated function has a few more copys but should be more correct. Maybe @pcwalton wants to comment since he has originally written the code.
* b230be8aaf partially solves #16638. (Partially because `border-image-outset` is not implemented. This is an older issue for border gradients: #15894.

To quickly catch regressions and see changes to gradients I have created [a set of twelve manual testcases](https://pyfisch.org/stuff/testcases-gradients.html) and placed them in a single file. Attached are two files. One shows how the gradients were rendered before the PR the other one with the changes applied.

![testcases-old](b433278e-2e7d-11e7-9396-500fef12eee0.png)
![testcases-new](b43222c6-2e7d-11e7-99ab-c0a2709baf41.png)

r? @emilio
and maybe also @jdm?

---
- [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/16666)
<!-- Reviewable:end -->
2017-05-07 07:56:51 -05:00
Pyfisch
f4fadc7875 Address feedback by emilio. 2017-05-07 12:28:57 +02:00
Pyfisch
72db8d8555 Duplicate first gradient stop if necessary.
If the first stop of a non-repeating gradient is
not placed at offset 0.0 it is duplicated at this
position. This solves the problem of the first
stop being ignored if it is placed at the same
offset as the next stop.
2017-05-06 21:43:22 +02:00
Nathan Froyd
681b578326 bump required rayon version to 0.7
...and bring jpeg-decoder along for the ride.  Minor tweaks were
necessary because of rayon API changes.
2017-05-05 10:36:01 -04:00
Martin Robinson
83ac0a8505 Rename PushScrollRoot and remove PopScrollRoot
PopScrollRoot was unused and PushScrollRoot no longer pushes a scroll
root, but defines a new one.
2017-05-05 09:02:24 +02:00
bors-servo
74c36cb35d Auto merge of #16652 - Gankro:bincode-ipc-5, r=jdm
Update to webrender's new bincode IPC

**DO NO MERGE YET**

This is the required update to Servo for my changes to webrender in https://github.com/servo/webrender/pull/1181

<!-- 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/16652)
<!-- Reviewable:end -->
2017-05-03 12:44:37 -05:00
Alexis Beingessner
db02979c4f Update to use webrender bincode IPC 2017-05-03 12:37:20 -04:00
bors-servo
8b41c7c137 Auto merge of #16689 - servo:m5e, r=nox
Upgrade to html5ever 0.16

<!-- 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/16689)
<!-- Reviewable:end -->
2017-05-03 08:42:41 -05:00
Bobby Holley
7b0679848b Fix up script and layout. 2017-05-02 17:35:45 -07:00
Simon Sapin
6c518c89b9 Upgrade to html5ever 0.16 2017-05-02 19:24:28 +02:00
Pyfisch
4f17b17082 Correct virtual gradient ray length of radial gradients.
The length should be the horizontal radius and not the
hypotenuse.
2017-05-01 14:19:35 +02:00
Pyfisch
f7f077c334 Add fix_gradient_stops function.
Render gradients where the last stop is the same position
as the previous one like Chrome and Firefox do.
2017-05-01 13:22:39 +02:00
Pyfisch
b230be8aaf Implement radial gradients for borders.
The property border-image-outset is not yet implemented.
Note: Also support repeating-linear-gradients for borders.
2017-04-30 22:36:45 +02:00
Pyfisch
a956e3fd52 Improve convert_gradient_stops function.
Implement Specification from CSS Images 3.

Improvements:

1. Stops with positions less than preceding stops are moved.
     A common pattern is blue `70%, white 0` for sharp transitions.
2. Stop runs are correct if first stop has a position.
    The list `black 0%, red, gold` now renders the same as `black, red, gold`.
    Other runs may also be corrected.
3. Absolute length are no longer capped to 100%.
2017-04-30 21:12:26 +02:00
Pyfisch
e62ad7e680 Implement -webkit-radial-gradient aliases.
In display_list_builder.rs handle cover and contain size keywords.
2017-04-30 21:12:26 +02:00
bors-servo
53c62e890a Auto merge of #16385 - pyfisch:radial-gradient, r=emilio
Implement radial gradients

<!-- Please describe your changes on the following line: -->
This PR passes the `radial-gradient` function down from CSS parsed properties to webrender. It currently lacks tests but the examples from MDN and some other tests work fine. Probably there are some wpt tests I can enable?

<!-- 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 #11779 (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/16385)
<!-- Reviewable:end -->
2017-04-29 09:40:32 -05:00
Pyfisch
d48c1222ca Changes needed for rebase. 2017-04-29 14:38:33 +02:00
Keith Yeung
2d5833d3af Fix fixed table layout column width distribution 2017-04-27 23:35:26 -07:00
Pyfisch
ce3e1406ca Handle unimplemented size keywords for radial gradients. 2017-04-27 22:07:31 +02:00
Pyfisch
c9461985c1 Fix gradient position if background-clip is present. 2017-04-27 22:07:31 +02:00
Pyfisch
1c4ae53a88 Pass repeating gradients to webrender. 2017-04-27 22:07:31 +02:00
Pyfisch
803bc0395c Fix gradient math and positioning. Formatting.
Start adding repeating gradients.
2017-04-27 22:07:31 +02:00
Pyfisch
6768614fdd Use content_box instead of absoulte bounds in radial_gradient. 2017-04-27 22:07:31 +02:00
Pyfisch
0215947733 Implement radial gradient size keywords. 2017-04-27 22:07:31 +02:00
Pyfisch
f4bad2d920 Partially implement radial gradients.
Missing: repeating radial gradients and keyword sizes.
2017-04-27 22:07:31 +02:00
Anthony Ramine
ae82cdab34 Parse interpolation hints (fixes #15166) 2017-04-27 15:04:36 +02:00
bors-servo
c1b347794c Auto merge of #16612 - glennw:update-wr-groove-ridge-2, r=jdm
Update WR (groove/ridge borders, mix-blend-mode opts)

<!-- 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/16612)
<!-- Reviewable:end -->
2017-04-26 07:56:32 -05:00
Glenn Watson
c879584a19 Update WR (new groove/ridge border path, mix-blend-mode optimizations)
A few other minor additions too.
2017-04-26 14:34:07 +10:00
Simon Sapin
627c823d0a Use CustomIdent in counter-increment 2017-04-26 13:02:17 +09:00
bors-servo
cd8af86244 Auto merge of #16597 - Manishearth:stylo-overflow, r=emilio
stylo: support all overflow values

overflow:clip doesn't exist, it's just called clip internally. Renamed, and added the other missing values.

I also removed the overflow newtype -- no need for extra code bloat, and it's not protecting us from much.

<!-- 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/16597)
<!-- Reviewable:end -->
2017-04-25 15:59:13 -05:00
Manish Goregaokar
f8e298b2b3 stylo: support all overflow values
MozReview-Commit-ID: 1iQdUDsb6u9
2017-04-25 13:52:39 -07:00
Ravi Shankar
0249270f61 Create a module for generics and make BorderRadiusSize generic 2017-04-25 17:13:41 +05:30
Simon Sapin
11cef135e7 Update to cssparser 0.13 2017-04-25 01:45:33 +02:00
bors-servo
418c3e8cc7 Auto merge of #16541 - sbwtw:fix_calc_behavior, r=stshine
Add calc method for CalcLengthOrPercentage

* Add calc method to calculate formula value with parent size
* Add unit test case

<!-- Please describe your changes on the following line: -->
Please see this issue: https://github.com/servo/servo/issues/15986

---
<!-- 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 #15986 (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/16541)
<!-- Reviewable:end -->
2017-04-24 04:16:18 -05:00
石博文
22f99c71b9
Add to_computed method for CalcLengthOrPercentage
* Add to_computed method to calculate `calc()` value with parent size,
if parent container size is `None`, the result will be `None`.
* Add from_option method for `MaybeAuto`, to construct from
`Option<Au>`.
* Update some test case.
2017-04-24 14:22:14 +08:00
bors-servo
0f6c883658 Auto merge of #16551 - glennw:update-wr-mostly-borders, r=jdm
Update WR (improved double border quality, minor API changes).

<!-- 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/16551)
<!-- Reviewable:end -->
2017-04-23 17:50:08 -05:00
bors-servo
541db5f9a7 Auto merge of #16458 - stshine:sequential-fallback, r=pcwalton,emilio
layout: Force reflow in the sequential fallback of block format context

When reflowing a block format context during the inorder traversal,
propagate restyle damage manually to its children since they were
already reflowed. Also, test the border box to see if it can fit into
floats according to CSS 2.1 § 9.5.

Improves reddit and yahoo.

---
<!-- 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 #__ (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/16458)
<!-- Reviewable:end -->
2017-04-22 23:55:22 -05:00