servo/components/layout
leo030303 93e5b672a7
layout: Fix bug where whitespace didn't have line decorations (#38007)
This PR fixes the issue where underlines weren't appearing on
whitespaces. This was due to whitespace being ignored in the `glyphs`
function of `components/layout/display_list/mod.rs` when the fragment
didn't have a selection. I added in a check to include the whitespace if
there's a selection or if there are any line decorations. I also renamed
the field from `ignore_whitespace` to `include_whitespace` to make it a
bit clearer since it was being reversed everywhere it was used anyway.

**Before:**
<img width="1235" height="169" alt="image"
src="https://github.com/user-attachments/assets/51d47781-355f-4915-8100-f3a7db81027f"
/>

**After:**
<img width="1235" height="169" alt="image"
src="https://github.com/user-attachments/assets/9b44fe77-d600-4080-9f3a-2c9b33924f51"
/>


Testing: `/css/css-text/white-space/pre-wrap-018.html` is now passing.
Also verified manually by running
`data:text/html;base64,PGRpdiBzdHlsZT0idGV4dC1kZWNvcmF0aW9uOiB1bmRlcmxpbmU7Ij5IZWxsbyBXb3JsZCE8L2Rpdj4=
`
Fixes: https://github.com/servo/servo/issues/33463

---------

Signed-off-by: Leo Ring <leoring03@gmail.com>
Signed-off-by: leo030303 <59373587+leo030303@users.noreply.github.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2025-07-13 13:34:51 +00:00
..
display_list layout: Fix bug where whitespace didn't have line decorations (#38007) 2025-07-13 13:34:51 +00:00
flexbox layout: Skip box tree construction when possible (#37957) 2025-07-09 17:33:09 +00:00
flow layout: Remove IndependentNonReplacedContents (#37971) 2025-07-10 07:46:04 +00:00
fragment_tree layout: Move BoxFragment's block-level info into a dedicated struct (#37938) 2025-07-09 15:04:57 +00:00
stylesheets script: Use an implemented pseudo-element to fortype=color ::color-swatch (#37427) 2025-07-09 15:36:58 +00:00
table layout: Remove IndependentNonReplacedContents (#37971) 2025-07-10 07:46:04 +00:00
taffy layout: Unify layout logic for replaced and non-replaced grid items (#37985) 2025-07-11 13:47:03 +00:00
tests layout: Combine layout_2020 and layout_thread_2020 into a crate called layout (#36613) 2025-04-19 10:17:03 +00:00
Cargo.toml layout: Store most anonymous pseudo-elements in box slots (#37941) 2025-07-08 15:22:09 +00:00
cell.rs layout: Combine layout_2020 and layout_thread_2020 into a crate called layout (#36613) 2025-04-19 10:17:03 +00:00
construct_modern.rs layout: Remove IndependentNonReplacedContents (#37971) 2025-07-10 07:46:04 +00:00
context.rs layout: Only create a LayoutContext if restyling (#37726) 2025-06-27 15:01:30 +00:00
dom.rs layout: Skip box tree construction when possible (#37957) 2025-07-09 17:33:09 +00:00
dom_traversal.rs layout: Store most anonymous pseudo-elements in box slots (#37941) 2025-07-08 15:22:09 +00:00
formatting_contexts.rs layout: Remove IndependentNonReplacedContents (#37971) 2025-07-10 07:46:04 +00:00
geom.rs layout: Unify layout logic for replaced and non-replaced floats&atomics (#37897) 2025-07-09 19:46:22 +00:00
layout_box_base.rs layout: Skip box tree construction when possible (#37957) 2025-07-09 17:33:09 +00:00
layout_impl.rs layout: Skip box tree construction when possible (#37957) 2025-07-09 17:33:09 +00:00
lib.rs layout: Move text decoration propagation to stacking context tree construction (#37069) 2025-05-21 16:38:29 +00:00
lists.rs Upgrade Stylo to 2025-06-03 (#37444) 2025-06-19 12:30:32 +00:00
positioned.rs layout: Unify layout logic for replaced and non-replaced abspos (#37943) 2025-07-09 08:44:27 +00:00
query.rs Rename script_layout_interface to layout_api (#37591) 2025-06-20 17:13:05 +00:00
quotes.rs layout: Combine layout_2020 and layout_thread_2020 into a crate called layout (#36613) 2025-04-19 10:17:03 +00:00
replaced.rs layout: Unify layout logic for replaced and non-replaced grid items (#37985) 2025-07-11 13:47:03 +00:00
sizing.rs layout: Fix block SizeConstraint for replaced elements (#37758) 2025-06-30 12:07:37 +00:00
style_ext.rs layout: Skip box tree construction when possible (#37957) 2025-07-09 17:33:09 +00:00
traversal.rs layout: Skip box tree construction when possible (#37957) 2025-07-09 17:33:09 +00:00