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 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 if (offset > contentSideWithMargin) | 1451 if (offset > contentSideWithMargin) |
1452 return childMargin; | 1452 return childMargin; |
1453 return offset - contentSide; | 1453 return offset - contentSide; |
1454 } | 1454 } |
1455 | 1455 |
1456 LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar
t, LayoutUnit childMarginEnd, const RenderBlockFlow* cb) const | 1456 LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar
t, LayoutUnit childMarginEnd, const RenderBlockFlow* cb) const |
1457 { | 1457 { |
1458 LayoutUnit logicalTopPosition = logicalTop(); | 1458 LayoutUnit logicalTopPosition = logicalTop(); |
1459 LayoutUnit startOffsetForContent = cb->startOffsetForContent(); | 1459 LayoutUnit startOffsetForContent = cb->startOffsetForContent(); |
1460 LayoutUnit endOffsetForContent = cb->endOffsetForContent(); | 1460 LayoutUnit endOffsetForContent = cb->endOffsetForContent(); |
1461 LayoutUnit startOffsetForLine = cb->startOffsetForLine(logicalTopPosition, f
alse); | 1461 LayoutUnit logicalHeight = cb->logicalHeightForChild(*this); |
1462 LayoutUnit endOffsetForLine = cb->endOffsetForLine(logicalTopPosition, false
); | 1462 LayoutUnit startOffsetForLine = cb->startOffsetForLine(logicalTopPosition, f
alse, logicalHeight); |
| 1463 LayoutUnit endOffsetForLine = cb->endOffsetForLine(logicalTopPosition, false
, logicalHeight); |
1463 | 1464 |
1464 // If there aren't any floats constraining us then allow the margins to shri
nk/expand the width as much as they want. | 1465 // If there aren't any floats constraining us then allow the margins to shri
nk/expand the width as much as they want. |
1465 if (startOffsetForContent == startOffsetForLine && endOffsetForContent == en
dOffsetForLine) | 1466 if (startOffsetForContent == startOffsetForLine && endOffsetForContent == en
dOffsetForLine) |
1466 return cb->availableLogicalWidthForLine(logicalTopPosition, false) - chi
ldMarginStart - childMarginEnd; | 1467 return cb->availableLogicalWidthForLine(logicalTopPosition, false, logic
alHeight) - childMarginStart - childMarginEnd; |
1467 | 1468 |
1468 LayoutUnit width = cb->availableLogicalWidthForLine(logicalTopPosition, fals
e) - std::max(LayoutUnit(), childMarginStart) - std::max(LayoutUnit(), childMarg
inEnd); | 1469 LayoutUnit width = cb->availableLogicalWidthForLine(logicalTopPosition, fals
e, logicalHeight) - std::max(LayoutUnit(), childMarginStart) - std::max(LayoutUn
it(), childMarginEnd); |
1469 // 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, | 1470 // 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, |
1470 // 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 | 1471 // 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 |
1471 // 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 | 1472 // 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 |
1472 // 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 | 1473 // 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 |
1473 // "consumed" by the float. Negative margins aren't consumed by the float, a
nd so we ignore them. | 1474 // "consumed" by the float. Negative margins aren't consumed by the float, a
nd so we ignore them. |
1474 width += portionOfMarginNotConsumedByFloat(childMarginStart, startOffsetForC
ontent, startOffsetForLine); | 1475 width += portionOfMarginNotConsumedByFloat(childMarginStart, startOffsetForC
ontent, startOffsetForLine); |
1475 width += portionOfMarginNotConsumedByFloat(childMarginEnd, endOffsetForConte
nt, endOffsetForLine); | 1476 width += portionOfMarginNotConsumedByFloat(childMarginEnd, endOffsetForConte
nt, endOffsetForLine); |
1476 return width; | 1477 return width; |
1477 } | 1478 } |
1478 | 1479 |
(...skipping 3042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4521 computedValues.m_margins.m_end = marginEnd(); | 4522 computedValues.m_margins.m_end = marginEnd(); |
4522 | 4523 |
4523 setLogicalTop(oldLogicalTop); | 4524 setLogicalTop(oldLogicalTop); |
4524 setLogicalWidth(oldLogicalWidth); | 4525 setLogicalWidth(oldLogicalWidth); |
4525 setLogicalLeft(oldLogicalLeft); | 4526 setLogicalLeft(oldLogicalLeft); |
4526 setMarginLeft(oldMarginLeft); | 4527 setMarginLeft(oldMarginLeft); |
4527 setMarginRight(oldMarginRight); | 4528 setMarginRight(oldMarginRight); |
4528 } | 4529 } |
4529 | 4530 |
4530 } // namespace blink | 4531 } // namespace blink |
OLD | NEW |