зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #7256 - layout: Use the value of the `max-width` property when speculating what the inline sizes of block formatting contexts are likely to be (from pcwalton:block-formatting-contexts-max-width); r=mbrubeck
Usually, Web developers set this property on block formatting contexts in order to avoid running into floats, and we can use this as a speculation hint. Fixes the width of the search box on the Google SERPs. r? @mbrubeck Source-Repo: https://github.com/servo/servo Source-Revision: 19d466b06250f10169e88fc7f0b447c7f2f8209e
This commit is contained in:
Родитель
3c5a2d72f0
Коммит
467ea4b992
|
@ -1639,10 +1639,16 @@ impl Flow for BlockFlow {
|
|||
// We can't actually compute the inline-size of this block now, because floats
|
||||
// might affect it. Speculate that its inline-size is equal to the inline-size
|
||||
// computed above minus the inline-size of the previous left and/or right floats.
|
||||
self.fragment.border_box.size.inline =
|
||||
self.fragment.border_box.size.inline -
|
||||
self.inline_size_of_preceding_left_floats -
|
||||
self.inline_size_of_preceding_right_floats;
|
||||
//
|
||||
// (If `max-width` is set, then don't perform this speculation. We guess that the
|
||||
// page set `max-width` in order to avoid hitting floats. The search box on Google
|
||||
// SERPs falls into this category.)
|
||||
if self.fragment.style.max_inline_size() == LengthOrPercentageOrNone::None {
|
||||
self.fragment.border_box.size.inline =
|
||||
self.fragment.border_box.size.inline -
|
||||
self.inline_size_of_preceding_left_floats -
|
||||
self.inline_size_of_preceding_right_floats;
|
||||
}
|
||||
}
|
||||
FormattingContextType::Other => {
|
||||
self.base.flags.remove(IMPACTED_BY_LEFT_FLOATS);
|
||||
|
|
Загрузка…
Ссылка в новой задаче