Chromium Code Reviews| 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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1019 transferredSize = adjustChildSizeForAspectRatioCrossAxisMinAndMax(ch ild, transferredSize); | 1019 transferredSize = adjustChildSizeForAspectRatioCrossAxisMinAndMax(ch ild, transferredSize); |
| 1020 minExtent = std::min(transferredSize, contentSize); | 1020 minExtent = std::min(transferredSize, contentSize); |
| 1021 } else { | 1021 } else { |
| 1022 minExtent = contentSize; | 1022 minExtent = contentSize; |
| 1023 } | 1023 } |
| 1024 } | 1024 } |
| 1025 ASSERT(minExtent >= 0); | 1025 ASSERT(minExtent >= 0); |
| 1026 return std::max(childSize, minExtent); | 1026 return std::max(childSize, minExtent); |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 LayoutUnit LayoutFlexibleBox::crossSizeForPercentageResolution(const LayoutBox& child) | |
| 1030 { | |
| 1031 if (isMultiline() || alignmentForChild(child) != ItemPositionStretch || hasA utoMarginsInCrossAxis(child)) | |
|
leviw_travelin_and_unemployed
2016/03/01 23:53:56
Is there a part of the spec that specifically ment
cbiesinger
2016/03/02 03:19:37
Done.
| |
| 1032 return LayoutUnit(-1); | |
| 1033 | |
| 1034 const Length& childCrossLength = isHorizontalFlow() ? child.styleRef().heigh t() : child.styleRef().width(); | |
| 1035 if (crossAxisLengthIsDefinite(child, childCrossLength)) | |
| 1036 return LayoutUnit(-1); | |
| 1037 | |
| 1038 LayoutUnit childCrossSize; | |
| 1039 | |
| 1040 LogicalExtentComputedValues computedValues; | |
| 1041 if (isColumnFlow()) { | |
| 1042 const Length& widthLength = styleRef().logicalWidth(); | |
| 1043 if (widthLength.isAuto() || (widthLength.hasPercent() && !hasDefiniteLog icalWidth())) | |
| 1044 return LayoutUnit(-1); | |
| 1045 | |
| 1046 computeLogicalWidth(computedValues); | |
| 1047 if (computedValues.m_extent == LayoutUnit(-1)) | |
| 1048 return LayoutUnit(-1); | |
| 1049 childCrossSize = computedValues.m_extent - borderAndPaddingLogicalWidth( ) - scrollbarLogicalWidth(); | |
| 1050 childCrossSize = child.constrainLogicalWidthByMinMax(childCrossSize, chi ldCrossSize, this) - child.scrollbarLogicalWidth() - child.borderAndPaddingLogic alWidth(); | |
| 1051 } else { | |
| 1052 const Length& heightLength = styleRef().logicalHeight(); | |
| 1053 if (heightLength.isAuto() || (heightLength.hasPercent() && computePercen tageLogicalHeight(heightLength) == -1)) | |
| 1054 return LayoutUnit(-1); | |
| 1055 | |
| 1056 computeLogicalHeight(LayoutUnit(-1), LayoutUnit(), computedValues); | |
| 1057 childCrossSize = computedValues.m_extent - borderAndPaddingLogicalHeight () - scrollbarLogicalHeight(); | |
| 1058 childCrossSize = child.constrainLogicalHeightByMinMax(childCrossSize, La youtUnit(-1)) - child.scrollbarLogicalHeight() - child.borderAndPaddingLogicalHe ight(); | |
| 1059 } | |
| 1060 return childCrossSize; | |
| 1061 } | |
| 1062 | |
| 1063 LayoutUnit LayoutFlexibleBox::childLogicalHeightForPercentageResolution(const La youtBox& child) | |
| 1064 { | |
| 1065 if (!hasOrthogonalFlow(child)) | |
| 1066 return crossSizeForPercentageResolution(child); | |
| 1067 return LayoutUnit(-1); | |
| 1068 } | |
| 1069 | |
| 1070 LayoutUnit LayoutFlexibleBox::childLogicalWidthForPercentageResolution(const Lay outBox& child) | |
| 1071 { | |
| 1072 if (hasOrthogonalFlow(child)) | |
| 1073 return crossSizeForPercentageResolution(child); | |
| 1074 return LayoutUnit(-1); | |
| 1075 } | |
| 1076 | |
| 1029 LayoutUnit LayoutFlexibleBox::adjustChildSizeForAspectRatioCrossAxisMinAndMax(co nst LayoutBox& child, LayoutUnit childSize) | 1077 LayoutUnit LayoutFlexibleBox::adjustChildSizeForAspectRatioCrossAxisMinAndMax(co nst LayoutBox& child, LayoutUnit childSize) |
| 1030 { | 1078 { |
| 1031 Length crossMin = isHorizontalFlow() ? child.style()->minHeight() : child.st yle()->minWidth(); | 1079 Length crossMin = isHorizontalFlow() ? child.style()->minHeight() : child.st yle()->minWidth(); |
| 1032 Length crossMax = isHorizontalFlow() ? child.style()->maxHeight() : child.st yle()->maxWidth(); | 1080 Length crossMax = isHorizontalFlow() ? child.style()->maxHeight() : child.st yle()->maxWidth(); |
| 1033 | 1081 |
| 1034 | 1082 |
| 1035 if (crossAxisLengthIsDefinite(child, crossMax)) { | 1083 if (crossAxisLengthIsDefinite(child, crossMax)) { |
| 1036 LayoutUnit maxValue = computeMainSizeFromAspectRatioUsing(child, crossMa x); | 1084 LayoutUnit maxValue = computeMainSizeFromAspectRatioUsing(child, crossMa x); |
| 1037 childSize = std::min(maxValue, childSize); | 1085 childSize = std::min(maxValue, childSize); |
| 1038 } | 1086 } |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1662 ASSERT(child); | 1710 ASSERT(child); |
| 1663 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; | 1711 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; |
| 1664 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; | 1712 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; |
| 1665 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; | 1713 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; |
| 1666 adjustAlignmentForChild(*child, newOffset - originalOffset); | 1714 adjustAlignmentForChild(*child, newOffset - originalOffset); |
| 1667 } | 1715 } |
| 1668 } | 1716 } |
| 1669 } | 1717 } |
| 1670 | 1718 |
| 1671 } // namespace blink | 1719 } // namespace blink |
| OLD | NEW |