Commit graph

121 commits

Author SHA1 Message Date
Pyfisch
3b3d4a9853 Unify background placement code
Merges the implementations for background-image placement
from gradients and images. Add missing parts and fix bugs.

Now supported are the CSS properties:

* background-attachment (except for local value)
* background-clip
* background-origin
* background-position-x/y
* background-repeat
* background-size

It should be noted that backgrounds are not clipped to
rounded border corners.
2017-12-28 20:14:31 +01:00
Pyfisch
9502e9f42a layout: support tiled gradients
Use background-size, background-position properties to render
CSS gradients.

Some cleanup in display_list_builder.rs related to gradient
calculations.

Adds two wpt tests for tiled gradients.

Note: For now even gradients with background-repeat: no-repeat
are repeated. Sometimes the gradient is not repeated everywhere.

Enable vars-background-shorthand-001.html CSS test.
2017-12-14 09:25:30 +01:00
Glenn Watson
58473cfdcd Update WR (AA improvements, many optimizations) 2017-12-07 15:08:31 +10:00
Emilio Cobos Álvarez
af879523ea
style: Make all keywords CamelCase for consistency.
This prevents confusion and paves the ground for derive(Parse) of them.
2017-12-06 02:35:10 +01:00
Dzmitry Malyshau
8922280b91 WR update to 4595561c49939cb21be9554c1b85c244508bde73 2017-11-23 14:51:11 -05:00
Glenn Watson
cdc163533c Update WR (opaque image optimizations, property binding optimizations) 2017-11-17 10:38:04 +10:00
Glenn Watson
b1ec2b260a Update WR (dotted border fix, better AA for split primitives) 2017-11-10 08:17:32 +10:00
Glenn Watson
3007bfe815 Update WR (blur and subpixel text optimizations, recording fix) 2017-11-07 14:48:53 +10:00
Martin Robinson
f37fa0cf6d Update WR to use the new sticky positioning API 2017-10-30 10:15:30 +01:00
Glenn Watson
47544b2d28 Update WR (line decorations, pre-mul borders, mac fonts) 2017-10-26 07:37:14 +10:00
Martin Robinson
5937f62352 Wait as late as possible to assign ClipIds
This will allow Servo to create ClipScrollNodes later during display
list construction, which will be necessary once rounded rectangles
are removed from the LocalClip structure. Instead of keeping track
of the ClipId of each ClipScrollNode, we keep track of its index in an
array of ClipScrollNodes. This will allow us to access them without a
hash lookup.
2017-10-24 16:28:07 +02:00
Glenn Watson
aaaf644c91 Update WR (box shadows + per-corner radii, elliptical clips). 2017-10-20 11:30:00 +10:00
bors-servo
4cf2ce66fc Auto merge of #18933 - mrobinson:wr-text-index, r=jdm
Use WebRender to compute text index on click events

This is the second half of switching over to WebRender for hit testing.
Now that WebRender gives us the location of the hit tested point in the
display item, we can use that to calculate text index.

<!-- 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 they shouldn't change behavior.

<!-- 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/18933)
<!-- Reviewable:end -->
2017-10-19 02:36:32 -05:00
bors-servo
59d727b020 Auto merge of #18926 - glennw:update-wr-bs, r=jdm
Update WR (box shadows, subpixel + alpha text)

