Commit graph

371 commits

Author SHA1 Message Date
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
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
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
Manish Goregaokar
f8e298b2b3 stylo: support all overflow values
MozReview-Commit-ID: 1iQdUDsb6u9
2017-04-25 13:52:39 -07:00
Martin Robinson
d150cc9f95 Eliminate ScrollRootId
Just use WebRender's ClipId directly. This will allow us to create and
use ReferenceFrames in the future, if we need to do that. It will also
make it easier to have Servo responsible for creating the root
scrolling area, which will allow removing some old hacks in the future.
2017-04-20 08:51:38 +02:00
Martin Robinson
43e4d04c24 Remove StackingContext::establishes_3d_context
This member is now unused since WebRender is the only display backend.
2017-04-18 10:06:25 +02:00
Martin Robinson
4451b8a771 Used shared clips for overflow:hidden and CSS clip
Instead of passing down a complex clipping region to each item, used
shared clipping to handle overflow:hidden and CSS clips. In addition to
being more efficient, this should also fix quite a few issues related
to absolutely positioned elements.

One existing reftest is slightly modified to avoid tickling a quirk
with the way that WebRender rasterizes masks. We are working out how to
best express these combined masks with the API or need to. The change
does not affect the original subject of the reftest.

Fixes #13109.
Fixes #10151.
Fixes #7575.
Fixes #8074.
Fixes #8780.
2017-04-17 17:06:43 +02:00
Martin Robinson
4213b320d1 Fix various issues with overflow clipping
When dealing absolutely positioned items, we should use clip of our
containing block, even if our containing block doesn't itself establish
a new overflow clip. Additionally, we need to properly handle
assigning scroll root ids to fragments of inline elements.

We add a test for this behavior.
2017-04-17 14:22:22 +02:00
Glenn Watson
9e874f50ae Update WR (gradients, batching, text run, border changes).
- Tidy and optimize the batching code.
- Support tiling / repeat for linear and radial gradients.
- Fix some edge cases of subpixel text AA.
- Add clip mask support to border shaders.
- Optimization to text run creation on CPU.
- Handle more box-shadow clipping cases.
- Fix a panic that could occur when window size is 0.
- Clip / scroll API improvements.
2017-04-12 13:29:03 +10:00
Nazım Can Altınova
9618363e08
stylo: Add -moz-element support 2017-04-09 21:25:48 +03:00
Martin Robinson
0353aad4e3 Use real clips when generating scroll roots
This is the first step toward removing inherited clips in favor of
scroll roots for handling overflow and CSS clipping. This will allow us
to more easily handle elements that should not be clipped. While we are
still using inherited clips here, we now properly clip some types of
content that wasn't clipped before.
2017-04-06 14:46:02 +02:00
Martin Robinson
39600f9f4e Update to support new clipping coordinates change 2017-04-05 10:45:31 +10:00
bors-servo
f2cd9efa96 Auto merge of #16127 - jbendig:issue_14954, r=emilio
Add full parsing/serialization for mask-repeat and background-repeat

I implemented full parsing and serialization for the mask-repeat and background-repeat style properties. I think some more tests are required but I'm not what I'm missing. I'd appreciate some direction.

I also had to modify some layout code to get my changes to compile. As a result, background-repeat should work individually in both directions now too.

---
<!-- 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 #14954.

<!-- Either: -->
- [ ] There are tests for these changes

<!-- 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/16127)
<!-- Reviewable:end -->
2017-03-28 13:30:13 -05:00
James Bendig
67282f9bee Add full parsing/serialization for mask-repeat and background-repeat 2017-03-27 14:52:56 -05:00
Fernando Jiménez Moreno
72d7ee613b Make image cache per-document rather than global 2017-03-27 19:54:13 +02:00
Martin Robinson
feac76701f Fix scroll root of absolutely positioned elements
Absolutely positioned elements should be given the scroll root of their
containing block and not necessarily the scroll root of their parent.
This fixes several CSS tests, though others are still failing pending a
similar fix for inherited clipping rectangles.

Fixes #13530.
2017-03-27 08:43:07 +02:00
bors-servo
fd8127b23b Auto merge of #15905 - mephisto41:add-border-gradient, r=emilio
Add gradient border support.

webrender add gradient border support in https://github.com/servo/webrender/pull/953. This pr add support in servo.

---
<!-- 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: -->
- [X] These changes do not require tests because it should be covered by wpt

<!-- 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/15905)
<!-- Reviewable:end -->
2017-03-26 02:29:16 -07:00
Nazım Can Altınova
494238ab29
Add support for -moz-image-rect 2017-03-25 21:58:36 +03:00
Nazım Can Altınova
645971b387
Rename and move PercentageOrNumber to values 2017-03-25 21:58:32 +03:00