Commit graph

394 commits

Author SHA1 Message Date
Alan Jeffrey
ef033b8362 Implemented paint worklet properties. 2017-07-11 17:28:56 -05:00
Nazım Can Altınova
d589645ee9 stylo: Implement -moz-prefixed radial gradients 2017-06-30 17:54:01 -07:00
Alan Jeffrey
328fb25a65 Implemented paint worklet rendering context. 2017-06-30 16:41:08 -05:00
Alan Jeffrey
3db4761767 Implemented paint worklets invoking worklet scripts. 2017-06-29 17:32:21 -05:00
Anthony Ramine
201d7e79e7 Make text-shadow and box-shadow use SimpleShadow 2017-06-28 16:28:25 +02:00
Anthony Ramine
395f6be0a6 Use the Separator trait for the filter property 2017-06-27 23:40:16 +02:00
Alan Jeffrey
dded87e402 Paint worklet size should agree with Chrome. 2017-06-22 09:51:30 -05:00
bors-servo
7a80192a82 Auto merge of #17395 - pyfisch:issue17387, r=emilio
Make background gradient cover padding

CSS-gradients should not only cover the content of an
element but also the padding (but not the border).

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

Thanks to @atouchet for catching this.

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

<!-- Either: -->
- [x] These changes do not require tests because gradients are hard to test automatically but you can use [this gist](https://gist.github.com/pyfisch/fa263c8dfc57e5812fe8a4869ad61513) as a manual test.

<!-- 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/17395)
<!-- Reviewable:end -->
2017-06-21 06:50:09 -07:00
Pyfisch
a34d8c7fa9 Make background gradient cover padding
CSS-gradients should not only cover the content of an
element but also the padding (but not the border).

Add a reftest.
2017-06-20 14:35:02 +02:00
Anthony Ramine
6f4061d4ad Use generics for the filter property
This introduces an additional shadow type for drop-shadow().
2017-06-20 13:48:53 +02:00
Glenn Watson
e7b1e041c8 Update WR (CPU text optimizations, image format renames). 2017-06-16 15:27:22 +10:00
Anthony Ramine
608e7f71a2 Make computed types hold Percentage instead of bare CSSFloat 2017-06-15 16:59:03 +02:00
Nicolas Silva
997608f11f Make BaseFlow::stacking_relative_position a vector. 2017-06-14 16:01:01 +02:00
Nicolas Silva
8617320500 Bump euclid to 0.14. 2017-06-14 16:00:59 +02:00
Anthony Ramine
d55d726a21 Derive ToCss for cursor keywords 2017-06-08 11:20:40 +02:00
Xidorn Quan
bf77f81ed6 Create RGBAColor for colors compute to RGBA. 2017-06-08 10:42:26 +10:00
Alan Jeffrey
fd17dcd604 Implemented the plumbing for paint worklets. 2017-06-07 13:49:30 -05:00
Xidorn Quan
3e47e6eab2 Make text-shadow reuse Shadow directly. 2017-06-07 13:32:17 +10:00
bors-servo
9d32b9cc35 Auto merge of #16317 - eloycoto:issue6799, r=emilio
Fix #6799: set stacking_context_position correctly on fragment_border_iterator

Hey,

First of all, this is my first PR to Servo project and I'm learning Rust, so sorry if you see something that it's not correct. I did that as best as I know.

This PR fix the issue #6799; I tried all the corner cases that I can think about it and always get the right result and the same as other browsers.

Related to the build:

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #6799

In the other hand, I added the test in the cssom folder, is where getBoundingClientRect  is defined, so I think that is the best place.

I'm sure that the line 122 can be better, but I didn't find a way to transform a Point2D from f32 to px in a easy way.

I'm here to listen to your recommendations and fix any issue.
Thanks!

