aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/construct.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2014-10-14 11:25:29 -0700
committerPatrick Walton <pcwalton@mimiga.net>2014-10-14 12:44:09 -0700
commit5f8d3f72d82c3c1b96c0ab9e5b21919f12743d2b (patch)
tree276c8c5e96c332b6c2c412b3af2e5e21a246d672 /components/layout/construct.rs
parent8077edc0622b04aeb26d42ced86ea285c9cac0e7 (diff)
downloadservo-5f8d3f72d82c3c1b96c0ab9e5b21919f12743d2b.tar.gz
servo-5f8d3f72d82c3c1b96c0ab9e5b21919f12743d2b.zip
layout: Introduce support for legacy presentational attributes to selector
matching, and use it for `<input size>` and `<td width>`. This implements a general framework for legacy presentational attributes to the DOM and style calculation, so that adding more of them later will be straightforward.
Diffstat (limited to 'components/layout/construct.rs')
-rw-r--r--components/layout/construct.rs26
1 files changed, 5 insertions, 21 deletions
diff --git a/components/layout/construct.rs b/components/layout/construct.rs
index 82bff208604..4233c565dba 100644
--- a/components/layout/construct.rs
+++ b/components/layout/construct.rs
@@ -30,10 +30,9 @@ use flow_ref::FlowRef;
use fragment::{Fragment, GenericFragment, IframeFragment, IframeFragmentInfo, ImageFragment};
use fragment::{ImageFragmentInfo, InlineAbsoluteHypotheticalFragment};
use fragment::{InlineAbsoluteHypotheticalFragmentInfo, InlineBlockFragment};
-use fragment::{InlineBlockFragmentInfo, InputFragment, InputFragmentInfo, SpecificFragmentInfo};
-use fragment::{TableCellFragment, TableColumnFragment, TableColumnFragmentInfo, TableFragment};
-use fragment::{TableRowFragment, TableWrapperFragment, UnscannedTextFragment};
-use fragment::{UnscannedTextFragmentInfo};
+use fragment::{InlineBlockFragmentInfo, InputFragment, SpecificFragmentInfo, TableCellFragment};
+use fragment::{TableColumnFragment, TableColumnFragmentInfo, TableFragment, TableRowFragment};
+use fragment::{TableWrapperFragment, UnscannedTextFragment, UnscannedTextFragmentInfo};
use inline::{InlineFragments, InlineFlow};
use parallel;
use table_wrapper::TableWrapperFlow;
@@ -222,21 +221,6 @@ impl<'a> FlowConstructor<'a> {
}
}
- fn build_fragment_info_for_input(&mut self, node: &ThreadSafeLayoutNode) -> SpecificFragmentInfo {
- //FIXME: would it make more sense to use HTMLInputElement::input_type instead of the raw
- // value? definitely for string comparisons.
- let elem = node.as_element();
- let data = match elem.get_attr(&ns!(""), &atom!("type")) {
- Some("checkbox") | Some("radio") => None,
- Some("button") | Some("submit") | Some("reset") =>
- Some(node.get_input_value().len() as u32),
- Some("file") => Some(node.get_input_size()),
- _ => Some(node.get_input_size()),
- };
- data.map(|size| InputFragment(InputFragmentInfo { size: size }))
- .unwrap_or(GenericFragment)
- }
-
/// Builds specific `Fragment` info for the given node.
///
/// This does *not* construct the text for generated content (but, for generated content with
@@ -253,7 +237,7 @@ impl<'a> FlowConstructor<'a> {
self.build_fragment_info_for_image(node, node.image_url())
}
Some(ElementNodeTypeId(HTMLInputElementTypeId)) => {
- self.build_fragment_info_for_input(node)
+ InputFragment
}
Some(ElementNodeTypeId(HTMLObjectElementTypeId)) => {
let data = node.get_object_data();
@@ -1216,7 +1200,7 @@ impl FlowConstructionUtils for FlowRef {
/// This must not be public because only the layout constructor can do this.
fn finish(&mut self, context: &LayoutContext) {
if !context.shared.opts.bubble_inline_sizes_separately {
- self.get_mut().bubble_inline_sizes(context)
+ self.get_mut().bubble_inline_sizes()
}
}
}