Commit graph

65 commits

Author SHA1 Message Date
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
ec548e849c Flex items in the box tree 2020-06-04 13:19:53 +02:00
Anthony Ramine
a30bdc16dd Reconstruct the box tree incrementally in some case 2020-06-04 10:49:45 +02:00
Martin Robinson
a238597a18 layout_2020: Add support for transitions and animations 2020-05-19 10:02:03 +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
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
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
bors-servo
15d8c6058b
Auto merge of #26048 - nox:layout-2020-transparent-data, r=jdm
Give a lifetime parameter to LayoutDom
2020-03-28 13:37:31 -04:00
Martin Robinson
19f4b708b3 layout_2020: Use ArcRefCell to track hoisted fragments
This avoids the use of lookup tables for containing blocks when
constructing the stacking context tree.

This seems to catch some laid-out hoisted fragments that were otherwise
dropped in the previous design. The changes cause one new test to pass
and one to fail. Visual examination of the failing tests reveals that
it's a progression (list markers are appearing when they were previously
not rendered).
2020-03-27 13:02:22 +01:00
bors-servo
4dbe3b30cd
Auto merge of #26037 - mrobinson:arcrefcell-fragment-tree, r=SimonSapin
layout_2020: Use ArcRefCell in the fragment tree

This will allow mutability which is useful for things like animations.

<!-- 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. -->
2020-03-26 10:23:23 -04:00
Anthony Ramine
04af32128c Add a 'dom lifetime to GetLayoutData 2020-03-26 13:17:46 +01:00
Martin Robinson
7cb0069be5 layout_2020: Use ArcRefCell in the fragment tree
This will allow mutability which is useful for things like animations.
2020-03-25 17:57:17 +01:00
bors-servo
acd14672e1
Auto merge of #25888 - ferjm:text.decoration.2020, r=nox
Partial text decoration support for layout 2020

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #25166
- [X] There are tests for these changes
2020-03-23 11:18:18 -04:00
Fernando Jiménez Moreno
17948f3b39 Propagate text decoration where needed 2020-03-23 11:13:10 +01:00
Martin Robinson
811c08c5a5 layout_2020: Use the containing block more when calculating scrolling overflow
When calculating scrolling overflow calculation we cannot currently use
the actual containing block in all cases. This change increases the
amount that we do use the containing block.
2020-03-23 10:08:04 +01:00
Patrick Walton
9cb824e77c Wrap BlockLevelBox and InlineLevelBox with AtomicRefCell 2020-03-17 11:15:17 -07:00
Anthony Ramine
c3932185ec Make AbsolutelyPositionedBox be 'static 2020-03-17 11:15:17 -07:00
Martin Robinson
c3b1c92ac1 layout_2020: Paint hoisted positioned fragments in tree order
Instead of painting hoisted position fragments in the order to which
they are hoisted, paint them in tree order and properly incorporate them
into the stacking context.

We do this by creating a placeholder fragment in the original tree position
of hoisted fragments. The ghost fragment contains an atomic id which
links back to the hoisted fragment in the containing block.

While building the stacking context, we keep track of containing blocks
and their children. When encountering a placeholder fragment we look at
the containing block's hoisted children in order to properly paint the
hoisted fragment.

