mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Fix percentage height calculation, absolute containing block height calculations.
It's not possible to correctly determine during the css cascade whether the container height is explicitly specified. Additionally, the spec https://drafts.csswg.org/css2/visudet.html#the-height-property says this should affect the *used* height, rather than the computed height. This significantly improves the layout in #6643.
This commit is contained in:
parent
ffe4bd25a4
commit
b9fea3deb3
10 changed files with 151 additions and 119 deletions
|
@ -1389,7 +1389,7 @@ impl ContainingBlockLink {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn generated_containing_block_size(&mut self, for_flow: OpaqueFlow) -> LogicalSize<Au> {
|
||||
pub fn generated_containing_block_size(&self, for_flow: OpaqueFlow) -> LogicalSize<Au> {
|
||||
match self.link {
|
||||
None => {
|
||||
panic!("Link to containing block not established; perhaps you forgot to call \
|
||||
|
@ -1398,6 +1398,24 @@ impl ContainingBlockLink {
|
|||
Some(ref link) => link.upgrade().unwrap().generated_containing_block_size(for_flow),
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn explicit_block_containing_size(&self, layout_context: &LayoutContext) -> Option<Au> {
|
||||
match self.link {
|
||||
None => {
|
||||
panic!("Link to containing block not established; perhaps you forgot to call \
|
||||
`set_absolute_descendants`?")
|
||||
}
|
||||
Some(ref link) => {
|
||||
let flow = link.upgrade().unwrap();
|
||||
if flow.is_block_like() {
|
||||
flow.as_immutable_block().explicit_block_containing_size(layout_context)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A wrapper for the pointer address of a flow. These pointer addresses may only be compared for
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue