| 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. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. |
| 7 * All rights reserved. | 7 * All rights reserved. |
| 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 2794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2805 ? marginStartWidth + marginEndWidth | 2805 ? marginStartWidth + marginEndWidth |
| 2806 : LayoutUnit()); | 2806 : LayoutUnit()); |
| 2807 | 2807 |
| 2808 if (marginBoxWidth < availableWidth) { | 2808 if (marginBoxWidth < availableWidth) { |
| 2809 // CSS 2.1: "If both 'margin-left' and 'margin-right' are 'auto', their used | 2809 // CSS 2.1: "If both 'margin-left' and 'margin-right' are 'auto', their used |
| 2810 // values are equal. This horizontally centers the element with respect to | 2810 // values are equal. This horizontally centers the element with respect to |
| 2811 // the edges of the containing block." | 2811 // the edges of the containing block." |
| 2812 const ComputedStyle& containingBlockStyle = containingBlock->styleRef(); | 2812 const ComputedStyle& containingBlockStyle = containingBlock->styleRef(); |
| 2813 if ((marginStartLength.isAuto() && marginEndLength.isAuto()) || | 2813 if ((marginStartLength.isAuto() && marginEndLength.isAuto()) || |
| 2814 (!marginStartLength.isAuto() && !marginEndLength.isAuto() && | 2814 (!marginStartLength.isAuto() && !marginEndLength.isAuto() && |
| 2815 containingBlockStyle.textAlign() == WEBKIT_CENTER)) { | 2815 containingBlockStyle.textAlign() == ETextAlign::WebkitCenter)) { |
| 2816 // Other browsers center the margin box for align=center elements so we | 2816 // Other browsers center the margin box for align=center elements so we |
| 2817 // match them here. | 2817 // match them here. |
| 2818 LayoutUnit centeredMarginBoxStart = std::max( | 2818 LayoutUnit centeredMarginBoxStart = std::max( |
| 2819 LayoutUnit(), | 2819 LayoutUnit(), |
| 2820 (availableWidth - childWidth - marginStartWidth - marginEndWidth) / | 2820 (availableWidth - childWidth - marginStartWidth - marginEndWidth) / |
| 2821 2); | 2821 2); |
| 2822 marginStart = centeredMarginBoxStart + marginStartWidth; | 2822 marginStart = centeredMarginBoxStart + marginStartWidth; |
| 2823 marginEnd = availableWidth - childWidth - marginStart + marginEndWidth; | 2823 marginEnd = availableWidth - childWidth - marginStart + marginEndWidth; |
| 2824 return; | 2824 return; |
| 2825 } | 2825 } |
| 2826 | 2826 |
| 2827 // Adjust margins for the align attribute | 2827 // Adjust margins for the align attribute |
| 2828 if ((!containingBlockStyle.isLeftToRightDirection() && | 2828 if ((!containingBlockStyle.isLeftToRightDirection() && |
| 2829 containingBlockStyle.textAlign() == WEBKIT_LEFT) || | 2829 containingBlockStyle.textAlign() == ETextAlign::WebkitLeft) || |
| 2830 (containingBlockStyle.isLeftToRightDirection() && | 2830 (containingBlockStyle.isLeftToRightDirection() && |
| 2831 containingBlockStyle.textAlign() == WEBKIT_RIGHT)) { | 2831 containingBlockStyle.textAlign() == ETextAlign::WebkitRight)) { |
| 2832 if (containingBlockStyle.isLeftToRightDirection() != | 2832 if (containingBlockStyle.isLeftToRightDirection() != |
| 2833 styleRef().isLeftToRightDirection()) { | 2833 styleRef().isLeftToRightDirection()) { |
| 2834 if (!marginStartLength.isAuto()) | 2834 if (!marginStartLength.isAuto()) |
| 2835 marginEndLength = Length(Auto); | 2835 marginEndLength = Length(Auto); |
| 2836 } else { | 2836 } else { |
| 2837 if (!marginEndLength.isAuto()) | 2837 if (!marginEndLength.isAuto()) |
| 2838 marginStartLength = Length(Auto); | 2838 marginStartLength = Length(Auto); |
| 2839 } | 2839 } |
| 2840 } | 2840 } |
| 2841 | 2841 |
| (...skipping 2774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5616 LayoutRect rect = frameRect(); | 5616 LayoutRect rect = frameRect(); |
| 5617 | 5617 |
| 5618 LayoutBlock* block = containingBlock(); | 5618 LayoutBlock* block = containingBlock(); |
| 5619 if (block) | 5619 if (block) |
| 5620 block->adjustChildDebugRect(rect); | 5620 block->adjustChildDebugRect(rect); |
| 5621 | 5621 |
| 5622 return rect; | 5622 return rect; |
| 5623 } | 5623 } |
| 5624 | 5624 |
| 5625 } // namespace blink | 5625 } // namespace blink |
| OLD | NEW |