diff options
author | bors-servo <metajack+bors@gmail.com> | 2014-10-09 00:06:32 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2014-10-09 00:06:32 -0600 |
commit | 15b508ac10d0e98ba10474b6ab091017ae95804e (patch) | |
tree | 9dd09c8cadfecaa69a211b60b7c483ac833d4952 | |
parent | c4ac93b315f058d9a061b20ce64cacbead339f86 (diff) | |
parent | a0b369ae7daf914a44bf826f3f1e7ebe9b422de2 (diff) | |
download | servo-15b508ac10d0e98ba10474b6ab091017ae95804e.tar.gz servo-15b508ac10d0e98ba10474b6ab091017ae95804e.zip |
auto merge of #3600 : pcwalton/servo/pseudo-unshareable, r=mbrubeck
Makes multiple `<br>` elements work, since those are implemented via
`before` pseudos.
r? @mbrubeck
-rw-r--r-- | components/layout/css/matching.rs | 14 | ||||
-rw-r--r-- | components/layout/parallel.rs | 4 | ||||
-rw-r--r-- | components/layout/wrapper.rs | 2 | ||||
-rw-r--r-- | tests/ref/basic.list | 1 | ||||
-rw-r--r-- | tests/ref/many_brs_a.html | 6 | ||||
-rw-r--r-- | tests/ref/many_brs_ref.html | 9 |
6 files changed, 29 insertions, 7 deletions
diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs index 2484127fb28..4ff49518edd 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -8,7 +8,8 @@ use css::node_style::StyledNode; use construct::FlowConstructor; use context::LayoutContext; use util::{LayoutDataAccess, LayoutDataWrapper}; -use wrapper::{LayoutElement, LayoutNode, PostorderNodeMutTraversal, ThreadSafeLayoutNode, TLayoutNode}; +use wrapper::{LayoutElement, LayoutNode, PostorderNodeMutTraversal, ThreadSafeLayoutNode}; +use wrapper::{TLayoutNode}; use script::dom::node::{TextNodeTypeId}; use servo_util::bloom::BloomFilter; @@ -233,11 +234,13 @@ impl StyleSharingCandidate { } match (&self.class, element.get_attr(&ns!(""), "class")) { (&None, Some(_)) | (&Some(_), None) => return false, - (&Some(ref this_class), Some(element_class)) if element_class != this_class.as_slice() => { + (&Some(ref this_class), Some(element_class)) + if element_class != this_class.as_slice() => { return false } (&Some(_), Some(_)) | (&None, None) => {} } + true } } @@ -440,7 +443,9 @@ impl<'ln> MatchMethods for LayoutNode<'ln> { Some(After), &mut applicable_declarations.after); - *shareable = applicable_declarations.normal_shareable + *shareable = applicable_declarations.normal_shareable && + applicable_declarations.before.len() == 0 && + applicable_declarations.after.len() == 0 } unsafe fn share_style_if_possible(&self, @@ -537,7 +542,8 @@ impl<'ln> MatchMethods for LayoutNode<'ln> { // First, check to see whether we can share a style with someone. let sharing_result = unsafe { - self.share_style_if_possible(layout_context.style_sharing_candidate_cache(), parent.clone()) + self.share_style_if_possible(layout_context.style_sharing_candidate_cache(), + parent.clone()) }; // Otherwise, match and cascade selectors. diff --git a/components/layout/parallel.rs b/components/layout/parallel.rs index 0535998ee65..03d3b02af7d 100644 --- a/components/layout/parallel.rs +++ b/components/layout/parallel.rs @@ -16,8 +16,8 @@ use layout_task::{AssignBSizesAndStoreOverflowTraversal, AssignISizesTraversal}; use layout_task::{BubbleISizesTraversal}; use url::Url; use util::{LayoutDataAccess, LayoutDataWrapper, OpaqueNodeMethods}; -use wrapper::{layout_node_to_unsafe_layout_node, layout_node_from_unsafe_layout_node, LayoutNode, PostorderNodeMutTraversal}; -use wrapper::{ThreadSafeLayoutNode, UnsafeLayoutNode}; +use wrapper::{layout_node_to_unsafe_layout_node, layout_node_from_unsafe_layout_node, LayoutNode}; +use wrapper::{PostorderNodeMutTraversal, ThreadSafeLayoutNode, UnsafeLayoutNode}; use gfx::display_list::OpaqueNode; use servo_util::bloom::BloomFilter; diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs index c9f9df91bec..579727617d0 100644 --- a/components/layout/wrapper.rs +++ b/components/layout/wrapper.rs @@ -633,7 +633,7 @@ impl<'ln> ThreadSafeLayoutNode<'ln> { } } - pub fn get_pseudo_element_type(&self) -> PseudoElementType { + pub fn get_pseudo_element_type(&self) -> PseudoElementType { self.pseudo } diff --git a/tests/ref/basic.list b/tests/ref/basic.list index 75eb1413189..247f4d38d81 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -167,3 +167,4 @@ fragment=top != ../html/acid2.html acid2_ref.html == box_sizing_border_box_a.html box_sizing_border_box_ref.html != input_height_a.html input_height_ref.html == pre_ignorable_whitespace_a.html pre_ignorable_whitespace_ref.html +== many_brs_a.html many_brs_ref.html diff --git a/tests/ref/many_brs_a.html b/tests/ref/many_brs_a.html new file mode 100644 index 00000000000..ea65cbe3390 --- /dev/null +++ b/tests/ref/many_brs_a.html @@ -0,0 +1,6 @@ +<!DOCTYPE html> +<html> +<body> +Cupcakes<br>are<br>supremely<br>delicious. +</body> +</html> diff --git a/tests/ref/many_brs_ref.html b/tests/ref/many_brs_ref.html new file mode 100644 index 00000000000..05b6c9fc2fe --- /dev/null +++ b/tests/ref/many_brs_ref.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<html> +<body> +<div>Cupcakes</div> +<div>are</div> +<div>supremely</div> +<div>delicious.</div> +</body> +</html> |