Commit graph

279 commits

Author SHA1 Message Date
bors-servo
d85c6ee341
Auto merge of #26838 - servo:flexbox, r=nox
Flexbox, the boring parts

I have a local branch starting to implement https://drafts.csswg.org/css-flexbox/#layout-algorithm. It’s not PR-ready yet, but it’s going to be large so here are some of the less interesting parts meaningful by themselves. Landing the module split in particular will help reduce merge conflicts.

CC https://github.com/servo/servo/issues/26639
2020-06-10 17:19:16 -04:00
Simon Sapin
08f008a011 Use the writing mode of the containing block when accessing CSS properties
… and converting them to flow-relative geometric values.

These values are almost always used to size and position a fragment within its containing block, so using the mode of the containing block seems more correct.

Note that the `writing-mode` and `direction` properties are disabled in Servo at the moment, so this PR by itself should have no effect: the writing mode of an element is always the same of that of its containing block since they’re both horizontal rtl.
2020-06-10 09:03:18 +02:00
Simon Sapin
dd0d6a2a6f Split layout_2020/flexbox.rs into modules 2020-06-10 08:43:51 +02:00
bors-servo
554af02ab4
Auto merge of #26833 - servo:layout-2020-arcrefcell-abspos, r=SimonSapin
Store abspos boxes in a RefCell too

We want to mutate them when lazily computing their content sizes, but they
are behind an Arc for the hoisting infra, so it also needs its own layer
of inner mutability.
2020-06-10 01:33:34 -04:00
bors-servo
7eacfa4f0d
Auto merge of #26823 - jdm:single-renderapi, r=asajeffrey
Update webrender

These changes reflect changes in webrender's API that make RenderApiSender and RenderApi objects more challenging to share. This PR moves us to a model where:
* the compositor owns the main RenderApi object
* other threads that need to create transactions or manipulate fonts proxy those operations to the compositor (script/layout use IPC, while other threads use non-IPC channels)
* the webgl thread owns its own independent RenderApi
2020-06-09 19:34:08 -04:00
bors-servo
cb4e3cb16a
Auto merge of #26758 - jdm:stacking-context-transform-zero, r=mrobinson
Don't create empty stacking contexts in display lists

