Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

min/max-width/height, replaced elements #25207

Merged
merged 19 commits into from Dec 10, 2019
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a2c2b29
Move `clamp_*` functions to methods of `Length`
SimonSapin Dec 7, 2019
ce7e84b
Replace `percent_resolved_*` functions with methods
SimonSapin Dec 7, 2019
999dd72
Account for min/max-width in outer intrinsic sizing
SimonSapin Dec 7, 2019
bf96988
Add min/max-width/height support for `inline-block`
SimonSapin Dec 7, 2019
c40583b
Move replaced box used size computation to a method of `ReplacedConte…
SimonSapin Dec 7, 2019
b73eb49
Add sizing of inline replaced boxes
SimonSapin Dec 7, 2019
8996be3
Don’t assume replaced elements have an intrinsic size
SimonSapin Dec 7, 2019
80b2b5f
Fix min/max-content of replaced boxes
SimonSapin Dec 7, 2019
f43dc3a
Remove inline/block_size from AbsolutelyPositionedFragment
SimonSapin Dec 7, 2019
e86222d
Remove AbsoluteBoxOffsets’s type parameter
SimonSapin Dec 7, 2019
14ddf39
Rename ReplacedContent::used_size to used_size_as_if_inline_element
SimonSapin Dec 7, 2019
f09c14a
impl From<&'_ DefiniteContainingBlock> for ContainingBlock
SimonSapin Dec 7, 2019
1fcdde9
Move two AbsoluteBoxOffsets fields into a Vec2
SimonSapin Dec 7, 2019
1fa20e9
Implement replaced abspos
SimonSapin Dec 7, 2019
c07c980
Delayed initialization over mutation
SimonSapin Dec 8, 2019
2906722
Conditionsals over closures
SimonSapin Dec 8, 2019
be8df1d
Move `solve_axis` function to module level
SimonSapin Dec 8, 2019
a17db21
Struct with named fields over large tuple
SimonSapin Dec 8, 2019
53ce714
Fix a “Accessing content size that was not requested” panic
SimonSapin Dec 8, 2019
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Account for min/max-width in outer intrinsic sizing

  • Loading branch information
SimonSapin committed Dec 10, 2019
commit 999dd72895319ea8343d8799aec358b717fcbaa1
@@ -107,17 +107,37 @@ impl BoxContentSizes {
&self,
style: &ComputedValues,
) -> (ContentSizes, Percentage) {
// FIXME: account for 'min-width', 'max-width', 'box-sizing'

// FIXME: account for 'box-sizing'
let inline_size = style.box_size().inline;
let min_inline_size = style
.min_box_size()
.inline
.percentage_relative_to(Length::zero())
.auto_is(Length::zero);
let max_inline_size = style
.max_box_size()
.inline
.to_option()
.and_then(|lp| lp.as_length());
let clamp = |l: Length| l.clamp_between_extremums(min_inline_size, max_inline_size);

// Percentages for 'width' are treated as 'auto'
let inline_size = inline_size.map(|lp| lp.as_length());
// The (inner) min/max-content are only used for 'auto'
let mut outer = match inline_size.non_auto().flatten() {

This comment has been minimized.

Copy link
@nox

nox Dec 9, 2019

Member

Can't you use and_then to define inline_size and then remove the flatten call?

This comment has been minimized.

Copy link
@SimonSapin

SimonSapin Dec 9, 2019

Author Member

The call two lines above is LengthPercentageOrAuto::map, not Option::map. Maybe we should have LengthPercentageOrAuto::and_then that return Auto when its closure returns Option::None?

None => self.expect_inline().clone(),
Some(length) => ContentSizes {
min_content: length,
max_content: length,
None => {
let inner = self.expect_inline().clone();
ContentSizes {
min_content: clamp(inner.min_content),
max_content: clamp(inner.max_content),
}
},
Some(length) => {
let length = clamp(length);
ContentSizes {
min_content: length,
max_content: length,
}
},
};

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.