| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#30586)
After placing a float, FloatBox's layout_into_line_items() was calling
place_line_among_floats() with ifc.current_line.inline_position as the
width of needed by the contents of the line.
The problem is that this amount includes the trailing whitespace advance
and thus it could seem that the in-flow contents wouldn't fit next to
the float.
That's not the case, since collapsible whitespace at the end of the line
is removed, and preserved whitespace hangs.
So this patch subtracts ifc.current_line.trailing_whitespace_advance
when calling place_line_among_floats(), like it was already happening
when computing the available_inline_size.
Fixes #30561
|
|
|
|
| |
Instead of panicking when no found is found for a TextRun, instead print
a warning. This prevents panics on pages with very large font sizes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Improve the calculation of the block size of line boxes and all their
component elements. Even empty spans can increase the size of the line
based on their font-size. Elements that have a line-height should
increase the block size of the line, but that setting should not effect
their own size.
In addition to the new passes there are some new failures
Failing because a progression exposes the real issue these tests are
testing:
- css/css-color/t32-opacity-offscreen-multiple-boxes-1-c.xht
- css/css-color/t32-opacity-offscreen-multiple-boxes-2-c.xht
Likely failing because of vertical-align and another sizing issue:
- css/css-transforms/perspective-untransformable-no-stacking-context.html
Failing because a progression reveals another failure:
- html/rendering/non-replaced-elements/hidden-elements.html
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a box has overflow, any floats placed in that box will lower the
float ceiling into the overflow. If no float is placed in the box
though, the ceiling should be the block position where the overflow
starts. We already know where this is, because we might be passing a
negative value for the new block position after processing a box
(content_size - actual_size would be negative). This negative value
never raises the ceiling though since a maximum is used.
In the case that there is overflow, this change allows raising the
ceiling, but never passed the lowest float. This necessitates keeping
two values for the ceiling: one for floats and one for non-floats.
Fixes #30304.
|
|
|
|
|
|
|
|
|
|
|
| |
* Partially fix filter clipping
* Clean up the logic
* Update components/layout_2020/display_list/stacking_context.rs
---------
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Sort stacking contexts and stacking containers by painting order
* fix stealing of stacking containers; fix interleaving with fragments
* actually positioned stacking containers should be stolen too
* update expectations and clean up panic changes
* rework naming and docs
* rename s_c_a_p_s_c to real_s_c_a_p_s_c; fix docs
* rename InlineStackingContainer to AtomicInlineStackingContainer
* rework debug logging to use PrintTree
* clean up docs and PrintTree output
* don't panic unless cfg!(debug_assertions) is true
* update expectations
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When display lists update quickly, a hit test result might be returned
for a previous display list / list of hit test items. When that happens,
ignore the hit test result.
This fixes a crash, but there might be situations where we can do
something better, such as wait for display list processing to finish
before performing the hit test. A future change might do this for events
like mouse clicks and touch events that should never be thrown away.
Ultimately, the best thing is likely moving hit testing back to layout
or script so a valid hit test can always be performed against the
current DOM.
Fixes #29796.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Implement support for `drop-shadow`
* Clean up remnant from early attempts
* Fix misleading comments on GenericSimpleShadow
If Servo-specific `style` changes will need to be upstreamed anyway, I might as well fix a thing that had thrown me off!
* Revert "Fix misleading comments on GenericSimpleShadow"
This reverts commit cdc810b826ac082041adc212c24649ee3b86ca0a.
* Clean up an import
* Update test expectations
* Fix missing expectation on Layout 2013
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#30351)
* Take forced line breaks into account for intrinsic size
Fixes #30350.
* Don't linebreak on collapsible whitespace
This whitespace can hang off the end of the line, because it will be
trimmed LineItem layout.
* Update float placement after line breakage
Also don't ever line break for collapsible whitespace.
* Fix a few more test cases and clean up
* Renaming according to review comments
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Refactor the scrolling and scrollable area calculation on the window
object, to make it better match the specification. This has some mild
changes to behavior, but in general things work the same as they did
before. This is mainly preparation for properly handling viewport
propagation of the `overflow` property but seems to fix a few issues as
well.
There is one new failure in Layout 2020 regarding `position: sticky`,
but this isn't a big deal because there is no support for `position:
sticky` in Layout 2020 yet.
Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
|
|
|
|
|
|
| |
This makes the names of flow relative geometry consistent with what is
used in the style crate and removes them from a module. With this change
it's more obvious what makes these types different from the ones in
`euclid`.
|
|
|
|
|
| |
* strict imports formatting
* Reformat all imports
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Upgrade vendored version of WebRender
* Patch WebRender: upgrade version of gleam
* Restore hit testing implementation
* Fix WebRender warnings
* Adapt Servo to new WebRender
* Update results
* Add a workaround for #30313
This slightly expands text boundaries in order to take into account the
fact that layout isn't measuring glyph boundaries.
|
|
|
|
|
|
|
|
|
|
|
| |
* remove extern crate
* Update components/script_plugins/lib.rs
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
---------
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes the nesting architecture of inline layout a lot simpler. Now
PartialInlineBoxFragment and InlineNestingLevelState are replaced by
two structs:
- InlineContainerState
- InlineBoxContainerState
InlineContainerState holds state for the root of the inline formatting
context, while InlineBoxContainerState holds state for inline boxes.
InlineBoxContainerState has an InlineContainerState as the first
element, thus "extends" it.
Now the inline iterators are stack variables directly in the `layout()`
method. They are no longer stored in the state. This avoids the weird
nesting of state and instead relies on a normal vector to hold the
stack of state.
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
|
|
|
|
| |
This still fails some tests because on element boundaries we want the
`white-space` property of the first shared ancestor.
|
|
|
|
|
|
|
|
|
|
| |
PlacementAmongFloats would stop iterating when current_bands would be
empty, even if next_band wasn't at infinity.
Then the BFC root or replaced block was placed after all the floats,
even if it could fit next to some of them.
This patch moves the next_band into current_bands so that the loop
keeps considering bands.
|
|
|
|
|
|
| |
Bumps [bitflags](https://github.com/bitflags/bitflags) from 1.3.2 to 2.3.1.
- [Release notes](https://github.com/bitflags/bitflags/releases)
- [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md)
- [Commits](https://github.com/bitflags/bitflags/compare/1.3.2...2.3.1)
|
|
|
|
|
|
|
| |
This implements the rest of the bulk of float support. Now inline
element flow around floats and floats can be pushed down by inline
elements before them.
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
|
|
|
|
|
| |
When a replaced element has a degenerate aspect ratio, it should be
handled as if that element did not have an aspect ratio according to
https://drafts.csswg.org/css-images/#natural-aspect-ratio.
|
|
|
|
|
|
|
|
|
|
|
| |
PlacementAmongFloats was assuming that there would always be a FloatBand
at a position smaller than or equal to the given ceiling, but this was
not the case for negative ceilings.
The reason is that the FloatContext initialized the FloatBandTree with
a band at 0, and another at +∞.
This patch changes the initial bands to −∞ and +∞. This seems more
consistent and matches the expectation of PlacementAmongFloats.
|
|
|
|
|
| |
`OnceCell` is now part of the standard library and we'll be able to use
it once we upgrade rust. For now we can use the version that's shipped
behind a feature flag in rust. This removes a dependency on one crate.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When layout was split into two phases, floats were laid out as direct
children of the inline formatting context. This meant that they were
positioned properly, but not properly made children of their inline
ancestors' stacking contexts. This change maintains the proper
positioning of floats, but positions them relatively to their inline
ancestors.
The big change here is that `text-align` needs to be taken into account
before actually laying out LineItems. This has the added benefit of
setting inline layout for the implementation of `text-align: full`. Now
all line items are laid out at the real final position and we can adjust
the `start_corner` property of float `BoxFragments` when their ancestors
are laid out.
|
| |
|
| |
|
|
|
| |
This reverts commit 8e15389caedd9b8e1b87cc9e4bfe8350a581546d.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* style: Simplify selector flag setting now that flag setting is atomic
These bits are write-only, actually, and we don't even need to read
them.
Differential Revision: https://phabricator.services.mozilla.com/D141888
* Further changes required by Servo
* style: Support media queries for dynamic-range and video-dynamic-range
This is a stub that only matches "standard" for all platforms.
Differential Revision: https://phabricator.services.mozilla.com/D141053
* style: Remove :-moz-lwtheme-{brighttext,darktext}
They are just convenience for :root[lwthemetextcolor="light"] (and dark,
respectively), but they generally shouldn't be used for dark mode
theming. In the past it was the only way to do it but now we have
prefers-color-scheme.
While at it, change lwthemetextcolor to be "lwtheme-brighttext" for
consistency with similar code we have for popups etc, and move it to
_setDarkModeAttributes.
While at it, remove layout.css.moz-lwtheme.content.enabled (which is
false always, we unshipped these from content successfully).
Differential Revision: https://phabricator.services.mozilla.com/D141593
* style: layout.css.moz-locale-dir.content.enabled
We successfully removed these from content in bug 1740230 (Firefox 96).
Differential Revision: https://phabricator.services.mozilla.com/D141727
* style: Really honor background-color: transparent in HCM even for form controls
I forgot we were doing this "revert-or-initial" shenanigans (which is needed
for stuff like link colors to be honored), so we need to early-return.
Use a more explicit test rather than a reftest for this.
Differential Revision: https://phabricator.services.mozilla.com/D142063
* style: Ignore unchanged property for scroll-linked effect detector
I think this is cleaner.
Differential Revision: https://phabricator.services.mozilla.com/D141737
* style: Allow to derive Parse/ToCss/SpecifiedValueInfo on bitflags
We keep getting this pattern of properties that have a set of joint and
disjoint flags, and copy-pasting or writing the same parsing and
serialization code in slightly different ways.
container-type is one such type, and I think we should have a single way
of dealing with this, thus implement deriving for various traits for
bitflags, with an attribute that says which flags are single vs mixed.
See docs and properties I ported. The remaining ones I left TODOs with,
they are a bit trickier but can be ported with some care.
Differential Revision: https://phabricator.services.mozilla.com/D142418
* Further changes required by Servo
* style: Implement parsing / serialization for container{,-type,-name} CSS properties
Two noteworthy details that may seem random otherwise:
* Moving values around in nsStyleDisplay is needed so that the struct
remains under the size limit that we have to avoid jumping allocator
buckets.
* All the test expectation churn is because tests depend on
`container-type: size` parsing to run, and now they run. Tests for
the relevant bits I implemented are passing, with the only exception
of some `container-name-computed.html` failures which are
https://github.com/w3c/csswg-drafts/issues/7181. Safari agrees with
us there.
Other notes when looking at the spec and seeing how it matches the
implementation:
* `container` syntax doesn't match spec, but matches tests and sanity:
https://github.com/w3c/csswg-drafts/issues/7180
* `container-type` syntax doesn't _quite_ match spec, but matches tests
and I think it's a spec bug since the definition for the missing
keyword is gone:
https://github.com/w3c/csswg-drafts/issues/7179
Differential Revision: https://phabricator.services.mozilla.com/D142419
* style: Remove assert that doesn't hold for text-decorations because of presentation hints
MANUAL PUSH: Orange fix CLOSED TREE
* style: Migrate `<th>` `text-align` behaviour from presentation hint to UA CSS
Differential Revision: https://phabricator.services.mozilla.com/D142494
* style: Deduplicate TokenList values faster
Remember whether we have already de-duplicated them once and avoid doing
that again.
This is an alternative approach that doesn't add overhead to attribute
setting in the general case.
Differential Revision: https://phabricator.services.mozilla.com/D142813
* style: Inherit used color-scheme from embedder <browser> elements
This allows popups and sidebars to use the chrome preferred
color-scheme.
This moves the responsibility of setting the content-preferred color
scheme to the appropriate browsers to the front-end (via tabs.css).
We still return the PreferredColorSchemeForContent() when there's no
pres context (e.g., for display:none in-process iframes). We could
potentially move a bunch of the pres-context data to the document
instead, but that should be acceptable IMO as for general web content
there's no behavior change in any case.
Differential Revision: https://phabricator.services.mozilla.com/D142578
* Further changes required by Servo
* style: Add basic @container rule parsing and boilerplate
For now parse a MediaFeatureCondition. That needs being made more
specific, but that is probably worth its own patch.
Differential Revision: https://phabricator.services.mozilla.com/D143192
* Further changes required by Servo
* style: Tweak cascade priority to split writing-mode and font properties
This makes the worst case for cascade performance slightly more
expensive (4 rather than three declaration walks), but my hope is that
it will make the average case faster, since the best case is now just
two walks instead of three, and writing mode properties are somewhat
rare.
This needs a test, but needs to wait until the writing-mode dependent
viewport units land (will wait to land with a test).
Differential Revision: https://phabricator.services.mozilla.com/D143261
* style: Implement new {small,large,dynamic} viewport units
Differential Revision: https://phabricator.services.mozilla.com/D143252
* Further changes required by Servo
* style: Implement new *vi and *vb units
Differential Revision: https://phabricator.services.mozilla.com/D143253
* style: Implement prefers-contrast: custom and let prefers-contrast ride the trains
Differential Revision: https://phabricator.services.mozilla.com/D143198
* style: Join servo style threads during shutdown
I was unable to change the BLOOM_KEY field to no longer be leaked, as the TLS
is also accessed on the main thread, which is not exited before the leak
checker shuts down.
Differential Revision: https://phabricator.services.mozilla.com/D143529
* Further changes required by Servo
* style: Fix visited handling after bug 1763750
Before bug 1763750, we unconditionally called compute_writing_mode,
which got the writing mode from the cascade mode for visited styles.
However after that bug we only do that if we apply any
writing-mode-related property.
We could just call compute_writing_mode unconditionally, but instead it
seems better to skip all that work for visited cascade and reuse the
mechanism introduced in that bug to only apply the visited-dependent
longhands.
We assert that all visited-dependent longhands are "late" longhands, so
as to also avoid applying the font group and such.
Differential Revision: https://phabricator.services.mozilla.com/D143490
* style: Clean-up viewport unit resolution a bit
I should've caught this when reviewing the new viewport units but alas :-)
Differential Revision: https://phabricator.services.mozilla.com/D143856
* style: Implement `contain: inline-size`
Differential Revision: https://phabricator.services.mozilla.com/D143501
* style: Simplify media query evaluation code a bit
This patch:
* Removes generic <ident> support for media features. These were used
for some privileged media features but are no longer used.
* Simplifies media feature getters by shifting the responsibility of
dealing with RangeOrOperator to the caller. This makes it easier to
implement container-query / mediaqueries-4 syntax, and also cleans up
the code a bunch.
There should be no change in behavior.
Differential Revision: https://phabricator.services.mozilla.com/D144051
* Further changes required by Servo
* style: Move transitions and animations to nsStyleUIReset
This mostly just moves code around, to minimize potential behavior
changes. There are some cleanups that we should try to do long term
(this "have an array with n different counts" is pretty weird).
But for now this should unblock people.
The destination struct (nsStyleUIReset) was chosen mainly because it's
small and non-inherited, and it doesn't seem like a worse place than
nsStyleDisplay.
Differential Revision: https://phabricator.services.mozilla.com/D144183
* Further changes required by Servo
* style: Make media feature evaluation take a computed::Context
This has no behavior change right now, but will simplify sharing code
with container queries.
Container queries will have container information in the
computed::Context (this is necessary anyways for container-based units),
so this avoids having to have different code for media and container
queries.
Differential Revision: https://phabricator.services.mozilla.com/D144152
* Further changes required by Servo
* style: Add scroll() to animation-timeline for style system
scroll() is defined in the spec proposal, and there is a temporary spec:
https://drafts.csswg.org/scroll-animations-1/rewrite#scroll-notation.
The spec is still under development, so we don't drop the orignal
scroll-timeline at rule. Instead, we add a new scroll() notation to
animation-timeline, and support both syntax for now.
Differential Revision: https://phabricator.services.mozilla.com/D143417
* style: Tweak contain bitflag definition order to avoid static constructors
This has no behavior change otherwise. The STRICT definition depended on
SIZE, which was defined later. That's fine in Rust, but in C++ it causes
the initialization to be dynamic because it doesn't have the definition
of SIZE yet (ugh).
This is the fix for the regression, though the following patch turns on
constexpr support in cbindgen, which would've caught this at build-time,
and guarantees that we don't have extra static constructors.
Differential Revision: https://phabricator.services.mozilla.com/D144316
* style: Move some of the media query code to a more generic queries module
No behavior change, just moving and renaming files.
The code in the "queries" module will be shared between @media and
@container.
@media has some other code that container queries doesn't need like
MediaList / MediaType / etc. That remains in the media_queries module.
Differential Revision: https://phabricator.services.mozilla.com/D144435
* Further changes required by Servo
* style: cleanup animation-name
Make the representation the same between Gecko and Servo code. This will
enable further clean-ups in the future.
Make serialization be correct, serializing as identifier unless it's an
invalid one (in which case we serialize as a string).
This changes our stringification behavior in the specified style, but
now it will match the computed style and be more correct over-all.
Differential Revision: https://phabricator.services.mozilla.com/D144473
* Further changes required by Servo
* style: Add support for parsing container-query-specific features
There are some mediaqueries-5 features that we still don't support and
explain the remaining failures in at-container-{parsing,serialization}.
Differential Revision: https://phabricator.services.mozilla.com/D144446
* Further changes required by Servo
* style: Introduce Optional<T> to represent optional values in the style system
cross-fade() was kinda doing this in its own way with PercentOrNone, but
since now we have more use-cases for this we should probably make this a
slightly more general solution.
I added some convenience APIs, but they're unused as of this patch so
let me know if you want them gone.
Differential Revision: https://phabricator.services.mozilla.com/D144831
* style: Fix insertRule with layer statements before imports
We need to do a bit more nuanced check because @layer statements might
go before imports.
Differential Revision: https://phabricator.services.mozilla.com/D144996
* style: Factor out parsing the query feature name
No behavior change.
Differential Revision: https://phabricator.services.mozilla.com/D145229
* style: Refactor media feature expression representation in preparation to support multi-range syntax
No behavior change.
Depends on D145229
Differential Revision: https://phabricator.services.mozilla.com/D145230
* style: Implement media feature expression multi-range syntax
Differential Revision: https://phabricator.services.mozilla.com/D145231
* style: Remove proton places tooltip code
There's nobody working on it, and tooltips should hopefully be nice
enough after recent changes (bug 1765423).
Having it enabled causes artifacts like bug 1767815 comment 3. We can
always rescue this from hg history if needed.
Differential Revision: https://phabricator.services.mozilla.com/D145621
* style: Simplify selector flags setup even more
In my investigation for bug 1766439, I am digging into why selector
matching regressed.
It doesn't help that the selector-matching code is instantiated a
gazillion times (so there's a ton of copies of the relevant functions).
This was needed in the past because we had different ways of setting the
selector flags on elements, but I unified that recently and now we only
need to either set them or not. That is the kind of thing that
MatchingContext is really good for, so pass that instead on
MatchingContext creation.
Differential Revision: https://phabricator.services.mozilla.com/D145428
* Further changes required by Servo
* style: Track @container condition id in style rules
Much like we track layer rules. Consolidate that "containing rule state
we pass down while building the cascade data" in a single struct that we
can easily restore.
For now, do nothing with it. I want to land this patch separately
because it touches the Rule struct and CascadeData rebuilds, which both
are performance sensitive.
Its layout shouldn't change because I also changed LayerId to be a u16
(this shouldn't matter in practice, since LayerOrder is already a u16).
Differential Revision: https://phabricator.services.mozilla.com/D145243
* Further changes required by Servo
* style: Fix layer statement rules with multiple layer names
MANUAL PUSH: Trivial orange fix CLOSED TREE.
* style: Implement piecewise linear function
Differential Revision: https://phabricator.services.mozilla.com/D145256
* style: Convert specified value tests to compile-time tests
These were written at a time where std::mem::size_of wasn't a `const fn` in
Rust.
Now that it is, we can make these tests live in the style crate, and the build
not to compile if they fail.
Differential Revision: https://phabricator.services.mozilla.com/D146103
* Further changes required by Servo
* style: Move size of tests to compile-time tests in the style crate
Same reasoning as the previous commit.
Differential Revision: https://phabricator.services.mozilla.com/D146104
* Further changes required by Servo
* style: Lint and 32-bit build fix.
MANUAL PUSH: Bustage fix CLOSED TREE
* style: Implement 'update' media feature
Differential Revision: https://phabricator.services.mozilla.com/D146338
* style: Clean up unused -moz-window-shadow values
After bug 1768278 and bug 1767815 there's no more uses of the cliprounded value
in the tree (also it causes artifacts on HiDPI screens so we probably don't
want new usages).
The "sheet" value is unused, and the other values other than "default" and
"none" are only derived from "default", so they don't need to be exposed in the
style system.
Differential Revision: https://phabricator.services.mozilla.com/D145821
* style: More container queries plumbing
Provide container information in computed::Context and use it to resolve
the container queries.
This still fails a lot of tests because we are not ensuring that layout
is up-to-date when we style the container descendants, but that's
expected.
Differential Revision: https://phabricator.services.mozilla.com/D146478
* Further changes required by Servo
* style: Ensure options in listbox selects are not stacking contexts by default
We could have a different property or something but this seems
reasonable as well probably.
Differential Revision: https://phabricator.services.mozilla.com/D146994
* style: Implement overflow-clip-margin: <length>
Differential Revision: https://phabricator.services.mozilla.com/D146432
* style: Change order of container shorthand
Since the initial value of container-type is an open issue [1],
I'm leaving that as-is for now.
[1] https://github.com/w3c/csswg-drafts/issues/7202
Differential Revision: https://phabricator.services.mozilla.com/D147338
* style: Make modal dialog code more generic, and make it apply to fullscreen too behind a pref
For now, don't turn it on by default yet, because I want to wait for
more discussion in https://github.com/w3c/csswg-drafts/issues/6965 and
so on. But I think the code is simple enough to land this.
Differential Revision: https://phabricator.services.mozilla.com/D147295
* style: Cache computed styles objects display: none subtrees
This reuses our existing undisplayed style generation, but in a
per-document rather than per-nsComputedDOMStyle object, which means that
we can avoid re-resolving styles of elements in display: none subtrees
much more often.
This brings the test-case in the bug to par with other browsers or
better, and is much simpler than the initial approach I tried back in
the day.
Differential Revision: https://phabricator.services.mozilla.com/D147547
* Further changes required by Servo
* style: Parse scroll-snap-stop style and propagate it to APZ side
Depends on D146147
Differential Revision: https://phabricator.services.mozilla.com/D145850
* style: Update color-mix() syntax to match the current spec
Test expectation updates for this in the latest patch of the bug.
Differential Revision: https://phabricator.services.mozilla.com/D147002
* Further changes required by Servo
* style: Make the color interpolation code more generic
It's really piece-wise premultiplied interpolation, with a special-case
for hue, so centralize the implementation.
Differential Revision: https://phabricator.services.mozilla.com/D147003
* style: Implement more color-mix() color-spaces
We had code to convert between these and the latest draft supports them so...
Differential Revision: https://phabricator.services.mozilla.com/D147004
* style: Fix color-mix() percentage normalization
Differential Revision: https://phabricator.services.mozilla.com/D147005
* style: Fix hue adjustment to match the spec
The value to sum is tau, not pi. This was caught by some tests, see
https://drafts.csswg.org/css-color/#shorter
Differential Revision: https://phabricator.services.mozilla.com/D147006
* style: Do hue interpolations in degrees rather than radians. r=barret
This gives us a bit more precision.
Differential Revision: https://phabricator.services.mozilla.com/D147007
* style: Improve Percentage -> LengthPercentage conversion
This doesn't change behavior because we only use them for images that
have no clamping.
Depends on D147008
Differential Revision: https://phabricator.services.mozilla.com/D147511
* style: Remove some dead vibrancy code
Drive-by cleanup.
Differential Revision: https://phabricator.services.mozilla.com/D147698
* style: Fix warnings about whitelist/blocklist functions being deprecated in bindgen 0.59
Differential Revision: https://phabricator.services.mozilla.com/D147695
* style: Update style to arrayvec 0.7
Differential Revision: https://phabricator.services.mozilla.com/D147476
* style: Update style to uluru 3.0
Differential Revision: https://phabricator.services.mozilla.com/D147477
* style: Remove -moz-scrollbar-thumb-proportional
It unconditionally matches on all platforms, so it's not returning any useful information.
Depends on D147689
Differential Revision: https://phabricator.services.mozilla.com/D147690
* style: Use ColorMix for interpolated colors in the computed style rather than ComplexColorRatios
This among other things preserves the right color-space when
interpolating currentColor.
Differential Revision: https://phabricator.services.mozilla.com/D147512
* Further changes required by Servo
* style: Add an input-region-margin to widgets, and implement it on Linux
Recompute the input region when resizing the widget and so on, and use
it to check for rollups.
Depends on D148211
Differential Revision: https://phabricator.services.mozilla.com/D148222
* Avoid complaints from ./mach test-tidy
* Update test expectations
---------
Co-authored-by: Emilio Cobos Álvarez <emilio@crisal.io>
Co-authored-by: Brad Werth <bwerth@mozilla.com>
Co-authored-by: David Shin <dshin@mozilla.com>
Co-authored-by: Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
Co-authored-by: Nika Layzell <nika@thelayzells.com>
Co-authored-by: Boris Chiou <boris.chiou@gmail.com>
Co-authored-by: Autumn on Tape <autumn@cyfox.net>
Co-authored-by: Mike Hommey <mh+mozilla@glandium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
From https://drafts.csswg.org/css-sizing-3/#min-percentage-contribution
> For the min size properties, as well as for margins and paddings
> (and gutters), a cyclic percentage is resolved against zero
> for determining intrinsic size contributions.
|
| |
|
|
|
| |
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
solve_containing_block_padding_border_and_margin_for_in_flow_box (#30073)
Avoid solve_containing_block_padding_border_and_margin_for_in_flow_box()
for a block-level box that establishes an independent formatting context
(or is replaced) in the presence of floats, since the margins and inline
size could then be incorrect.
No actual change in behavior: this patch still resolves the margins
incorrectly with solve_block_margins_for_in_flow_block_level(),
and also keeps the old logic for width:auto.
However, this refactoring prepares the terrain to address these issues
in #30072 and #30057.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Add explanatory comments.
- Rename some methods.
- Store the ceiling instead of relying on the first band, this allows
calling place() when current_bands is empty.
- Make current_bands_height() work when current_bands is empty.
- Add add_one_band() helper method.
- Make place() return a Rect. Follow-up patches will need to know the
size of the area shrunk by floats.
This will be useful for #30057 and #30050.
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
|
|
|
|
|
|
|
|
| |
With direction:ltr (and we don't support direction:rtl yet), the rules
from https://drafts.csswg.org/css2/#blockwidth imply that margin-left
shouldn't resolve auto to a negative amount.
This aligns Servo with Gecko and Blink. WebKit may resolve to a negative
amount in some cases.
|
|
|
|
|
|
| |
When descending and we have the option, don't create new
PositioningContexts just to update the static position of laid out
abspos descendants. Instead, use the new PositioningContextLength to
only update the newly added hoisted abspos boxes.
|
|
|
|
|
|
|
|
| |
(#30060)
Just use clamp_between_extremums() to resolve the inline size, and then
only call solve_inline_margins_for_in_flow_block_level() once.
There should be no change in behavior.
|
|
|
|
|
|
|
|
|
|
|
|
| |
No difference in behavior, just these changes:
- PlacementAmongFloats::new() initializes the top of the 1st band to the
ceiling, so that other methods can just refer to the former without
having to floor by the later.
- In fact, the 'ceiling' field becomes unnecessary, and is removed.
- top_of_placement_for_current_bands() is renamed to current_ceiling().
- try_place_once() is reorganized to reduce indentation.
- The condition 'len() > 0' becomes '!is_empty()'.
- The 1st band is now popped in place() instead of try_place_once(),
then it's easier to see why the loop will end.
|
|
|
|
|
|
|
|
|
| |
Consumers of PlacementAmongFloats weren't handling margins properly.
They were assuming that they would either get a positive adjustment,
or zero for no-op.
However, just like the regular clearance triggered by 'clear', the
clearance added onto blocks that establish an independent FC can be
zero or negative, and the effect is different than having no clearance.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#30034)
Calculating the max-content size of a block container may add the outer
max-content sizes of multiple children. The problem is that the outer
size may be negative (due to margins), producing an incorrect result.
In particular, it could happen that the max-content size was 50-25=25,
but the min-content size would just take the maximum and be 50, which
doesn't make sense.
Therefore, this patch floors the size of all children by 0. This seems
to match Blink. Firefox and WebKit don't floor in some cases, but then
the result seems suboptimal to me. Note that there is no spec for this,
see https://github.com/w3c/csswg-drafts/issues/9120 for details.
|
|
|
| |
Just use Clear instead, they have the same values.
|
|
|
|
|
|
|
|
| |
Since #29950, unit tests were only running with the legacy layout, and
there was no way to run them for layout 2020.
This patch makes './mach test-unit' run unit tests for both.
Also doing some changes so that the layout 2020 floats.rs tests compile.
|
|
|
| |
It was useful when it had 3 callers, but #29977 removed 2 of them.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
|
|
|
|
| |
(#30012)
A block that establishes an independent formatting context is placed
next to previous floats, so we should add their sizes when computing
the intrinsic contribution of the parent block container.
|
|
|
|
|
|
|
|
|
|
|
| |
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`).
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
calculate_inline_content_size_for_block_level_boxes was relying on
inline_content_sizes to get the size of each block-level box child.
For absolutely positioned boxes, this was 0x0.
That was no-op before #29887, but then it prevented adding the sizes
of a sequence of floats. Abspos should just be ignored instead of
treated as 0x0.
This patch removes inline_content_sizes, moves the logic into
calculate_inline_content_size_for_block_level_boxes (the only caller),
and handles abspos correctly.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Place replaced and non-auto inline size independent FCs next to floats
The CSS2 specification says that replaced content and independent
formatting contexts should be placed next to floats. This change adds
support for that, but punts on support for independent formatting
contexts that have an auto inline size. With an auto inline size, we
which requires a much more complex layout algorithm.
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Fix issue with where last band was taken into account for inline size
* adjustment_from_floats should prevent margin collapse
* Properly handle elements with 0 height
---------
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
|