A recent change to euclid exposed that our display lists can contain Rects that contain NaN values. These NaNs originate from creating stacking contexts with transforms that scale the horizontal or vertical dimensions to 0. WebRender isn't prepared to handle these, so we need to not produce these empty stacking contexts when building the display list.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26592 and fix #26590
- [x] There are tests for these changes
2020-06-09 13:37:30 -04:00
Josh Matthews
75efaa95f5 Proxy all WR interactions for layout/font/script/canvas threads to the compositor
thread. There is now a single RenderApi that is used, and all transactions are serialized
through the compositor.
2020-06-09 13:05:16 -04:00
Josh Matthews
56ff8f41e0 layout2020: Don't create stacking contexts for empty fragments and boxes. 2020-06-09 11:30:17 -04:00
Anthony Ramine
e975d24c4b Store abspos boxes in a RefCell too
We want to mutate them when lazily computing their content sizes, but they
are behind an Arc for the hoisting infra, so it also needs its own layer
of inner mutability.
2020-06-09 15:13:18 +02:00
Anthony Ramine
d9e87f2eb1 Mutably borrow to do layout of independent formatting contexts
We want to compute content sizes on demand rather than eagerly so we will
need to mutate the independent formatting contexts that own the content sizes.
2020-06-09 13:44:43 +02:00
Martin Robinson
89855afa4d layout_2020: Tag fragments with their pseudo content type
This will allow us to answer queries and properly handle animations in
the future for fragments generated for pseudo content.
2020-06-06 17:25:08 +02:00
Simon Sapin
b9069d48d9 Parallelize flex item boxes construction 2020-06-04 13:19:53 +02:00
Simon Sapin
fff5cd5142 Owned ServoArc<ComputedValues> in TraversalHandler 2020-06-04 13:19:53 +02:00
Simon Sapin
29005e1626 Keep flex items in order-modified document order in the box tree 2020-06-04 13:19:53 +02:00
Simon Sapin
67d8aa84d2 Anonymous flex item for text directly in a flex container 2020-06-04 13:19:53 +02:00
Simon Sapin
ec548e849c Flex items in the box tree 2020-06-04 13:19:53 +02:00
Simon Sapin
64124f7a5e Layout 2020 skeleton for display: flex, behind a pref 2020-06-04 13:09:57 +02:00
Anthony Ramine
a30bdc16dd Reconstruct the box tree incrementally in some case 2020-06-04 10:49:45 +02:00
Simon Sapin
d4227b5b0d Remove some unused dependency declarations
This is based on compiling with `RUSTFLAGS="-W unused_crate_dependencies"` (CC https://github.com/rust-lang/rust/pull/72342) in a recent Nightly (more so than used in the tree as of this writing, CC https://github.com/servo/servo/issues/26661 for work-arounds).

Only one crate is actually removed from the dependency graph, others are still dependended from other places.
2020-05-29 00:04:34 +02:00
Josh Matthews
1da40b59af Remove use of nightly features in parking_lot. Update many uses from 0.9 to 0.10. 2020-05-26 09:34:50 -04:00
bors-servo
79b6758cb9
Auto merge of #26484 - servo:layout-2020-style-prep, r=SimonSapin
Implement concept of dirty root
2020-05-19 11:40:58 -04:00
Martin Robinson
a238597a18 layout_2020: Add support for transitions and animations 2020-05-19 10:02:03 +02:00
Anthony Ramine
f4c4af2bd4 Don't panic while already panicking in BoxSlot::drop 2020-05-18 10:23:45 +02:00
Martin Robinson
c2875482d6 layout_2020: Implement support for backface-visibility 2020-05-16 09:42:45 +02:00
bors-servo
7d7e987ba0
Auto merge of #26414 - servo:canvas-background2, r=mrobinson
Correctly paint the CSS canvas’ background

https://drafts.csswg.org/css-backgrounds/#special-backgrounds

Fixes https://github.com/servo/servo/issues/25559
Closes https://github.com/servo/servo/pull/26121, as it is an alternative.
Fixes https://github.com/servo/servo/issues/26444.
2020-05-15 10:20:23 -04:00
Simon Sapin
f53ac953d6 Fix incorrect sign background-image rectangle computation 2020-05-15 13:37:09 +02:00
Simon Sapin
1f6efbf9e9 Correctly paint the CSS canvas’ background
https://drafts.csswg.org/css-backgrounds/#special-backgrounds

Fixes https://github.com/servo/servo/issues/25559
Closes https://github.com/servo/servo/pull/26121, as it is an alternative.
2020-05-15 13:37:09 +02:00
Simon Sapin
c7acfc37ed Separate computing a WR reference frame from adding it to the display list 2020-05-15 13:25:35 +02:00
Simon Sapin
3e8623332b Rewrite handling of pointers to boxes in the DOM tree 2020-05-15 13:25:35 +02:00
Simon Sapin
c43ab0c267 Rename BoxTreeRoot/FragmentTreeRoot to BoxTree/FragmentTree 2020-05-15 13:25:35 +02:00
Simon Sapin
ee62c7f2e4 Set in the DOM the box generated by the root element 2020-05-15 13:25:35 +02:00
Simon Sapin
09dbf91e7b display: contents computes to block on the root element 2020-05-15 13:25:35 +02:00
Alex Touchet
d132866c5d
More Cargo.toml cleanups 2020-05-14 22:20:18 -07:00
bors-servo
ea4ae04655
Auto merge of #26335 - jdm:wrup, r=SimonSapin
Update webrender.
2020-05-12 14:56:19 -04:00
Josh Matthews
af05da574b Use new webrender rounded clip API. 2020-05-12 14:43:41 -04:00
Josh Matthews
eb2f7f7f0a Convert all uses of UpdateResources api to use webrender transactions. 2020-05-11 17:41:56 -04:00
Josh Matthews
8842250033 Update webrender. 2020-05-11 17:41:56 -04:00
bors-servo
aa9f16ce45
Auto merge of #26477 - mrobinson:layout-2020-get-computed-value, r=jdm
Add support for getComputedStyle() to layout_2020

These changes add support for `getComputedStyle()` to layout_2020.

---
<!-- 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] 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. -->
2020-05-11 15:57:25 -04:00
Martin Robinson
9c7b1ae715 layout_2020: Add initial support for getComputedStyle
This implementation is more-or-less on par with the one from layout_2013
and in some cases better. There are still some cases where we don't
return the correct "resolved value," but this is enough to test
animations and transitions.
2020-05-11 20:14:01 +02:00
Martin Robinson
a637810df3 layout_2020: Add support for transform-style
This requires creating a matching stacking context for every reference
frame and also properly placing those stacking contexts inside them.
2020-05-11 15:03:29 +02:00
Bastien Orivel
8249be38c9 Implement cross origin resource policy check
I removed the window getter usage from those tests as servo does not
support that yet.
2020-05-08 19:15:24 +02:00
Martin Robinson
b585ce5b1f Use a restyle for animation ticks
This change corrects synchronization issues with animations, by
reworking the animation processing model to do a quick restyle and
incremental layout when ticking animations.

