OLD | NEW |
---|---|
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 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1530 { | 1530 { |
1531 if (!m_node) | 1531 if (!m_node) |
1532 return 0; | 1532 return 0; |
1533 if (m_node->isElementNode()) { | 1533 if (m_node->isElementNode()) { |
1534 if (PseudoElement* element = toElement(m_node)->pseudoElement(m_pseudoEl ementSpecifier)) | 1534 if (PseudoElement* element = toElement(m_node)->pseudoElement(m_pseudoEl ementSpecifier)) |
1535 return element; | 1535 return element; |
1536 } | 1536 } |
1537 return m_node.get(); | 1537 return m_node.get(); |
1538 } | 1538 } |
1539 | 1539 |
1540 static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element) | |
1541 { | |
1542 if (position != ItemPositionAuto) | |
1543 return position; | |
1544 | |
1545 bool isFlexOrGrid = element && element->computedStyle() | |
1546 && element->computedStyle()->isDisplayFlexibleOrGridBox(); | |
1547 | |
1548 return isFlexOrGrid ? ItemPositionStretch : ItemPositionStart; | |
1549 } | |
1550 | |
1551 static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlig nment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositi onType positionType) | 1540 static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlig nment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositi onType positionType) |
1552 { | 1541 { |
1553 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated (); | 1542 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated (); |
1554 if (positionType == LegacyPosition) | 1543 if (positionType == LegacyPosition) |
1555 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); | 1544 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); |
1556 result->append(CSSPrimitiveValue::create(itemPosition)); | 1545 result->append(CSSPrimitiveValue::create(itemPosition)); |
1557 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign mentDefault) | 1546 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign mentDefault) |
1558 result->append(CSSPrimitiveValue::create(overflowAlignment)); | 1547 result->append(CSSPrimitiveValue::create(overflowAlignment)); |
1559 ASSERT(result->length() <= 2); | 1548 ASSERT(result->length() <= 2); |
1560 return result.release(); | 1549 return result.release(); |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1823 } | 1812 } |
1824 case CSSPropertyDirection: | 1813 case CSSPropertyDirection: |
1825 return cssValuePool().createValue(style->direction()); | 1814 return cssValuePool().createValue(style->direction()); |
1826 case CSSPropertyDisplay: | 1815 case CSSPropertyDisplay: |
1827 return cssValuePool().createValue(style->display()); | 1816 return cssValuePool().createValue(style->display()); |
1828 case CSSPropertyEmptyCells: | 1817 case CSSPropertyEmptyCells: |
1829 return cssValuePool().createValue(style->emptyCells()); | 1818 return cssValuePool().createValue(style->emptyCells()); |
1830 case CSSPropertyAlignContent: | 1819 case CSSPropertyAlignContent: |
1831 return cssValuePool().createValue(style->alignContent()); | 1820 return cssValuePool().createValue(style->alignContent()); |
1832 case CSSPropertyAlignItems: | 1821 case CSSPropertyAlignItems: |
1833 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAut o(style->alignItems(), styledNode), style->alignItemsOverflowAlignment(), NonLeg acyPosition); | 1822 return valueForItemPositionWithOverflowAlignment(style->alignItems() , style->alignItemsOverflowAlignment(), NonLegacyPosition); |
1834 case CSSPropertyAlignSelf: | 1823 case CSSPropertyAlignSelf: { |
1835 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAut o(style->alignSelf(), styledNode->parentNode()), style->alignSelfOverflowAlignme nt(), NonLegacyPosition); | 1824 ItemPosition alignSelf = style->alignSelf(); |
1825 OverflowAlignment overflow = style->alignSelfOverflowAlignment(); | |
1826 if (alignSelf == ItemPositionAuto) { | |
1827 Node* parent = styledNode->parentNode(); | |
1828 if (parent && parent->computedStyle()) { | |
1829 alignSelf = parent->computedStyle()->alignItems(); | |
1830 overflow = parent->computedStyle()->alignItemsOverflowAlignm ent(); | |
esprehn
2014/08/19 00:56:33
This seems like code duplication, also same issues
jfernandez
2014/08/19 21:00:12
Do you mean code duplication with the logic managi
esprehn
2014/09/03 21:45:28
Yes.
jfernandez
2014/09/03 22:27:49
Done.
| |
1831 } | |
1832 } | |
1833 return valueForItemPositionWithOverflowAlignment(alignSelf, overflow , NonLegacyPosition); | |
1834 } | |
1836 case CSSPropertyFlex: | 1835 case CSSPropertyFlex: |
1837 return valuesForShorthandProperty(flexShorthand()); | 1836 return valuesForShorthandProperty(flexShorthand()); |
1838 case CSSPropertyFlexBasis: | 1837 case CSSPropertyFlexBasis: |
1839 return zoomAdjustedPixelValueForLength(style->flexBasis(), *style); | 1838 return zoomAdjustedPixelValueForLength(style->flexBasis(), *style); |
1840 case CSSPropertyFlexDirection: | 1839 case CSSPropertyFlexDirection: |
1841 return cssValuePool().createValue(style->flexDirection()); | 1840 return cssValuePool().createValue(style->flexDirection()); |
1842 case CSSPropertyFlexFlow: | 1841 case CSSPropertyFlexFlow: |
1843 return valuesForShorthandProperty(flexFlowShorthand()); | 1842 return valuesForShorthandProperty(flexFlowShorthand()); |
1844 case CSSPropertyFlexGrow: | 1843 case CSSPropertyFlexGrow: |
1845 return cssValuePool().createValue(style->flexGrow()); | 1844 return cssValuePool().createValue(style->flexGrow()); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1993 return cssValuePool().createValue(style->hyphenationString(), CSSPri mitiveValue::CSS_STRING); | 1992 return cssValuePool().createValue(style->hyphenationString(), CSSPri mitiveValue::CSS_STRING); |
1994 case CSSPropertyWebkitBorderFit: | 1993 case CSSPropertyWebkitBorderFit: |
1995 if (style->borderFit() == BorderFitBorder) | 1994 if (style->borderFit() == BorderFitBorder) |
1996 return cssValuePool().createIdentifierValue(CSSValueBorder); | 1995 return cssValuePool().createIdentifierValue(CSSValueBorder); |
1997 return cssValuePool().createIdentifierValue(CSSValueLines); | 1996 return cssValuePool().createIdentifierValue(CSSValueLines); |
1998 case CSSPropertyImageRendering: | 1997 case CSSPropertyImageRendering: |
1999 return CSSPrimitiveValue::create(style->imageRendering()); | 1998 return CSSPrimitiveValue::create(style->imageRendering()); |
2000 case CSSPropertyIsolation: | 1999 case CSSPropertyIsolation: |
2001 return cssValuePool().createValue(style->isolation()); | 2000 return cssValuePool().createValue(style->isolation()); |
2002 case CSSPropertyJustifyItems: | 2001 case CSSPropertyJustifyItems: |
2003 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAut o(style->justifyItems(), styledNode), style->justifyItemsOverflowAlignment(), st yle->justifyItemsPositionType()); | 2002 return valueForItemPositionWithOverflowAlignment(style->justifyItems (), style->justifyItemsOverflowAlignment(), style->justifyItemsPositionType()); |
2004 case CSSPropertyJustifySelf: | 2003 case CSSPropertyJustifySelf: { |
2005 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAut o(style->justifySelf(), styledNode->parentNode()), style->justifySelfOverflowAli gnment(), NonLegacyPosition); | 2004 ItemPosition justifySelf = style->justifySelf(); |
2005 OverflowAlignment overflow = style->justifySelfOverflowAlignment(); | |
2006 if (justifySelf == ItemPositionAuto) { | |
2007 Node* parent = styledNode->parentNode(); | |
2008 if (parent && parent->computedStyle()) { | |
esprehn
2014/08/19 00:56:33
You need to use NodeRenderingTraversal::parent(),
jfernandez
2014/08/19 21:00:12
I used parentNode() because it was what it was use
esprehn
2014/09/03 21:45:27
I don't understand what you mean, style is resolve
jfernandez
2014/09/03 22:27:49
Acknowledged.
| |
2009 justifySelf = parent->computedStyle()->justifyItems(); | |
2010 overflow = parent->computedStyle()->justifyItemsOverflowAlig nment(); | |
2011 } | |
2012 } | |
2013 return valueForItemPositionWithOverflowAlignment(justifySelf, overfl ow, NonLegacyPosition); | |
2014 } | |
2006 case CSSPropertyLeft: | 2015 case CSSPropertyLeft: |
2007 return valueForPositionOffset(*style, CSSPropertyLeft, renderer); | 2016 return valueForPositionOffset(*style, CSSPropertyLeft, renderer); |
2008 case CSSPropertyLetterSpacing: | 2017 case CSSPropertyLetterSpacing: |
2009 if (!style->letterSpacing()) | 2018 if (!style->letterSpacing()) |
2010 return cssValuePool().createIdentifierValue(CSSValueNormal); | 2019 return cssValuePool().createIdentifierValue(CSSValueNormal); |
2011 return zoomAdjustedPixelValue(style->letterSpacing(), *style); | 2020 return zoomAdjustedPixelValue(style->letterSpacing(), *style); |
2012 case CSSPropertyWebkitLineClamp: | 2021 case CSSPropertyWebkitLineClamp: |
2013 if (style->lineClamp().isNone()) | 2022 if (style->lineClamp().isNone()) |
2014 return cssValuePool().createIdentifierValue(CSSValueNone); | 2023 return cssValuePool().createIdentifierValue(CSSValueNone); |
2015 return cssValuePool().createValue(style->lineClamp().value(), style- >lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveVa lue::CSS_NUMBER); | 2024 return cssValuePool().createValue(style->lineClamp().value(), style- >lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveVa lue::CSS_NUMBER); |
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3012 return list.release(); | 3021 return list.release(); |
3013 } | 3022 } |
3014 | 3023 |
3015 void CSSComputedStyleDeclaration::trace(Visitor* visitor) | 3024 void CSSComputedStyleDeclaration::trace(Visitor* visitor) |
3016 { | 3025 { |
3017 visitor->trace(m_node); | 3026 visitor->trace(m_node); |
3018 CSSStyleDeclaration::trace(visitor); | 3027 CSSStyleDeclaration::trace(visitor); |
3019 } | 3028 } |
3020 | 3029 |
3021 } // namespace blink | 3030 } // namespace blink |
OLD | NEW |