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 2082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2093 const RenderStyle* containingBlockStyle = containingBlock->style(); | 2093 const RenderStyle* containingBlockStyle = containingBlock->style(); |
2094 if ((marginStartLength.isAuto() && marginEndLength.isAuto() && marginBoxWidt h < availableWidth) | 2094 if ((marginStartLength.isAuto() && marginEndLength.isAuto() && marginBoxWidt h < availableWidth) |
2095 || (!marginStartLength.isAuto() && !marginEndLength.isAuto() && containi ngBlockStyle->textAlign() == WEBKIT_CENTER)) { | 2095 || (!marginStartLength.isAuto() && !marginEndLength.isAuto() && containi ngBlockStyle->textAlign() == WEBKIT_CENTER)) { |
2096 // Other browsers center the margin box for align=center elements so we match them here. | 2096 // Other browsers center the margin box for align=center elements so we match them here. |
2097 LayoutUnit centeredMarginBoxStart = std::max<LayoutUnit>(0, (availableWi dth - childWidth - marginStartWidth - marginEndWidth) / 2); | 2097 LayoutUnit centeredMarginBoxStart = std::max<LayoutUnit>(0, (availableWi dth - childWidth - marginStartWidth - marginEndWidth) / 2); |
2098 marginStart = centeredMarginBoxStart + marginStartWidth; | 2098 marginStart = centeredMarginBoxStart + marginStartWidth; |
2099 marginEnd = availableWidth - childWidth - marginStart + marginEndWidth; | 2099 marginEnd = availableWidth - childWidth - marginStart + marginEndWidth; |
2100 return; | 2100 return; |
2101 } | 2101 } |
2102 | 2102 |
2103 | |
2104 | |
mstensho (USE GERRIT)
2014/12/09 09:54:41
Couple of extraneous blank lines.
Kyungtae Kim
2014/12/09 11:36:32
Done.
| |
2105 bool hasInvertedDirection = containingBlockStyle->isLeftToRightDirection() ! = style()->isLeftToRightDirection(); | |
2106 bool pushToEndFromTextAlign = !marginEndLength.isAuto() && ((!containingBloc kStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_ LEFT) | |
2107 || (containingBlockStyle->isLeftToRightDirection() && containingBlockSty le->textAlign() == WEBKIT_RIGHT)); | |
2108 | |
2103 // CSS 2.1: "If there is exactly one value specified as 'auto', its used val ue follows from the equality." | 2109 // CSS 2.1: "If there is exactly one value specified as 'auto', its used val ue follows from the equality." |
2104 if (marginEndLength.isAuto() && marginBoxWidth < availableWidth) { | 2110 if ((marginEndLength.isAuto() && marginBoxWidth < availableWidth) || (pushTo EndFromTextAlign && hasInvertedDirection)) { |
2105 marginStart = marginStartWidth; | 2111 marginStart = marginStartWidth; |
2106 marginEnd = availableWidth - childWidth - marginStart; | 2112 marginEnd = availableWidth - childWidth - marginStart; |
2107 return; | 2113 return; |
2108 } | 2114 } |
2109 | 2115 |
2110 bool pushToEndFromTextAlign = !marginEndLength.isAuto() && ((!containingBloc kStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_ LEFT) | |
2111 || (containingBlockStyle->isLeftToRightDirection() && containingBlockSty le->textAlign() == WEBKIT_RIGHT)); | |
2112 if ((marginStartLength.isAuto() && marginBoxWidth < availableWidth) || pushT oEndFromTextAlign) { | 2116 if ((marginStartLength.isAuto() && marginBoxWidth < availableWidth) || pushT oEndFromTextAlign) { |
2113 marginEnd = marginEndWidth; | 2117 marginEnd = marginEndWidth; |
2114 marginStart = availableWidth - childWidth - marginEnd; | 2118 marginStart = availableWidth - childWidth - marginEnd; |
2115 return; | 2119 return; |
2116 } | 2120 } |
2117 | 2121 |
2118 // Either no auto margins, or our margin box width is >= the container width , auto margins will just turn into 0. | 2122 // Either no auto margins, or our margin box width is >= the container width , auto margins will just turn into 0. |
2119 marginStart = marginStartWidth; | 2123 marginStart = marginStartWidth; |
2120 marginEnd = marginEndWidth; | 2124 marginEnd = marginEndWidth; |
2121 } | 2125 } |
(...skipping 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4429 computedValues.m_margins.m_end = marginEnd(); | 4433 computedValues.m_margins.m_end = marginEnd(); |
4430 | 4434 |
4431 setLogicalTop(oldLogicalTop); | 4435 setLogicalTop(oldLogicalTop); |
4432 setLogicalWidth(oldLogicalWidth); | 4436 setLogicalWidth(oldLogicalWidth); |
4433 setLogicalLeft(oldLogicalLeft); | 4437 setLogicalLeft(oldLogicalLeft); |
4434 setMarginLeft(oldMarginLeft); | 4438 setMarginLeft(oldMarginLeft); |
4435 setMarginRight(oldMarginRight); | 4439 setMarginRight(oldMarginRight); |
4436 } | 4440 } |
4437 | 4441 |
4438 } // namespace blink | 4442 } // namespace blink |
OLD | NEW |