| 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 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1825 if (isFloating() || isInline()) { | 1825 if (isFloating() || isInline()) { |
| 1826 // Inline blocks/tables and floats don't have their margins increased. | 1826 // Inline blocks/tables and floats don't have their margins increased. |
| 1827 containingBlock->setMarginStartForChild(this, minimumValueForLength(marg
inStartLength, containerWidth, renderView)); | 1827 containingBlock->setMarginStartForChild(this, minimumValueForLength(marg
inStartLength, containerWidth, renderView)); |
| 1828 containingBlock->setMarginEndForChild(this, minimumValueForLength(margin
EndLength, containerWidth, renderView)); | 1828 containingBlock->setMarginEndForChild(this, minimumValueForLength(margin
EndLength, containerWidth, renderView)); |
| 1829 return; | 1829 return; |
| 1830 } | 1830 } |
| 1831 | 1831 |
| 1832 // Case One: The object is being centered in the containing block's availabl
e logical width. | 1832 // Case One: The object is being centered in the containing block's availabl
e logical width. |
| 1833 if ((marginStartLength.isAuto() && marginEndLength.isAuto() && childWidth <
containerWidth) | 1833 if ((marginStartLength.isAuto() && marginEndLength.isAuto() && childWidth <
containerWidth) |
| 1834 || (!marginStartLength.isAuto() && !marginEndLength.isAuto() && containi
ngBlock->style()->textAlign() == WEBKIT_CENTER)) { | 1834 || (!marginStartLength.isAuto() && !marginEndLength.isAuto() && containi
ngBlock->style()->textAlign() == WEBKIT_CENTER)) { |
| 1835 containingBlock->setMarginStartForChild(this, max<LayoutUnit>(0, (contai
nerWidth - childWidth) / 2)); | 1835 // Other browsers center the margin box for align=center elements so we
match them here. |
| 1836 containingBlock->setMarginEndForChild(this, containerWidth - childWidth
- containingBlock->marginStartForChild(this)); | 1836 LayoutUnit marginStartWidth = marginStartLength.value(); |
| 1837 LayoutUnit marginEndWidth = marginEndLength.value(); |
| 1838 LayoutUnit centeredMarginBoxStart = max<LayoutUnit>(0, (containerWidth -
childWidth - marginStartWidth - marginEndWidth) / 2); |
| 1839 containingBlock->setMarginStartForChild(this, centeredMarginBoxStart + m
arginStartWidth); |
| 1840 containingBlock->setMarginEndForChild(this, containerWidth - childWidth
- containingBlock->marginStartForChild(this) + marginEndWidth); |
| 1837 return; | 1841 return; |
| 1838 } | 1842 } |
| 1839 | 1843 |
| 1840 // Case Two: The object is being pushed to the start of the containing block
's available logical width. | 1844 // Case Two: The object is being pushed to the start of the containing block
's available logical width. |
| 1841 if (marginEndLength.isAuto() && childWidth < containerWidth) { | 1845 if (marginEndLength.isAuto() && childWidth < containerWidth) { |
| 1842 containingBlock->setMarginStartForChild(this, valueForLength(marginStart
Length, containerWidth, renderView)); | 1846 containingBlock->setMarginStartForChild(this, valueForLength(marginStart
Length, containerWidth, renderView)); |
| 1843 containingBlock->setMarginEndForChild(this, containerWidth - childWidth
- containingBlock->marginStartForChild(this)); | 1847 containingBlock->setMarginEndForChild(this, containerWidth - childWidth
- containingBlock->marginStartForChild(this)); |
| 1844 return; | 1848 return; |
| 1845 } | 1849 } |
| 1846 | 1850 |
| (...skipping 2133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3980 } | 3984 } |
| 3981 | 3985 |
| 3982 if (didSplitParentAnonymousBoxes) | 3986 if (didSplitParentAnonymousBoxes) |
| 3983 markBoxForRelayoutAfterSplit(this); | 3987 markBoxForRelayoutAfterSplit(this); |
| 3984 | 3988 |
| 3985 ASSERT(beforeChild->parent() == this); | 3989 ASSERT(beforeChild->parent() == this); |
| 3986 return beforeChild; | 3990 return beforeChild; |
| 3987 } | 3991 } |
| 3988 | 3992 |
| 3989 } // namespace WebCore | 3993 } // namespace WebCore |
| OLD | NEW |