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 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1499 if (offset > contentSideWithMargin) | 1499 if (offset > contentSideWithMargin) |
1500 return childMargin; | 1500 return childMargin; |
1501 return offset - contentSide; | 1501 return offset - contentSide; |
1502 } | 1502 } |
1503 | 1503 |
1504 LayoutUnit LayoutBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar
t, LayoutUnit childMarginEnd, const LayoutBlockFlow* cb) const | 1504 LayoutUnit LayoutBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar
t, LayoutUnit childMarginEnd, const LayoutBlockFlow* cb) const |
1505 { | 1505 { |
1506 LayoutUnit logicalTopPosition = logicalTop(); | 1506 LayoutUnit logicalTopPosition = logicalTop(); |
1507 LayoutUnit startOffsetForContent = cb->startOffsetForContent(); | 1507 LayoutUnit startOffsetForContent = cb->startOffsetForContent(); |
1508 LayoutUnit endOffsetForContent = cb->endOffsetForContent(); | 1508 LayoutUnit endOffsetForContent = cb->endOffsetForContent(); |
1509 LayoutUnit logicalHeight = cb->logicalHeightForChild(*this); | 1509 LayoutUnit startOffsetForLine = cb->startOffsetForLine(logicalTopPosition, f
alse); |
1510 LayoutUnit startOffsetForLine = cb->startOffsetForLine(logicalTopPosition, f
alse, logicalHeight); | 1510 LayoutUnit endOffsetForLine = cb->endOffsetForLine(logicalTopPosition, false
); |
1511 LayoutUnit endOffsetForLine = cb->endOffsetForLine(logicalTopPosition, false
, logicalHeight); | |
1512 | 1511 |
1513 // If there aren't any floats constraining us then allow the margins to shri
nk/expand the width as much as they want. | 1512 // If there aren't any floats constraining us then allow the margins to shri
nk/expand the width as much as they want. |
1514 if (startOffsetForContent == startOffsetForLine && endOffsetForContent == en
dOffsetForLine) | 1513 if (startOffsetForContent == startOffsetForLine && endOffsetForContent == en
dOffsetForLine) |
1515 return cb->availableLogicalWidthForLine(logicalTopPosition, false, logic
alHeight) - childMarginStart - childMarginEnd; | 1514 return cb->availableLogicalWidthForLine(logicalTopPosition, false) - chi
ldMarginStart - childMarginEnd; |
1516 | 1515 |
1517 LayoutUnit width = cb->availableLogicalWidthForLine(logicalTopPosition, fals
e, logicalHeight) - std::max(LayoutUnit(), childMarginStart) - std::max(LayoutUn
it(), childMarginEnd); | 1516 LayoutUnit width = cb->availableLogicalWidthForLine(logicalTopPosition, fals
e) - std::max(LayoutUnit(), childMarginStart) - std::max(LayoutUnit(), childMarg
inEnd); |
1518 // We need to see if margins on either the start side or the end side can co
ntain the floats in question. If they can, | 1517 // We need to see if margins on either the start side or the end side can co
ntain the floats in question. If they can, |
1519 // then just using the line width is inaccurate. In the case where a float c
ompletely fits, we don't need to use the line | 1518 // then just using the line width is inaccurate. In the case where a float c
ompletely fits, we don't need to use the line |
1520 // offset at all, but can instead push all the way to the content edge of th
e containing block. In the case where the float | 1519 // offset at all, but can instead push all the way to the content edge of th
e containing block. In the case where the float |
1521 // doesn't fit, we can use the line offset, but we need to grow it by the ma
rgin to reflect the fact that the margin was | 1520 // doesn't fit, we can use the line offset, but we need to grow it by the ma
rgin to reflect the fact that the margin was |
1522 // "consumed" by the float. Negative margins aren't consumed by the float, a
nd so we ignore them. | 1521 // "consumed" by the float. Negative margins aren't consumed by the float, a
nd so we ignore them. |
1523 width += portionOfMarginNotConsumedByFloat(childMarginStart, startOffsetForC
ontent, startOffsetForLine); | 1522 width += portionOfMarginNotConsumedByFloat(childMarginStart, startOffsetForC
ontent, startOffsetForLine); |
1524 width += portionOfMarginNotConsumedByFloat(childMarginEnd, endOffsetForConte
nt, endOffsetForLine); | 1523 width += portionOfMarginNotConsumedByFloat(childMarginEnd, endOffsetForConte
nt, endOffsetForLine); |
1525 return width; | 1524 return width; |
1526 } | 1525 } |
1527 | 1526 |
(...skipping 3117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4645 computedValues.m_margins.m_end = marginEnd(); | 4644 computedValues.m_margins.m_end = marginEnd(); |
4646 | 4645 |
4647 setLogicalTop(oldLogicalTop); | 4646 setLogicalTop(oldLogicalTop); |
4648 setLogicalWidth(oldLogicalWidth); | 4647 setLogicalWidth(oldLogicalWidth); |
4649 setLogicalLeft(oldLogicalLeft); | 4648 setLogicalLeft(oldLogicalLeft); |
4650 setMarginLeft(oldMarginLeft); | 4649 setMarginLeft(oldMarginLeft); |
4651 setMarginRight(oldMarginRight); | 4650 setMarginRight(oldMarginRight); |
4652 } | 4651 } |
4653 | 4652 |
4654 } // namespace blink | 4653 } // namespace blink |
OLD | NEW |