Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 if ((!oldStyle && newStyle) || (oldStyle && !newStyle)) | 172 if ((!oldStyle && newStyle) || (oldStyle && !newStyle)) |
| 173 return Reattach; | 173 return Reattach; |
| 174 | 174 |
| 175 if (!oldStyle && !newStyle) | 175 if (!oldStyle && !newStyle) |
| 176 return NoChange; | 176 return NoChange; |
| 177 | 177 |
| 178 if (oldStyle->display() != newStyle->display() | 178 if (oldStyle->display() != newStyle->display() |
| 179 || oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FI RST_LETTER) | 179 || oldStyle->hasPseudoStyle(FIRST_LETTER) != newStyle->hasPseudoStyle(FI RST_LETTER) |
| 180 || oldStyle->columnSpan() != newStyle->columnSpan() | 180 || oldStyle->columnSpan() != newStyle->columnSpan() |
| 181 || !oldStyle->contentDataEquivalent(newStyle) | 181 || !oldStyle->contentDataEquivalent(newStyle) |
| 182 || oldStyle->hasTextCombine() != newStyle->hasTextCombine()) | 182 || oldStyle->hasTextCombine() != newStyle->hasTextCombine() |
| 183 || oldStyle->justifyItems() != newStyle->justifyItems() | |
| 184 || oldStyle->alignItems() != newStyle->alignItems()) | |
| 183 return Reattach; | 185 return Reattach; |
| 184 | 186 |
| 185 if (*oldStyle == *newStyle) | 187 if (*oldStyle == *newStyle) |
| 186 return diffPseudoStyles(oldStyle, newStyle); | 188 return diffPseudoStyles(oldStyle, newStyle); |
| 187 | 189 |
| 188 if (oldStyle->inheritedNotEqual(newStyle) | 190 if (oldStyle->inheritedNotEqual(newStyle) |
| 189 || oldStyle->hasExplicitlyInheritedProperties() | 191 || oldStyle->hasExplicitlyInheritedProperties() |
| 190 || newStyle->hasExplicitlyInheritedProperties()) | 192 || newStyle->hasExplicitlyInheritedProperties()) |
| 191 return Inherit; | 193 return Inherit; |
| 192 | 194 |
| (...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1686 | 1688 |
| 1687 // right | 1689 // right |
| 1688 radiiSum = radii.topRight().height() + radii.bottomRight().height(); | 1690 radiiSum = radii.topRight().height() + radii.bottomRight().height(); |
| 1689 if (radiiSum > rect.height()) | 1691 if (radiiSum > rect.height()) |
| 1690 factor = std::min(rect.height() / radiiSum, factor); | 1692 factor = std::min(rect.height() / radiiSum, factor); |
| 1691 | 1693 |
| 1692 ASSERT(factor <= 1); | 1694 ASSERT(factor <= 1); |
| 1693 return factor; | 1695 return factor; |
| 1694 } | 1696 } |
| 1695 | 1697 |
| 1698 | |
| 1699 void RenderStyle::resolveJustifyItemsAuto(const RenderStyle& parentStyle) | |
| 1700 { | |
| 1701 if (justifyItems() != ItemPositionAuto) | |
| 1702 return; | |
| 1703 | |
| 1704 // If the inherited value of justify-items includes the legacy keyword, 'aut o' | |
| 1705 // computes to the the inherited value. | |
| 1706 // Otherwise, auto computes to: | |
| 1707 // - 'stretch' for flex containers and grid containers. | |
| 1708 // - 'start' for everything else. | |
|
svillar
2014/07/29 10:40:05
I don't think you need these comments. Code is sel
| |
| 1709 if (parentStyle.justifyItemsPositionType() == LegacyPosition) { | |
| 1710 setJustifyItems(parentStyle.justifyItems()); | |
| 1711 setJustifyItemsPositionType(parentStyle.justifyItemsPositionType()); | |
| 1712 } else if (isDisplayFlexibleOrGridBox()) { | |
| 1713 setJustifyItems(ItemPositionStretch); | |
| 1714 } | |
| 1715 } | |
| 1716 | |
| 1717 void RenderStyle::resolveJustifySelfAuto(const RenderStyle& parentStyle) | |
| 1718 { | |
| 1719 if (justifySelf() != ItemPositionAuto) | |
| 1720 return; | |
| 1721 | |
| 1722 // The 'auto' keyword computes to 'stretch' on absolutely-positioned element s, | |
| 1723 // and to the computed value of justify-items on the parent (minus | |
| 1724 // any legacy keywords) on all other boxes. | |
|
svillar
2014/07/29 10:40:05
Ditto.
| |
| 1725 if (position() == AbsolutePosition) { | |
| 1726 setJustifySelf(ItemPositionStretch); | |
| 1727 } else { | |
| 1728 setJustifySelf(parentStyle.justifyItems()); | |
| 1729 setJustifySelfOverflowAlignment(parentStyle.justifyItemsOverflowAlignmen t()); | |
| 1730 } | |
| 1731 } | |
| 1732 | |
| 1733 void RenderStyle::resolveAlignItemsAuto(const RenderStyle& parentStyle) | |
| 1734 { | |
| 1735 if (alignItems() != ItemPositionAuto) | |
| 1736 return; | |
| 1737 | |
| 1738 // The 'auto' keyword computes to: | |
| 1739 // 'stretch' for flex containers and grid containers, | |
| 1740 // 'start' for everything else. | |
|
svillar
2014/07/29 10:40:05
Ditto.
| |
| 1741 if (isDisplayFlexibleOrGridBox()) | |
| 1742 setAlignItems(ItemPositionStretch); | |
| 1743 } | |
| 1744 | |
| 1745 void RenderStyle::resolveAlignSelfAuto(const RenderStyle& parentStyle) | |
| 1746 { | |
| 1747 if (alignSelf() != ItemPositionAuto) | |
| 1748 return; | |
| 1749 | |
| 1750 // The 'auto' keyword computes to 'stretch' on absolutely-positioned element s, | |
| 1751 // and to the computed value of align-items on the parent (minus | |
| 1752 // any 'legacy' keywords) on all other boxes. | |
|
svillar
2014/07/29 10:40:05
Ditto.
| |
| 1753 if ((position() == AbsolutePosition)) { | |
| 1754 setAlignSelf(ItemPositionStretch); | |
| 1755 } else { | |
| 1756 setAlignSelf(parentStyle.alignItems()); | |
| 1757 setAlignSelfOverflowAlignment(parentStyle.alignItemsOverflowAlignment()) ; | |
| 1758 } | |
| 1759 } | |
| 1760 | |
| 1696 } // namespace blink | 1761 } // namespace blink |
| OLD | NEW |