| 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 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1898 if (isFloating() || isInline()) { | 1898 if (isFloating() || isInline()) { |
| 1899 // Inline blocks/tables and floats don't have their margins increased. | 1899 // Inline blocks/tables and floats don't have their margins increased. |
| 1900 containingBlock->setMarginStartForChild(this, minimumValueForLength(marg
inStartLength, containerWidth, renderView)); | 1900 containingBlock->setMarginStartForChild(this, minimumValueForLength(marg
inStartLength, containerWidth, renderView)); |
| 1901 containingBlock->setMarginEndForChild(this, minimumValueForLength(margin
EndLength, containerWidth, renderView)); | 1901 containingBlock->setMarginEndForChild(this, minimumValueForLength(margin
EndLength, containerWidth, renderView)); |
| 1902 return; | 1902 return; |
| 1903 } | 1903 } |
| 1904 | 1904 |
| 1905 // Case One: The object is being centered in the containing block's availabl
e logical width. | 1905 // Case One: The object is being centered in the containing block's availabl
e logical width. |
| 1906 if ((marginStartLength.isAuto() && marginEndLength.isAuto() && childWidth <
containerWidth) | 1906 if ((marginStartLength.isAuto() && marginEndLength.isAuto() && childWidth <
containerWidth) |
| 1907 || (!marginStartLength.isAuto() && !marginEndLength.isAuto() && containi
ngBlock->style()->textAlign() == WEBKIT_CENTER)) { | 1907 || (!marginStartLength.isAuto() && !marginEndLength.isAuto() && containi
ngBlock->style()->textAlign() == WEBKIT_CENTER)) { |
| 1908 containingBlock->setMarginStartForChild(this, max<LayoutUnit>(0, (contai
nerWidth - childWidth) / 2)); | 1908 // Other browsers center the margin box for align=center elements so we
match them here. |
| 1909 containingBlock->setMarginEndForChild(this, containerWidth - childWidth
- containingBlock->marginStartForChild(this)); | 1909 LayoutUnit marginStartWidth = marginStartLength.value(); |
| 1910 LayoutUnit marginEndWidth = marginEndLength.value(); |
| 1911 LayoutUnit centeredMarginBoxStart = max<LayoutUnit>(0, (containerWidth -
childWidth - marginStartWidth - marginEndWidth) / 2); |
| 1912 containingBlock->setMarginStartForChild(this, centeredMarginBoxStart + m
arginStartWidth); |
| 1913 containingBlock->setMarginEndForChild(this, containerWidth - childWidth
- containingBlock->marginStartForChild(this) + marginEndWidth); |
| 1910 return; | 1914 return; |
| 1911 } | 1915 } |
| 1912 | 1916 |
| 1913 // Case Two: The object is being pushed to the start of the containing block
's available logical width. | 1917 // Case Two: The object is being pushed to the start of the containing block
's available logical width. |
| 1914 if (marginEndLength.isAuto() && childWidth < containerWidth) { | 1918 if (marginEndLength.isAuto() && childWidth < containerWidth) { |
| 1915 containingBlock->setMarginStartForChild(this, valueForLength(marginStart
Length, containerWidth, renderView)); | 1919 containingBlock->setMarginStartForChild(this, valueForLength(marginStart
Length, containerWidth, renderView)); |
| 1916 containingBlock->setMarginEndForChild(this, containerWidth - childWidth
- containingBlock->marginStartForChild(this)); | 1920 containingBlock->setMarginEndForChild(this, containerWidth - childWidth
- containingBlock->marginStartForChild(this)); |
| 1917 return; | 1921 return; |
| 1918 } | 1922 } |
| 1919 | 1923 |
| (...skipping 2127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4047 } | 4051 } |
| 4048 | 4052 |
| 4049 if (didSplitParentAnonymousBoxes) | 4053 if (didSplitParentAnonymousBoxes) |
| 4050 markBoxForRelayoutAfterSplit(this); | 4054 markBoxForRelayoutAfterSplit(this); |
| 4051 | 4055 |
| 4052 ASSERT(beforeChild->parent() == this); | 4056 ASSERT(beforeChild->parent() == this); |
| 4053 return beforeChild; | 4057 return beforeChild; |
| 4054 } | 4058 } |
| 4055 | 4059 |
| 4056 } // namespace WebCore | 4060 } // namespace WebCore |
| OLD | NEW |