Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(492)

Side by Side Diff: Source/core/css/CSSComputedStyleDeclaration.cpp

Issue 333423005: [CSS Grid Layout] Implement 'justify-items' parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Suggested changes and additional test cases. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 CSSPropertyFontFamily, 129 CSSPropertyFontFamily,
130 CSSPropertyFontKerning, 130 CSSPropertyFontKerning,
131 CSSPropertyFontSize, 131 CSSPropertyFontSize,
132 CSSPropertyFontStyle, 132 CSSPropertyFontStyle,
133 CSSPropertyFontVariant, 133 CSSPropertyFontVariant,
134 CSSPropertyFontVariantLigatures, 134 CSSPropertyFontVariantLigatures,
135 CSSPropertyFontWeight, 135 CSSPropertyFontWeight,
136 CSSPropertyHeight, 136 CSSPropertyHeight,
137 CSSPropertyImageRendering, 137 CSSPropertyImageRendering,
138 CSSPropertyIsolation, 138 CSSPropertyIsolation,
139 CSSPropertyJustifyItems,
139 CSSPropertyJustifySelf, 140 CSSPropertyJustifySelf,
140 CSSPropertyLeft, 141 CSSPropertyLeft,
141 CSSPropertyLetterSpacing, 142 CSSPropertyLetterSpacing,
142 CSSPropertyLineHeight, 143 CSSPropertyLineHeight,
143 CSSPropertyListStyleImage, 144 CSSPropertyListStyleImage,
144 CSSPropertyListStylePosition, 145 CSSPropertyListStylePosition,
145 CSSPropertyListStyleType, 146 CSSPropertyListStyleType,
146 CSSPropertyMarginBottom, 147 CSSPropertyMarginBottom,
147 CSSPropertyMarginLeft, 148 CSSPropertyMarginLeft,
148 CSSPropertyMarginRight, 149 CSSPropertyMarginRight,
(...skipping 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 { 1548 {
1548 if (!m_node) 1549 if (!m_node)
1549 return 0; 1550 return 0;
1550 if (m_node->isElementNode()) { 1551 if (m_node->isElementNode()) {
1551 if (PseudoElement* element = toElement(m_node)->pseudoElement(m_pseudoEl ementSpecifier)) 1552 if (PseudoElement* element = toElement(m_node)->pseudoElement(m_pseudoEl ementSpecifier))
1552 return element; 1553 return element;
1553 } 1554 }
1554 return m_node.get(); 1555 return m_node.get();
1555 } 1556 }
1556 1557
1557 static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlig nment(ItemPosition itemPosition, OverflowAlignment overflowAlignment) 1558 static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlig nment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, bool isLeg acy)
1558 { 1559 {
1559 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated (); 1560 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated ();
1561 if (isLegacy)
1562 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy));
1560 result->append(CSSPrimitiveValue::create(itemPosition)); 1563 result->append(CSSPrimitiveValue::create(itemPosition));
1561 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign mentDefault) 1564 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign mentDefault)
1562 result->append(CSSPrimitiveValue::create(overflowAlignment)); 1565 result->append(CSSPrimitiveValue::create(overflowAlignment));
1563 return result.release(); 1566 return result.release();
1564 } 1567 }
1565 1568
1566 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu e(CSSPropertyID propertyID, EUpdateLayout updateLayout) const 1569 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu e(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
1567 { 1570 {
1568 Node* styledNode = this->styledNode(); 1571 Node* styledNode = this->styledNode();
1569 if (!styledNode) 1572 if (!styledNode)
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 } 1882 }
1880 case CSSPropertyDirection: 1883 case CSSPropertyDirection:
1881 return cssValuePool().createValue(style->direction()); 1884 return cssValuePool().createValue(style->direction());
1882 case CSSPropertyDisplay: 1885 case CSSPropertyDisplay:
1883 return cssValuePool().createValue(style->display()); 1886 return cssValuePool().createValue(style->display());
1884 case CSSPropertyEmptyCells: 1887 case CSSPropertyEmptyCells:
1885 return cssValuePool().createValue(style->emptyCells()); 1888 return cssValuePool().createValue(style->emptyCells());
1886 case CSSPropertyAlignContent: 1889 case CSSPropertyAlignContent:
1887 return cssValuePool().createValue(style->alignContent()); 1890 return cssValuePool().createValue(style->alignContent());
1888 case CSSPropertyAlignItems: 1891 case CSSPropertyAlignItems:
1889 return valueForItemPositionWithOverflowAlignment(style->alignItems() , style->alignItemsOverflowAlignment()); 1892 return valueForItemPositionWithOverflowAlignment(style->alignItems() , style->alignItemsOverflowAlignment(), false);
1890 case CSSPropertyAlignSelf: { 1893 case CSSPropertyAlignSelf: {
1891 ItemPosition alignSelf = style->alignSelf(); 1894 ItemPosition alignSelf = style->alignSelf();
1892 if (alignSelf == ItemPositionAuto) { 1895 if (alignSelf == ItemPositionAuto) {
1893 Node* parent = styledNode->parentNode(); 1896 Node* parent = styledNode->parentNode();
1894 if (parent && parent->computedStyle()) 1897 if (parent && parent->computedStyle())
1895 alignSelf = parent->computedStyle()->alignItems(); 1898 alignSelf = parent->computedStyle()->alignItems();
1896 else 1899 else
1897 alignSelf = ItemPositionStretch; 1900 alignSelf = ItemPositionStretch;
1898 } 1901 }
1899 return valueForItemPositionWithOverflowAlignment(alignSelf, style->a lignSelfOverflowAlignment()); 1902 return valueForItemPositionWithOverflowAlignment(alignSelf, style->a lignSelfOverflowAlignment(), false);
1900 } 1903 }
1901 case CSSPropertyFlex: 1904 case CSSPropertyFlex:
1902 return valuesForShorthandProperty(flexShorthand()); 1905 return valuesForShorthandProperty(flexShorthand());
1903 case CSSPropertyFlexBasis: 1906 case CSSPropertyFlexBasis:
1904 return zoomAdjustedPixelValueForLength(style->flexBasis(), *style); 1907 return zoomAdjustedPixelValueForLength(style->flexBasis(), *style);
1905 case CSSPropertyFlexDirection: 1908 case CSSPropertyFlexDirection:
1906 return cssValuePool().createValue(style->flexDirection()); 1909 return cssValuePool().createValue(style->flexDirection());
1907 case CSSPropertyFlexFlow: 1910 case CSSPropertyFlexFlow:
1908 return valuesForShorthandProperty(flexFlowShorthand()); 1911 return valuesForShorthandProperty(flexFlowShorthand());
1909 case CSSPropertyFlexGrow: 1912 case CSSPropertyFlexGrow:
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 return cssValuePool().createIdentifierValue(CSSValueAuto); 2023 return cssValuePool().createIdentifierValue(CSSValueAuto);
2021 return cssValuePool().createValue(style->hyphenationString(), CSSPri mitiveValue::CSS_STRING); 2024 return cssValuePool().createValue(style->hyphenationString(), CSSPri mitiveValue::CSS_STRING);
2022 case CSSPropertyWebkitBorderFit: 2025 case CSSPropertyWebkitBorderFit:
2023 if (style->borderFit() == BorderFitBorder) 2026 if (style->borderFit() == BorderFitBorder)
2024 return cssValuePool().createIdentifierValue(CSSValueBorder); 2027 return cssValuePool().createIdentifierValue(CSSValueBorder);
2025 return cssValuePool().createIdentifierValue(CSSValueLines); 2028 return cssValuePool().createIdentifierValue(CSSValueLines);
2026 case CSSPropertyImageRendering: 2029 case CSSPropertyImageRendering:
2027 return CSSPrimitiveValue::create(style->imageRendering()); 2030 return CSSPrimitiveValue::create(style->imageRendering());
2028 case CSSPropertyIsolation: 2031 case CSSPropertyIsolation:
2029 return cssValuePool().createValue(style->isolation()); 2032 return cssValuePool().createValue(style->isolation());
2033 case CSSPropertyJustifyItems:
2034 return valueForItemPositionWithOverflowAlignment(style->justifyItems (), style->justifyItemsOverflowAlignment(), style->justifyItemsIsLegacy());
2030 case CSSPropertyJustifySelf: 2035 case CSSPropertyJustifySelf:
2031 return valueForItemPositionWithOverflowAlignment(style->justifySelf( ), style->justifySelfOverflowAlignment()); 2036 return valueForItemPositionWithOverflowAlignment(style->justifySelf( ), style->justifySelfOverflowAlignment(), false);
2032 case CSSPropertyLeft: 2037 case CSSPropertyLeft:
2033 return valueForPositionOffset(*style, CSSPropertyLeft, renderer); 2038 return valueForPositionOffset(*style, CSSPropertyLeft, renderer);
2034 case CSSPropertyLetterSpacing: 2039 case CSSPropertyLetterSpacing:
2035 if (!style->letterSpacing()) 2040 if (!style->letterSpacing())
2036 return cssValuePool().createIdentifierValue(CSSValueNormal); 2041 return cssValuePool().createIdentifierValue(CSSValueNormal);
2037 return zoomAdjustedPixelValue(style->letterSpacing(), *style); 2042 return zoomAdjustedPixelValue(style->letterSpacing(), *style);
2038 case CSSPropertyWebkitLineClamp: 2043 case CSSPropertyWebkitLineClamp:
2039 if (style->lineClamp().isNone()) 2044 if (style->lineClamp().isNone())
2040 return cssValuePool().createIdentifierValue(CSSValueNone); 2045 return cssValuePool().createIdentifierValue(CSSValueNone);
2041 return cssValuePool().createValue(style->lineClamp().value(), style- >lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveVa lue::CSS_NUMBER); 2046 return cssValuePool().createValue(style->lineClamp().value(), style- >lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveVa lue::CSS_NUMBER);
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
3057 return list.release(); 3062 return list.release();
3058 } 3063 }
3059 3064
3060 void CSSComputedStyleDeclaration::trace(Visitor* visitor) 3065 void CSSComputedStyleDeclaration::trace(Visitor* visitor)
3061 { 3066 {
3062 visitor->trace(m_node); 3067 visitor->trace(m_node);
3063 CSSStyleDeclaration::trace(visitor); 3068 CSSStyleDeclaration::trace(visitor);
3064 } 3069 }
3065 3070
3066 } // namespace WebCore 3071 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698