<!-- 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/16317)
<!-- Reviewable:end -->
2017-05-30 11:28:26 -05:00
Eloy Coto
33a46597ed Fix #6799: set stacking_context_position correctly on
fragment_border_iterator
2017-05-30 09:38:37 +02:00
Anthony Ramine
4144dc74db Make Rect<T> a struct tuple
It makes no sense to have named fields in some cases, notably to reuse
Rect<T> in BorderRadius<T>.
2017-05-28 14:36:36 +02:00
Anthony Ramine
ca8fae91da Use generics for background-size property 2017-05-25 17:27:11 +02:00
Anthony Ramine
078d4ed40c Use generics for border-image-slice property 2017-05-23 14:36:54 +02:00
Anthony Ramine
307dd74ecf Introduce CalcLengthOrPercentage::unclamped_length
This is necessary for some operations, notably converting this to something
suitable for gecko.
2017-05-18 19:27:31 +02:00
Anthony Ramine
d0b9bd9c64 Refactor how calc() clamping is done on computed values (fixes #15296) 2017-05-18 10:14:59 +02:00
bors-servo
a5ff57b20f Auto merge of #16891 - kvark:preserve3d, r=glennw,emilio
Using TransformStyle::Preserve3D

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

The changes were reviewed previously as a part of WR update PRs, but then we decided to move them out.
r? @emilio

---
<!-- 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: -->
- [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/16891)
<!-- Reviewable:end -->
2017-05-17 20:38:14 -05:00
bors-servo
8375319928 Auto merge of #16876 - asajeffrey:constellation-rename-frames, r=cbrewster
Renamed constellation::Frame to constellation::BrowsingContext

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

Now that script has `WindowProxy` rather than `BrowsingContext` objects, we can rename `Frame` in the constellation to `BrowsingContext`. In particular, this means that `FrameId`s are now `BrowsingContextid`s, which better captures their purpose (and they are used in a lot of places, not just the constellation).

---
<!-- 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 do not require tests because renaming

<!-- 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/16876)
<!-- Reviewable:end -->
2017-05-16 23:10:45 -05:00
bors-servo
fada0eb660 Auto merge of #16795 - mrobinson:out-of-viewport-transform, r=glennw
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.

<!-- 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 #13822 (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/16795)
<!-- Reviewable:end -->
2017-05-16 21:27:47 -05:00
Dzmitry Malyshau
d04a64394e Using TransformStyle::Preserve3D 2017-05-16 11:08:32 -04:00
Alan Jeffrey
607e011b05 Renamed constellation::Frame to constellation::BrowsingContext. 2017-05-15 21:03:11 -05:00
Anthony Ramine
73f77e0a53 Rename LayerImage to ImageLayer and make it a type alias 2017-05-15 15:36:21 +02:00
Anthony Ramine
abef5da9d8 Refactor Gradient
In a similar way to Position, now specified and computed gradients share
a common Gradient type defined in style::values::generics::image.

This allows us to reuse most code for many style traits like ToCss,
HasViewportPercentage and ToComputedValue.

The test changes are the fallout of the disappearance of AngleOrCorner::None,
which align our code to the spec for serialisation, where components that can
be omitted should be omitted.
2017-05-15 15:36:15 +02:00
Anthony Ramine
f2aaba685b Kill side keywords from style::values::specified::image 2017-05-15 15:35:31 +02:00
Anthony Ramine
1c54758ad6 Introduce style::values::generics::image 2017-05-15 15:35:26 +02:00
Connor Brewster
d004db95cf Make non-initial about:blank loads asynchronous
Don't update iframe pipeline until load completes

To preserve the previous functionality of delaying load events when a
new navigation is triggered, pending pipeline id represents the
current pending load. The load event is only fired if the load message's
pipeline id matches the pending pipeline id.

Track frame size on Frame instead of Pipeline

Disabled matchMedia test

Track creator pipeline id
2017-05-12 11:53:43 -06: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
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
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
Bobby Holley
7b0679848b Fix up script and layout. 2017-05-02 17:35:45 -07: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
Pyfisch
d48c1222ca Changes needed for rebase. 2017-04-29 14:38:33 +02:00