mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
style: Make the allocation of AuthorStyles for ShadowRoot lazy.
So that we don't waste a bunch of memory with stuff like <svg:use>. I plan to shrink AuthorStyles further, but this should help regardless, and isn't very complex. Differential Revision: https://phabricator.services.mozilla.com/D4618
This commit is contained in:
parent
1bc452703b
commit
1e6aa62c6f
3 changed files with 41 additions and 28 deletions
|
@ -167,15 +167,14 @@ impl<'lr> TShadowRoot for GeckoShadowRoot<'lr> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn style_data<'a>(&self) -> &'a CascadeData
|
||||
fn style_data<'a>(&self) -> Option<&'a CascadeData>
|
||||
where
|
||||
Self: 'a,
|
||||
{
|
||||
debug_assert!(!self.0.mServoStyles.mPtr.is_null());
|
||||
|
||||
let author_styles = unsafe {
|
||||
&*(self.0.mServoStyles.mPtr as *const structs::RawServoAuthorStyles
|
||||
as *const bindings::RawServoAuthorStyles)
|
||||
(self.0.mServoStyles.mPtr
|
||||
as *const structs::RawServoAuthorStyles
|
||||
as *const bindings::RawServoAuthorStyles).as_ref()?
|
||||
};
|
||||
|
||||
|
||||
|
@ -187,7 +186,7 @@ impl<'lr> TShadowRoot for GeckoShadowRoot<'lr> {
|
|||
author_styles.stylesheets.dirty()
|
||||
);
|
||||
|
||||
&author_styles.data
|
||||
Some(&author_styles.data)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue