mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
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.
This commit is contained in:
parent
8077edc062
commit
5f8d3f72d8
31 changed files with 570 additions and 214 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue