| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
| 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 break; | 727 break; |
| 728 case ReflectionRight: | 728 case ReflectionRight: |
| 729 result.setX(box.maxX() + reflectionOffset() + (box.maxX() - r.maxX())); | 729 result.setX(box.maxX() + reflectionOffset() + (box.maxX() - r.maxX())); |
| 730 break; | 730 break; |
| 731 } | 731 } |
| 732 return result; | 732 return result; |
| 733 } | 733 } |
| 734 | 734 |
| 735 int LayoutBox::verticalScrollbarWidth() const | 735 int LayoutBox::verticalScrollbarWidth() const |
| 736 { | 736 { |
| 737 if (!hasOverflowClip() || style()->overflowY() == OOVERLAY) | 737 if (!hasOverflowClip() || style()->overflowY() == OverflowOverlay) |
| 738 return 0; | 738 return 0; |
| 739 | 739 |
| 740 return scrollableArea()->verticalScrollbarWidth(); | 740 return scrollableArea()->verticalScrollbarWidth(); |
| 741 } | 741 } |
| 742 | 742 |
| 743 int LayoutBox::horizontalScrollbarHeight() const | 743 int LayoutBox::horizontalScrollbarHeight() const |
| 744 { | 744 { |
| 745 if (!hasOverflowClip() || style()->overflowX() == OOVERLAY) | 745 if (!hasOverflowClip() || style()->overflowX() == OverflowOverlay) |
| 746 return 0; | 746 return 0; |
| 747 | 747 |
| 748 return scrollableArea()->horizontalScrollbarHeight(); | 748 return scrollableArea()->horizontalScrollbarHeight(); |
| 749 } | 749 } |
| 750 | 750 |
| 751 int LayoutBox::intrinsicScrollbarLogicalWidth() const | 751 int LayoutBox::intrinsicScrollbarLogicalWidth() const |
| 752 { | 752 { |
| 753 if (!hasOverflowClip()) | 753 if (!hasOverflowClip()) |
| 754 return 0; | 754 return 0; |
| 755 | 755 |
| 756 ASSERT(scrollableArea()); | 756 ASSERT(scrollableArea()); |
| 757 | 757 |
| 758 if (isHorizontalWritingMode() && style()->overflowY() == OSCROLL) { | 758 if (isHorizontalWritingMode() && style()->overflowY() == OverflowScroll) { |
| 759 // Even with OSCROLL, the scrollbar may not exist (crbug.com/415031). | 759 // Even with OverflowScroll, the scrollbar may not exist (crbug.com/4150
31). |
| 760 return scrollableArea()->hasVerticalScrollbar() ? verticalScrollbarWidth
() : 0; | 760 return scrollableArea()->hasVerticalScrollbar() ? verticalScrollbarWidth
() : 0; |
| 761 } | 761 } |
| 762 | 762 |
| 763 if (!isHorizontalWritingMode() && style()->overflowX() == OSCROLL) { | 763 if (!isHorizontalWritingMode() && style()->overflowX() == OverflowScroll) { |
| 764 // Even with OSCROLL, the scrollbar may not exist (crbug.com/415031). | 764 // Even with OverflowScroll, the scrollbar may not exist (crbug.com/4150
31). |
| 765 return scrollableArea()->hasHorizontalScrollbar() ? horizontalScrollbarH
eight() : 0; | 765 return scrollableArea()->hasHorizontalScrollbar() ? horizontalScrollbarH
eight() : 0; |
| 766 } | 766 } |
| 767 | 767 |
| 768 return 0; | 768 return 0; |
| 769 } | 769 } |
| 770 | 770 |
| 771 ScrollResult LayoutBox::scroll(ScrollGranularity granularity, const FloatSize& d
elta) | 771 ScrollResult LayoutBox::scroll(ScrollGranularity granularity, const FloatSize& d
elta) |
| 772 { | 772 { |
| 773 // Presumably the same issue as in setScrollTop. See crbug.com/343132. | 773 // Presumably the same issue as in setScrollTop. See crbug.com/343132. |
| 774 DisableCompositingQueryAsserts disabler; | 774 DisableCompositingQueryAsserts disabler; |
| (...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2072 computedValues.m_margins.m_start = minimumValueForLength(styleToUse.marg
inStart(), containerLogicalWidth); | 2072 computedValues.m_margins.m_start = minimumValueForLength(styleToUse.marg
inStart(), containerLogicalWidth); |
| 2073 computedValues.m_margins.m_end = minimumValueForLength(styleToUse.margin
End(), containerLogicalWidth); | 2073 computedValues.m_margins.m_end = minimumValueForLength(styleToUse.margin
End(), containerLogicalWidth); |
| 2074 if (treatAsReplaced) | 2074 if (treatAsReplaced) |
| 2075 computedValues.m_extent = std::max(LayoutUnit(floatValueForLength(lo
gicalWidthLength, 0)) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth
()); | 2075 computedValues.m_extent = std::max(LayoutUnit(floatValueForLength(lo
gicalWidthLength, 0)) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth
()); |
| 2076 return; | 2076 return; |
| 2077 } | 2077 } |
| 2078 | 2078 |
| 2079 // Width calculations | 2079 // Width calculations |
| 2080 if (treatAsReplaced) { | 2080 if (treatAsReplaced) { |
| 2081 computedValues.m_extent = LayoutUnit(logicalWidthLength.value()) + borde
rAndPaddingLogicalWidth(); | 2081 computedValues.m_extent = LayoutUnit(logicalWidthLength.value()) + borde
rAndPaddingLogicalWidth(); |
| 2082 } else if (parent()->isLayoutGrid() && style()->logicalWidth().isAuto() && s
tyle()->logicalMinWidth().isAuto() && style()->overflowX() == OVISIBLE && contai
nerLogicalWidth < minPreferredLogicalWidth()) { | 2082 } else if (parent()->isLayoutGrid() && style()->logicalWidth().isAuto() && s
tyle()->logicalMinWidth().isAuto() && style()->overflowX() == OverflowVisible &&
containerLogicalWidth < minPreferredLogicalWidth()) { |
| 2083 // TODO (lajava) Move this logic to the LayoutGrid class. | 2083 // TODO (lajava) Move this logic to the LayoutGrid class. |
| 2084 // Implied minimum size of Grid items. | 2084 // Implied minimum size of Grid items. |
| 2085 computedValues.m_extent = constrainLogicalWidthByMinMax(minPreferredLogi
calWidth(), containerLogicalWidth, cb); | 2085 computedValues.m_extent = constrainLogicalWidthByMinMax(minPreferredLogi
calWidth(), containerLogicalWidth, cb); |
| 2086 } else { | 2086 } else { |
| 2087 LayoutUnit containerWidthInInlineDirection = containerLogicalWidth; | 2087 LayoutUnit containerWidthInInlineDirection = containerLogicalWidth; |
| 2088 if (hasPerpendicularContainingBlock) { | 2088 if (hasPerpendicularContainingBlock) { |
| 2089 containerWidthInInlineDirection = perpendicularContainingBlockLogica
lHeight(); | 2089 containerWidthInInlineDirection = perpendicularContainingBlockLogica
lHeight(); |
| 2090 } else if (cb->isFlexItem() && styleToUse.logicalWidth().hasPercent() &&
!isOutOfFlowPositioned()) { | 2090 } else if (cb->isFlexItem() && styleToUse.logicalWidth().hasPercent() &&
!isOutOfFlowPositioned()) { |
| 2091 LayoutUnit stretchedWidth = toLayoutFlexibleBox(cb->parent())->child
LogicalWidthForPercentageResolution(*cb); | 2091 LayoutUnit stretchedWidth = toLayoutFlexibleBox(cb->parent())->child
LogicalWidthForPercentageResolution(*cb); |
| 2092 if (stretchedWidth != LayoutUnit(-1)) | 2092 if (stretchedWidth != LayoutUnit(-1)) |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2413 bool stretching = parent()->style()->boxAlign() == BSTRETCH; | 2413 bool stretching = parent()->style()->boxAlign() == BSTRETCH; |
| 2414 bool treatAsReplaced = shouldComputeSizeAsReplaced() && (!inHorizontalBo
x || !stretching); | 2414 bool treatAsReplaced = shouldComputeSizeAsReplaced() && (!inHorizontalBo
x || !stretching); |
| 2415 bool checkMinMaxHeight = false; | 2415 bool checkMinMaxHeight = false; |
| 2416 | 2416 |
| 2417 // The parent box is flexing us, so it has increased or decreased our he
ight. We have to | 2417 // The parent box is flexing us, so it has increased or decreased our he
ight. We have to |
| 2418 // grab our cached flexible height. | 2418 // grab our cached flexible height. |
| 2419 // FIXME: Account for writing-mode in flexible boxes. | 2419 // FIXME: Account for writing-mode in flexible boxes. |
| 2420 // https://bugs.webkit.org/show_bug.cgi?id=46418 | 2420 // https://bugs.webkit.org/show_bug.cgi?id=46418 |
| 2421 if (hasOverrideLogicalContentHeight()) { | 2421 if (hasOverrideLogicalContentHeight()) { |
| 2422 LayoutUnit contentHeight = overrideLogicalContentHeight(); | 2422 LayoutUnit contentHeight = overrideLogicalContentHeight(); |
| 2423 if (parent()->isLayoutGrid() && style()->logicalMinHeight().isAuto()
&& style()->overflowY() == OVISIBLE) { | 2423 if (parent()->isLayoutGrid() && style()->logicalMinHeight().isAuto()
&& style()->overflowY() == OverflowVisible) { |
| 2424 ASSERT(style()->logicalHeight().isAuto()); | 2424 ASSERT(style()->logicalHeight().isAuto()); |
| 2425 LayoutUnit minContentHeight = computeContentLogicalHeight(MinSiz
e, Length(MinContent), computedValues.m_extent - borderAndPaddingLogicalHeight()
); | 2425 LayoutUnit minContentHeight = computeContentLogicalHeight(MinSiz
e, Length(MinContent), computedValues.m_extent - borderAndPaddingLogicalHeight()
); |
| 2426 contentHeight = std::max(contentHeight, constrainContentBoxLogic
alHeightByMinMax(minContentHeight, computedValues.m_extent - borderAndPaddingLog
icalHeight())); | 2426 contentHeight = std::max(contentHeight, constrainContentBoxLogic
alHeightByMinMax(minContentHeight, computedValues.m_extent - borderAndPaddingLog
icalHeight())); |
| 2427 } | 2427 } |
| 2428 h = Length(contentHeight, Fixed); | 2428 h = Length(contentHeight, Fixed); |
| 2429 } else if (treatAsReplaced) { | 2429 } else if (treatAsReplaced) { |
| 2430 h = Length(computeReplacedLogicalHeight(), Fixed); | 2430 h = Length(computeReplacedLogicalHeight(), Fixed); |
| 2431 } else { | 2431 } else { |
| 2432 h = style()->logicalHeight(); | 2432 h = style()->logicalHeight(); |
| 2433 checkMinMaxHeight = true; | 2433 checkMinMaxHeight = true; |
| (...skipping 2244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4678 } | 4678 } |
| 4679 | 4679 |
| 4680 void LayoutBox::IntrinsicSizingInfo::transpose() | 4680 void LayoutBox::IntrinsicSizingInfo::transpose() |
| 4681 { | 4681 { |
| 4682 size = size.transposedSize(); | 4682 size = size.transposedSize(); |
| 4683 aspectRatio = aspectRatio.transposedSize(); | 4683 aspectRatio = aspectRatio.transposedSize(); |
| 4684 std::swap(hasWidth, hasHeight); | 4684 std::swap(hasWidth, hasHeight); |
| 4685 } | 4685 } |
| 4686 | 4686 |
| 4687 } // namespace blink | 4687 } // namespace blink |
| OLD | NEW |