Commit graph

92 commits

Author SHA1 Message Date
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
Martin Robinson
c20c468814 Rename AbsolutelyPositionedBox::layout to AbsolutelyPositionedBox::to_hoisted
This method doesn't actually do any layout, but converts this block to a
HoistedAbsolutelyPositionedBox which is hoisted and then laid-out with
its containing block later. This makes the code a little easier to read.
2020-02-28 14:42:29 +01:00
Fernando Jiménez Moreno
48a4c07246 Properly position atomic inline level boxes 2020-02-27 17:14:18 +01:00
Fernando Jiménez Moreno
c4276aa27e Fix rebase issues and run Prettier on layout viewer code 2020-02-21 11:11: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
67706f9c0b Add fragment debug id 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
Emilio Cobos Álvarez
1754c832d8
layout_2020: Avoid decomposing mixed length / percentages in intrinsic sizing.
As that makes no sense in presence of min / max.
2020-02-12 02:43:23 +01:00
Emilio Cobos Álvarez
f03026b869
layout: Resolve word_spacing ahead of time.
It's not possible anymore, in the presence of min() / max(), to split a
<length-percentage> value into a <length> and a <percentage> component.

Tweak word_spacing to do what Gecko does (resolving it in advance).
2020-02-12 02:43:23 +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
Anthony Ramine
b2f6cc7144 Introduce BlockLevelJob 2019-12-13 17:51:06 +01:00
Simon Sapin
6f3c5ce773 Rename BlockLevelKind to NonReplacedContents 2019-12-13 13:59:15 +01:00
Simon Sapin
58b7005a9b Make for_maybe_position_relative take care of relative adjustment. 2019-12-13 13:13:50 +01:00
Simon Sapin
04b701b9e0 Move call to for_maybe_position_relative out of layout_in_flow_non_replaced_block_level 2019-12-13 12:41:58 +01:00
Simon Sapin
672d971d58 Regroup branches specific to SameFormattingContextBlock 2019-12-13 12:33:07 +01:00
Simon Sapin
c0962aa3fc Replace the closure in layout_in_flow_non_replaced_block_level with an enum 2019-12-13 12:09:51 +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
1c8d14ac0d Upgrade rayon_croissant to 0.2.0 2019-12-12 18:57:18 +01:00
Simon Sapin
9edda952c9 Make adjust_static_positions a method of PositioningContext 2019-12-12 15:43:50 +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
53ce714005 Fix a “Accessing content size that was not requested” panic
Percentage `width` are treated as `auto` for the purpose of
min/max-content computation, so they also need to be considered
when testing “wether width is auto”
2019-12-10 15:11:53 +01:00
Simon Sapin
f09c14aa6b impl From<&'_ DefiniteContainingBlock> for ContainingBlock 2019-12-10 15:11:53 +01:00
Simon Sapin
14ddf39215 Rename ReplacedContent::used_size to used_size_as_if_inline_element 2019-12-10 15:11:53 +01:00
Simon Sapin
b73eb49a58 Add sizing of inline replaced boxes 2019-12-10 12:36:43 +01:00
Simon Sapin
c40583b644 Move replaced box used size computation to a method of ReplacedContents 2019-12-10 12:36:43 +01:00
Simon Sapin
bf96988260 Add min/max-width/height support for inline-block
(… and other non-replaced atomic inline-level boxes.)
2019-12-10 12:36:43 +01:00
Simon Sapin
ce7e84be72 Replace percent_resolved_* functions with methods 2019-12-10 12:36:43 +01:00
Simon Sapin
a2c2b294d5 Move clamp_* functions to methods of Length 2019-12-10 12:36:43 +01:00
Simon Sapin
9f4b1a0f14 Implement text-align (except justify) 2019-12-07 14:31:45 +01:00
Simon Sapin
6d91d77fba Rename content_rect to rect in TextFragment and ImageFragment
Since they don’t have padding etc.
2019-12-07 14:25:16 +01:00
Simon Sapin
ce9fc3e651 Rename LineBoxes to Lines, since it contains fragments 2019-12-07 14:25:16 +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
bors-servo
e70397d90a
Auto merge of #25033 - servo:intrinsic, r=nox
Add support for inline-block and for computing min/max-content
2019-12-04 16:23:33 -05:00