aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_layout_interface
diff options
context:
space:
mode:
authorBobby Holley <bobbyholley@gmail.com>2016-09-29 17:59:02 -0700
committerBobby Holley <bobbyholley@gmail.com>2016-10-02 19:19:52 -0700
commit5bcc4192bf2c0723444ee62b8fbbbc2084d53175 (patch)
tree63b9977bd50fe1fd5f65ccb6706fecc24bb807f2 /components/script_layout_interface
parent18d552a1e90122262cb2057deb36d03f0eb8dd54 (diff)
downloadservo-5bcc4192bf2c0723444ee62b8fbbbc2084d53175.tar.gz
servo-5bcc4192bf2c0723444ee62b8fbbbc2084d53175.zip
Stop using Ref::map for selected_style and resolved_style.
Same concept as the previous patch. MozReview-Commit-ID: RFC8s7qQPM
Diffstat (limited to 'components/script_layout_interface')
-rw-r--r--components/script_layout_interface/wrapper_traits.rs30
1 files changed, 14 insertions, 16 deletions
diff --git a/components/script_layout_interface/wrapper_traits.rs b/components/script_layout_interface/wrapper_traits.rs
index 9becba2ddfe..bd0f2068271 100644
--- a/components/script_layout_interface/wrapper_traits.rs
+++ b/components/script_layout_interface/wrapper_traits.rs
@@ -18,7 +18,7 @@ use style::context::SharedStyleContext;
use style::dom::{LayoutIterator, NodeInfo, PresentationalHintsSynthetizer, TNode};
use style::dom::OpaqueNode;
use style::properties::ServoComputedValues;
-use style::refcell::{Ref, RefCell};
+use style::refcell::RefCell;
use style::selector_impl::{PseudoElement, PseudoElementCascadeType, ServoSelectorImpl};
use url::Url;
@@ -303,24 +303,22 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + NodeInfo + PartialEq + Sized {
/// This should be used just for querying layout, or when we know the
/// element style is precomputed, not from general layout itself.
#[inline]
- fn resolved_style(&self) -> Ref<Arc<ServoComputedValues>> {
- Ref::map(self.get_style_data().unwrap().borrow(), |data| {
- match self.get_pseudo_element_type() {
- PseudoElementType::Normal
- => data.style_data.style.as_ref().unwrap(),
- other
- => data.style_data.per_pseudo.get(&other.style_pseudo_element()).unwrap(),
- }
- })
+ fn resolved_style(&self) -> Arc<ServoComputedValues> {
+ let data = self.get_style_data().unwrap().borrow();
+ match self.get_pseudo_element_type() {
+ PseudoElementType::Normal
+ => data.style_data.style.as_ref().unwrap().clone(),
+ other
+ => data.style_data.per_pseudo.get(&other.style_pseudo_element()).unwrap().clone(),
+ }
}
#[inline]
- fn selected_style(&self, _context: &SharedStyleContext) -> Ref<Arc<ServoComputedValues>> {
- Ref::map(self.get_style_data().unwrap().borrow(), |data| {
- data.style_data.per_pseudo
- .get(&PseudoElement::Selection)
- .unwrap_or(data.style_data.style.as_ref().unwrap())
- })
+ fn selected_style(&self, _context: &SharedStyleContext) -> Arc<ServoComputedValues> {
+ let data = self.get_style_data().unwrap().borrow();
+ data.style_data.per_pseudo
+ .get(&PseudoElement::Selection)
+ .unwrap_or(data.style_data.style.as_ref().unwrap()).clone()
}
/// Removes the style from this node.