aboutsummaryrefslogtreecommitdiffstats
path: root/components/style
Commit message (Collapse)AuthorAgeFilesLines
* Move Stylo to its own repo (#31350)Delan Azabani2024-02-27302-108344/+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
* style: Remove dependency on servo_config (was #31409) (#31411)Delan Azabani2024-02-234-10/+4
| | | | | | | | | | | | | | | | | | | | | | | | | * Initial style_config crate * Remove servo_config from style * Remove servo_config from tests/unit/style * Plumb servo prefs into stylo * Clean up dependencies * Fix formatting * Add unit tests * Add comment about avoiding clone * Fix bug where getters acquire unnecessary write lock * Remove stray dbg!() * Plumb default prefs into Stylo as well * Add comments about logging and mapping new pref types
* script: Do not run layout in a thread (#31346)Martin Robinson2024-02-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * script: Do not run layout in a thread Instead of spawning a thread for layout that almost always runs synchronously with script, simply run layout in the script thread. This is a resurrection of #28708, taking just the bits that remove the layout thread. It's a complex change and thus is just a first step toward cleaning up the interface between script and layout. Messages are still passed from script to layout via a `process()` method and script proxies some messages to layout from other threads as well. Big changes: 1. Layout is created in the script thread on Document load, thus every live document is guaranteed to have a layout. This isn't completely hidden in the interface, but we can safely `unwrap()` on a Document's layout. 2. Layout configuration is abstracted away into a LayoutConfig struct and the LayoutFactory is a struct passed around by the Constellation. This is to avoid having to monomorphize the entire script thread for each layout. 3. Instead of having the Constellation block on the layout thread to figure out the current epoch and whether there are pending web fonts loading, updates are sent synchronously to the Constellation when rendering to a screenshot. This practically only used by the WPT. A couple tests start to fail, which is probably inevitable since removing the layout thread has introduced timing changes in "exit after load" and screenshot behavior. Co-authored-by: Josh Matthews <josh@joshmatthews.net> * Update test expectations * Fix some issues found during review * Clarify some comments * Address review comments --------- Co-authored-by: Josh Matthews <josh@joshmatthews.net>
* layout: Add initial support for `text-transform` (#31396)Martin Robinson2024-02-221-1/+0
| | | | | | | | | | | | | This adds basic support for `text-transform` in a way that is more complete than legacy layout. There are still many missing elements of proper `text-transform` support such as: 1. Support for `full-width` and `full-size-kana` 2. Support for grapheme based uppercasing, lowercasing, and capitalization. These are all done per-code point right now. 3. Support for the language-specific `SpecialCasing.txt` cases for case mapping such as the ones for Irish and Turkish. Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
* Revert remaining Stylo changes (#31408)Delan Azabani2024-02-226-20/+13
| | | | | * Revert remaining changes from Stylo split-into-commits branch * Do the minimum amount of formatting to appease mach test-tidy
* style: Remove dependency on servo_url (#31358)Martin Robinson2024-02-165-21/+56
| | | | | In order for stylo to be a separate crate, it needs to depend on less things from Servo. This change makes it so that stylo no longer depends on servo_url.
* style: Add a `static_prefs` implementation (#31351)Martin Robinson2024-02-1417-147/+26
| | | | This will eventually be part of the stylo crate and reduces the diff between our verson of style and upstream's.
* Fix list-style serialization (#31314)Oriol Brufau2024-02-111-2/+9
| | | | | | | In layout2020, 'list-style-position' is disabled behind a pref, so the list_style_position field is an Option. The serialization of the 'list-style' shorthand wasn't correctly handling the case of it being None.
* Update mozangle and mozjs in order to use bindgen 0.69.4 (#31306)Martin Robinson2024-02-101-1/+1
| | | | | | This should fix issues that we have with Float16 support on newer LLVM. This also updates style, in order to remove the duplicate version of bindgen. We will soon be able to manage updates to style more consistently.
* layout: Add support for table `border-spacing` (#31166)Martin Robinson2024-01-261-1/+0
| | | | | | This adds support for table `border-spacing` property. Note that we do not yet support the collapsed border model. Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* layout: Implement support for `line-height` and `vertical-align` (#30902)Martin Robinson2024-01-081-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * layout: Implement support for `line-height` and `vertical-align` This is an initial implementation of proper `line-height` and `vertical-align` support. While this change includes the bulk of the work there are still many missing pieces for full support. In particular some big missing things are: - Flex containers do not properly compute their baselines. The idea is to tackle this in a followup change. This causes various flex tests to start failing because everything used to be top aligned. - The implementation of the line-height quirks (only active in quirks mode) are incomplete. While the quirk works in many cases, there are still some cases where it is handled incorrectly. This requires more redesign and refinement, better suited for a followup. - Most of the features are CSS 3 such as precision control of the baseline and first and last baselines are not implemented. This change gets us close to CSS 2.x support. While there are many new test passes with this change some tests are starting to fail. An accounting of new failures: Tests failing also in Layout 2013: - /css/css2/positioning/toogle-abspos-on-relpos-inline-child.html (only passes in Chrome) - /css/CSS2/fonts/font-applies-to-001.xht (potentially an issue with font size) Invalid tests: - /css/CSS2/visudet/inline-block-baseline-003.xht - /css/CSS2/visudet/inline-block-baseline-004.xht - These are are failing in all browsers. See https://bugs.chromium.org/p/chromium/issues/detail?id=1222151. Missing table support: - /_mozilla/mozilla/table_valign_middle.html Missing `font-size-adjust` support : - /css/css-fonts/font-size-adjust-zero-2.html (also failing in 2013) Incomplete form field support : - /html/rendering/widgets/the-select-element/option-add-label-quirks.html (label isn't rendered so button isn't the right size in quirks mode due to line height quirk) Need support for calculating flexbox baseline: - /css/css-flexbox/fieldset-baseline-alignment.html - /css/css-flexbox/flex-inline.html - /css/css-flexbox/flexbox-baseline-multi-line-horiz-001.html - /css/css-flexbox/flexbox-baseline-single-item-001a.html - /css/css-flexbox/flexbox-baseline-single-item-001b.html Failing because we don't create anonymous inline boxes for text children of blocks: - /css/CSS2/linebox/anonymous-inline-inherit-001.html Passes locally (potentially related to fonts): - /css/CSS2/css1/c414-flt-fit-004.xht - /css/css-transforms/transform-input-017.html - /html/obsolete/requirements-for-implementations/the-marquee-element-0/marquee-min-intrinsic-size.html - /css/css-fonts/first-available-font-005.html - /css/css-fonts/first-available-font-006.html * Some cleanups after live review with @mukilan Also update results.
* Add support for table fixups (#30868)Martin Robinson2023-12-221-10/+10
| | | | | | | | | | | | | | | | 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>
* layout: Add support for `text-align-last` (#30905)Martin Robinson2023-12-211-1/+1
| | | | | | | | This change adds support for `text-align-last` as well as ensuring that it also applies to lines before forced line breaks. Two tests start to fail because they rely on right-to-left text to pass: - /css/css-text/text-align/text-align-last-010.html.ini - /css/css-text/text-align/text-align-last-011.html.ini
* Update branch name to main (#30877)Alex Touchet2023-12-161-1/+1
|
* Add basic support for `text-align: justify` (#30807)Martin Robinson2023-12-151-1/+0
| | | | This also enables parsing of `text-justify` for non-legacy layout, though only None is supported (disabling justification).
* Generalize LengthPercentageOrAuto impl to Generic Type (#30824)atbrakhi2023-12-061-5/+5
| | | | | * Generalize LengthPercentageOrAuto impl to Generic Type * review fix
* Add initial support for sticky positioning for non-legacy layout (#30686)Martin Robinson2023-11-291-0/+1
| | | | | | | | | | * Add initial support for sticky positioning for non-legacy layout Many tests still fail for a variety of reasons. One of the primary ones is that CSSOM currently does not return correct values for elements positioned by sticky nodes. This requires changes to WebRender to work properly. * Fix an assertion failure in the legacy layout sticky code
* Further changes required by ServoOriol Brufau2023-11-241-3/+3
|
* style: Add a query-selector fast path for attribute selectors in the ↵Emilio Cobos Álvarez2023-11-241-2/+44
| | | | | | rightmost compound Differential Revision: https://phabricator.services.mozilla.com/D180553
* style: Speed up / specialize attribute selector-matchingEmilio Cobos Álvarez2023-11-243-174/+164
| | | | | | | Inline the attribute lookup code, and only branch on the attribute selector type if we have found an attribute. Differential Revision: https://phabricator.services.mozilla.com/D180531
* Further changes required by ServoOriol Brufau2023-11-241-1/+1
|
* style: Remove unused TElement::has_attrEmilio Cobos Álvarez2023-11-242-9/+1
| | | | Differential Revision: https://phabricator.services.mozilla.com/D180530
* style: Remove the never_matches field from attr selectorsEmilio Cobos Álvarez2023-11-242-16/+14
| | | | | | | It's an extra branch which in practice we almost never take, plus extra checks during parsing. Differential Revision: https://phabricator.services.mozilla.com/D180529
* style: Don't recompute quirks mode -> case sensitivity over and overEmilio Cobos Álvarez2023-11-241-22/+24
| | | | | | | The only reason we pass the quirks mode around is to compute the case sensitivity, but we can just pass the later. Differential Revision: https://phabricator.services.mozilla.com/D180527
* style: Fix style invalidation on layer rule insertionEmilio Cobos Álvarez2023-11-241-1/+5
| | | | | | | | | | Layer insertion may change the order of styles, so we may need to fully invalidate. Without this change, bug 1838045 makes layer-statement-before-import.html fail. Differential Revision: https://phabricator.services.mozilla.com/D180929
* style: Container units should prevent us from sharing style by rule nodeEmilio Cobos Álvarez2023-11-243-2/+21
| | | | | | | | | | | | At least when the containers are different. For now check that by doing a somewhat simplified test (checking sibling-ness). The new flag can be useful to optimize container query restyles on resizes too, in the future. Differential Revision: https://phabricator.services.mozilla.com/D179268
* style: Remove obsolete comment to add use counter for developing CSS propertiesTing-Yu Lin2023-11-241-10/+0
| | | | | | | | The CSS properties in the list are all shipped. Since we still don't support use counter for developing CSS properties since this bug opens, I assume this feature is not critical. Hence the removal of the comment. Differential Revision: https://phabricator.services.mozilla.com/D180771
* style: Move `ANCHORS_RELATIVE_SELECTOR` out of nsINode flagsDavid Shin2023-11-245-25/+31
| | | | | | Move the flag to ComputedValueFlags, like `CONSIDERED_RELATIVE_SELECTOR`. Differential Revision: https://phabricator.services.mozilla.com/D180726
* style: Clean up Context::for_non_inherited_propertyEmilio Cobos Álvarez2023-11-245-32/+19
| | | | | | | We don't ever check the particular property, so it can just be a boolean. Differential Revision: https://phabricator.services.mozilla.com/D180680
* style: Fix rebase conflict with bug 1837664Emilio Cobos Álvarez2023-11-241-1/+1
|
* style: Do not snap -webkit-text-stroke-width to dev pixelsEmilio Cobos Álvarez2023-11-248-52/+104
| | | | | | | Introduce LineWidth (which doesn't snap) and let BorderSideWidth wrap it and actually do the snapping. Differential Revision: https://phabricator.services.mozilla.com/D180688
* style: Improve border-image shorthand serialization, and annotate more passesEmilio Cobos Álvarez2023-11-241-11/+25
|
* style: Don't allow to share style by rule node for linksEmilio Cobos Álvarez2023-11-241-13/+7
| | | | | | (Regardless of visitedness) Differential Revision: https://phabricator.services.mozilla.com/D180353
* style: Improve border shorthand serializationEmilio Cobos Álvarez2023-11-243-49/+65
| | | | | | | | | | | | Fix some bugs caught by css/cssom/shorthand-values. In particular: * Make the shorthand order match the spec. * Omit values when we can. Fix a subtest that wasn't correct. Shorthands can be serialized as long as !important matches in all components. Differential Revision: https://phabricator.services.mozilla.com/D180466
* style: Minor clean-ups to border shorthand parsingEmilio Cobos Álvarez2023-11-241-64/+50
| | | | | | This doesn't change behavior. Differential Revision: https://phabricator.services.mozilla.com/D180465
* style: Avoid selecting zero-resolution images in image-setEmilio Cobos Álvarez2023-11-241-7/+11
| | | | | | | Fairly straight-forward. This fixes the two tests mentioned in comment 0 which aren't still in the repo. Differential Revision: https://phabricator.services.mozilla.com/D180414
* Further changes required by ServoOriol Brufau2023-11-241-7/+4
|
* style: Add method to parse CSS filters without context for workersAndrew Osmond2023-11-242-0/+93
| | | | | | | | This patch adds the ability to parse most CSS filters without a context. OffscreenCanvas can use this on worker threads to provide support for filter operations. Differential Revision: https://phabricator.services.mozilla.com/D179994
* style: Serialize NaN and infinity numbersCanadaHonk2023-11-243-23/+37
| | | | | | | | | | | | | | | | | Added NaN/inf serialization of <number> and changed calc() code to not remove NaN/infinity in code using it. This change is unfortunately imperfect as some things using <number> still refuse to serialize NaN/infinity for some reason (scale()?), but this bug/patch is just for <number> so leaving that out of scope for this. Also added new WPT test file for number NaN/inf serialization based on existing serialization tests (all pass already!). 5 other WPT subtests now newly pass. Differential Revision: https://phabricator.services.mozilla.com/D178587
* style: Forbid negative CSS resolutions at parse timeEmilio Cobos Álvarez2023-11-242-2/+2
| | | | | | | | | | Apply some clang-tidy suggestions while I was going through the ServoStyleConstsInlines while at it. Remove one 0x test because it's tested on the same test and causes a harness error. Differential Revision: https://phabricator.services.mozilla.com/D180331
* style: Make flex-flow serialization interoperableTing-Yu Lin2023-11-241-1/+15
| | | | Differential Revision: https://phabricator.services.mozilla.com/D180270
* style: Remove viewport rule codeEmilio Cobos Álvarez2023-11-2410-1008/+3
| | | | | | | Turns out Servo doesn't need this either, see https://github.com/servo/servo/pull/29850. Differential Revision: https://phabricator.services.mozilla.com/D180264
* Further changes required by ServoOriol Brufau2023-11-242-3/+17
|
* style: Unify parallel and sequential traversal schedulingEmilio Cobos Álvarez2023-11-245-292/+150
| | | | | | | Use in_place_scope_fifo to spawn work into the thread pool while doing work in the main thread. Differential Revision: https://phabricator.services.mozilla.com/D179492
* style: Remove :nth-child(... of) prefEmilio Cobos Álvarez2023-11-241-1/+1
| | | | | | We ship this, and the front-end uses it by default, so remove the pref. Differential Revision: https://phabricator.services.mozilla.com/D180222
* style: Send offset-position to the compositorBoris Chiou2023-11-241-0/+1
| | | | | | | | | | We send offset-position to the compositor, just like other similar properties, e.g. offset-rotate, offset-anchor. This includes extracting this animation value, doing serialization and sending it via IPC. So now we can run the animation of ray() on the compositor properly. Differential Revision: https://phabricator.services.mozilla.com/D179862
* style: Add at <position> into ray() in style systemBoris Chiou2023-11-244-33/+86
| | | | | | | | | | | | We reuse PositionOrAuto here, and let "auto" represent the situation when the author omits "at <position>" because it has a special meaning. https://drafts.fxtf.org/motion-1/#valdef-ray-at-position Note: No need to update css/motion/parsing/offset-path-parsing-valid.html because Blink added some to the upstream repo already. Differential Revision: https://phabricator.services.mozilla.com/D179860
* style: Return Err() in to_animated_zero() for offset-pathBoris Chiou2023-11-241-3/+8
| | | | | | | | It's unnecessary to implement ToAnimatedZero for this property and so we return Err(()), just like other properties which also use basic shapes, e.g. clip-path, shape-outside. Differential Revision: https://phabricator.services.mozilla.com/D179859
* style: Change some references to raw pointers in some FFI functionsEmilio Cobos Álvarez2023-11-241-2/+2
| | | | | | | | Even tho https://github.com/rust-lang/rust/issues/112337 is IMO a rust bug, it's easy to work around in our code and it doesn't really affect expressiveness. Differential Revision: https://phabricator.services.mozilla.com/D180065
* Further changes required by ServoOriol Brufau2023-11-241-1/+2
|