diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2015-08-12 16:26:05 -0700 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2015-08-13 09:51:17 -0700 |
commit | 8fe2f8930c6d577d97ae347d11b965a1b7ef91fb (patch) | |
tree | 0248d1cee0761461ef2fe5a98435e66498fc0b7c /components/layout | |
parent | 9fda72d60fcc2db5c4af37b58621071305858018 (diff) | |
download | servo-8fe2f8930c6d577d97ae347d11b965a1b7ef91fb.tar.gz servo-8fe2f8930c6d577d97ae347d11b965a1b7ef91fb.zip |
layout: Make inline margins on `<input type=button>` and friends apply
only to the button and not to the text inside.
Improves the Google home page.
Diffstat (limited to 'components/layout')
-rw-r--r-- | components/layout/construct.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 5976045e740..0e57bd13d1a 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -673,11 +673,13 @@ impl<'a> FlowConstructor<'a> { fn build_flow_for_block_like(&mut self, flow: FlowRef, node: &ThreadSafeLayoutNode) -> ConstructionResult { let mut initial_fragments = IntermediateInlineFragments::new(); - if node.get_pseudo_element_type() != PseudoElementType::Normal || + let node_is_input_or_text_area = node.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement( HTMLElementTypeId::HTMLInputElement))) || node.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement( - HTMLElementTypeId::HTMLTextAreaElement))) { + HTMLElementTypeId::HTMLTextAreaElement))); + if node.get_pseudo_element_type() != PseudoElementType::Normal || + node_is_input_or_text_area { // A TextArea's text contents are displayed through the input text // box, so don't construct them. if node.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement( @@ -687,9 +689,12 @@ impl<'a> FlowConstructor<'a> { } } - self.create_fragments_for_node_text_content(&mut initial_fragments, - node, - &*node.style()); + let mut style = node.style().clone(); + if node_is_input_or_text_area { + properties::modify_style_for_input_text(&mut style); + } + + self.create_fragments_for_node_text_content(&mut initial_fragments, node, &style) } self.build_flow_for_block_starting_with_fragments(flow, node, initial_fragments) |