| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
This accomplishes two things:
1. Makes it easier to iterate through all inline formatting context
items.
2. Will make it possible to easily move back and forth through the tree
of inline boxes, in order to enable reordering and splitting inline
boxes on lines -- necessary for BiDi.
Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The main change here is that collapsed and `text-transform`'d text is
computed as it's processed by DOM traversal. This single transformed
text is stored in the root of the `InlineFormattingContext`.
This will eventually allow performing linebreaking and shaping of the
entire inline formatting context at once. Allowing for intelligent
processing of linebreaking and also shaping across elements. This
matches more closely what LayoutNG does.
This shouldn't have any (or negligable) behavioral changes, but will
allow us to prevent linebreaking inside of clusters in a followup
change.
Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While <https://drafts.csswg.org/css-lists/#list-style-position-property> says:
> The size or contents of the marker box may affect the height of the
> principal block box and/or the height of its first line box, and in some
> cases may cause the creation of a new line box; this interaction is also
> not defined.
All other browsers ensure that the first line of list item content is
the same block size as the marker. Doing this is complicated, but we can
ensure that the entire list item is at least as tall as the marker. This
should handle the majority of cases and we can make refinements later
for stranger situations, such as when the marker is very tall.
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change adds very basic support for `list-style-position`.
Currently, the marker does not do any kind of baseline alignment with
the rest
of the list item contents and it also doesn't force the list item to be
at least as tall as the marker.
This adds a few new failures:
- Four failures because markers do not ensure that list-items have at
least the same block size as they do:
- FAIL [expected PASS] /css/CSS2/lists/list-style-applies-to-012.xht
- FAIL [expected PASS] /css/CSS2/lists/list-style-applies-to-014.xht
- FAIL [expected PASS]
/css/CSS2/lists/list-style-type-applies-to-012.xht
- FAIL [expected PASS]
/css/CSS2/lists/list-style-type-applies-to-014.xht
- One failure because we don't yet support the `::marker`
pseudo-selector:
- FAIL [expected PASS]
/css/css-position/position-absolute-dynamic-list-marker.html
- One failure because we don't support the list item exception for the
line height quirk:
- FAIL [expected PASS] /quirks/line-height-in-list-item.tentative.html
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
<!-- Please describe your changes on the following line: -->
Fixes #27383.
---
<!-- 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] These changes fix #27383.
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___
<!-- 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. -->
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
| |
This avoids inserting it outside of its parent.
|
|
|
|
| |
So that the table appears after preceding inline-level contents.
Fixes #31603.
|
|
|
|
|
| |
* clippy: fix warnings in components/layout_2020
* fix: review comments
|
|
|
|
|
|
|
| |
This doesn't really have observable behavior right now, as much as I
tried to trigger some kind of bug. On the other hand, it's just wrong
and is very obvious when you dump the Fragment tree. If you create a
`display: table-cell` that is a child of the `<body>` all parts of the
anonymous table are flagged as if they are the `<body>` element.
|
|
|
|
|
|
|
|
| |
This moves white space collapse to right before breaking and shaping
happens, which is more similar to what happens in legacy layout. This is
the first step toward making this procedure more efficient (avoiding
string copies) and also implementing support for `text-transform`.
Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
|
|
|
|
|
|
|
| |
This adds an initial implementation of font fallback, on part with the
one used in legacy layout. There are still issues. For instance, font
matching is done per unicode character rather than based on graphemes or
the shape first approach of Chrome. The idea is that these changes can
be made later.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Shape text during InlineFormattingContext construction rather than doing
it twice during fragment tree construction. This is a step on the way
toward proper font fallback.
This also moves all `TextRun` related code into `text_run.rs` to try to
trim down the size of `inline.rs`.
<!-- 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
- [x] These changes do not require tests because this should only have
performance impacts.
<!-- 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. -->
|
|
|
| |
cargo clippy --fix -p layout_2020 --allow-dirty --broken-code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds support for fixing up tables so that internal table elements
that are not properly parented in the DOM have the correct box tree
structure according to the CSS Table specification [1]. Note that this
only comes into play when building the DOM via script, as HTML 5 has its
own table fixups that mean that the box tree construction fixups here
are not necessary.
There are no tests for this change. In general, it's hard to write tests
against the shape of the box tree, because it depends on the DOM. We
plan to test this via WPT tests once layout is complete.
1. https://drafts.csswg.org/css-tables/#table-internal-element
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the first part of constructing the box tree for table layout. No
layout is actually done and the construction of tables is now hidden
behind a flag (in order to not regress WPT). Notably, this does not
handle anonymous table part construction, when the DOM does not reflect
a fully-formed table. That's part two.
Progress toward #27459.
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Manish Goregaokar <manishsmail@gmail.com>
|
|
|
|
|
|
|
|
|
| |
Flattening the LineItem tree into a token stream will allow for handling
the case where an unbreakable line segment spans multiple inline boxes
which might have different hierarchies. This change also fixes the
handling of the second anonymous fragment of a block-in-inline-split.
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In legacy layout, anonymous text wrappers were inheriting the `overflow`
and `text-overflow` properties. This results in the creation of extra
clipping for these anonymous wrappers which could clip away floats. We
will likely implement `text-overflow` differently in non-legacy layout.
This change marks all legacy layout pseudo elements as "legacy" and also
adds a new pseudo element for non-legacy layout that does not inherit
`overflow`.
Fixes #30562.
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
| |
* strict imports formatting
* Reformat all imports
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
|
|
|
|
|
|
|
|
| |
Remove rayon_croissant and refactor the way that information about
floats in flows bubbles up. This simplifies the code a good deal and
lets us take advantage of some more optimized functions provided by
rayon. This removes 2 crates from the dependency tree.
In addition, this allows avoiding passing `contains_floats` up from
every box tree construction function. This makes things simpler, but
also opens up the possibility of passing more of these flags up in the
future (such as `contains_counters`).
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
During layout it is often useful, for various specification reasons, to
know if an element is the `<body>` element of an `<html>` element root. There
are a couple places where a brittle heuristic is used to detect `<body>`
elements. This information is going to be even more important to
properly handle `<html>` elements that inherit their overflow property from
their `<body>` children.
Implementing this properly requires updating the DOM wrapper interface.
This check does reach up to the parent of thread-safe nodes, but this is
essentially the same kind of operation that `parent_style()` does, so is
ostensibly safe.
This change should not change any behavior and is just a preparation
step for properly handle `<body>` overflow.
|
|
|
|
|
|
| |
It was only applied to the 1st inline formatting context of a block
container. Other IFCs were created with the Default trait, implying
TextDecorationLine::NONE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Existing WPT now passing:
- _mozilla/css/text_indent_a.html
- css/CSS2/css1/c71-fwd-parsing-002.xht
- css/CSS2/css1/c71-fwd-parsing-004.xht
- css/CSS2/floats-clear/floats-138.xht
- css/CSS2/text/text-indent-007.xht
- css/CSS2/text/text-indent-008.xht
- css/CSS2/text/text-indent-010.xht
- css/CSS2/text/text-indent-019.xht
- css/CSS2/text/text-indent-020.xht
- css/CSS2/text/text-indent-031.xht
- css/CSS2/text/text-indent-032.xht
- css/CSS2/text/text-indent-043.xht
- css/CSS2/text/text-indent-044.xht
- css/CSS2/text/text-indent-055.xht
- css/CSS2/text/text-indent-056.xht
- css/CSS2/text/text-indent-067.xht
- css/CSS2/text/text-indent-068.xht
- css/CSS2/text/text-indent-079.xht
- css/CSS2/text/text-indent-080.xht
- css/CSS2/text/text-indent-091.xht
- css/CSS2/text/text-indent-092.xht
- css/CSS2/text/text-indent-103.xht
- css/CSS2/text/text-indent-104.xht
- css/CSS2/text/text-indent-112.xht
- css/CSS2/text/text-indent-113.xht
- css/CSS2/text/text-indent-115.xht
- css/CSS2/text/text-indent-applies-to-002.xht
- css/CSS2/text/text-indent-applies-to-003.xht
- css/CSS2/text/text-indent-applies-to-005.xht
- css/CSS2/text/text-indent-applies-to-006.xht
- css/CSS2/text/text-indent-applies-to-007.xht
- css/CSS2/text/text-indent-applies-to-008.xht
- css/CSS2/text/text-indent-applies-to-009.xht
- css/CSS2/text/text-indent-applies-to-010.xht
- css/CSS2/text/text-indent-applies-to-011.xht
- css/CSS2/text/text-indent-applies-to-014.xht
- css/CSS2/text/text-indent-applies-to-015.xht
- css/CSS2/text/text-indent-inherited-001.xht
- css/CSS2/text/text-indent-overflow-001.xht
- css/CSS2/text/text-indent-overflow-002.xht
- css/CSS2/text/text-indent-overflow-003.xht
- css/CSS2/text/text-indent-overflow-004.xht
- css/CSS2/text/text-indent-wrap-001.xht
- css/css-text-decor/text-shadow/textindent.html
- css/css-text/text-indent/text-indent-percentage-001.xht
- css/css-text/text-indent/text-indent-percentage-002.html
- css/css-text/text-indent/text-indent-percentage-003.html
- css/css-text/text-indent/text-indent-percentage-004.html
- css/css-values/minmax-length-percent-serialize.html
- css/css-values/minmax-length-serialize.html
Also improvements in:
- _mozilla/mozilla/calc.html
- css/css-text/animations/text-indent-interpolation.html
- css/css-text/inheritance.html
- css/css-text/parsing/text-indent-computed.html
- css/css-text/parsing/text-indent-valid.html
- css/css-transitions/properties-value-implicit-001.html
- css/css-values/animations/calc-interpolation.html
- css/css-values/minmax-percentage-serialize.html
- css/css-values/viewport-units-css2-001.html
- css/css-variables/variable-substitution-basic.html
- css/cssom/serialize-values.html
Existing WPT now failing, due to lack of direction, outside list markers,
flex and grid:
- css/CSS2/text/text-indent-rtl-001.xht
- css/CSS2/text/text-indent-rtl-002.xht
- css/css-pseudo/marker-content-023.html
- css/css-text/text-indent/anonymous-flex-item-001.html
- css/css-text/text-indent/anonymous-grid-item-001.html
New WPT tests:
- css/css-text/text-indent/text-indent-length-001.html
- css/css-text/text-indent/text-indent-length-002.html
This one fails in layout-2013.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
They now take a closure that will compute the content sizes on demand.
|
|
|
|
|
|
|
|
| |
… and converting them to flow-relative geometric values.
These values are almost always used to size and position a fragment within its containing block, so using the mode of the containing block seems more correct.
Note that the `writing-mode` and `direction` properties are disabled in Servo at the moment, so this PR by itself should have no effect: the writing mode of an element is always the same of that of its containing block since they’re both horizontal rtl.
|
|
|
|
|
|
| |
We want to mutate them when lazily computing their content sizes, but they
are behind an Arc for the hoisting infra, so it also needs its own layer
of inner mutability.
|
|
|
|
|
| |
This will allow us to answer queries and properly handle animations in
the future for fragments generated for pseudo content.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
issues
|
| |
|
| |
|
| |
|
|
|
|
| |
We now pass the Node as an argument during DOM traversal in layout.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
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”
|
| |
|
| |
|