One notable design modification in this change is that hoisted fragments
no longer need an AnonymousFragment as their parent. Instead they are
now direct children of the fragment that establishes their containing block.
2020-03-11 12:47:06 +01:00
Martin Robinson
8de55695e4 Have transforms and filters be CBs for all descendants in layout_2020
This is a feature that was never properly implemented in the previous
layout system. We still need to preserve their in-tree order in the
display list though.
2020-03-02 11:47:00 +01:00
Fernando Jiménez Moreno
a042f85083 Dump box tree state into json files and display it on layout 2020 viewer 2020-02-21 11:11:00 +01:00
Fernando Jiménez Moreno
5cbe05366b Add layout debugger support to layout_2020 2020-02-21 11:11:00 +01:00
Martin Robinson
d03560b0f1 Add layout_2020 support for filters and mix-blend-mode 2020-02-19 10:26:13 +01:00
Martin Robinson
9517190a60 Split stacking context fragments into sections in layout_2020
This allows rendering stacking context content in the proper order. We
also need to add a new pseudo stacking context for atomic inlines in
order to preserve proper rendering order in some cases.
2020-02-17 14:10:03 +01:00
Martin Robinson
4a2787b974 Add initial stacking context paint order support to layout_2020
This adds very rudimentary support for paint order in stacking context.
In particular z-index is now handled properly, apart from issues with
hoisted fragments.
2020-02-17 10:05:19 +01:00
Martin Robinson
843df5b529 Add support for a stacking context pass to layout_2020
This adds an intermediary data structure that allows the display list
builder to move through the fragment tree in stacking context painting
order. Spatial nodes are built during this phase and all display list
items are added to the end of the display list.
2020-02-14 10:57:45 +01:00
Simon Sapin
53d5e29c7b Replace iterate_through_fragments with a callback returning bool with find / Option<T> 2020-02-11 14:02:22 +01:00
Simon Sapin
d353e08529 Deduplicate the loop in iterate_through_fragments 2020-02-11 14:02:22 +01:00
Simon Sapin
ef8c51c4b1 Exit iterate_through_fragments through all recursion levels when the callback says so 2020-02-11 14:02:22 +01:00
Martin Robinson
fa7839270d Add layout_2020 support for NodeGeometryQuery and ContentBoxQuery 2020-02-11 14:02:19 +01:00
Martin Robinson
02deb99a05 Use euclid data types for physical structs in layout_2020
This removes a bit of duplication and allows layout_2020 to benefit from
a much richer set of utilities.
2020-01-23 15:39:32 +01:00
Martin Robinson
1cd772fe5f Answer content box queries for layout_2020 for the root element
This isn't correct yet, but it is necessary to give a value in order for
scrolling from script to work. Later this should give an accurate
content box response as well as work for non-root elements.
2020-01-21 15:29:23 +01:00
Martin Robinson
8825d588c1 Add initial support for scrollable overflow in layout_2020
This still isn't totally correct and non-root scrolling is not handled
at all, but the root frame now scrolls.
2020-01-21 15:29:23 +01:00
Martin Robinson
ea8c635344 Allow dumping the fragment tree in layout_2020
This is done when the dump-flow-tree debug option is passed.
2020-01-13 13:12:52 +01:00
Simon Sapin
53fc6143dc Use the is_contentful field of DisplayListBuilder 2020-01-09 15:21:58 +01:00
Anthony Ramine
abc2c15c28 Store an OpaqueNode in boxes and fragments 2019-12-13 17:59:27 +01:00
Anthony Ramine
47944a39fc Remove the Node type parameter from Contents
We now pass the Node as an argument during DOM traversal in layout.
2019-12-13 17:51:06 +01:00
Simon Sapin
5ebddf19e6 Layout position: fixed in the initial containing block 2019-12-12 22:50:11 +01:00
Simon Sapin
c44ee516a1 Give PositioningContext more responsibilities
Iits details are now private to the module.

It has a couple methods that take closures to make sure that "before" and "after" steps are done together:

* In an absolutely positioned box, take care of nested abspos (establish a new containing block, etc.)
* For a box that *might* be `position: relative`, optionally take care of the same.
2019-12-12 22:50:11 +01:00
Simon Sapin
b43a3de51d Introduce PositioningContext 2019-12-12 15:37:01 +01:00
Simon Sapin
c895e3d236 Disable use of rayon with --layout-threads 1 instead of panicking 2019-12-10 18:41:24 +01:00
Simon Sapin
f09c14aa6b impl From<&'_ DefiniteContainingBlock> for ContainingBlock 2019-12-10 15:11:53 +01:00
Simon Sapin
fa1adf2ad3 Containing blocks contains styles rather than just a writing mode 2019-12-07 14:25:16 +01:00
Simon Sapin
40ad9a722d Use the WritingMode bitflags from Stylo 2019-12-07 12:45:36 +01:00
Simon Sapin
38e8fd1e99 Replace boolean parameters by a new ContentSizesRequest enum 2019-12-04 15:10:11 +01:00
Simon Sapin
cfdd23ac16 Add a request_content_sizes parameter to IndependentFormattingContext::construct 2019-12-03 15:11:35 +01:00