mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 23:23:33 +00:00
Bug 1673930 - Use document quirks mode rather than sheet quirks mode for stylesheet invalidation. r=nordzilla
In order to determine whether classes or ids are case insensitive we need the document quirks mode. The sheet quirks mode almost always matches, but may not match when sheets are added by privileged APIs. Differential Revision: https://phabricator.services.mozilla.com/D95061
This commit is contained in:
parent
f8d2ad7b26
commit
a44649b0ba
@ -9,6 +9,7 @@ use crate::gecko::values::{convert_nscolor_to_rgba, convert_rgba_to_nscolor};
|
||||
use crate::gecko_bindings::bindings;
|
||||
use crate::gecko_bindings::structs;
|
||||
use crate::media_queries::MediaType;
|
||||
use crate::context::QuirksMode;
|
||||
use crate::properties::ComputedValues;
|
||||
use crate::string_cache::Atom;
|
||||
use crate::values::computed::Length;
|
||||
@ -143,6 +144,11 @@ impl Device {
|
||||
.store(size.px().to_bits(), Ordering::Relaxed)
|
||||
}
|
||||
|
||||
/// The quirks mode of the document.
|
||||
pub fn quirks_mode(&self) -> QuirksMode {
|
||||
self.document().mCompatMode.into()
|
||||
}
|
||||
|
||||
/// Sets the body text color for the "inherit color from body" quirk.
|
||||
///
|
||||
/// <https://quirks.spec.whatwg.org/#the-tables-inherit-color-from-body-quirk>
|
||||
|
@ -140,7 +140,7 @@ impl StylesheetInvalidationSet {
|
||||
return; // Nothing to do here.
|
||||
}
|
||||
|
||||
let quirks_mode = stylesheet.quirks_mode(guard);
|
||||
let quirks_mode = device.quirks_mode();
|
||||
for rule in stylesheet.effective_rules(device, guard) {
|
||||
self.collect_invalidations_for_rule(rule, guard, device, quirks_mode);
|
||||
if self.fully_invalid {
|
||||
|
@ -450,7 +450,7 @@ macro_rules! sheet_set_methods {
|
||||
change_kind: RuleChangeKind,
|
||||
) {
|
||||
if let Some(device) = device {
|
||||
let quirks_mode = sheet.quirks_mode(guard);
|
||||
let quirks_mode = device.quirks_mode();
|
||||
self.invalidations.rule_changed(
|
||||
sheet,
|
||||
rule,
|
||||
|
@ -0,0 +1,14 @@
|
||||
<!-- quirks, intentionally -->
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div class="mixedCase"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
const kLime = "rgb(0, 255, 0)";
|
||||
|
||||
let div = document.querySelector("div");
|
||||
assert_not_equals(getComputedStyle(div).color, kLime);
|
||||
SpecialPowers.DOMWindowUtils.loadSheetUsingURIString('data:text/css,.mixedCase{color:lime}', 1)
|
||||
assert_equals(getComputedStyle(div).color, kLime);
|
||||
}, "Invalidation of quirks documents when standard sheets are inserted works properly")
|
||||
</script>
|
Loading…
x
Reference in New Issue
Block a user