While this change adds overhead to animation ticks, the idea is that
this will be the fallback when synchronous behavior is required to
fulfill specification requirements. In the optimistic case, many
animations could be updated and applied off-the-main-thread and then
resynchronized when style information is queried by script.

Fixes #13865.
2020-05-05 15:13:35 +02:00
bors-servo
c9480c8e07
Auto merge of #23661 - julientregoat:i-21289, r=jdm
Refactor ImageCache::find_image_or_metadata -> ImageCache::{get_image, track_image}

<!-- Please describe your changes on the following line: -->
Updated the `ImageCache` trait to replace `find_image_or_metadata` with two new functions `track_image` and `get_image`, as well as a new enum (`ImageCacheResult`).

As a result, I was able to refactor the functions that previously called `find_image_or_metadata` pretty cleanly. For a list of these functions, please see the commit information.

---
<!-- 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 #21289  (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because tests already exist for these components. I ran `cargo test` in `net`, `net_traits`, `layout`, and `script` successfully.

<!-- 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/23661)
<!-- Reviewable:end -->
2020-04-17 15:56:30 -04:00
Julien Tregoat
2742fd2bea Refactor ImageCache::find_image_or_metadata API. 2020-04-17 11:58:18 -04:00
Emilio Cobos Álvarez
848a6203de Some servo build fixes. 2020-04-16 18:29:30 +02:00
Simon Sapin
7f975c3d5d Remove use of some other unstable features 2020-04-15 15:17:52 +02:00
Anthony Ramine
c10e839924 Don't go through the layout thread to retrieve a node's primary style 2020-04-07 14:34:47 +02:00
Anthony Ramine
030a1cf8fb Replace OpaqueStyleAndLayoutData by StyleAndOpaqueLayoutData 2020-04-06 23:06:13 +02:00
Anthony Ramine
88d79fe46d Remove postorder traversal from layout 2020 during styling 2020-04-06 12:40:05 +02:00
Anthony Ramine
e3be136c9b Rename a bunch of style/layout data items
GetLayoutData::get_style_and_layout_data becomes
GetOpaqueStyleAndLayoutData::get_opaque_style_and_layout_data.

GetRawData::get_raw_data becomes GetStyleAndLayoutData::get_style_and_layout_data.

LayoutNode::init_style_and_layout_data becomes
LayoutNode::init_opaque_style_and_layout_data.

LayoutNode::take_style_and_layout_data becomes
LayoutNode::take_opaque_style_and_layout_data.
2020-04-06 12:39:52 +02:00