diff options
author | Shing Lyu <shing.lyu@gmail.com> | 2015-03-12 20:46:16 +0800 |
---|---|---|
committer | Shing Lyu <shing.lyu@gmail.com> | 2015-04-14 10:09:23 +0800 |
commit | 7a65b95ae5c847f5a6dbb650865ca6d14490e9bc (patch) | |
tree | 3270350c67d93bebc981638c01cd13de470104de /components/layout/layout_task.rs | |
parent | 07520de97047916f0d15c7a63b3de20eac50f010 (diff) | |
download | servo-7a65b95ae5c847f5a6dbb650865ca6d14490e9bc.tar.gz servo-7a65b95ae5c847f5a6dbb650865ca6d14490e9bc.zip |
4873 - Support the image map processing for <img ismap/> inside an <a/>
Diffstat (limited to 'components/layout/layout_task.rs')
-rw-r--r-- | components/layout/layout_task.rs | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index a2f7b7ca81e..70462c31cd1 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -10,6 +10,7 @@ use animation; use construct::ConstructionResult; use context::{SharedLayoutContext, SharedLayoutContextWrapper}; +use css::node_style::StyledNode; use display_list_builder::ToGfxColor; use flow::{self, Flow, ImmutableFlowUtils, MutableFlowUtils, MutableOwnedFlowUtils}; use flow_ref::FlowRef; @@ -712,7 +713,10 @@ impl LayoutTask { let requested_node: OpaqueNode = OpaqueNodeMethods::from_script_node(requested_node); let mut iterator = UnioningFragmentBorderBoxIterator::new(requested_node); sequential::iterate_through_flow_tree_fragment_border_boxes(layout_root, &mut iterator); - rw_data.content_box_response = iterator.rect; + rw_data.content_box_response = match iterator.rect { + Some(rect) => rect, + None => Rect::zero() + }; } fn process_content_boxes_request<'a>(&'a self, @@ -1157,25 +1161,28 @@ impl LayoutRPC for LayoutRPCImpl { struct UnioningFragmentBorderBoxIterator { node_address: OpaqueNode, - rect: Rect<Au>, + rect: Option<Rect<Au>>, } impl UnioningFragmentBorderBoxIterator { fn new(node_address: OpaqueNode) -> UnioningFragmentBorderBoxIterator { UnioningFragmentBorderBoxIterator { node_address: node_address, - rect: Rect::zero(), + rect: None } } } impl FragmentBorderBoxIterator for UnioningFragmentBorderBoxIterator { fn process(&mut self, _: &Fragment, border_box: &Rect<Au>) { - self.rect = if self.rect.is_empty() { - *border_box - } else { - self.rect.union(border_box) - } + self.rect = match self.rect { + Some(rect) => { + Some(rect.union(border_box)) + } + None => { + Some(*border_box) + } + }; } fn should_process(&mut self, fragment: &Fragment) -> bool { |