diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-05-23 06:35:16 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-23 06:35:16 -0500 |
commit | 84c1f904cbf5ca338b46f41426eab53fc45543e9 (patch) | |
tree | e872d2a662733132ded09bc731875ef9537a4056 /components/script | |
parent | e24d96cdd04fb40c0681a6ba46476ba04607f573 (diff) | |
parent | e17e001b0fbf488308281a2235fc0e5122240688 (diff) | |
download | servo-84c1f904cbf5ca338b46f41426eab53fc45543e9.tar.gz servo-84c1f904cbf5ca338b46f41426eab53fc45543e9.zip |
Auto merge of #16985 - emilio:cache, r=bholley
layout: Stop mutating the style data from layout.
This is part of #16982.
Right now we have some code that tries to cache stuff in the style data during
layout.
This code is extremely rarely executed, only for `<details>` and `<summary>`.
I think if we really really want to cache these, we should find a place in the
layout data for it.
For now, let's move it away (and all the other layout code) from mutating the
style data from layout.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16985)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/layout_wrapper.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs index fca0f0949eb..5241d01785d 100644 --- a/components/script/layout_wrapper.rs +++ b/components/script/layout_wrapper.rs @@ -30,7 +30,7 @@ #![allow(unsafe_code)] -use atomic_refcell::AtomicRefCell; +use atomic_refcell::{AtomicRef, AtomicRefCell}; use dom::bindings::inheritance::{CharacterDataTypeId, ElementTypeId}; use dom::bindings::inheritance::{HTMLElementTypeId, NodeTypeId}; use dom::bindings::js::LayoutJS; @@ -1092,8 +1092,10 @@ impl<'le> ThreadSafeLayoutElement for ServoThreadSafeLayoutElement<'le> { self.element.get_attr(namespace, name) } - fn get_style_data(&self) -> Option<&AtomicRefCell<ElementData>> { + fn style_data(&self) -> AtomicRef<ElementData> { self.element.get_data() + .expect("Unstyled layout node?") + .borrow() } } |