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

Implement sequential fallback to float speculation #13401

Merged
merged 3 commits into from Sep 29, 2016
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Add `util::clamp` function

  • Loading branch information
notriddle committed Sep 27, 2016
commit abe8c0d457e51940b85675fdd3679cc9fbca2e75
@@ -63,6 +63,7 @@ use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMod
use style::properties::ServoComputedValues;
use style::values::computed::{LengthOrNone, LengthOrPercentageOrNone};
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
use util::clamp;
use util::geometry::max_rect;

/// The number of screens of data we're allowed to generate display lists for in each direction.
@@ -1534,12 +1535,8 @@ impl BlockFlow {
box_sizing::T::content_box =>
size + self.fragment.border_padding.inline_start_end(),
}
} else if available_inline_size > max_inline_size {
max_inline_size
} else if available_inline_size < min_inline_size {
min_inline_size
} else {
available_inline_size
clamp(min_inline_size, available_inline_size, max_inline_size)
};

This comment has been minimized.

@pcwalton

pcwalton Sep 27, 2016

Contributor

Do we not have a clamp function for this?

This comment has been minimized.

@notriddle

notriddle Sep 27, 2016

Author Contributor

Not that I could find. I can add one, though.

This comment has been minimized.

@notriddle

notriddle Sep 27, 2016

Author Contributor

Done.

self.base.position.size.inline = inline_size + self.fragment.margin.inline_start_end();

@@ -44,3 +44,13 @@ pub fn servo_version() -> String {
None => format!("Servo {}", cargo_version),
}
}

pub fn clamp<T: Ord>(lo: T, mid: T, hi: T) -> T {
if mid < lo {
lo
} else if mid > hi {
hi
} else {
mid
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.