| 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 1807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1818 return offset - contentSide; | 1818 return offset - contentSide; |
| 1819 } | 1819 } |
| 1820 | 1820 |
| 1821 LayoutUnit LayoutBox::shrinkLogicalWidthToAvoidFloats( | 1821 LayoutUnit LayoutBox::shrinkLogicalWidthToAvoidFloats( |
| 1822 LayoutUnit childMarginStart, | 1822 LayoutUnit childMarginStart, |
| 1823 LayoutUnit childMarginEnd, | 1823 LayoutUnit childMarginEnd, |
| 1824 const LayoutBlockFlow* cb) const { | 1824 const LayoutBlockFlow* cb) const { |
| 1825 LayoutUnit logicalTopPosition = logicalTop(); | 1825 LayoutUnit logicalTopPosition = logicalTop(); |
| 1826 LayoutUnit startOffsetForContent = cb->startOffsetForContent(); | 1826 LayoutUnit startOffsetForContent = cb->startOffsetForContent(); |
| 1827 LayoutUnit endOffsetForContent = cb->endOffsetForContent(); | 1827 LayoutUnit endOffsetForContent = cb->endOffsetForContent(); |
| 1828 LayoutUnit startOffsetForLine = | 1828 LayoutUnit logicalHeight = cb->logicalHeightForChild(*this); |
| 1829 cb->startOffsetForLine(logicalTopPosition, DoNotIndentText); | 1829 LayoutUnit startOffsetForLine = cb->startOffsetForLine( |
| 1830 logicalTopPosition, DoNotIndentText, logicalHeight); |
| 1830 LayoutUnit endOffsetForLine = | 1831 LayoutUnit endOffsetForLine = |
| 1831 cb->endOffsetForLine(logicalTopPosition, DoNotIndentText); | 1832 cb->endOffsetForLine(logicalTopPosition, DoNotIndentText, logicalHeight); |
| 1832 | 1833 |
| 1833 // If there aren't any floats constraining us then allow the margins to shrink
/expand the width as much as they want. | 1834 // If there aren't any floats constraining us then allow the margins to shrink
/expand the width as much as they want. |
| 1834 if (startOffsetForContent == startOffsetForLine && | 1835 if (startOffsetForContent == startOffsetForLine && |
| 1835 endOffsetForContent == endOffsetForLine) | 1836 endOffsetForContent == endOffsetForLine) |
| 1836 return cb->availableLogicalWidthForLine(logicalTopPosition, | 1837 return cb->availableLogicalWidthForLine(logicalTopPosition, DoNotIndentText, |
| 1837 DoNotIndentText) - | 1838 logicalHeight) - |
| 1838 childMarginStart - childMarginEnd; | 1839 childMarginStart - childMarginEnd; |
| 1839 | 1840 |
| 1840 LayoutUnit width = | 1841 LayoutUnit width = cb->availableLogicalWidthForLine( |
| 1841 cb->availableLogicalWidthForLine(logicalTopPosition, DoNotIndentText) - | 1842 logicalTopPosition, DoNotIndentText, logicalHeight) - |
| 1842 std::max(LayoutUnit(), childMarginStart) - | 1843 std::max(LayoutUnit(), childMarginStart) - |
| 1843 std::max(LayoutUnit(), childMarginEnd); | 1844 std::max(LayoutUnit(), childMarginEnd); |
| 1844 // We need to see if margins on either the start side or the end side can cont
ain the floats in question. If they can, | 1845 // We need to see if margins on either the start side or the end side can cont
ain the floats in question. If they can, |
| 1845 // then just using the line width is inaccurate. In the case where a float com
pletely fits, we don't need to use the line | 1846 // then just using the line width is inaccurate. In the case where a float com
pletely fits, we don't need to use the line |
| 1846 // offset at all, but can instead push all the way to the content edge of the
containing block. In the case where the float | 1847 // offset at all, but can instead push all the way to the content edge of the
containing block. In the case where the float |
| 1847 // doesn't fit, we can use the line offset, but we need to grow it by the marg
in to reflect the fact that the margin was | 1848 // doesn't fit, we can use the line offset, but we need to grow it by the marg
in to reflect the fact that the margin was |
| 1848 // "consumed" by the float. Negative margins aren't consumed by the float, and
so we ignore them. | 1849 // "consumed" by the float. Negative margins aren't consumed by the float, and
so we ignore them. |
| 1849 width += portionOfMarginNotConsumedByFloat( | 1850 width += portionOfMarginNotConsumedByFloat( |
| 1850 childMarginStart, startOffsetForContent, startOffsetForLine); | 1851 childMarginStart, startOffsetForContent, startOffsetForLine); |
| 1851 width += portionOfMarginNotConsumedByFloat( | 1852 width += portionOfMarginNotConsumedByFloat( |
| 1852 childMarginEnd, endOffsetForContent, endOffsetForLine); | 1853 childMarginEnd, endOffsetForContent, endOffsetForLine); |
| 1853 return width; | 1854 return width; |
| (...skipping 3610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5464 LayoutRect rect = frameRect(); | 5465 LayoutRect rect = frameRect(); |
| 5465 | 5466 |
| 5466 LayoutBlock* block = containingBlock(); | 5467 LayoutBlock* block = containingBlock(); |
| 5467 if (block) | 5468 if (block) |
| 5468 block->adjustChildDebugRect(rect); | 5469 block->adjustChildDebugRect(rect); |
| 5469 | 5470 |
| 5470 return rect; | 5471 return rect; |
| 5471 } | 5472 } |
| 5472 | 5473 |
| 5473 } // namespace blink | 5474 } // namespace blink |
| OLD | NEW |