<!-- 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/18926)
<!-- Reviewable:end -->
2017-10-18 23:52:54 -05:00
Martin Robinson
2e2ed444d5 Remove DisplayListTraversal
It's no longer necessary because we always just walk through the
display list one item at a time.
2017-10-18 17:34:34 +02:00
Glenn Watson
4c1c20d492 Update WR (box shadows, subpixel + alpha text) 2017-10-18 12:00:14 +10:00
Martin Robinson
b5d51dd263 Switch to using WebRender hit testing
This trades quite a bit of complicated code in Servo for few more
messages and a significant performance improvement. In particular,
WebRender can search the entire display list at once instead of
ping-ponging down the pipeline tree. This allows us to send mouse
events to the correct pipeline immediately.
2017-10-17 23:33:13 +02:00
Glenn Watson
4469f39f3f Update WR (details below):
* Add support for clip masks on text runs.
* Fix atomic ordering of items with multiple shadows.
* Update to bincode + ipc-channel with optimizations.
* Fix some plane splitting precision errors.
* Improve the anti-aliasing quality significantly.
* Add internal ClipChain support.
* Fix diacritic glyphs on Linux.
2017-10-16 16:33:24 +10:00
Glenn Watson
bcd74053a8 Update WR (clip masks on angle gradients, fix clips on transformed images). 2017-10-05 08:00:03 +10:00
Glenn Watson
2b6fe42236 Update WR (implement blur filter, text-shadow blend fixes, frame output fix). 2017-09-19 11:56:03 +10:00
bors-servo
b2df99cb65 Auto merge of #18462 - mrobinson:cleanup-building-state, r=emilio
Do some minor cleanups in display list building

<!-- 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 they should not change behavior.

<!-- 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/18462)
<!-- Reviewable:end -->
2017-09-15 05:30:47 -05:00
Martin Robinson
cedc7ebc53 Rename ScrollRoot to ClipScrollNode
ScrollRoot is an ever increasingly inaccurate name for this thing and
WebRender consistently uses ClipScrollNode nowadays. Stick with the
WebRender terminology to be consistent.
2017-09-15 10:10:22 +02:00
Boris Chiou
a949e2a057 Introduce CSSPixelLength and update NonNegativeLength.
First, we define computed::CSSPixelLength which contains a CSSFloat, a
pixel value, and then we replace computed::Length with CSSPixelLength.
Therefore, the |ComputedValue| of NoCalcLength, AbsoluteLength,
FontRelativeLength, ViewportPercentageLength, CharacterWidth, and
PhysicalLength is CSSPixelLength.

Besides, we drop NonNegativeAu, and replace computed::NonNegativeLength
with NonNegative<computed::Length>. (i.e. NonNegative<CSSPixelLength>)
2017-09-13 18:05:14 +08:00
Glenn Watson
15d7697474 Update WR (backface API changes).
This does the minimal work to update to the API changes related
to backface support. It doesn't actually pass through any info
about the backface visibility flags yet.
2017-09-13 07:55:55 +10:00
bors-servo
f1fab036ab Auto merge of #18212 - mrobinson:position-sticky, r=emilio
Add support for position:sticky

This leverages the position:sticky support in WebRender to bring basic
support for position:sticky in Servo. There are still some issues with
nested sticky flows as well as a few other corner cases. Tests are
imported from WPT and can be removed once we update to the latest
version.

<!-- 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: -->
- [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/18212)
<!-- Reviewable:end -->
2017-09-05 15:36:47 -05:00
Martin Robinson
bc455c8a1f Add support for position:sticky
This leverages the position:sticky support in WebRender to bring basic
support for position:sticky in Servo. There are still some issues with
nested sticky flows as well as a few other corner cases. Tests are
imported from WPT and can be removed once we update to the latest
version.
2017-09-05 09:10:55 +02:00
Glenn Watson
b015e93dc5 Update WR (font instance API).
WR now has a concept of font templates and font instances. This
makes the WR font interfaces closer to Cairo and Gecko, and also
makes some future performance optimizations possible.

A font template is the font family, and data backing the font.
A font instance is a reference to a font template and per-instance
options, such as font size, anti-aliasing settings etc.

