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 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 } else { | 657 } else { |
658 ASSERT(crossSizeLength.hasPercent()); | 658 ASSERT(crossSizeLength.hasPercent()); |
659 crossSize = hasOrthogonalFlow(child) ? | 659 crossSize = hasOrthogonalFlow(child) ? |
660 adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(crossSizeLeng
th, contentWidth())) : | 660 adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(crossSizeLeng
th, contentWidth())) : |
661 child.computePercentageLogicalHeight(crossSizeLength); | 661 child.computePercentageLogicalHeight(crossSizeLength); |
662 } | 662 } |
663 | 663 |
664 const LayoutSize& childIntrinsicSize = child.intrinsicSize(); | 664 const LayoutSize& childIntrinsicSize = child.intrinsicSize(); |
665 double ratio = childIntrinsicSize.width().toFloat() / childIntrinsicSize.hei
ght().toFloat(); | 665 double ratio = childIntrinsicSize.width().toFloat() / childIntrinsicSize.hei
ght().toFloat(); |
666 if (isHorizontalFlow()) | 666 if (isHorizontalFlow()) |
667 return crossSize * ratio; | 667 return LayoutUnit(crossSize * ratio); |
668 return crossSize / ratio; | 668 return LayoutUnit(crossSize / ratio); |
669 } | 669 } |
670 | 670 |
671 void LayoutFlexibleBox::setFlowAwareLocationForChild(LayoutBox& child, const Lay
outPoint& location) | 671 void LayoutFlexibleBox::setFlowAwareLocationForChild(LayoutBox& child, const Lay
outPoint& location) |
672 { | 672 { |
673 if (isHorizontalFlow()) | 673 if (isHorizontalFlow()) |
674 child.setLocationAndUpdateOverflowControlsIfNeeded(location); | 674 child.setLocationAndUpdateOverflowControlsIfNeeded(location); |
675 else | 675 else |
676 child.setLocationAndUpdateOverflowControlsIfNeeded(location.transposedPo
int()); | 676 child.setLocationAndUpdateOverflowControlsIfNeeded(location.transposedPo
int()); |
677 } | 677 } |
678 | 678 |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 bool LayoutFlexibleBox::resolveFlexibleLengths(FlexSign flexSign, const OrderedF
lexItemList& children, LayoutUnit availableFreeSpace, LayoutUnit& remainingFreeS
pace, double& totalFlexGrow, double& totalFlexShrink, double& totalWeightedFlexS
hrink, InflexibleFlexItemSize& inflexibleItems, Vector<LayoutUnit, 16>& childSiz
es) | 1092 bool LayoutFlexibleBox::resolveFlexibleLengths(FlexSign flexSign, const OrderedF
lexItemList& children, LayoutUnit availableFreeSpace, LayoutUnit& remainingFreeS
pace, double& totalFlexGrow, double& totalFlexShrink, double& totalWeightedFlexS
hrink, InflexibleFlexItemSize& inflexibleItems, Vector<LayoutUnit, 16>& childSiz
es) |
1093 { | 1093 { |
1094 childSizes.resize(0); | 1094 childSizes.resize(0); |
1095 LayoutUnit totalViolation; | 1095 LayoutUnit totalViolation; |
1096 LayoutUnit usedFreeSpace; | 1096 LayoutUnit usedFreeSpace; |
1097 Vector<Violation> minViolations; | 1097 Vector<Violation> minViolations; |
1098 Vector<Violation> maxViolations; | 1098 Vector<Violation> maxViolations; |
1099 | 1099 |
1100 double sumFlexFactors = (flexSign == PositiveFlexibility) ? totalFlexGrow :
totalFlexShrink; | 1100 double sumFlexFactors = (flexSign == PositiveFlexibility) ? totalFlexGrow :
totalFlexShrink; |
1101 if (sumFlexFactors > 0 && sumFlexFactors < 1) { | 1101 if (sumFlexFactors > 0 && sumFlexFactors < 1) { |
1102 LayoutUnit fractional = availableFreeSpace * sumFlexFactors; | 1102 LayoutUnit fractional(availableFreeSpace * sumFlexFactors); |
1103 if (fractional.abs() < remainingFreeSpace.abs()) | 1103 if (fractional.abs() < remainingFreeSpace.abs()) |
1104 remainingFreeSpace = fractional; | 1104 remainingFreeSpace = fractional; |
1105 } | 1105 } |
1106 | 1106 |
1107 for (size_t i = 0; i < children.size(); ++i) { | 1107 for (size_t i = 0; i < children.size(); ++i) { |
1108 LayoutBox* child = children[i]; | 1108 LayoutBox* child = children[i]; |
1109 if (child->isOutOfFlowPositioned()) { | 1109 if (child->isOutOfFlowPositioned()) { |
1110 childSizes.append(0); | 1110 childSizes.append(0); |
1111 continue; | 1111 continue; |
1112 } | 1112 } |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 ASSERT(child); | 1629 ASSERT(child); |
1630 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; | 1630 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; |
1631 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; | 1631 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; |
1632 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; | 1632 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; |
1633 adjustAlignmentForChild(*child, newOffset - originalOffset); | 1633 adjustAlignmentForChild(*child, newOffset - originalOffset); |
1634 } | 1634 } |
1635 } | 1635 } |
1636 } | 1636 } |
1637 | 1637 |
1638 } // namespace blink | 1638 } // namespace blink |
OLD | NEW |