| 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 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1641 LayoutUnit marginStartWidth = minimumValueForLength(marginStartLength, conta
inerWidth); | 1641 LayoutUnit marginStartWidth = minimumValueForLength(marginStartLength, conta
inerWidth); |
| 1642 LayoutUnit marginEndWidth = minimumValueForLength(marginEndLength, container
Width); | 1642 LayoutUnit marginEndWidth = minimumValueForLength(marginEndLength, container
Width); |
| 1643 | 1643 |
| 1644 // CSS 2.1 (10.3.3): "If 'width' is not 'auto' and 'border-left-width' + 'pa
dding-left' + 'width' + 'padding-right' + 'border-right-width' | 1644 // CSS 2.1 (10.3.3): "If 'width' is not 'auto' and 'border-left-width' + 'pa
dding-left' + 'width' + 'padding-right' + 'border-right-width' |
| 1645 // (plus any of 'margin-left' or 'margin-right' that are not 'auto') is larg
er than the width of the containing block, then any 'auto' | 1645 // (plus any of 'margin-left' or 'margin-right' that are not 'auto') is larg
er than the width of the containing block, then any 'auto' |
| 1646 // values for 'margin-left' or 'margin-right' are, for the following rules,
treated as zero. | 1646 // values for 'margin-left' or 'margin-right' are, for the following rules,
treated as zero. |
| 1647 LayoutUnit marginBoxWidth = childWidth + (!style()->width().isAuto() ? margi
nStartWidth + marginEndWidth : LayoutUnit()); | 1647 LayoutUnit marginBoxWidth = childWidth + (!style()->width().isAuto() ? margi
nStartWidth + marginEndWidth : LayoutUnit()); |
| 1648 | 1648 |
| 1649 // CSS 2.1: "If both 'margin-left' and 'margin-right' are 'auto', their used
values are equal. This horizontally centers the element | 1649 // CSS 2.1: "If both 'margin-left' and 'margin-right' are 'auto', their used
values are equal. This horizontally centers the element |
| 1650 // with respect to the edges of the containing block." | 1650 // with respect to the edges of the containing block." |
| 1651 if ((marginStartLength.isAuto() && marginEndLength.isAuto() && marginBoxWidt
h < containerWidth) | 1651 if (marginStartLength.isAuto() && marginEndLength.isAuto() && marginBoxWidth
< containerWidth) { |
| 1652 || (!marginStartLength.isAuto() && !marginEndLength.isAuto())) { | |
| 1653 // Other browsers center the margin box for align=center elements so we
match them here. | 1652 // Other browsers center the margin box for align=center elements so we
match them here. |
| 1654 LayoutUnit centeredMarginBoxStart = std::max<LayoutUnit>(0, (containerWi
dth - childWidth - marginStartWidth - marginEndWidth) / 2); | 1653 LayoutUnit centeredMarginBoxStart = std::max<LayoutUnit>(0, (containerWi
dth - childWidth - marginStartWidth - marginEndWidth) / 2); |
| 1655 marginStart = centeredMarginBoxStart + marginStartWidth; | 1654 marginStart = centeredMarginBoxStart + marginStartWidth; |
| 1656 marginEnd = containerWidth - childWidth - marginStart + marginEndWidth; | 1655 marginEnd = containerWidth - childWidth - marginStart + marginEndWidth; |
| 1657 return; | 1656 return; |
| 1658 } | 1657 } |
| 1659 | 1658 |
| 1660 // CSS 2.1: "If there is exactly one value specified as 'auto', its used val
ue follows from the equality." | 1659 // CSS 2.1: "If there is exactly one value specified as 'auto', its used val
ue follows from the equality." |
| 1661 if (marginEndLength.isAuto() && marginBoxWidth < containerWidth) { | 1660 if (marginEndLength.isAuto() && marginBoxWidth < containerWidth) { |
| 1662 marginStart = marginStartWidth; | 1661 marginStart = marginStartWidth; |
| (...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3511 | 3510 |
| 3512 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) | 3511 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) |
| 3513 { | 3512 { |
| 3514 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); | 3513 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); |
| 3515 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); | 3514 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); |
| 3516 ASSERT(hasBackground == style.hasBackground()); | 3515 ASSERT(hasBackground == style.hasBackground()); |
| 3517 hasBorder = style.hasBorder(); | 3516 hasBorder = style.hasBorder(); |
| 3518 } | 3517 } |
| 3519 | 3518 |
| 3520 } // namespace blink | 3519 } // namespace blink |
| OLD | NEW |