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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 flexLength = | 477 flexLength = |
478 isHorizontalFlow() ? child.style()->width() : child.style()->height(); | 478 isHorizontalFlow() ? child.style()->width() : child.style()->height(); |
479 return flexLength; | 479 return flexLength; |
480 } | 480 } |
481 | 481 |
482 LayoutUnit LayoutFlexibleBox::crossAxisExtentForChild( | 482 LayoutUnit LayoutFlexibleBox::crossAxisExtentForChild( |
483 const LayoutBox& child) const { | 483 const LayoutBox& child) const { |
484 return isHorizontalFlow() ? child.size().height() : child.size().width(); | 484 return isHorizontalFlow() ? child.size().height() : child.size().width(); |
485 } | 485 } |
486 | 486 |
487 static inline LayoutUnit constrainedChildIntrinsicContentLogicalHeight( | |
488 const LayoutBox& child, | |
489 LayoutUnit childIntrinsicContentLogicalHeight) { | |
490 // TODO(cbiesinger): scrollbar height? | |
491 return child.constrainLogicalHeightByMinMax( | |
492 childIntrinsicContentLogicalHeight + | |
493 child.borderAndPaddingLogicalHeight(), | |
494 childIntrinsicContentLogicalHeight); | |
495 } | |
496 | |
497 LayoutUnit LayoutFlexibleBox::childIntrinsicLogicalHeight( | 487 LayoutUnit LayoutFlexibleBox::childIntrinsicLogicalHeight( |
498 const LayoutBox& child) const { | 488 const LayoutBox& child) const { |
499 // This should only be called if the logical height is the cross size | 489 // This should only be called if the logical height is the cross size |
500 DCHECK(!hasOrthogonalFlow(child)); | 490 DCHECK(!hasOrthogonalFlow(child)); |
501 if (needToStretchChildLogicalHeight(child)) { | 491 if (needToStretchChildLogicalHeight(child)) { |
502 LayoutUnit childIntrinsicContentLogicalHeight; | 492 LayoutUnit childIntrinsicContentLogicalHeight; |
503 if (!child.styleRef().containsSize()) | 493 if (!child.styleRef().containsSize()) { |
504 childIntrinsicContentLogicalHeight = | 494 childIntrinsicContentLogicalHeight = |
505 child.intrinsicContentLogicalHeight(); | 495 child.intrinsicContentLogicalHeight(); |
506 return constrainedChildIntrinsicContentLogicalHeight( | 496 } |
507 child, childIntrinsicContentLogicalHeight); | 497 LayoutUnit childIntrinsicLogicalHeight = |
| 498 childIntrinsicContentLogicalHeight + child.scrollbarLogicalHeight() + |
| 499 child.borderAndPaddingLogicalHeight(); |
| 500 return child.constrainLogicalHeightByMinMax( |
| 501 childIntrinsicLogicalHeight, childIntrinsicContentLogicalHeight); |
508 } | 502 } |
509 return child.logicalHeight(); | 503 return child.logicalHeight(); |
510 } | 504 } |
511 | 505 |
512 DISABLE_CFI_PERF | 506 DISABLE_CFI_PERF |
513 LayoutUnit LayoutFlexibleBox::childIntrinsicLogicalWidth( | 507 LayoutUnit LayoutFlexibleBox::childIntrinsicLogicalWidth( |
514 const LayoutBox& child) const { | 508 const LayoutBox& child) const { |
515 // This should only be called if the logical width is the cross size | 509 // This should only be called if the logical width is the cross size |
516 DCHECK(hasOrthogonalFlow(child)); | 510 DCHECK(hasOrthogonalFlow(child)); |
517 // If our height is auto, make sure that our returned height is unaffected by | 511 // If our height is auto, make sure that our returned height is unaffected by |
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1831 crossAxisExtentForChild(*child)) - | 1825 crossAxisExtentForChild(*child)) - |
1832 ascent; | 1826 ascent; |
1833 | 1827 |
1834 maxAscent = std::max(maxAscent, ascent); | 1828 maxAscent = std::max(maxAscent, ascent); |
1835 maxDescent = std::max(maxDescent, descent); | 1829 maxDescent = std::max(maxDescent, descent); |
1836 | 1830 |
1837 // TODO(cbiesinger): Take scrollbar into account | 1831 // TODO(cbiesinger): Take scrollbar into account |
1838 childCrossAxisMarginBoxExtent = maxAscent + maxDescent; | 1832 childCrossAxisMarginBoxExtent = maxAscent + maxDescent; |
1839 } else { | 1833 } else { |
1840 childCrossAxisMarginBoxExtent = crossAxisIntrinsicExtentForChild(*child) + | 1834 childCrossAxisMarginBoxExtent = crossAxisIntrinsicExtentForChild(*child) + |
1841 crossAxisMarginExtentForChild(*child) + | 1835 crossAxisMarginExtentForChild(*child); |
1842 crossAxisScrollbarExtentForChild(*child); | |
1843 } | 1836 } |
1844 if (!isColumnFlow()) | 1837 if (!isColumnFlow()) |
1845 setLogicalHeight(std::max( | 1838 setLogicalHeight(std::max( |
1846 logicalHeight(), | 1839 logicalHeight(), |
1847 crossAxisOffset + flowAwareBorderAfter() + flowAwarePaddingAfter() + | 1840 crossAxisOffset + flowAwareBorderAfter() + flowAwarePaddingAfter() + |
1848 childCrossAxisMarginBoxExtent + crossAxisScrollbarExtent())); | 1841 childCrossAxisMarginBoxExtent + crossAxisScrollbarExtent())); |
1849 maxChildCrossAxisExtent = | 1842 maxChildCrossAxisExtent = |
1850 std::max(maxChildCrossAxisExtent, childCrossAxisMarginBoxExtent); | 1843 std::max(maxChildCrossAxisExtent, childCrossAxisMarginBoxExtent); |
1851 | 1844 |
1852 mainAxisOffset += flowAwareMarginStartForChild(*child); | 1845 mainAxisOffset += flowAwareMarginStartForChild(*child); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2170 LayoutUnit originalOffset = | 2163 LayoutUnit originalOffset = |
2171 lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; | 2164 lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; |
2172 LayoutUnit newOffset = | 2165 LayoutUnit newOffset = |
2173 contentExtent - originalOffset - lineCrossAxisExtent; | 2166 contentExtent - originalOffset - lineCrossAxisExtent; |
2174 adjustAlignmentForChild(*flexItem.box, newOffset - originalOffset); | 2167 adjustAlignmentForChild(*flexItem.box, newOffset - originalOffset); |
2175 } | 2168 } |
2176 } | 2169 } |
2177 } | 2170 } |
2178 | 2171 |
2179 } // namespace blink | 2172 } // namespace blink |
OLD | NEW |