servo/components/script
Oriol Brufau f9e154af55
Fix InsertRule to use the right CssRuleTypes (#32125)
`CSSRule::Type()` returns an u16 for CSSOM. `InsertRule()` was
incorrectly using this to create a `CssRuleTypes`.

Instead of `CssRuleTypes::from_bits(rule_type)`, it should be something
like `CssRuleTypes::from_bits(1 << rule_type)`.

However, that would only work when `Type()` provides an actual value,
which per https://drafts.csswg.org/cssom/#dom-cssrule-type only happens
for old rule types. New rule types just return 0.

Therefore, this patch changes the signature of `SpecificCSSRule::ty()`
to return the actual `CssRuleType`, and then `CSSRule::Type()` can zero
it out when necessary.

The fix is only relevant for CSS Nesting, which is currently disabled on
Servo, so no test is necessary.

<!-- Please describe your changes on the following line: -->


---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by
`[X]` when the step is complete, and replace `___` with appropriate
data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes do not require tests because the fix is only
relevant for CSS Nesting, which is currently disabled

<!-- Also, please make sure that "Allow edits from maintainers" checkbox
is checked, so that we can help you if you get stuck somewhere along the
way.-->

<!-- Pull requests that do not address these steps are welcome, but they
will require additional verification as part of the review process. -->
2024-04-22 07:06:36 +00:00
..
docs Update branch name to main (#30877) 2023-12-16 09:32:20 +00:00
dom Fix InsertRule to use the right CssRuleTypes (#32125) 2024-04-22 07:06:36 +00:00
layout_dom script: Make layout DOM wrappers not generic on layout data (#31994) 2024-04-04 11:34:35 +00:00
task_source clippy: Fix redundant field names warnings (#31793) 2024-03-20 23:05:29 +00:00
animation_timeline.rs script: Start replacing time with std::time and chrono (#30639) 2024-01-16 12:23:18 +00:00
animations.rs clippy: Fix mem_replace_with_default warnings (#31921) 2024-03-28 13:10:37 +00:00
body.rs clippy: Fix let_and_return warnings (#31964) 2024-04-01 15:43:24 +00:00
build.rs Update python detection in codegen (#31873) 2024-03-26 10:14:06 +00:00
canvas_state.rs Upgrade Stylo to 2024-03-01 (#32089) 2024-04-16 12:27:51 +00:00
Cargo.toml Update phf_codegen and phf_shared to 0.11 (#31537) 2024-03-08 07:25:12 +00:00
clipboard_provider.rs
devtools.rs clippy: fixed some warnings in components/script (#31888) 2024-03-26 21:25:42 +00:00
document_loader.rs clippy: fixed some warnings in components/script (#31888) 2024-03-26 21:25:42 +00:00
euclidext.rs Update euclid 2020-04-07 08:51:08 -07:00
fetch.rs Fixed some clippy warnings by replacing 'match' with 'if' (#32007) 2024-04-07 07:39:05 +00:00
image_listener.rs Strict import formatting (grouping and granularity) (#30325) 2023-09-11 19:16:54 +00:00
init.rs Fixed some clippy warning by adding default implementations (#31989) 2024-04-04 09:33:30 +00:00
layout_image.rs clippy: Fix some warnings in the script crate (#31719) 2024-03-18 10:05:18 +00:00
lib.rs crown: Do not warn about crown for rustdoc or clippy (#31805) 2024-03-21 15:33:06 +00:00
mem.rs Strict import formatting (grouping and granularity) (#30325) 2023-09-11 19:16:54 +00:00
microtask.rs Strict import formatting (grouping and granularity) (#30325) 2023-09-11 19:16:54 +00:00
network_listener.rs clippy: Fix redundant field names warnings (#31793) 2024-03-20 23:05:29 +00:00
realms.rs Strict import formatting (grouping and granularity) (#30325) 2023-09-11 19:16:54 +00:00
script_module.rs Fixed some clippy warnings in components (#32025) 2024-04-10 07:50:01 +00:00
script_runtime.rs Fixed some clippy warning by adding default implementations (#31989) 2024-04-04 09:33:30 +00:00
script_thread.rs script: Add an implementation of Default for Documents (#32048) 2024-04-19 08:45:38 +00:00
serviceworker_manager.rs clippy: fix warnings in components/script (#32023) 2024-04-09 09:34:52 +00:00
stylesheet_loader.rs fonts: Add support for WOFF2 and properly load web fonts from @imports (#31879) 2024-03-26 20:31:52 +00:00
stylesheet_set.rs
task.rs ensure clean shutdown of all threads running JS 2020-06-30 13:22:38 +08:00
task_manager.rs clippy: Allow too_many_arguments for all functions (#31962) 2024-04-01 14:53:33 +00:00
task_queue.rs clippy: Fix some clippy problems in components/script (#31778) 2024-03-20 18:41:07 +00:00
test.rs Strict import formatting (grouping and granularity) (#30325) 2023-09-11 19:16:54 +00:00
textinput.rs clippy: Fix collapsible_else_if warnings (#31853) 2024-03-26 09:15:04 +00:00
timers.rs clippy: Fix some warnings in components/script/timers.rs (#31878) 2024-03-27 10:15:15 +00:00
unpremultiplytable.rs
webdriver_handlers.rs Fix some clippy warnings in components/script/webdriver_handlers.rs (#31784) 2024-03-22 11:08:07 +00:00
window_named_properties.rs clippy: Fix several warnings (#31710) 2024-03-18 08:33:43 +00:00