| 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 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1677 return 0; | 1677 return 0; |
| 1678 LayoutUnit contentSideWithMargin = contentSide + childMargin; | 1678 LayoutUnit contentSideWithMargin = contentSide + childMargin; |
| 1679 if (offset > contentSideWithMargin) | 1679 if (offset > contentSideWithMargin) |
| 1680 return childMargin; | 1680 return childMargin; |
| 1681 return offset - contentSide; | 1681 return offset - contentSide; |
| 1682 } | 1682 } |
| 1683 | 1683 |
| 1684 LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar
t, LayoutUnit childMarginEnd, const RenderBlockFlow* cb) const | 1684 LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar
t, LayoutUnit childMarginEnd, const RenderBlockFlow* cb) const |
| 1685 { | 1685 { |
| 1686 LayoutUnit logicalTopPosition = logicalTop(); | 1686 LayoutUnit logicalTopPosition = logicalTop(); |
| 1687 LayoutUnit startOffsetForContent = cb->startOffsetForContent(); |
| 1688 LayoutUnit endOffsetForContent = cb->endOffsetForContent(); |
| 1689 LayoutUnit startOffsetForLine = cb->startOffsetForLine(logicalTopPosition, f
alse); |
| 1690 LayoutUnit endOffsetForLine = cb->endOffsetForLine(logicalTopPosition, false
); |
| 1691 |
| 1692 // If there aren't any floats constraining us then allow the margins to shri
nk/expand the width as much as they want. |
| 1693 if (startOffsetForContent == startOffsetForLine && endOffsetForContent == en
dOffsetForLine) |
| 1694 return cb->availableLogicalWidthForLine(logicalTopPosition, false) - chi
ldMarginStart - childMarginEnd; |
| 1695 |
| 1687 LayoutUnit width = cb->availableLogicalWidthForLine(logicalTopPosition, fals
e) - std::max<LayoutUnit>(0, childMarginStart) - std::max<LayoutUnit>(0, childMa
rginEnd); | 1696 LayoutUnit width = cb->availableLogicalWidthForLine(logicalTopPosition, fals
e) - std::max<LayoutUnit>(0, childMarginStart) - std::max<LayoutUnit>(0, childMa
rginEnd); |
| 1688 | |
| 1689 // 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, | 1697 // 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, |
| 1690 // 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 | 1698 // 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 |
| 1691 // 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 | 1699 // 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 |
| 1692 // 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 | 1700 // 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 |
| 1693 // "consumed" by the float. Negative margins aren't consumed by the float, a
nd so we ignore them. | 1701 // "consumed" by the float. Negative margins aren't consumed by the float, a
nd so we ignore them. |
| 1694 width += portionOfMarginNotConsumedByFloat(childMarginStart, cb->startOffset
ForContent(), cb->startOffsetForLine(logicalTopPosition, false)); | 1702 width += portionOfMarginNotConsumedByFloat(childMarginStart, startOffsetForC
ontent, startOffsetForLine); |
| 1695 width += portionOfMarginNotConsumedByFloat(childMarginEnd, cb->endOffsetForC
ontent(), cb->endOffsetForLine(logicalTopPosition, false)); | 1703 width += portionOfMarginNotConsumedByFloat(childMarginEnd, endOffsetForConte
nt, endOffsetForLine); |
| 1696 return width; | 1704 return width; |
| 1697 } | 1705 } |
| 1698 | 1706 |
| 1699 LayoutUnit RenderBox::containingBlockLogicalWidthForContent() const | 1707 LayoutUnit RenderBox::containingBlockLogicalWidthForContent() const |
| 1700 { | 1708 { |
| 1701 if (hasOverrideContainingBlockLogicalWidth()) | 1709 if (hasOverrideContainingBlockLogicalWidth()) |
| 1702 return overrideContainingBlockContentLogicalWidth(); | 1710 return overrideContainingBlockContentLogicalWidth(); |
| 1703 | 1711 |
| 1704 RenderBlock* cb = containingBlock(); | 1712 RenderBlock* cb = containingBlock(); |
| 1705 return cb->availableLogicalWidth(); | 1713 return cb->availableLogicalWidth(); |
| (...skipping 3040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4746 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) | 4754 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) |
| 4747 { | 4755 { |
| 4748 backgroundColor = style.visitedDependentColor(CSSPropertyBackgroundColor); | 4756 backgroundColor = style.visitedDependentColor(CSSPropertyBackgroundColor); |
| 4749 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); | 4757 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); |
| 4750 ASSERT(hasBackground == style.hasBackground()); | 4758 ASSERT(hasBackground == style.hasBackground()); |
| 4751 hasBorder = style.hasBorder(); | 4759 hasBorder = style.hasBorder(); |
| 4752 hasAppearance = style.hasAppearance(); | 4760 hasAppearance = style.hasAppearance(); |
| 4753 } | 4761 } |
| 4754 | 4762 |
| 4755 } // namespace blink | 4763 } // namespace blink |
| OLD | NEW |