mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Handle floats in BlockContainer::inline_content_sizes
Typically, block-level contents are stacked vertically, so this was just taking the maximum size among all contents. However, floats can be stacked horizontally, so we need to sum their sizes.
This commit is contained in:
parent
47fb54fc54
commit
4ec6dd1783
4 changed files with 112 additions and 28 deletions
|
@ -33,13 +33,20 @@ impl ContentSizes {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn max(self, other: Self) -> Self {
|
||||
pub fn max(&self, other: Self) -> Self {
|
||||
Self {
|
||||
min_content: self.min_content.max(other.min_content),
|
||||
max_content: self.max_content.max(other.max_content),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add(&self, other: &Self) -> Self {
|
||||
Self {
|
||||
min_content: self.min_content.max(other.min_content),
|
||||
max_content: self.max_content + other.max_content,
|
||||
}
|
||||
}
|
||||
|
||||
/// Relevant to outer intrinsic inline sizes, for percentages from padding and margin.
|
||||
pub fn adjust_for_pbm_percentages(&mut self, percentages: Percentage) {
|
||||
// " Note that this may yield an infinite result, but undefined results
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue