aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/style_adjuster.rs
Commit message (Collapse)AuthorAgeFilesLines
* Move Stylo to its own repo (#31350)Delan Azabani2024-02-271-1013/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove packages that were moved to external repo * Add workspace dependencies pointing to 2023-06-14 branch * Fix servo-tidy.toml errors * Update commit to include #31346 * Update commit to include servo/stylo#2 * Move css-properties.json lookup to target/doc/stylo * Remove dependency on vendored mako in favour of pypi dependency This also removes etc/ci/generate_workflow.py, which has been unused since at least 9e71bd6a7010d6e5723831696ae0ebe26b47682f. * Add temporary code to debug Windows test failures * Fix failures on Windows due to custom target dir * Update commit to include servo/stylo#3 * Fix license in tests/unit/style/build.rs * Document how to build with local Stylo in Cargo.toml
* Further changes required by ServoOriol Brufau2023-11-241-1/+2
|
* style: Make content-visibility: auto forces contain-intrinsic-size to gain ↵Jihye Hong2023-11-241-0/+27
| | | | | | | | | | an auto value When the content having `content-visibility: auto` and the specific value for `contain-intrinsic-size` is slightly out of the viewport, its computed value keeps changing. This patch makes `content-visibilty: auto` forces `contain-intrinsic-size` to gain an auto value to solve this issue. Differential Revision: https://phabricator.services.mozilla.com/D174583
* style: Rustfmt servo/. r=zrhoffmanEmilio Cobos Álvarez2023-11-241-16/+25
| | | | | | | | $ find servo -name '*.rs' | xargs rustup run nightly rustfmt Depends on D179380 Differential Revision: https://phabricator.services.mozilla.com/D179381
* style: Implement the font-synthesis-{weight,style,small-caps} longhand ↵Jonathan Kew2023-11-061-25/+11
| | | | | | properties, and make font-synthesis into a shorthand Differential Revision: https://phabricator.services.mozilla.com/D167480
* Further changes required by ServoOriol Brufau2023-11-041-0/+2
|
* style: Compute column-rule-width to 0 when column-rule-style is noneOriol Brufau2023-11-041-2/+16
| | | | | | Depends on D164554 Differential Revision: https://phabricator.services.mozilla.com/D164549
* style: Fix outline-style: inherit behavior if you don't specify outline-widthEmilio Cobos Álvarez2023-11-041-11/+9
| | | | | | | | | | The fix is calling set_outline_style so that we also reset the actual outline width. Also clean-up surrounding code a little bit to be marginally more efficient, and do the same change for border-*-style (which was doing the right thing, but it's better to make sure both stay in sync). Differential Revision: https://phabricator.services.mozilla.com/D164554
* Further changes required by ServoOriol Brufau2023-11-041-1/+5
|
* style: Fix style containment not triggered by 'contain'Oriol Brufau2023-11-041-2/+45
| | | | | | | | | | | | | | | | | | | | 'container-type' and 'content-visibility' can trigger various kinds of containment, but this was done via nsStyleDisplay::EffectiveContainment, to avoid affecting the computed value of 'contain'. This was fine except for style containment, which needs to set the flag SELF_OR_ANCESTOR_HAS_CONTAIN_STYLE in order to really work, but this was only done with 'contain: style'. So this patch removes nsStyleDisplay::EffectiveContainment, and instead uses two fields for containment: mContain and mEffectiveContainment. This is somewhat analogous to mDisplay and mOriginalDisplay, though in that case the computed value is the modified display. Also fixes a typo in IsContainStyle() that made it return true for any kind of containment, not just for style containment. Differential Revision: https://phabricator.services.mozilla.com/D163779
* style: Flag computed styles of elements with `container-type: *size` set & ↵David Shin2023-11-031-4/+11
| | | | | | | | propagate them to their descendants Low-hanging fruit optimization that enables short-circuit exit of container query lookups. Differential Revision: https://phabricator.services.mozilla.com/D158056
* style: Run "cargo +nightly fmt" for style components in servoTing-Yu Lin2023-11-031-5/+7
| | | | | | | | | | | | | | | | | | The directories changed: * servo/components/selectors/ * servo/components/style/ * servo/components/style_derive/ * servo/ports/geckolib/ Per review request, disable rustfmt in `components_to_transform_3d_matrix()` to preserve the format for a call to `Transform3D::new`. My mozilla-central is at https://hg.mozilla.org/mozilla-central/rev/d1ae84015c22f2034435b47194fdced878072035 My nightly rust is 1.66.0-nightly (8b705839c 2022-09-26). Differential Revision: https://phabricator.services.mozilla.com/D158234
* Further changes required by ServoOriol Brufau2023-11-031-0/+2
|
* style: Make -webkit-line-clamp create a block container in the appropriate ↵Emilio Cobos Álvarez2023-11-031-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | situations This is a hack, sorta, similar to Chromium's: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/layout/layout_object.cc;l=356;drc=312b74e385e6aba98ab31fd911238c0dc16b396c except at computed-value rather than used-value time, because it's both simpler to reason about and prevents lying in the computed style. This fixes the relevant test-case, and matches closer what Chromium does, by not creating anonymous flex items for all elements inside the line-clamp context. The behavior change is covered by the test changes. I had to also fix a couple pre-existing bugs that were caught by tests, now that the line-clamped block is the -webkit-box-styled element rather than an anonymous flex item (and thus now had padding). Depends on D155180 Differential Revision: https://phabricator.services.mozilla.com/D155181
* style: Do not reset font-weight/font-style when mathvariant is specifiedFrederic Wang2023-11-031-14/+0
| | | | | | | | | In the past, mathvariant was cancelling the effect of legacy fontstyle/fontweight attributes by resetting the font-style/font-weight properties. These legacy attributes have been removed in bug 1783841, so remove this hack from Stylo and add corresponding WPT test. Differential Revision: https://phabricator.services.mozilla.com/D156174
* Further changes required by ServoOriol Brufau2023-10-021-0/+2
|
* style: Implement CSS 'contain: style'Martin Robinson2023-10-021-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an implementation of CSS `contain: style`. This introduces two new data structures, the ContainStyleScope and ContainStyleScopeManager. ContainStyleScope manages one `contain: style` "world" which has its own counter and quote lists. The contents of these lists depend on their parent scopes, but are not affected by their children. ContainStyleScopeManager manages a tree of scopes starting at a root scope which is outside of any `contain: style` element. Scopes are stored in a hash table that is keyed off of the nsIContent which establishes the `contain: style` scope. When modifying quote or content lists, the ContainStyleScopeManager is responsible for finding the appropriate `contain: style` scope to modify. Perhaps the most complex part of this is that counters and quotes have read access to the state of counters and quotes that are in ancestor `contain: style` scopes. In the case of counters, USE nodes that are at the beginning of counter lists might have a counter scope that starts in an ancestor `contain: style` scope. When nsCounterNode::SetScope() is called, the code may look upward in the `contain: style` scope tree to find the start of the counter scope. In the case of quotes, the first node in the quote list must look for the state of quotes in ancestor `contain: style` scopes. Differential Revision: https://phabricator.services.mozilla.com/D149508
* style: Move fixed-point font types to RustEmilio Cobos Álvarez2023-10-021-4/+3
| | | | | | | | | Now that cbindgen and rust support const generics, it seems more simple. This centralizes all the relevant font constants etc in rust and avoids conversions when going from rust to C++ and vice versa. Differential Revision: https://phabricator.services.mozilla.com/D148847
* Make the choice of layout runtime settingMartin Robinson2023-07-061-5/+2
| | | | Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
* style: Top layer elements that are display:contents should be display: blockEmilio Cobos Álvarez2023-06-091-1/+7
| | | | | | | | As per https://fullscreen.spec.whatwg.org/#new-stacking-layer: If its specified display property is contents, it computes to block. Differential Revision: https://phabricator.services.mozilla.com/D131585
* style: Run rustfmt on servo/components/style and servo/ports/geckolibTing-Yu Lin2023-06-091-9/+37
| | | | | | | | | | | | This patch is generated by running `cargo +nightly fmt` under `servo/components/style/` and `servo/ports/geckolib` against mozilla-central https://hg.mozilla.org/mozilla-central/rev/b193f2e7a6a5d1f042c957ea4acd5c89bf210512 My nightly version is: 1.58.0-nightly (c9c4b5d72 2021-11-17) Manually remove the redundant braces in author_styles.rs to fix a warning. Differential Revision: https://phabricator.services.mozilla.com/D131556
* style: Make inert not modify the computed styleEmilio Cobos Álvarez2023-05-311-58/+0
| | | | Differential Revision: https://phabricator.services.mozilla.com/D127422
* style: Blockify outside markers at used value time rather than at computed ↵Emilio Cobos Álvarez2023-05-241-13/+0
| | | | | | | | | value time Trusting the display value in style_adjuster is wrong, as some elements force a given kind of frame (like <details>). Differential Revision: https://phabricator.services.mozilla.com/D119609
* style: Fix mixed indentation in style_adjuster.rsEmilio Cobos Álvarez2023-05-241-1/+1
| | | | Differential Revision: https://phabricator.services.mozilla.com/D119579
* style: Implement 'content: none' for ::markerMats Palmgren2023-05-241-2/+3
| | | | Differential Revision: https://phabricator.services.mozilla.com/D111707
* style: Unify font-family storageEmilio Cobos Álvarez2023-05-241-9/+2
| | | | | | | | | This changes font-family storage to reuse the rust types, removing a bunch of code while at it. This allows us to, for example, use a single static font family for -moz-bullet and clone it, rather than creating a lot of expensive copies. Differential Revision: https://phabricator.services.mozilla.com/D118011
* style: Add some style quirks for legacy ::markers created from ↵Mats Palmgren2023-05-241-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | list-style-type/list-style-image Specifically: For "bullets", i.e. 'list-style-type:disc|circle|square| disclosure-closed|disclosure-open', we use a built-in font (-moz-bullet-font, which has glyphs for those symbols + space) to retain mostly backwards compatible rendering for those. Authors may override that with an explicit 'font-family' ::marker style though. We also use this font for 'list-style-image' in case it would fallback to one of the above when the image fails to load (so that we get the same width space). When the -moz-bullet-font is used we also set 'font-synthesis' to avoid synthesizing italic/bold for this font. Authors may override this with an explicit ::marker declaration. We also set 'letter-spacing' and 'word-spacing' to the initial value for bullets for web-compat reasons. Again, authors may override this with an explicit ::marker declaration. (This breaks backwards- compat slightly but makes us compatible with Chrome. We used to ignore these for list-style-type:<string> too.) Differential Revision: https://phabricator.services.mozilla.com/D111693
* Miscellaneous build / tidy fixes.Emilio Cobos Álvarez2021-02-261-2/+3
|
* Rustfmt.Emilio Cobos Álvarez2021-02-261-3/+3
|
* style: Avoid some allocations in selector serialization.Emilio Cobos Álvarez2021-02-261-1/+1
| | | | | | | The allocations in display_to_css_identifier show up in the profiles of bug 1675628. Differential Revision: https://phabricator.services.mozilla.com/D97856
* style: Make the document blocked by the topmost element in the top layer.Sean Feng2021-02-261-0/+3
| | | | | | | | Spec: https://html.spec.whatwg.org/multipage/#blocked-by-a-modal-dialog Depends on D86392 Differential Revision: https://phabricator.services.mozilla.com/D86227
* style: Fix two minor issues with scrollbar style caching.Emilio Cobos Álvarez2021-02-261-0/+3
| | | | | | | | | | Add -moz-inert and -moz-script-level to the set of internal properties that aren't included in "all". -moz-inert may need to be uncacheable in the future if we make it not change the pointer-events computed value. Left a comment to that effect. Differential Revision: https://phabricator.services.mozilla.com/D87115
* style: Use Overflow::is_scrollable in StyleAdjuster.Emilio Cobos Álvarez2021-02-261-5/+1
| | | | | | | It was introduced in the overflow: clip work but this standalone equivalent remained. Differential Revision: https://phabricator.services.mozilla.com/D85778
* style: Implement overflow:clip/visible combinations.Mats Palmgren2021-02-261-37/+11
| | | | Differential Revision: https://phabricator.services.mozilla.com/D73717
* style: Rename overflow:-moz-hidden-unscrollable to overflow:clip.Jeremy Ir2021-02-261-3/+3
| | | | Differential Revision: https://phabricator.services.mozilla.com/D73716
* style: implement -moz-inert CSS property.Alexander Surkov2021-02-261-0/+51
| | | | | | -moz-inert CSS property reflects inert subtrees concept and can be used to implement HTML:dialog element and HTML:inert attribute Differential Revision: https://phabricator.services.mozilla.com/D81701
* style: Defer to -moz-default-appearance when appearance is auto.Cameron McCormack2021-02-261-1/+7
| | | | Differential Revision: https://phabricator.services.mozilla.com/D83429
* style: Add unprefixed appearance property and make -moz-appearance and ↵Cameron McCormack2021-02-261-2/+2
| | | | | | -webkit-appearance be aliases. Differential Revision: https://phabricator.services.mozilla.com/D83428
* style: Use mozilla::Length rather than nscoord to store font sizes.Emilio Cobos Álvarez2021-02-261-2/+3
| | | | | | | | This avoids arbitrary precision loss when computing REM units and so on, which is particularly important if we ever change the base of our app units (but useful regardless). Differential Revision: https://phabricator.services.mozilla.com/D79928
* style: Reformat recent changes.Emilio Cobos Álvarez2020-04-161-4/+4
|
* style: Fix number input so that it honors overflow-clip-box-block.Emilio Cobos Álvarez2020-04-161-3/+36
| | | | | | | | | | | | | | | | This never worked, but it's more visible with the new form controls which have more padding. Make the anonymous div and co a pseudo-element, so that they inherit from the <input> properly in all cases. This works for non-number inputs because the editor root is a direct child of the <input>, but it doesn't for number inputs because there's a flex wrapper in between. This way overflow-clip-box: inherit does what we want. Reset the padding in the inline direction, as the padding for <input type=number> applies to the arrow boxes as well, and thus we'd double-apply it. Differential Revision: https://phabricator.services.mozilla.com/D65271
* style: Add an inherited style bit to know whether an element is in an ↵Emilio Cobos Álvarez2020-04-161-9/+15
| | | | | | | | | | opacity: 0 subtree. I think this should work for the animation throttling stuff. Opacity works on the element tree, so I think this is sound. Differential Revision: https://phabricator.services.mozilla.com/D64441
* style: Rustfmt recent changes.Emilio Cobos Álvarez2020-02-121-4/+10
|
* style: Add a style flag for the root element style.Emilio Cobos Álvarez2020-02-121-5/+9
| | | | | | | This is needed to make the root element not a containing block in presence of filters or what not. Differential Revision: https://phabricator.services.mozilla.com/D61167
* style: Don't apply text-combine-upright in sideways-* writing modes.Jonathan Kew2020-02-121-1/+1
| | | | Differential Revision: https://phabricator.services.mozilla.com/D61326
* style: Ensure nested ruby level container don't escape from line break ↵Xidorn Quan2020-02-121-4/+18
| | | | | | suppression. Differential Revision: https://phabricator.services.mozilla.com/D58351
* style: Do not use synthetic display-inside values.Emilio Cobos Álvarez2020-02-121-3/+1
| | | | | | | This matches the new servo layout engine too, and thus removes some #[cfg] gunk. Just use `flow` since it doesn't simplify the layout code as much. Differential Revision: https://phabricator.services.mozilla.com/D45973
* style: Make Rust static atoms able to be used in const contexts.Emilio Cobos Álvarez2019-11-301-31/+26
| | | | | | | | | | | | | | | | | | I see atom dropping code generated in release builds for stuff like dropping the "class" atom here: https://searchfox.org/mozilla-central/rev/4df8821c1b824db5f40f381f48432f219d99ae36/servo/components/style/gecko/wrapper.rs#592 That is silly, and I hope making Atom be able to be used in const context will help the compiler see that yeah, we're not doing anything interesting and the atom shouldn't get dropped. It also allows us to get rid of a few lazy_static!s, so we should do it anyway. In order to accomplish this, compute the offset into gGkAtoms manually instead of going through the static_atoms() array and then back to the byte offset. Differential Revision: https://phabricator.services.mozilla.com/D55039
* style: Use consistent naming and shared code for out-of-flow stuff.Emilio Cobos Álvarez2019-10-071-6/+6
| | | | Use the functions introduced in ee17eedf3a857f27ce2b6b775574a3a455df8aa3.
* style: Align the Rust and C++ representations of WritingMode.Cameron McCormack2019-09-121-0/+3
| | | | Differential Revision: https://phabricator.services.mozilla.com/D44412