mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +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
|
@ -1495,13 +1495,11 @@ impl Flow for BlockFlow {
|
|||
|
||||
/// Pass 1 of reflow: computes minimum and preferred inline-sizes.
|
||||
///
|
||||
/// Recursively (bottom-up) determine the flow's minimum and preferred inline-sizes. When called on
|
||||
/// this flow, all child flows have had their minimum and preferred inline-sizes set. This function
|
||||
/// must decide minimum/preferred inline-sizes based on its children's inline-sizes and the dimensions of
|
||||
/// any fragments it is responsible for flowing.
|
||||
///
|
||||
/// TODO(pcwalton): Inline blocks.
|
||||
fn bubble_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
||||
/// Recursively (bottom-up) determine the flow's minimum and preferred inline-sizes. When
|
||||
/// called on this flow, all child flows have had their minimum and preferred inline-sizes set.
|
||||
/// This function must decide minimum/preferred inline-sizes based on its children's
|
||||
/// inline-sizes and the dimensions of any fragments it is responsible for flowing.
|
||||
fn bubble_inline_sizes(&mut self) {
|
||||
let _scope = layout_debug_scope!("block::bubble_inline_sizes {:s}", self.base.debug_id());
|
||||
|
||||
let mut flags = self.base.flags;
|
||||
|
@ -1557,13 +1555,16 @@ impl Flow for BlockFlow {
|
|||
max(intrinsic_inline_sizes.preferred_inline_size,
|
||||
left_float_width + right_float_width);
|
||||
|
||||
let fragment_intrinsic_inline_sizes = self.fragment.intrinsic_inline_sizes(layout_context);
|
||||
intrinsic_inline_sizes.minimum_inline_size = max(intrinsic_inline_sizes.minimum_inline_size,
|
||||
fragment_intrinsic_inline_sizes.minimum_inline_size);
|
||||
intrinsic_inline_sizes.preferred_inline_size = max(intrinsic_inline_sizes.preferred_inline_size,
|
||||
fragment_intrinsic_inline_sizes.preferred_inline_size);
|
||||
intrinsic_inline_sizes.surround_inline_size = intrinsic_inline_sizes.surround_inline_size +
|
||||
fragment_intrinsic_inline_sizes.surround_inline_size;
|
||||
let fragment_intrinsic_inline_sizes = self.fragment.intrinsic_inline_sizes();
|
||||
intrinsic_inline_sizes.minimum_inline_size =
|
||||
max(intrinsic_inline_sizes.minimum_inline_size,
|
||||
fragment_intrinsic_inline_sizes.minimum_inline_size);
|
||||
intrinsic_inline_sizes.preferred_inline_size =
|
||||
max(intrinsic_inline_sizes.preferred_inline_size,
|
||||
fragment_intrinsic_inline_sizes.preferred_inline_size);
|
||||
intrinsic_inline_sizes.surround_inline_size =
|
||||
intrinsic_inline_sizes.surround_inline_size +
|
||||
fragment_intrinsic_inline_sizes.surround_inline_size;
|
||||
self.base.intrinsic_inline_sizes = intrinsic_inline_sizes;
|
||||
|
||||
match self.fragment.style().get_box().float {
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ pub trait Flow: fmt::Show + ToString + Sync {
|
|||
/// called on this flow, all child flows have had their minimum and preferred inline-sizes set.
|
||||
/// This function must decide minimum/preferred inline-sizes based on its children's inline-
|
||||
/// sizes and the dimensions of any boxes it is responsible for flowing.
|
||||
fn bubble_inline_sizes(&mut self, _ctx: &LayoutContext) {
|
||||
fn bubble_inline_sizes(&mut self) {
|
||||
fail!("bubble_inline_sizes not yet implemented")
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ pub enum SpecificFragmentInfo {
|
|||
InlineAbsoluteHypotheticalFragment(InlineAbsoluteHypotheticalFragmentInfo),
|
||||
|
||||
InlineBlockFragment(InlineBlockFragmentInfo),
|
||||
InputFragment(InputFragmentInfo),
|
||||
InputFragment,
|
||||
ScannedTextFragment(ScannedTextFragmentInfo),
|
||||
TableFragment,
|
||||
TableCellFragment,
|
||||
|
@ -183,22 +183,6 @@ impl InlineBlockFragmentInfo {
|
|||
}
|
||||
}
|
||||
|
||||
/// A fragment that represents a displayable form element
|
||||
#[deriving(Clone)]
|
||||
pub struct InputFragmentInfo {
|
||||
pub size: u32,
|
||||
}
|
||||
|
||||
impl InputFragmentInfo {
|
||||
/// Returns the original inline-size of the input.
|
||||
fn input_inline_size(&self, font_style: &FontStyle, layout_context: &LayoutContext) -> Au {
|
||||
let metrics = text::font_metrics_for_style(layout_context.font_context(), font_style);
|
||||
|
||||
// https://html.spec.whatwg.org/#converting-a-character-width-to-pixels
|
||||
metrics.average_advance * (self.size as i32 - 1) + metrics.max_advance
|
||||
}
|
||||
}
|
||||
|
||||
/// A fragment that represents a replaced content image and its accompanying borders, shadows, etc.
|
||||
#[deriving(Clone)]
|
||||
pub struct ImageFragmentInfo {
|
||||
|
@ -550,7 +534,7 @@ impl Fragment {
|
|||
fn style_specified_intrinsic_inline_size(&self) -> IntrinsicISizes {
|
||||
let (use_margins, use_padding) = match self.specific {
|
||||
GenericFragment | IframeFragment(_) | ImageFragment(_) | InlineBlockFragment(_) |
|
||||
InputFragment(_) => (true, true),
|
||||
InputFragment => (true, true),
|
||||
TableFragment | TableCellFragment => (false, true),
|
||||
TableWrapperFragment => (true, false),
|
||||
TableRowFragment => (false, false),
|
||||
|
@ -1195,7 +1179,7 @@ impl Fragment {
|
|||
clip_rect))
|
||||
}
|
||||
GenericFragment | IframeFragment(..) | TableFragment | TableCellFragment |
|
||||
TableRowFragment | TableWrapperFragment | InlineBlockFragment(_) | InputFragment(_) |
|
||||
TableRowFragment | TableWrapperFragment | InlineBlockFragment(_) | InputFragment |
|
||||
InlineAbsoluteHypotheticalFragment(_) => {
|
||||
// FIXME(pcwalton): This is a bit of an abuse of the logging infrastructure. We
|
||||
// should have a real `SERVO_DEBUG` system.
|
||||
|
@ -1258,13 +1242,13 @@ impl Fragment {
|
|||
}
|
||||
|
||||
/// Returns the intrinsic inline-sizes of this fragment.
|
||||
pub fn intrinsic_inline_sizes(&mut self, layout_context: &LayoutContext) -> IntrinsicISizes {
|
||||
pub fn intrinsic_inline_sizes(&mut self) -> IntrinsicISizes {
|
||||
let mut result = self.style_specified_intrinsic_inline_size();
|
||||
|
||||
match self.specific {
|
||||
GenericFragment | IframeFragment(_) | TableFragment | TableCellFragment |
|
||||
TableColumnFragment(_) | TableRowFragment | TableWrapperFragment |
|
||||
InlineAbsoluteHypotheticalFragment(_) => {}
|
||||
InlineAbsoluteHypotheticalFragment(_) | InputFragment => {}
|
||||
InlineBlockFragment(ref mut info) => {
|
||||
let block_flow = info.flow_ref.get_mut().as_block();
|
||||
result.minimum_inline_size = max(result.minimum_inline_size,
|
||||
|
@ -1280,12 +1264,6 @@ impl Fragment {
|
|||
result.preferred_inline_size = max(result.preferred_inline_size,
|
||||
image_inline_size);
|
||||
}
|
||||
InputFragment(ref input_fragment_info) => {
|
||||
let font_style = text::computed_style_to_font_style(&*self.style);
|
||||
let input_inline_size = input_fragment_info.input_inline_size(&font_style, layout_context);
|
||||
result.minimum_inline_size = input_inline_size;
|
||||
result.preferred_inline_size = input_inline_size;
|
||||
}
|
||||
ScannedTextFragment(ref text_fragment_info) => {
|
||||
let range = &text_fragment_info.range;
|
||||
let min_line_inline_size = text_fragment_info.run.min_width_for_range(range);
|
||||
|
@ -1333,7 +1311,7 @@ impl Fragment {
|
|||
match self.specific {
|
||||
GenericFragment | IframeFragment(_) | TableFragment | TableCellFragment |
|
||||
TableRowFragment | TableWrapperFragment | InlineBlockFragment(_) |
|
||||
InputFragment(_) | InlineAbsoluteHypotheticalFragment(_) => Au(0),
|
||||
InputFragment | InlineAbsoluteHypotheticalFragment(_) => Au(0),
|
||||
ImageFragment(ref image_fragment_info) => {
|
||||
image_fragment_info.computed_inline_size()
|
||||
}
|
||||
|
@ -1352,7 +1330,7 @@ impl Fragment {
|
|||
match self.specific {
|
||||
GenericFragment | IframeFragment(_) | TableFragment | TableCellFragment |
|
||||
TableRowFragment | TableWrapperFragment | InlineBlockFragment(_) |
|
||||
InputFragment(_) | InlineAbsoluteHypotheticalFragment(_) => Au(0),
|
||||
InputFragment | InlineAbsoluteHypotheticalFragment(_) => Au(0),
|
||||
ImageFragment(ref image_fragment_info) => {
|
||||
image_fragment_info.computed_block_size()
|
||||
}
|
||||
|
@ -1386,7 +1364,7 @@ impl Fragment {
|
|||
-> Option<(SplitInfo, Option<SplitInfo>, Arc<Box<TextRun>> /* TODO(bjz): remove */)> {
|
||||
match self.specific {
|
||||
GenericFragment | IframeFragment(_) | ImageFragment(_) | TableFragment | TableCellFragment |
|
||||
TableRowFragment | TableWrapperFragment | InputFragment(_) => None,
|
||||
TableRowFragment | TableWrapperFragment | InputFragment => None,
|
||||
TableColumnFragment(_) => fail!("Table column fragments do not need to split"),
|
||||
UnscannedTextFragment(_) => fail!("Unscanned text fragments should have been scanned by now!"),
|
||||
InlineBlockFragment(_) | InlineAbsoluteHypotheticalFragment(_) => {
|
||||
|
@ -1429,7 +1407,7 @@ impl Fragment {
|
|||
-> Option<(Option<SplitInfo>, Option<SplitInfo>, Arc<Box<TextRun>> /* TODO(bjz): remove */)> {
|
||||
match self.specific {
|
||||
GenericFragment | IframeFragment(_) | ImageFragment(_) | TableFragment | TableCellFragment |
|
||||
TableRowFragment | TableWrapperFragment | InlineBlockFragment(_) | InputFragment(_) |
|
||||
TableRowFragment | TableWrapperFragment | InlineBlockFragment(_) | InputFragment |
|
||||
InlineAbsoluteHypotheticalFragment(_) => None,
|
||||
TableColumnFragment(_) => fail!("Table column fragments do not have inline_size"),
|
||||
UnscannedTextFragment(_) => fail!("Unscanned text fragments should have been scanned by now!"),
|
||||
|
@ -1528,7 +1506,7 @@ impl Fragment {
|
|||
container_inline_size: Au) {
|
||||
match self.specific {
|
||||
GenericFragment | IframeFragment(_) | TableFragment | TableCellFragment |
|
||||
TableRowFragment | TableWrapperFragment | InputFragment(_) => return,
|
||||
TableRowFragment | TableWrapperFragment | InputFragment => return,
|
||||
TableColumnFragment(_) => fail!("Table column fragments do not have inline_size"),
|
||||
UnscannedTextFragment(_) => {
|
||||
fail!("Unscanned text fragments should have been scanned by now!")
|
||||
|
@ -1624,7 +1602,7 @@ impl Fragment {
|
|||
pub fn assign_replaced_block_size_if_necessary(&mut self, containing_block_block_size: Au) {
|
||||
match self.specific {
|
||||
GenericFragment | IframeFragment(_) | TableFragment | TableCellFragment |
|
||||
TableRowFragment | TableWrapperFragment | InputFragment(_) => return,
|
||||
TableRowFragment | TableWrapperFragment | InputFragment => return,
|
||||
TableColumnFragment(_) => fail!("Table column fragments do not have block_size"),
|
||||
UnscannedTextFragment(_) => {
|
||||
fail!("Unscanned text fragments should have been scanned by now!")
|
||||
|
@ -1787,7 +1765,7 @@ impl Fragment {
|
|||
TableWrapperFragment => false,
|
||||
GenericFragment | IframeFragment(_) | ImageFragment(_) | ScannedTextFragment(_) |
|
||||
TableFragment | TableCellFragment | TableColumnFragment(_) | TableRowFragment |
|
||||
UnscannedTextFragment(_) | InputFragment(_) => true,
|
||||
UnscannedTextFragment(_) | InputFragment => true,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1844,7 +1822,7 @@ impl fmt::Show for Fragment {
|
|||
ImageFragment(_) => "ImageFragment",
|
||||
InlineAbsoluteHypotheticalFragment(_) => "InlineAbsoluteHypotheticalFragment",
|
||||
InlineBlockFragment(_) => "InlineBlockFragment",
|
||||
InputFragment(_) => "InputFragment",
|
||||
InputFragment => "InputFragment",
|
||||
ScannedTextFragment(_) => "ScannedTextFragment",
|
||||
TableFragment => "TableFragment",
|
||||
TableCellFragment => "TableCellFragment",
|
||||
|
|
|
@ -914,7 +914,7 @@ impl Flow for InlineFlow {
|
|||
self
|
||||
}
|
||||
|
||||
fn bubble_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
||||
fn bubble_inline_sizes(&mut self) {
|
||||
let _scope = layout_debug_scope!("inline::bubble_inline_sizes {:s}", self.base.debug_id());
|
||||
|
||||
let writing_mode = self.base.writing_mode;
|
||||
|
@ -927,7 +927,7 @@ impl Flow for InlineFlow {
|
|||
debug!("Flow: measuring {}", *fragment);
|
||||
|
||||
let fragment_intrinsic_inline_sizes =
|
||||
fragment.intrinsic_inline_sizes(layout_context);
|
||||
fragment.intrinsic_inline_sizes();
|
||||
intrinsic_inline_sizes.minimum_inline_size = max(
|
||||
intrinsic_inline_sizes.minimum_inline_size,
|
||||
fragment_intrinsic_inline_sizes.minimum_inline_size);
|
||||
|
|
|
@ -171,9 +171,9 @@ impl Flow for TableFlow {
|
|||
/// table layout calculation.
|
||||
/// The maximum min/pref inline-sizes of each column are set from the rows for the automatic
|
||||
/// table layout calculation.
|
||||
fn bubble_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
||||
fn bubble_inline_sizes(&mut self) {
|
||||
let _scope = layout_debug_scope!("table::bubble_inline_sizes {:s}",
|
||||
self.block_flow.base.debug_id());
|
||||
self.block_flow.base.debug_id());
|
||||
|
||||
let mut min_inline_size = Au(0);
|
||||
let mut pref_inline_size = Au(0);
|
||||
|
@ -239,8 +239,7 @@ impl Flow for TableFlow {
|
|||
}
|
||||
}
|
||||
|
||||
let fragment_intrinsic_inline_sizes =
|
||||
self.block_flow.fragment.intrinsic_inline_sizes(layout_context);
|
||||
let fragment_intrinsic_inline_sizes = self.block_flow.fragment.intrinsic_inline_sizes();
|
||||
self.block_flow.base.intrinsic_inline_sizes.minimum_inline_size = min_inline_size;
|
||||
self.block_flow.base.intrinsic_inline_sizes.preferred_inline_size =
|
||||
max(min_inline_size, pref_inline_size);
|
||||
|
|
|
@ -48,8 +48,8 @@ impl Flow for TableCaptionFlow {
|
|||
&mut self.block_flow
|
||||
}
|
||||
|
||||
fn bubble_inline_sizes(&mut self, ctx: &LayoutContext) {
|
||||
self.block_flow.bubble_inline_sizes(ctx);
|
||||
fn bubble_inline_sizes(&mut self) {
|
||||
self.block_flow.bubble_inline_sizes();
|
||||
}
|
||||
|
||||
fn assign_inline_sizes(&mut self, ctx: &LayoutContext) {
|
||||
|
|
|
@ -74,16 +74,21 @@ impl Flow for TableCellFlow {
|
|||
&mut self.block_flow
|
||||
}
|
||||
|
||||
/// Minimum/preferred inline-sizes set by this function are used in automatic table layout calculation.
|
||||
fn bubble_inline_sizes(&mut self, ctx: &LayoutContext) {
|
||||
/// Minimum/preferred inline-sizes set by this function are used in automatic table layout
|
||||
/// calculation.
|
||||
fn bubble_inline_sizes(&mut self) {
|
||||
let _scope = layout_debug_scope!("table_cell::bubble_inline_sizes {:s}",
|
||||
self.block_flow.base.debug_id());
|
||||
self.block_flow.base.debug_id());
|
||||
|
||||
self.block_flow.bubble_inline_sizes(ctx);
|
||||
let specified_inline_size = MaybeAuto::from_style(self.block_flow.fragment.style().content_inline_size(),
|
||||
Au::new(0)).specified_or_zero();
|
||||
if self.block_flow.base.intrinsic_inline_sizes.minimum_inline_size < specified_inline_size {
|
||||
self.block_flow.base.intrinsic_inline_sizes.minimum_inline_size = specified_inline_size;
|
||||
self.block_flow.bubble_inline_sizes();
|
||||
let specified_inline_size = MaybeAuto::from_style(self.block_flow
|
||||
.fragment
|
||||
.style()
|
||||
.content_inline_size(),
|
||||
Au(0)).specified_or_zero();
|
||||
if self.block_flow.base.intrinsic_inline_sizes.minimum_inline_size <
|
||||
specified_inline_size {
|
||||
self.block_flow.base.intrinsic_inline_sizes.minimum_inline_size = specified_inline_size
|
||||
}
|
||||
if self.block_flow.base.intrinsic_inline_sizes.preferred_inline_size <
|
||||
self.block_flow.base.intrinsic_inline_sizes.minimum_inline_size {
|
||||
|
|
|
@ -53,7 +53,7 @@ impl Flow for TableColGroupFlow {
|
|||
self
|
||||
}
|
||||
|
||||
fn bubble_inline_sizes(&mut self, _: &LayoutContext) {
|
||||
fn bubble_inline_sizes(&mut self) {
|
||||
let _scope = layout_debug_scope!("table_colgroup::bubble_inline_sizes {:s}",
|
||||
self.base.debug_id());
|
||||
|
||||
|
|
|
@ -171,7 +171,7 @@ impl Flow for TableRowFlow {
|
|||
/// responsible for flowing.
|
||||
/// Min/pref inline-sizes set by this function are used in automatic table layout calculation.
|
||||
/// The specified column inline-sizes of children cells are used in fixed table layout calculation.
|
||||
fn bubble_inline_sizes(&mut self, _: &LayoutContext) {
|
||||
fn bubble_inline_sizes(&mut self) {
|
||||
let _scope = layout_debug_scope!("table_row::bubble_inline_sizes {:s}",
|
||||
self.block_flow.base.debug_id());
|
||||
|
||||
|
|
|
@ -132,14 +132,16 @@ impl Flow for TableRowGroupFlow {
|
|||
&self.col_pref_inline_sizes
|
||||
}
|
||||
|
||||
/// Recursively (bottom-up) determines the context's preferred and minimum inline-sizes. When called
|
||||
/// on this context, all child contexts have had their min/pref inline-sizes set. This function must
|
||||
/// decide min/pref inline-sizes based on child context inline-sizes and dimensions of any fragments it is
|
||||
/// responsible for flowing.
|
||||
/// Recursively (bottom-up) determines the context's preferred and minimum inline-sizes. When
|
||||
/// called on this context, all child contexts have had their min/pref inline-sizes set. This
|
||||
/// function must decide min/pref inline-sizes based on child context inline-sizes and
|
||||
/// dimensions of any fragments it is responsible for flowing.
|
||||
///
|
||||
/// Min/pref inline-sizes set by this function are used in automatic table layout calculation.
|
||||
/// Also, this function finds the specified column inline-sizes from the first row.
|
||||
/// Those are used in fixed table layout calculation
|
||||
fn bubble_inline_sizes(&mut self, _: &LayoutContext) {
|
||||
///
|
||||
/// Also, this function finds the specified column inline-sizes from the first row. These are
|
||||
/// used in fixed table layout calculation.
|
||||
fn bubble_inline_sizes(&mut self) {
|
||||
let _scope = layout_debug_scope!("table_rowgroup::bubble_inline_sizes {:s}",
|
||||
self.block_flow.base.debug_id());
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ impl Flow for TableWrapperFlow {
|
|||
self.block_flow.float_kind()
|
||||
}
|
||||
|
||||
fn bubble_inline_sizes(&mut self, ctx: &LayoutContext) {
|
||||
fn bubble_inline_sizes(&mut self) {
|
||||
// get column inline-sizes info from table flow
|
||||
for kid in self.block_flow.base.child_iter() {
|
||||
assert!(kid.is_table_caption() || kid.is_table());
|
||||
|
@ -270,7 +270,7 @@ impl Flow for TableWrapperFlow {
|
|||
}
|
||||
}
|
||||
|
||||
self.block_flow.bubble_inline_sizes(ctx);
|
||||
self.block_flow.bubble_inline_sizes();
|
||||
}
|
||||
|
||||
fn assign_inline_sizes(&mut self, layout_context: &LayoutContext) {
|
||||
|
|
|
@ -260,7 +260,7 @@ pub struct BubbleISizes<'a> {
|
|||
impl<'a> PostorderFlowTraversal for BubbleISizes<'a> {
|
||||
#[inline]
|
||||
fn process(&mut self, flow: &mut Flow) -> bool {
|
||||
flow.bubble_inline_sizes(self.layout_context);
|
||||
flow.bubble_inline_sizes();
|
||||
true
|
||||
}
|
||||
|
||||
|
|
|
@ -38,8 +38,9 @@ use css::node_style::StyledNode;
|
|||
use util::{LayoutDataAccess, LayoutDataWrapper, PrivateLayoutData, OpaqueNodeMethods};
|
||||
|
||||
use gfx::display_list::OpaqueNode;
|
||||
use script::dom::bindings::codegen::InheritTypes::{HTMLIFrameElementDerived, HTMLInputElementDerived};
|
||||
use script::dom::bindings::codegen::InheritTypes::{HTMLImageElementDerived, TextDerived};
|
||||
use script::dom::bindings::codegen::InheritTypes::{HTMLIFrameElementDerived};
|
||||
use script::dom::bindings::codegen::InheritTypes::{HTMLImageElementDerived};
|
||||
use script::dom::bindings::codegen::InheritTypes::{HTMLInputElementDerived, TextDerived};
|
||||
use script::dom::bindings::js::JS;
|
||||
use script::dom::element::{Element, HTMLAreaElementTypeId, HTMLAnchorElementTypeId};
|
||||
use script::dom::element::{HTMLLinkElementTypeId, LayoutElementHelpers, RawLayoutElementHelpers};
|
||||
|
@ -52,13 +53,13 @@ use script::dom::node::{IsDirty, HasDirtyDescendants};
|
|||
use script::dom::text::Text;
|
||||
use script::layout_interface::LayoutChan;
|
||||
use servo_msg::constellation_msg::{PipelineId, SubpageId};
|
||||
use servo_util::str::is_whitespace;
|
||||
use servo_util::str::{LengthOrPercentageOrAuto, is_whitespace};
|
||||
use std::cell::{RefCell, Ref, RefMut};
|
||||
use std::kinds::marker::ContravariantLifetime;
|
||||
use std::mem;
|
||||
use style::computed_values::{content, display, white_space};
|
||||
use style::{AnyNamespace, AttrSelector, PropertyDeclarationBlock, SpecificNamespace, TElement};
|
||||
use style::{TNode};
|
||||
use style::{AnyNamespace, AttrSelector, IntegerAttribute, LengthAttribute};
|
||||
use style::{PropertyDeclarationBlock, SpecificNamespace, TElement, TElementAttributes, TNode};
|
||||
use url::Url;
|
||||
use string_cache::{Atom, Namespace};
|
||||
|
||||
|
@ -517,6 +518,20 @@ impl<'le> TElement<'le> for LayoutElement<'le> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'le> TElementAttributes for LayoutElement<'le> {
|
||||
fn get_length_attribute(self, length_attribute: LengthAttribute) -> LengthOrPercentageOrAuto {
|
||||
unsafe {
|
||||
self.element.get_length_attribute_for_layout(length_attribute)
|
||||
}
|
||||
}
|
||||
|
||||
fn get_integer_attribute(self, integer_attribute: IntegerAttribute) -> Option<i32> {
|
||||
unsafe {
|
||||
self.element.get_integer_attribute_for_layout(integer_attribute)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn get_content(content_list: &content::T) -> String {
|
||||
match *content_list {
|
||||
content::Content(ref value) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue