mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Merge pull request #3272 from glennw/wikipedia-layout
Fix layout of Create Account / Login when rendering Wikipedia.
This commit is contained in:
commit
db3217397b
5 changed files with 83 additions and 3 deletions
|
@ -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 {
|
||||
|
|
30
tests/ref/abs_float_pref_width_a.html
Normal file
30
tests/ref/abs_float_pref_width_a.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: 'ahem';
|
||||
src: url(fonts/ahem/ahem.ttf);
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'ahem';
|
||||
font-size: 100px;
|
||||
color: green;
|
||||
}
|
||||
div {
|
||||
position: absolute;
|
||||
left: 100px;
|
||||
}
|
||||
span {
|
||||
float: left;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<span>X</span>
|
||||
<span>X</span>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
21
tests/ref/abs_float_pref_width_ref.html
Normal file
21
tests/ref/abs_float_pref_width_ref.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
div {
|
||||
position: absolute;
|
||||
left: 100px;
|
||||
width: 200px;
|
||||
height: 100px;
|
||||
background-color: green;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -110,3 +110,4 @@ flaky_gpu,flaky_linux == acid2_noscroll.html acid2_ref_broken.html
|
|||
== float_intrinsic_width_a.html float_intrinsic_width_ref.html
|
||||
== float_right_intrinsic_width_a.html float_right_intrinsic_width_ref.html
|
||||
== fixed_width_overrides_child_intrinsic_width_a.html fixed_width_overrides_child_intrinsic_width_ref.html
|
||||
== abs_float_pref_width_a.html abs_float_pref_width_ref.html
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue