| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 child.computePercentageLogicalHeight(length) != -1; | 708 child.computePercentageLogicalHeight(length) != -1; |
| 709 } | 709 } |
| 710 // TODO(cbiesinger): Eventually we should support other types of sizes here.
Requires updating | 710 // TODO(cbiesinger): Eventually we should support other types of sizes here.
Requires updating |
| 711 // computeMainSizeFromAspectRatioUsing. | 711 // computeMainSizeFromAspectRatioUsing. |
| 712 return length.isFixed(); | 712 return length.isFixed(); |
| 713 } | 713 } |
| 714 | 714 |
| 715 bool LayoutFlexibleBox::childFlexBaseSizeRequiresLayout(const LayoutBox& child)
const | 715 bool LayoutFlexibleBox::childFlexBaseSizeRequiresLayout(const LayoutBox& child)
const |
| 716 { | 716 { |
| 717 return !mainAxisLengthIsDefinite(child, flexBasisForChild(child)) && ( | 717 return !mainAxisLengthIsDefinite(child, flexBasisForChild(child)) && ( |
| 718 hasOrthogonalFlow(child) || crossAxisOverflowForChild(child) == OAUTO); | 718 hasOrthogonalFlow(child) || crossAxisOverflowForChild(child) == Overflow
Auto); |
| 719 } | 719 } |
| 720 | 720 |
| 721 void LayoutFlexibleBox::cacheChildMainSize(const LayoutBox& child) | 721 void LayoutFlexibleBox::cacheChildMainSize(const LayoutBox& child) |
| 722 { | 722 { |
| 723 ASSERT(!child.needsLayout()); | 723 ASSERT(!child.needsLayout()); |
| 724 LayoutUnit mainSize; | 724 LayoutUnit mainSize; |
| 725 if (hasOrthogonalFlow(child)) { | 725 if (hasOrthogonalFlow(child)) { |
| 726 mainSize = child.logicalHeight(); | 726 mainSize = child.logicalHeight(); |
| 727 } else { | 727 } else { |
| 728 // The max preferred logical width includes the intrinsic scrollbar logi
cal width, which is only set for | 728 // The max preferred logical width includes the intrinsic scrollbar logi
cal width, which is only set for |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 childSize = maxExtent; | 987 childSize = maxExtent; |
| 988 } | 988 } |
| 989 | 989 |
| 990 Length min = isHorizontalFlow() ? child.style()->minWidth() : child.style()-
>minHeight(); | 990 Length min = isHorizontalFlow() ? child.style()->minWidth() : child.style()-
>minHeight(); |
| 991 LayoutUnit minExtent; | 991 LayoutUnit minExtent; |
| 992 if (min.isSpecifiedOrIntrinsic()) { | 992 if (min.isSpecifiedOrIntrinsic()) { |
| 993 minExtent = computeMainAxisExtentForChild(child, MinSize, min); | 993 minExtent = computeMainAxisExtentForChild(child, MinSize, min); |
| 994 // computeMainAxisExtentForChild can return -1 when the child has a perc
entage | 994 // computeMainAxisExtentForChild can return -1 when the child has a perc
entage |
| 995 // min size, but we have an indefinite size in that axis. | 995 // min size, but we have an indefinite size in that axis. |
| 996 minExtent = std::max(LayoutUnit(), minExtent); | 996 minExtent = std::max(LayoutUnit(), minExtent); |
| 997 } else if (min.isAuto() && mainAxisOverflowForChild(child) == OVISIBLE && !(
isColumnFlow() && child.isFlexibleBox())) { | 997 } else if (min.isAuto() && mainAxisOverflowForChild(child) == OverflowVisibl
e && !(isColumnFlow() && child.isFlexibleBox())) { |
| 998 // TODO(cbiesinger): For now, we do not handle min-height: auto for nest
ed column flexboxes. We need | 998 // TODO(cbiesinger): For now, we do not handle min-height: auto for nest
ed column flexboxes. We need |
| 999 // to implement https://drafts.csswg.org/css-flexbox/#intrinsic-sizes be
fore that produces | 999 // to implement https://drafts.csswg.org/css-flexbox/#intrinsic-sizes be
fore that produces |
| 1000 // reasonable results. Tracking bug: https://crbug.com/581553 | 1000 // reasonable results. Tracking bug: https://crbug.com/581553 |
| 1001 // css-flexbox section 4.5 | 1001 // css-flexbox section 4.5 |
| 1002 LayoutUnit contentSize = computeMainAxisExtentForChild(child, MinSize, L
ength(MinContent)); | 1002 LayoutUnit contentSize = computeMainAxisExtentForChild(child, MinSize, L
ength(MinContent)); |
| 1003 ASSERT(contentSize >= 0); | 1003 ASSERT(contentSize >= 0); |
| 1004 if (hasAspectRatio(child) && child.intrinsicSize().height() > 0) | 1004 if (hasAspectRatio(child) && child.intrinsicSize().height() > 0) |
| 1005 contentSize = adjustChildSizeForAspectRatioCrossAxisMinAndMax(child,
contentSize); | 1005 contentSize = adjustChildSizeForAspectRatioCrossAxisMinAndMax(child,
contentSize); |
| 1006 if (maxExtent != -1 && contentSize > maxExtent) | 1006 if (maxExtent != -1 && contentSize > maxExtent) |
| 1007 contentSize = maxExtent; | 1007 contentSize = maxExtent; |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 ASSERT(child); | 1735 ASSERT(child); |
| 1736 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; | 1736 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; |
| 1737 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; | 1737 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; |
| 1738 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; | 1738 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; |
| 1739 adjustAlignmentForChild(*child, newOffset - originalOffset); | 1739 adjustAlignmentForChild(*child, newOffset - originalOffset); |
| 1740 } | 1740 } |
| 1741 } | 1741 } |
| 1742 } | 1742 } |
| 1743 | 1743 |
| 1744 } // namespace blink | 1744 } // namespace blink |
| OLD | NEW |