Return the result from process_resolved_style_request.

This commit is contained in:
Ms2ger 2015-10-26 09:28:41 +01:00
parent 16b6e812a2
commit 9754bfc330

View file

@ -887,15 +887,14 @@ impl LayoutTask {
rw_data.client_rect_response = iterator.client_rect; rw_data.client_rect_response = iterator.client_rect;
} }
// Compute the resolved value of property for a given (pseudo)element. /// Return the resolved value of property for a given (pseudo)element.
// Stores the result in rw_data.resolved_style_response. /// https://drafts.csswg.org/cssom/#resolved-value
// https://drafts.csswg.org/cssom/#resolved-value fn process_resolved_style_request(&self,
fn process_resolved_style_request<'a>(&'a self, requested_node: TrustedNodeAddress,
requested_node: TrustedNodeAddress, pseudo: &Option<PseudoElement>,
pseudo: &Option<PseudoElement>, property: &Atom,
property: &Atom, layout_root: &mut FlowRef)
layout_root: &mut FlowRef, -> Option<String> {
rw_data: &mut RWGuard<'a>) {
// FIXME: Isolate this transmutation into a "bridge" module. // FIXME: Isolate this transmutation into a "bridge" module.
// FIXME(rust#16366): The following line had to be moved because of a // FIXME(rust#16366): The following line had to be moved because of a
// rustc bug. It should be in the next unsafe block. // rustc bug. It should be in the next unsafe block.
@ -918,8 +917,7 @@ impl LayoutTask {
// The pseudo doesn't exist, return nothing. Chrome seems to query // The pseudo doesn't exist, return nothing. Chrome seems to query
// the element itself in this case, Firefox uses the resolved value. // the element itself in this case, Firefox uses the resolved value.
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=29006 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=29006
rw_data.resolved_style_response = None; return None;
return;
} }
Some(layout_node) => layout_node Some(layout_node) => layout_node
}; };
@ -970,7 +968,7 @@ impl LayoutTask {
style.writing_mode); style.writing_mode);
sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root,
&mut iterator); &mut iterator);
rw_data.resolved_style_response = iterator.result.map(|r| r.to_css_string()); iterator.result.map(|r| r.to_css_string())
}, },
atom!("bottom") | atom!("top") | atom!("right") | atom!("bottom") | atom!("top") | atom!("right") |
@ -1003,14 +1001,13 @@ impl LayoutTask {
position); position);
sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root,
&mut iterator); &mut iterator);
rw_data.resolved_style_response = iterator.result.map(|r| r.to_css_string()); iterator.result.map(|r| r.to_css_string())
}, },
// FIXME: implement used value computation for line-height // FIXME: implement used value computation for line-height
ref property => { ref property => {
rw_data.resolved_style_response = style.computed_value_to_string(property.as_slice()).ok()
style.computed_value_to_string(property.as_slice()).ok();
} }
}; }
} }
fn process_offset_parent_query(&self, fn process_offset_parent_query(&self,
@ -1237,11 +1234,11 @@ impl LayoutTask {
ReflowQueryType::NodeGeometryQuery(node) => ReflowQueryType::NodeGeometryQuery(node) =>
self.process_node_geometry_request(node, &mut root_flow, &mut rw_data), self.process_node_geometry_request(node, &mut root_flow, &mut rw_data),
ReflowQueryType::ResolvedStyleQuery(node, ref pseudo, ref property) => { ReflowQueryType::ResolvedStyleQuery(node, ref pseudo, ref property) => {
self.process_resolved_style_request(node, rw_data.resolved_style_response =
pseudo, self.process_resolved_style_request(node,
property, pseudo,
&mut root_flow, property,
&mut rw_data) &mut root_flow)
} }
ReflowQueryType::OffsetParentQuery(node) => ReflowQueryType::OffsetParentQuery(node) =>
rw_data.offset_parent_response = self.process_offset_parent_query(node, &mut root_flow), rw_data.offset_parent_response = self.process_offset_parent_query(node, &mut root_flow),