Improvements in FlexLayout "stretch" cross-axis alignment handling.
Previously, a child view with a very large cross-axis size would cause a layout with cross-axis alignment set to "stretch" to become larger, so child views would be stretched to a size larger than the host view, cutting off the trailing end of the child views. Now, when the cross-axis alignment is set to stretch and a cross-axis size is specified, the layout will be exactly that large in the cross-axis dimension. The only exception is if a minimum cross-axis size is specified, or the interior margines would be too large to fit in the available space. Example: Vertical layout with cross-axis set to stretch. Host view width = 100. Two child views, one with a width of 120, the other with a width of 50. In the old behavior, the first child would force the layout to 120 DIPs and both views would stretch to that size. +-------------------+ | Host view | |+-----------------------+ || Child view 1 | |+-----------------------+ |+-----------------------+ || Child view 2 | |+-----------------------+ +-------------------+ In the new behavior, the layout would be forced to fit in exactly the size of the host view, setting them both to 100 DIPs. +-------------------+ | Host view | |+-----------------+| || Child view 1 || |+-----------------+| |+-----------------+| || Child view 2 || |+-----------------+| +-------------------+ In nearly all cases, this second behavior is the intended one when stretch is specified, hence the change. Still to do: properly handle GetHeightForWidth() in this case, but that only affects vertical layouts with multiline text and so far there are no known examples using FlexLayout. Bug: 930500 Change-Id: I44aa75051406628210751cd1a36040def47996b4 Reviewed-on: https://chromium-review.googlesource.com/c/1461829 Commit-Queue: Dana Fried <dfried@chromium.org> Reviewed-by:Bret Sepulveda <bsep@chromium.org> Cr-Commit-Position: refs/heads/master@{#631485}
Showing
This diff is collapsed.
Please register or sign in to comment