Commit graph

1854 commits

Author SHA1 Message Date
Martin Robinson
59f5414ca8
Split line layout into two phases (#30089)
In the first phase, we gather LineItems and then when we have enough to
form a line we turn them into Fragments. This will make it possible to
more simply implement `vertical-align` and `text-align: justify` because
we need to measure the different aspects of the candidate line and then
produce a Fragments.

This is a general refactor of the way that inline layout works, so comes
with some progressions. In addition there are some new failures.

New failures:

Some tests are now failing because only the test or reference is getting
proper line height when it wasn't before. These should be fixed in a
followup change that properly calculate line-height in more cases:

 - /_mozilla/css/list_style_position_a.html
 - /css/CSS2/floats/float-no-content-beside-001.html
 - /css/css-content/pseudo-element-inline-box.html
 - /css/css-flexbox/flexbox_flex-none-wrappable-content.html

Some tests are now failing because floats are now placed properly, but
are no longer in their inline box stacking contexts. These will be fixed
by a followup change which properly parents them:

- /css/filter-effects/filtered-inline-applies-to-float.html.ini
- /css/css-color/inline-opacity-float-child.html.ini

One test is failing due to floating point precision errors:

- /css/CSS2/floats-clear/floats-141.xht.ini

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2023-08-11 07:19:50 +00:00
Oriol Brufau
8dceb8e412
Handle inline margins when avoiding floats (#30072) 2023-08-09 21:19:16 +00:00
Oriol Brufau
ab0f48f8e8
Handle BFC roots with auto width next to floats (#30057)
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-08-08 11:46:36 +00:00
Atbrakhi
2b67392fd5
Add initial support for css-text-3 whitespace handling (#29828)
* Add initial support for css-text-3 whitespace handling

This adds initial support for whitespace handling from the CSS
specification for Layout 2020. In general, the basics are covered. Since
test output is very sensitive to whitespace handling, this change
incorporates several fixes:

1. Whitespace is collapsed according to the Phase 1 rules of the
   specification, though language-specific unbreaking rules are not
   handled properly yet.
2. Whitespace is mostly trimmed and positioned according to the Phase 2
   rules, but full support for removing whitespace at the end of lines
   is pending on a temporary data structure to hold lines under
   construction.
3. Completely empty box fragments left over immediately after line
   breaks are now trimmed from the fragment tree.
4. This change tries to detect when an inline formatting context
   collapses through.

Fixes #29994.

Co-authored-by: Mukilan Thiyagarajan <me@mukilan.in>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>

* Update test results

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <me@mukilan.in>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-07-20 18:34:31 +00:00
Martin Robinson
d31cdb682f
Make the choice of layout runtime setting
Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
2023-07-06 14:49:24 +02:00
WPT Sync Bot
e594552299 Update web-platform-tests to revision b'f513c41310ebb13de9a0c5ea5e1c22544e0b5000' 2023-07-02 01:24:53 +00:00
bors-servo
3f7e5b15f8
Auto merge of #29850 - servo:css-viewport-removal, r=mrobinson
CSS viewport removal

It was removed from the spec and it's disabled everywhere.

This also removes the meta viewport support (which was implemented on top), but that also had a single test and is disabled everywhere, so I'm not too concerned, it can be implemented again if / when needed.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26349
- [x] There are tests for these changes
2023-06-30 20:54:11 +02:00
Emilio Cobos Álvarez
349edff768
It was removed from the spec and it's disabled everywhere.
This also removes the meta viewport support (which was implemented on top), but that also had a single test and is disabled everywhere, so I'm not too concerned, it can be implemented again if / when needed.
2023-06-30 16:28:21 +02:00
Pu Xingyu
65445ad742 Update test expectations 2023-06-30 10:40:33 +08:00
Oriol Brufau
e38083a96e Increase BFC root height to contain floats 2023-06-26 01:00:00 +02:00
WPT Sync Bot
209b7ad36b Update web-platform-tests to revision b'7b682ab07397d72fceb6594d0f27cb36cf1d8ee3' 2023-06-25 01:32:25 +00:00
Martin Robinson
f4578afdfe
Rename metadata directories
This renames:
 - `tests/wpt/metadata` → `tests/wpt/meta-legacy-layout`
 - `tests/wpt/metadata-layout-2020` → `tests/wpt/meta`
 - `tests/wpt/mozilla/meta` → `tests/wpt/mozilla/meta-legacy-layout`
 - `tests/wpt/mozilla/meta-layout-2020` → `tests/wpt/mozilla/meta`
2023-06-22 21:15:41 +02:00
Martin Robinson
30ab348116 Properly position absolutes with static insets that are children of floats
Previously, final float positions were calculated when their parents
were positioned. This prevented proper positioning of absolute children
of floats with static insets, because they accumulate offsets as they
are hoisted up the tree.

This change moves the final float positioning to
`PlacementState::place_fragment` for the float itself so that it happens
before any insets are updated for hoisted descendants. In addition to
simplifying the code, this makes it a bit more efficient. Finally,
floats are taken into account when updating static insets of hoisted
boxes.

Fixes #29826.
2023-06-22 01:55:21 +02:00
WPT Sync Bot
60a0a6bc0f Update web-platform-tests to revision b'b31eaacb964b5e159b841d9eb18aa12e1d37867a' 2023-06-18 01:22:12 +00:00
Oriol Brufau
05d697323d Update tests 2023-05-24 19:13:43 +02:00
WPT Sync Bot
f0bb7a6f9c Update web-platform-tests to revision b'02400d32d48521baa38663fe8601779994fcfb78' 2023-05-21 01:38:11 +00:00
WPT Sync Bot
06e9d5a631 Update web-platform-tests to revision b'c9946198c9ee19db3b4974a388fae45da844a94a' 2023-05-14 01:39:34 +00:00
Martin Robinson
edeb24b30f Fix scrolling on root element
eca0acf459 uncovered a bug in the way that
the scrolling area of `window` was calculated and broke scrolling on the
root element. This change does two things in order to fix that:

1. Does a partial revert of eca0acf459 in
   order to get scrolling from script working again on the window
   object.
2. Has the compositor always generate a frame for scrolls starting from
   script and waits for them. This is speculative fix for flakiness in
   root scrolling tests on CI.
2023-05-05 12:42:02 +02:00
WPT Sync Bot
44e249bebb Update web-platform-tests to revision b'797e75946c24d0625f04247b16d33c26d4ada273' 2023-04-30 01:30:40 +00:00
WPT Sync Bot
75286b8eab Update web-platform-tests to revision b'f0b66362cc5dec54d81e0a56458b48f310a2eba9' 2023-04-16 01:29:26 +00:00
WPT Sync Bot
b8f194326b Update web-platform-tests to revision b'a877a8f14afc4b3a1d438cd5a9bfd7cd029111b7' 2023-04-12 01:24:06 +00:00
bors-servo
59df8e3856
Auto merge of #29597 - servo:wpt_update_07-04-2023, r=mrobinson
Sync WPT with upstream (07-04-2023)

Automated downstream sync of changes from upstream as of 07-04-2023
[no-wpt-sync]
r? @servo-wpt-sync
2023-04-07 16:48:08 +02:00
Martin Robinson
2770b4c9bb Enable CSS position tests and add results
This also removes imported position: sticky tests from the Mozilla
directory. These were only supposed to be temporary until the upstream
version from WPT were imported.
2023-04-07 11:09:28 +02:00
WPT Sync Bot
bb34f95b33 Update web-platform-tests to revision b'1d9b01e2fad6af3a057d571b1e088e15fa9bc8e6' 2023-04-07 01:30:49 +00:00
WPT Sync Bot
7bf23c63b3 Update web-platform-tests to revision b'2703c75d5e889bb7c6a918de44841bf9de8d63a7' 2023-03-25 01:54:46 +00:00
WPT Sync Bot
90b96becef Update web-platform-tests to revision b'62c17eac9f99db2ea4e213328c9c6122136694cc' 2023-03-22 01:37:18 +00:00
WPT Sync Bot
4e30ee5e08 Update web-platform-tests to revision b'065cf84e9f00d1c11faf2a41e500a73ad6b95a48' 2023-03-21 01:40:05 +00:00
WPT Sync Bot
3b420af385 Update web-platform-tests to revision b'afdce893ed51bc1a7a7ac03b16b5a575caad071a' 2023-03-17 01:55:41 +00:00
WPT Sync Bot
2ebdfcea9d Update web-platform-tests to revision b'3ee7ccc2abbbc8d8f6efbb45f80bffdb3c0c76ba' 2023-03-11 01:46:58 +00:00
WPT Sync Bot
0431e20517 Update web-platform-tests to revision b'14684f837eba364df3de2b6683d4eb5385333158' 2023-03-08 02:09:14 +00:00
WPT Sync Bot
59944f9e42 Update web-platform-tests to revision b'e731a1368a9d3436487e0996ecfebbef5a58f485' 2023-03-06 01:45:09 +00:00
WPT Sync Bot
84de92ecaf Update web-platform-tests to revision b'2d1ad05908ee5447fdfa70eed9757273aa5da367' 2023-03-05 01:42:13 +00:00
WPT Sync Bot
e8bd8b22fa Update web-platform-tests to revision b'1393983442315fc6a96bacda5202036ca10327e3' 2023-03-03 03:18:30 +00:00
WPT Sync Bot
17f4d58879 Update web-platform-tests to revision b'3b791e5b10812a4ca4473d93679fc70d1a7f5f88' 2023-03-02 01:49:57 +00:00
WPT Sync Bot
d2eeed132b Update web-platform-tests to revision b'49287d0e660dd6704c508ef20c9d53c13aee296b' 2023-03-01 01:42:49 +00:00
WPT Sync Bot
6d6ac7bedf Update web-platform-tests to revision b'5b72ee9b50ae6898c94fe3ab50f4c68d4572977c' 2023-02-28 01:47:36 +00:00
WPT Sync Bot
632afc64ae Update web-platform-tests to revision b'c9f81de4242294a0d694ecd5a63155acfe6bf49a' 2023-02-25 01:52:07 +00:00
WPT Sync Bot
496ae4e174 Update web-platform-tests to revision b'b3615436df24bedfdc4f14f959428307a86f74ce' 2023-02-21 01:39:27 +00:00
WPT Sync Bot
489f4ac90d Update web-platform-tests to revision b'49819d78d44b87d5ebb076c5b005dcbfc630c24f' 2023-02-20 01:57:35 +00:00
WPT Sync Bot
5867b3554a Update web-platform-tests to revision b'96ef5777e50f7ed8f54b91525002d6708fc097d7' 2023-02-19 01:39:19 +00:00
WPT Sync Bot
812c6de70b Update web-platform-tests to revision b'45fdf45f79582953fb3aa708566cd2c0707cb222' 2023-02-18 01:43:43 +00:00
yvt
effd5a3107 fix(script): request animation ticks if Animations::pending_events is not empty
Fixes the test case `/_mozilla/css/css-transition-cancel-event
.html`, which was failing under a specific circumstance.

The observed sequence of events during the failing test run looks like
this:

1. Transitions start in `div1` and `div2`.

2. `div1` generates a `transitionend` event.

3. The `transitionend` event handler removes `div2` from DOM, cancelling
   its ongoing transition.

4. `div2` is supposed to generate a `transitioncancel` event in a timely
   manner, which it does not. The test fails as a result.

What is going on here? Here's a possible explaination:

1. During one invocation of `ScriptThread::handle_msgs`...

2. In step 2, `ScriptThread::update_animations_send_events` -> `Document
   ::update_for_new_timeline_value` detects the completion of the
   transition, and in response, pends the `transitionend` event.

3. In step 3, `ScriptThread::update_animations_send_events` ->
   `Animations::send_pending_events` calls the `transitionend` handler.

4. The `transitionend` event handler removes `div2`, thereby cancelling
   its ongoing transition and triggering a reflow.

5. Reflow takes place. During this, `Animations::do_post_reflow_update`
   -> `Animations::handle_canceled_animations` pends the
   `transitioncancel` event (precursor to step 4).

6. Having discovering that there was no running animation, `Animations::
   do_post_reflow_update` calls `self.update_running_animation_presence
   (_, false)`, which sends `AnimationState::NoAnimationsPresent`.

7. The invocation of `ScriptThread::handle_msgs` ends, and another
   starts. It blocks waiting for events.

8. Meanwhile, the compositor receives `AnimationState::
   NoAnimationsPresent` and stops further generation of animation ticks.

9. With no events to wake it up, the script thread is stuck waiting
   despite having the pending `transitioncancel` event (step 4).

The HTML specification [says][1] that "an event loop must continually
run [...] as long as it exists" and does not say it can block if there
is nothing to do. Blocking is merely optimization in a user agent
implementation. Pending animation-related events must be processed every
time a "rendering opportunity" arises unless the user agent has a reason
to believe that it "would have no visible effect".

Skipping the processing of animation-related events would have visible
effect if such events are indeed present. The correct implementation in
Servo, therefore, would be to request more animation ticks so that such
events are processed in a subsequent tick.

[1]: https://html.spec.whatwg.org/multipage/#event-loop-processing-model
2023-02-10 14:44:27 +01:00
WPT Sync Bot
ec63c43030 Update web-platform-tests to revision b'd1192ca239e944dc6cdbcd079e1c16227e08e30c' 2023-02-02 01:55:40 +00:00
WPT Sync Bot
879f987fc2 Update web-platform-tests to revision b'7b1babebddf2f0fdd866fa8b83b8621b86590fc9' 2023-01-29 01:42:28 +00:00
WPT Sync Bot
32cc2e03c4 Update web-platform-tests to revision b'544363de4568baf9ae90d71e4822661edc546650' 2023-01-28 01:52:20 +00:00
WPT Sync Bot
cda7a10498 Update web-platform-tests to revision b'89142292ab8c7f3564d978a76fdabc66626c421e' 2023-01-26 01:45:06 +00:00
WPT Sync Bot
a6bc3e1a73 Update web-platform-tests to revision b'704eebbe6af5b43643971e96e33a0c979fba2904' 2023-01-25 01:36:16 +00:00
WPT Sync Bot
02cb6d44e5 Update web-platform-tests to revision b'ece751218b0ba35e99fa900bfd2a2d89c4bb69da' 2023-01-22 01:42:09 +00:00
WPT Sync Bot
92be0baf34 Update web-platform-tests to revision b'8a99353217938b6f1da31a9a108da3d501cee58b' 2023-01-20 01:41:09 +00:00
WPT Sync Bot
1c6b303ef2 Update web-platform-tests to revision b'2d7c53f5bc604132d2c83955537e454ee9c788c0' 2023-01-18 01:48:18 +00:00