servo: Merge #3272 - Fix layout of Create Account / Login when rendering Wikipedia (from glennw:wikipedia-layout)

Source-Repo: https://github.com/servo/servo
Source-Revision: db3217397b21cae9d1a9ab209b5718aa9c4d72aa
This commit is contained in:
Glenn Watson 2014-09-10 19:18:43 +10:00
Родитель f34eb13e4d
Коммит f2cd48f800
2 изменённых файлов: 31 добавлений и 3 удалений

Просмотреть файл

@ -1448,6 +1448,10 @@ impl Flow for BlockFlow {
self.fragment.style().get_box().clear
}
fn float_kind(&self) -> float::T {
self.fragment.style().get_box().float
}
/// 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
@ -1473,25 +1477,45 @@ impl Flow for BlockFlow {
// Find the maximum inline-size from children.
let mut intrinsic_inline_sizes = IntrinsicISizes::new();
let mut left_float_width = Au(0);
let mut right_float_width = Au(0);
for child_ctx in self.base.child_iter() {
assert!(child_ctx.is_block_flow() ||
child_ctx.is_inline_flow() ||
child_ctx.is_table_kind());
let float_kind = child_ctx.float_kind();
let child_base = flow::mut_base(child_ctx);
if !fixed_width {
intrinsic_inline_sizes.minimum_inline_size =
geometry::max(intrinsic_inline_sizes.minimum_inline_size,
child_base.intrinsic_inline_sizes.total_minimum_inline_size());
intrinsic_inline_sizes.preferred_inline_size =
geometry::max(intrinsic_inline_sizes.preferred_inline_size,
match float_kind {
float::none => {
intrinsic_inline_sizes.preferred_inline_size =
geometry::max(intrinsic_inline_sizes.preferred_inline_size,
child_base.intrinsic_inline_sizes.total_preferred_inline_size());
}
float::left => {
left_float_width = left_float_width +
child_base.intrinsic_inline_sizes.total_preferred_inline_size();
}
float::right => {
right_float_width = right_float_width +
child_base.intrinsic_inline_sizes.total_preferred_inline_size();
}
}
}
flags.union_floated_descendants_flags(child_base.flags);
}
intrinsic_inline_sizes.preferred_inline_size =
geometry::max(intrinsic_inline_sizes.preferred_inline_size,
left_float_width + right_float_width);
let fragment_intrinsic_inline_sizes = self.fragment.intrinsic_inline_sizes();
intrinsic_inline_sizes.minimum_inline_size = geometry::max(intrinsic_inline_sizes.minimum_inline_size,
fragment_intrinsic_inline_sizes.minimum_inline_size);

Просмотреть файл

@ -61,7 +61,7 @@ use std::iter::Zip;
use std::raw;
use std::sync::atomics::{AtomicUint, Relaxed, SeqCst};
use std::slice::MutItems;
use style::computed_values::{clear, position, text_align};
use style::computed_values::{clear, float, position, text_align};
/// Virtual methods that make up a float context.
///
@ -195,6 +195,10 @@ pub trait Flow: fmt::Show + ToString + Share {
clear::none
}
fn float_kind(&self) -> float::T {
float::none
}
/// Returns true if this float is a block formatting context and false otherwise. The default
/// implementation returns false.
fn is_block_formatting_context(&self, _only_impactable_by_floats: bool) -> bool {