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 2089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2100 return; | 2100 return; |
2101 } | 2101 } |
2102 | 2102 |
2103 // CSS 2.1: "If there is exactly one value specified as 'auto', its used val
ue follows from the equality." | 2103 // 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) { | 2104 if (marginEndLength.isAuto() && marginBoxWidth < availableWidth) { |
2105 marginStart = marginStartWidth; | 2105 marginStart = marginStartWidth; |
2106 marginEnd = availableWidth - childWidth - marginStart; | 2106 marginEnd = availableWidth - childWidth - marginStart; |
2107 return; | 2107 return; |
2108 } | 2108 } |
2109 | 2109 |
2110 bool pushToEndFromTextAlign = !marginEndLength.isAuto() && ((!containingBloc
kStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_
LEFT) | 2110 bool adjustFromTextAlign = !marginEndLength.isAuto() && ((!containingBlockSt
yle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_LEF
T) |
2111 || (containingBlockStyle->isLeftToRightDirection() && containingBlockSty
le->textAlign() == WEBKIT_RIGHT)); | 2111 || (containingBlockStyle->isLeftToRightDirection() && containingBlockSty
le->textAlign() == WEBKIT_RIGHT)); |
2112 if ((marginStartLength.isAuto() && marginBoxWidth < availableWidth) || pushT
oEndFromTextAlign) { | 2112 bool hasInvertedDirection = containingBlockStyle->isLeftToRightDirection() !
= style()->isLeftToRightDirection(); |
| 2113 |
| 2114 if ((marginStartLength.isAuto() && marginBoxWidth < availableWidth) || (adju
stFromTextAlign && !hasInvertedDirection)) { |
2113 marginEnd = marginEndWidth; | 2115 marginEnd = marginEndWidth; |
2114 marginStart = availableWidth - childWidth - marginEnd; | 2116 marginStart = availableWidth - childWidth - marginEnd; |
2115 return; | 2117 return; |
2116 } | 2118 } |
2117 | 2119 |
| 2120 if (adjustFromTextAlign && hasInvertedDirection) { |
| 2121 marginStart = marginStartWidth; |
| 2122 marginEnd = availableWidth - childWidth - marginStart; |
| 2123 return; |
| 2124 } |
| 2125 |
2118 // Either no auto margins, or our margin box width is >= the container width
, auto margins will just turn into 0. | 2126 // Either no auto margins, or our margin box width is >= the container width
, auto margins will just turn into 0. |
2119 marginStart = marginStartWidth; | 2127 marginStart = marginStartWidth; |
2120 marginEnd = marginEndWidth; | 2128 marginEnd = marginEndWidth; |
2121 } | 2129 } |
2122 | 2130 |
2123 void RenderBox::updateLogicalHeight() | 2131 void RenderBox::updateLogicalHeight() |
2124 { | 2132 { |
2125 m_intrinsicContentLogicalHeight = contentLogicalHeight(); | 2133 m_intrinsicContentLogicalHeight = contentLogicalHeight(); |
2126 | 2134 |
2127 LogicalExtentComputedValues computedValues; | 2135 LogicalExtentComputedValues computedValues; |
(...skipping 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4429 computedValues.m_margins.m_end = marginEnd(); | 4437 computedValues.m_margins.m_end = marginEnd(); |
4430 | 4438 |
4431 setLogicalTop(oldLogicalTop); | 4439 setLogicalTop(oldLogicalTop); |
4432 setLogicalWidth(oldLogicalWidth); | 4440 setLogicalWidth(oldLogicalWidth); |
4433 setLogicalLeft(oldLogicalLeft); | 4441 setLogicalLeft(oldLogicalLeft); |
4434 setMarginLeft(oldMarginLeft); | 4442 setMarginLeft(oldMarginLeft); |
4435 setMarginRight(oldMarginRight); | 4443 setMarginRight(oldMarginRight); |
4436 } | 4444 } |
4437 | 4445 |
4438 } // namespace blink | 4446 } // namespace blink |
OLD | NEW |