aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/query.rs
Commit message (Collapse)AuthorAgeFilesLines
* Upgrade Stylo to 2024-01-16 (#32066)Oriol Brufau2024-04-131-7/+7
| | | | | | | | | | | | | | | * Upgrade Stylo to 2024-01-16 * Fixup for https://phabricator.services.mozilla.com/D187736 * Fixup for https://phabricator.services.mozilla.com/D196415 * Fixup for https://phabricator.services.mozilla.com/D197147 * Fixup for https://phabricator.services.mozilla.com/D196194 * Fixup for https://phabricator.services.mozilla.com/D196195 * Update test expectations
* chore: Clean up use of `gfx` and `constellation` types (#31981)Martin Robinson2024-04-091-10/+0
| | | | | | | | | | | | This change contains three semi-related clean ups: 1. the `to_webrender()` and `from_webrender()` functions on Pipeline are turned into more-idiomatic `From` and `Into` implementations. 2. `combine_id_with_fragment_type` now returns a `u64` as that is what is expected for all callers and not a `usize`. 3. The `query_scroll_id` query is removed entirely. The `ExternalScrollId` that this queries is easily generated directly from the node's opaque id. Querying into layout isn't necessary at all.
* Update Stylo to 2023-10-16 (#31932)Oriol Brufau2024-03-301-3/+4
| | | | | | | | | | | | | | | | | | | | | | | * Update Stylo to 2023-10-16 * Fixup for https://phabricator.services.mozilla.com/D185154 * Fixup for https://phabricator.services.mozilla.com/D188216 * Fixup for https://phabricator.services.mozilla.com/D185677 * Fixup for https://phabricator.services.mozilla.com/D188566 * Fixup for https://phabricator.services.mozilla.com/D188727 * Fixup for https://phabricator.services.mozilla.com/D189475 * Fixup for https://phabricator.services.mozilla.com/D189521 * Fixup for https://phabricator.services.mozilla.com/D188812 * Fixup for https://phabricator.services.mozilla.com/D189484 * Update test expectations
* layout: Remove LayoutRPC and query layout via the `Layout` trait (#31937)Martin Robinson2024-03-291-172/+20
| | | | | | | | | | | | | | | | | Instead of the tricky `LayoutRPC` interface, query layout using the `Layout` trait. This means that now queries will requires calling layout and then running the query. During layout an enum is used to indicate what kind of layout is necessary. This change also removes the mutex-locked `rw_data` from both layout threads. It's no longer necessary since layout runs synchronously. The one downside here is that for resolved style queries, we now have to create two StyleContexts. One for layout and one for the query itself. The creation of this context should not be very expensive though. `LayoutRPC` used to be necessary because layout used to run asynchronously from script, but that no longer happens. With this change, it becomes possible to safely pass nodes to layout from script -- a cleanup that can happen in a followup change.
* layout: use `Au` in `BoxFragment` (#31794)atbrakhi2024-03-221-8/+8
| | | | | * use au in BoxFragement * review fix
* layout: Add basic support for `getClientRects()` queries (#31696)Martin Robinson2024-03-151-3/+17
| | | | | | This adds basic support for `getClientRects()` by sharing code with the implementation of `getBoundingClientRect()`. In addition to sharing code, it also shares all of the bugs. Primarily, scrolilng positions are not taken into account when return boundary rectangles.
* clippy: Fix warnings in `components/layout_2020` (#31611)eri2024-03-111-6/+3
| | | | | * clippy: fix warnings in components/layout_2020 * fix: review comments
* layout: Add an implementation of `process_resolved_font_style_query` for ↵Smitty2024-02-281-9/+110
| | | | | | | | | | | | | | | Layout 2020 (#31436) * layout: support setting canvas font Signed-off-by: syvb <me@iter.ca> * Update 2d.reset.state.font.html test Signed-off-by: syvb <me@iter.ca> --------- Signed-off-by: syvb <me@iter.ca>
* script: Do not run layout in a thread (#31346)Martin Robinson2024-02-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 support for table rows, columns, rowgroups and colgroups (#31341)Martin Robinson2024-02-201-30/+46
| | | | | | | | | | | | | | This adds support for table rows, columns, rowgroups and colgroups. There are few additions here: 1. The createion of fragments, which allows script queries and hit testing to work properly. These fragments are empty as all cells are still direct descendants of the table fragment. 2. Properly handling size information from tracks and track groups as well as frustrating rules about reordering rowgroups. 3. Painting a background seemlessly across track groups and groups. This is a thing that isn't done in legacy layout (nor WebKit)! Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* layout: Respond to shorthand property requests with real values (#31277)Sebastian C2024-02-101-7/+28
| | | | | | | | | | | | | | | | | | | | | | | | | * Respond to shorthand property requests with real values Signed-off-by: Sebastian C <sebsebmc@gmail.com> * Cleanup formatting and old comments Signed-off-by: Sebastian C <sebsebmc@gmail.com> * Update WPT expectations Signed-off-by: Sebastian C <sebsebmc@gmail.com> * Refactor out helper fn Signed-off-by: Sebastian C <sebsebmc@gmail.com> * Cleanup Signed-off-by: Sebastian C <sebsebmc@gmail.com> --------- Signed-off-by: Sebastian C <sebsebmc@gmail.com>
* layout: return None bounding box when no nodes found (#31253)Smitty2024-02-021-1/+1
| | | Signed-off-by: syvb <me@iter.ca>
* layout: Round `clientTop`, etc queries to pixels properly (#31187)Martin Robinson2024-01-271-2/+5
| | | | | | | | | | | | | | | | * layout: Round getClientRect queries to pixels properly Instead of just flooring all pixels in getClientRect queries, we should round the rectangle. * Fix scrollWidth/scrollHeight too, and tests * Tests passing * Test expectation for legacy layout --------- Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Lint layout_2020 with clippy (#31169)Oriol Brufau2024-01-251-15/+15
| | | cargo clippy --fix -p layout_2020 --allow-dirty --broken-code
* rustdoc: Fix many rustdoc errors (#31147)Martin Robinson2024-01-221-1/+1
| | | | This fixes many rustdoc errors that occur due to raw URLs in rustdoc comments as well as unescaped Rust code that should be in backticks.
* Further changes required by ServoOriol Brufau2023-11-041-1/+1
|
* Refactor scrolls on the window object (#29680)Martin Robinson2023-09-151-9/+14
| | | | | | | | | | | | | | 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>
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-14/+13
| | | | | * strict imports formatting * Reformat all imports
* remove `extern crate` (#30311)Samson2023-09-081-0/+1
| | | | | | | | | | | * 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>
* Further changes required by ServoOriol Brufau2023-08-161-1/+7
|
* Revert "Backport several style changes from Gecko (5) (#30099)" (#30104)Oriol Brufau2023-08-161-7/+1
| | | This reverts commit 8e15389caedd9b8e1b87cc9e4bfe8350a581546d.
* Backport several style changes from Gecko (5) (#30099)Oriol Brufau2023-08-151-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Try to `use` WebRender types moreMartin Robinson2023-07-101-2/+2
| | | | | The newer versions of WebRender move types around between `webrender` and `webrender_api` and this will reduce the churn during the upgrade.
* Make the choice of layout runtime settingMartin Robinson2023-07-061-1/+2
| | | | Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
* Layout 2020: Move all Fragment code to the `fragment_tree` directoryMartin Robinson2023-06-041-3/+1
| | | | | | | | This is a simple code organization change with no behavior change with the idea of making Layout 2020 easier to understand by new folks to the project. The idea is that we will have a cleaner separation between the different parts of layout ie one directory for the fragment tree and one (currently multiple) directory for the box tree.
* Do not hoist floated fragmentsMartin Robinson2023-06-031-24/+19
| | | | | | | | | | | | | | | | | | | | | Instead of hoisting floated fragments to be siblings of the fragment created by their containing block formatting context, keep them in "normal" fragment tree position and adjust their positioning to be relative to the containing block. This means that float fragments follow the existing invariants of the fragment tree and properly handle hit testing, painting order, and relative positioning. The tradeoff here is more complexity tracking the containing block offsets from the block formatting context (including handling collapsed margins), but less complexity dealing with hoisting / shared ownership in addition to the correctness benefits. Some tests are failing now because this change revealed some additional shortcomings with clearing block formatting context content size past the end of their contained floats. This will be fixed in a followup change. Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Place floats in layout 2020, but don't flow text around the floats yet.Patrick Walton2023-06-031-0/+6
| | | | | | | | | | | | | | | This commit puts floats behind the `layout.floats.enabled` pref, because of the following issues and unimplemented features: * Inline formatting contexts don't take floats into account, so text doesn't flow around the floats yet. * Non-floated block formatting contexts don't take floats into account, so BFCs can overlap floats. * Block formatting contexts that contain floats don't expand vertically to contain all the floats. That is, floats can stick out the bottom of BFCs, contra spec.
* Simplify our setup for font metric queries from styleOriol Brufau2023-05-111-1/+1
| | | | | | | | This is a backport of https://phabricator.services.mozilla.com/D157589, by Emilio Cobos Álvarez, plus some additions so that Servo compiles, and some parts from https://phabricator.services.mozilla.com/D144455. Should have no change in behavior.
* Better implement getComputedStyle() for positioned insetsMartin Robinson2023-05-091-8/+12
| | | | | | | | The specification dictates quite quite idiosyncratic return values when querying insets of positioned elements via getComputedStyle(). These depend on whether or not the elements size was overconstrained. This change adds a better implementation of that in preparation for returning proper values for position: sticky.
* Detect body elements during layoutMartin Robinson2023-05-041-19/+19
| | | | | | | | | | | | | | | | | 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.
* Fix scrolling from script in Layout 2020Martin Robinson2023-04-251-2/+9
| | | | | | | | | Script will only scroll if it detects that an element has a scrolling box, so this change adds an implementation of the scroll area query to Layout 2020. This allows some scrolling tests to start passing. This change also updates all expected results in css-backgrounds and cssom-view.
* Add support for <iframe> elements for Layout 2020Martin Robinson2023-04-041-5/+3
| | | | | | This change adds support for the <iframe> element to Layout 2020. In addition, certain aspects of the implementation are made the same between both layout systems.
* Update nightly rustc.Josh Matthews2021-11-011-1/+1
|
* feat(layout_2020): implement `offset{Parent, Top, Left, Width, Height}`yvt2021-06-191-2/+199
|
* refactor(layout_2020): add `depth` parameter to the closure passed to ↵yvt2021-06-161-1/+1
| | | | `FragmentTree::find`
* Fix ./mach build --release --with-layout-2020Utsav Oza2020-06-101-0/+8
|
* Store resolved font style in canvas context stateUtsav Oza2020-06-101-3/+9
|
* Fix ./mach build --release --with-layout-2020Utsav Oza2020-06-101-1/+6
|
* layout_2020: Tag fragments with their pseudo content typeMartin Robinson2020-06-061-8/+9
| | | | | This will allow us to answer queries and properly handle animations in the future for fragments generated for pseudo content.
* Rename BoxTreeRoot/FragmentTreeRoot to BoxTree/FragmentTreeSimon Sapin2020-05-151-19/+13
|
* layout_2020: Add initial support for getComputedStyleMartin Robinson2020-05-111-8/+170
| | | | | | | This implementation is more-or-less on par with the one from layout_2013 and in some cases better. There are still some cases where we don't return the correct "resolved value," but this is enough to test animations and transitions.
* Don't go through the layout thread to retrieve a node's primary styleAnthony Ramine2020-04-071-14/+1
|
* Add a 'dom lifetime to GetLayoutDataAnthony Ramine2020-03-261-10/+7
|
* Fix rebase issues and run Prettier on layout viewer codeFernando Jiménez Moreno2020-02-211-2/+2
|
* Add layout_2020 support for NodeGeometryQuery and ContentBoxQueryMartin Robinson2020-02-111-4/+13
|
* Answer content box queries for layout_2020 for the root elementMartin Robinson2020-01-211-2/+10
| | | | | | This isn't correct yet, but it is necessary to give a value in order for scrolling from script to work. Later this should give an accurate content box response as well as work for non-root elements.
* dom: Calculate the viewport size of iframes when they are first added to the ↵Josh Matthews2019-11-061-0/+11
| | | | tree.
* Remove layout_2020::display_list, use WebRender display lists insteadSimon Sapin2019-09-071-3/+6
|
* Remove more stuff from layout_2020Anthony Ramine2019-08-131-819/+24
|
* Fix compilation errors due to the rebaseAnthony Ramine2019-08-011-39/+8
| | | | It's too complicated to make all the commits in that branch compile properly.