To update Servo in a minimally invasive way, I added a new font
cache call, that creates a font instance. This means that when
a font is created, and doesn't exist in the cache there are now
two calls to the font cache thread. We could refactor the font
cache to make this work in one call, which we should do in the
future. However, refactoring the font cache is a large chunk of
work by itself. The extra call is only when a font doesn't already
exist in the font context cache, so it should have minimal
performance impact.
2017-08-31 16:10:30 +10:00
Anthony Ramine
676f2c8acf Revert "Auto merge of #18114 - emilio:revert-webgl-refactor, r=nox"
This reverts commit 4d10d39e8f, reversing
changes made to ee94e2b7c0.
2017-08-16 23:23:18 +02:00
Emilio Cobos Álvarez
cfe22e3979
Revert "Auto merge of #17891 - MortimerGoro:webgl_move, r=glennw,emilio"
This reverts commit 90f55ea458, reversing
changes made to 2e60b27a21.
2017-08-16 16:42:13 +02:00
Imanol Fernandez
703962fe61 Improve WebGL architecture. 2017-08-15 22:14:32 +02:00
bors-servo
016ea11cba Auto merge of #17783 - BorisChiou:stylo/animation/restrictions, r=nox
stylo: Bug 1374233 - Clamp interpolated values for properties which need to be restricted

Some properties only accept non-negative values, or values greater than or equal to one. It is possible to produce an negative interpolated values while using negative timing functions, so we have to apply a restriction to these values to avoid getting invalid values.

For example, line-height must be non-negative, but the output progress of some timing functions (e,g. cubic-bezier(0.25, -2, 0.75, 1)) may be a negative value, so the interpolated result of line-height is also negative.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix Bug 1374233.
- [X] These changes do not require tests because we have tests in Gecko side already.

<!-- 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/17783)
<!-- Reviewable:end -->
2017-08-07 11:05:17 -05:00
Boris Chiou
8651acd94c Bug 1374233 - Part 13: Use NonNegative{*} types for components of Shadow and Filter.
MozReview-Commit-ID: Im4KGy1n9IJ
2017-08-04 14:23:30 +08:00
Martin Robinson
daf638bc3f Fix fixed position items with parents with CSS clips
In order to properly handle CSS clipping, we need to keep track of what
the different kinds of clips that we have. On one hand, clipping due to
overflow rules should respect the containing block hierarchy, while CSS
clipping should respect the flow tree hierarchy. In order to represent
the complexity of items that are scrolled via one clip/scroll frame and
clipped by another we keep track of that status with a
ClipAndScrollInfo.
2017-08-03 17:52:02 +02:00
Martin Robinson
537025800f Allow overflow:hidden to scroll via script 2017-07-26 09:58:33 +10:00
Alexis Beingessner
855b1fe6f1 use DisplayListBuilder::with_capacity 2017-07-24 11:47:38 -04:00
Glenn Watson
dc82366f72 Update WR (switch to new text-decorations API in WR).
This only makes use of the "Solid" text decoration type, which
matches the existing support. WR now supports dotted, dashed
and wavy text decorations, but supporting those will need some
extra work in Servo to pass through the correct values.
2017-07-24 13:02:21 +10:00
Martin Robinson
2aa34f9dc2 Rounded corners for images and iframes. 2017-07-18 15:25:45 +02:00
Alexis Beingessner
2d3eae3e3a Implement new Webrender PushTextShadow API
Also includes an incidental bugfix for the rendering order of text decorations.

This change depends on servo/webrender#1454 being merged and upstreamed to servo.
2017-07-18 12:53:34 +02:00
Martin Robinson
e58e8ab42e Upgrade to the latest version of WebRender 2017-07-13 07:44:08 +10:00
Anthony Ramine
395f6be0a6 Use the Separator trait for the filter property 2017-06-27 23:40:16 +02:00
Glenn Watson
206fb3eb7f Update WR (z-buffer fix, border-image fill support). 2017-06-21 06:21:08 +10: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
Nicolas Silva
8617320500 Bump euclid to 0.14. 2017-06-14 16:00:59 +02:00
Dzmitry Malyshau
d04a64394e Using TransformStyle::Preserve3D 2017-05-16 11:08:32 -04:00
Glenn Watson
d175986501 Update WR (ellipse border-radius clip, preserve-3d functionality). 2017-05-16 11:09:40 +10: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
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
Alexis Beingessner
db02979c4f Update to use webrender bincode IPC 2017-05-03 12:37:20 -04: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
1c4ae53a88 Pass repeating gradients to webrender. 2017-04-27 22:07:31 +02:00