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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 maxPreferredLogicalWidth += margin; | 109 maxPreferredLogicalWidth += margin; |
| 110 if (!isColumnFlow()) { | 110 if (!isColumnFlow()) { |
| 111 maxLogicalWidth += maxPreferredLogicalWidth; | 111 maxLogicalWidth += maxPreferredLogicalWidth; |
| 112 if (isMultiline()) { | 112 if (isMultiline()) { |
| 113 // For multiline, the min preferred width is if you put a break between each item. | 113 // For multiline, the min preferred width is if you put a break between each item. |
| 114 minLogicalWidth = std::max(minLogicalWidth, minPreferredLogicalW idth); | 114 minLogicalWidth = std::max(minLogicalWidth, minPreferredLogicalW idth); |
| 115 } else | 115 } else |
| 116 minLogicalWidth += minPreferredLogicalWidth; | 116 minLogicalWidth += minPreferredLogicalWidth; |
| 117 } else { | 117 } else { |
| 118 minLogicalWidth = std::max(minPreferredLogicalWidth, minLogicalWidth ); | 118 minLogicalWidth = std::max(minPreferredLogicalWidth, minLogicalWidth ); |
| 119 if (isMultiline()) { | 119 maxLogicalWidth = std::max(maxPreferredLogicalWidth, maxLogicalWidth ); |
| 120 // For multiline, the max preferred width is if you never break between items. | |
| 121 maxLogicalWidth += maxPreferredLogicalWidth; | |
| 122 } else | |
| 123 maxLogicalWidth = std::max(maxPreferredLogicalWidth, maxLogicalW idth); | |
| 124 } | 120 } |
| 125 } | 121 } |
| 126 | 122 |
| 127 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); | 123 maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); |
| 128 | 124 |
| 129 LayoutUnit scrollbarWidth = instrinsicScrollbarLogicalWidth(); | 125 LayoutUnit scrollbarWidth = instrinsicScrollbarLogicalWidth(); |
| 130 maxLogicalWidth += scrollbarWidth; | 126 maxLogicalWidth += scrollbarWidth; |
| 131 minLogicalWidth += scrollbarWidth; | 127 minLogicalWidth += scrollbarWidth; |
| 132 } | 128 } |
| 133 | 129 |
| (...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1112 LayoutUnit ascent = marginBoxAscentForChild(child); | 1108 LayoutUnit ascent = marginBoxAscentForChild(child); |
| 1113 LayoutUnit descent = (crossAxisMarginExtentForChild(child) + crossAx isExtentForChild(child)) - ascent; | 1109 LayoutUnit descent = (crossAxisMarginExtentForChild(child) + crossAx isExtentForChild(child)) - ascent; |
| 1114 | 1110 |
| 1115 maxAscent = std::max(maxAscent, ascent); | 1111 maxAscent = std::max(maxAscent, ascent); |
| 1116 maxDescent = std::max(maxDescent, descent); | 1112 maxDescent = std::max(maxDescent, descent); |
| 1117 | 1113 |
| 1118 childCrossAxisMarginBoxExtent = maxAscent + maxDescent; | 1114 childCrossAxisMarginBoxExtent = maxAscent + maxDescent; |
| 1119 } else { | 1115 } else { |
| 1120 childCrossAxisMarginBoxExtent = crossAxisIntrinsicExtentForChild(chi ld) + crossAxisMarginExtentForChild(child); | 1116 childCrossAxisMarginBoxExtent = crossAxisIntrinsicExtentForChild(chi ld) + crossAxisMarginExtentForChild(child); |
| 1121 } | 1117 } |
| 1122 if (!isColumnFlow()) | 1118 if (!isColumnFlow()) { |
| 1123 setLogicalHeight(std::max(logicalHeight(), crossAxisOffset + flowAwa reBorderAfter() + flowAwarePaddingAfter() + childCrossAxisMarginBoxExtent + cros sAxisScrollbarExtent())); | 1119 setLogicalHeight(std::max(logicalHeight(), crossAxisOffset + flowAwa reBorderAfter() + flowAwarePaddingAfter() + childCrossAxisMarginBoxExtent + cros sAxisScrollbarExtent())); |
| 1120 } else if (isMultiline() && !style()->logicalWidth().isSpecified()) { | |
|
tony
2014/07/21 17:50:59
I don't think this is correct. This part of the s
harpreet.sk
2014/07/22 10:10:23
Acknowledged.
| |
| 1121 LayoutUnit w = std::max(logicalWidth(), crossAxisOffset + flowAwareB orderAfter() + flowAwarePaddingAfter() + childCrossAxisMarginBoxExtent + crossAx isScrollbarExtent()); | |
| 1122 bool hasPerpendicularContainingBlock = containingBlock()->isHorizont alWritingMode() != isHorizontalWritingMode(); | |
| 1123 LayoutUnit containerWidthInInlineDirection = std::max<LayoutUnit>(0, containingBlockLogicalWidthForContent()); | |
| 1124 if (hasPerpendicularContainingBlock) | |
| 1125 containerWidthInInlineDirection = perpendicularContainingBlockLo gicalHeight(); | |
| 1126 setLogicalWidth(constrainLogicalWidthByMinMax(w, containerWidthInInl ineDirection, containingBlock())); | |
| 1127 } | |
| 1124 maxChildCrossAxisExtent = std::max(maxChildCrossAxisExtent, childCrossAx isMarginBoxExtent); | 1128 maxChildCrossAxisExtent = std::max(maxChildCrossAxisExtent, childCrossAx isMarginBoxExtent); |
| 1125 | 1129 |
| 1126 mainAxisOffset += flowAwareMarginStartForChild(child); | 1130 mainAxisOffset += flowAwareMarginStartForChild(child); |
| 1127 | 1131 |
| 1128 LayoutUnit childMainExtent = mainAxisExtentForChild(child); | 1132 LayoutUnit childMainExtent = mainAxisExtentForChild(child); |
| 1129 // In an RTL column situation, this will apply the margin-right/margin-e nd on the left. | 1133 // In an RTL column situation, this will apply the margin-right/margin-e nd on the left. |
| 1130 // This will be fixed later in flipForRightToLeftColumn. | 1134 // This will be fixed later in flipForRightToLeftColumn. |
| 1131 LayoutPoint childLocation(shouldFlipMainAxis ? totalMainExtent - mainAxi sOffset - childMainExtent : mainAxisOffset, | 1135 LayoutPoint childLocation(shouldFlipMainAxis ? totalMainExtent - mainAxi sOffset - childMainExtent : mainAxisOffset, |
| 1132 crossAxisOffset + flowAwareMarginBeforeForChild(child)); | 1136 crossAxisOffset + flowAwareMarginBeforeForChild(child)); |
| 1133 | 1137 |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1401 ASSERT(child); | 1405 ASSERT(child); |
| 1402 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; | 1406 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; |
| 1403 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; | 1407 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; |
| 1404 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; | 1408 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; |
| 1405 adjustAlignmentForChild(child, newOffset - originalOffset); | 1409 adjustAlignmentForChild(child, newOffset - originalOffset); |
| 1406 } | 1410 } |
| 1407 } | 1411 } |
| 1408 } | 1412 } |
| 1409 | 1413 |
| 1410 } | 1414 } |
| OLD | NEW |