style: Don't EnsureUniqueInner from the cssRules getter

Instead, fix up the various content data structures when the stylesheet
is mutated. This makes reading a stylesheet not disable style sharing.

Differential Revision: https://phabricator.services.mozilla.com/D115203
This commit is contained in:
Emilio Cobos Álvarez 2023-05-22 10:07:21 +02:00 committed by Oriol Brufau
parent c0a2b99c4f
commit 8f4d782952
2 changed files with 15 additions and 2 deletions

View file

@ -56,10 +56,17 @@ impl GeckoStyleSheet {
/// already holds a strong reference.
#[inline]
pub unsafe fn from_addrefed(s: *const DomStyleSheet) -> Self {
debug_assert!(!s.is_null());
assert!(!s.is_null());
GeckoStyleSheet(s)
}
/// HACK(emilio): This is so that we can avoid crashing release due to
/// bug 1719963 and can hopefully get a useful report from fuzzers.
#[inline]
pub fn hack_is_null(&self) -> bool {
self.0.is_null()
}
/// Get the raw `StyleSheet` that we're wrapping.
pub fn raw(&self) -> &DomStyleSheet {
unsafe { &*self.0 }