Repository navigation
Conversation
Contributor
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
- Update Parley: span edges are placed in visual order and a span split by bidi reordering has a fragment per visual piece; preserved hanging whitespace stays part of the fragment; empty spans stay on the line of the preceding content. - Resolve calc() with a percentage against zero when there is no basis. - Don't let the missing side of a wrapped span limit the border radii. - Empty inline elements in an inline root with no line boxes have no height. - scrollIntoView uses the fragment bounding box for non-atomic inlines. - Don't depend on where the font wraps in the wrapped border test.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Margin, border and padding on ordinary inline elements (
<span style="padding: 2px 8px; border: 1px solid">) now take up inline space, wrap like they do in browsers, and are painted. Previously they were ignored: such elements only got abackground-colorrect per glyph run.Depends on DioxusLabs/parley#83 (
TextStyle::inline_start/inline_end,Line::span_fragments(),Layout::span_edges_mut()). Theparleydependency temporarily points at that branch (DioxusLabs/parley@e6c2e55) and needs repointing before merge.Spans stay non-atomic style spans (
push_style_span/pop_style_span); nothing is converted to an inline box.How it works
construct.rs): a span whose inline-axis margin + border + padding can be non-zero is pushed with placeholder edges, so that Parley creates edge items for it. The real sizes are not known yet (percentages).inline.rs): next to the existinginline_boxes_mut()loop, each edge is resolved and written throughspan_edges_mut():layout/inline_span.rs):BaseDocument::inline_span_fragments(inline_root)turns Parley's per-line span fragments into border boxes (InlineSpanFragment), adding the vertical padding/border and dropping the left/right side on lines where that side of the box is absent (box-decoration-break: slice).blitz-paint):draw_inline_backgrounds(per glyph run, background colour only) is replaced bydraw_inline_span_boxes, which runs the normaldraw_background+draw_borderon each fragment. Inline elements therefore also get background images, border radii etc.inline_fragment_rects(getClientRectsfor inline elements) is built from the same fragments.An inline root that contains only an empty span with inline edges now generates a line, as in browsers.
Behaviour changes to existing output
pre-wrap, is still included).scrollIntoViewon a non-atomic inline uses the bounding box of its fragments.Comparison with Chrome
Chrome 137 on the left, this branch on the right, for a set of probe cases (
font: 20px/30px monospace, 120px wide containers,padding: 0 20pxon the spans):getClientRects()for the spans in 15 probe cases match Chrome exactly in 12. The differences:aaa <span>bbb </span>ccccc). Chrome hangs the space and lets the end edge overflow the line by 4px. Here the end edge keeps the space before it from hanging, so the span is moved to the next line and is one space wider. Not verified against Firefox.box-decoration-break: cloneis not implemented (treated asslice).Known limitations
directionis used for every span: edges are placed in visual order in the root's direction, and a span split by bidi reordering gets one box per visual piece. A span whose owndirectiondiffers from the root's gets its start/end sides swapped (WPTltr-span-only,rtl-span-only); fixing that needs a per-span direction in Parley.outlineis not painted on non-atomic inlines (it was not before either).WPT
Compared with
main, 131 tests newly pass and 49 newly fail. The newly failing ones, none of which pass for the right reason onmain:text-autospace-*(17), vertical writing modes (line-box-height-v*,inline-box-border-vlr-001,border-slice-001; 16), ruby (2),clip-pathon inlines (3),box-decoration-break: clone,::first-letterbackgrounds, multicol (area-002),hanging-punctuation,text-align-last: justifyon a line with only an empty inline,outlineon inlines (empty-span-size-002).direction(2):ltr-span-only,rtl-span-only.inherit-computed-001(the border of an empty<em>is now painted, andborder: inheritgives it the wrong colour),background-attachment-fixed-inline-scrolled(fixed background of a scrolled inline is 8px off).word-break-normal-hi-000fails on CI only (it passes locally); it depends on the Devanagari font fitting four words in 390px, and probably passed before only becauseoffsetWidthincluded the hanging space.Testing
New
tests/blitz-tests/tests/inline_span_pbm.rs(16 tests): inline-axis space, no effect of vertical PBM on line height, wrapped start/end sides, edges not separable from adjacent content, empty spans, percentages, RTL side mapping, logical properties, and painted background/border pixels including wrapped fragments; pluscalc()percentages in intrinsically sized blocks, empty spans (line placement, zero height in an empty block), preserved trailing whitespace, and a span split by bidi reordering.Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/38d20c11138046c5a04fb2aa400e7033
Open in Devin Desktop: https://dioxus.staging.devinenterprise.com/desktop/session/38d20c11138046c5a04fb2aa400e7033?variant=devin-insiders
Requested by: @nicoburns
WPT results
Subtests: 148 newly passing, 54 newly failing (net +94).
Full diff (183 changed tests)
Generated by the WPT workflow.