mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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:
parent
c0a2b99c4f
commit
8f4d782952
2 changed files with 15 additions and 2 deletions
|
@ -56,10 +56,17 @@ impl GeckoStyleSheet {
|
||||||
/// already holds a strong reference.
|
/// already holds a strong reference.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn from_addrefed(s: *const DomStyleSheet) -> Self {
|
pub unsafe fn from_addrefed(s: *const DomStyleSheet) -> Self {
|
||||||
debug_assert!(!s.is_null());
|
assert!(!s.is_null());
|
||||||
GeckoStyleSheet(s)
|
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.
|
/// Get the raw `StyleSheet` that we're wrapping.
|
||||||
pub fn raw(&self) -> &DomStyleSheet {
|
pub fn raw(&self) -> &DomStyleSheet {
|
||||||
unsafe { &*self.0 }
|
unsafe { &*self.0 }
|
||||||
|
|
|
@ -56,7 +56,13 @@ impl ImportSheet {
|
||||||
/// exists.
|
/// exists.
|
||||||
pub fn as_sheet(&self) -> Option<&crate::gecko::data::GeckoStyleSheet> {
|
pub fn as_sheet(&self) -> Option<&crate::gecko::data::GeckoStyleSheet> {
|
||||||
match *self {
|
match *self {
|
||||||
ImportSheet::Sheet(ref s) => Some(s),
|
ImportSheet::Sheet(ref s) => {
|
||||||
|
debug_assert!(!s.hack_is_null());
|
||||||
|
if s.hack_is_null() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
Some(s)
|
||||||
|
},
|
||||||
ImportSheet::Pending(_) => None,
|
ImportSheet::Pending(_) => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue