| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "core/css/CSSTimingFunctionValue.h" | 48 #include "core/css/CSSTimingFunctionValue.h" |
| 49 #include "core/css/CSSTransformValue.h" | 49 #include "core/css/CSSTransformValue.h" |
| 50 #include "core/css/CSSValueList.h" | 50 #include "core/css/CSSValueList.h" |
| 51 #include "core/css/CSSValuePool.h" | 51 #include "core/css/CSSValuePool.h" |
| 52 #include "core/css/Pair.h" | 52 #include "core/css/Pair.h" |
| 53 #include "core/css/Rect.h" | 53 #include "core/css/Rect.h" |
| 54 #include "core/css/StylePropertySet.h" | 54 #include "core/css/StylePropertySet.h" |
| 55 #include "core/css/resolver/StyleResolver.h" | 55 #include "core/css/resolver/StyleResolver.h" |
| 56 #include "core/dom/Document.h" | 56 #include "core/dom/Document.h" |
| 57 #include "core/dom/ExceptionCode.h" | 57 #include "core/dom/ExceptionCode.h" |
| 58 #include "core/dom/NodeRenderingTraversal.h" |
| 58 #include "core/dom/PseudoElement.h" | 59 #include "core/dom/PseudoElement.h" |
| 59 #include "core/rendering/RenderBox.h" | 60 #include "core/rendering/RenderBox.h" |
| 60 #include "core/rendering/RenderGrid.h" | 61 #include "core/rendering/RenderGrid.h" |
| 61 #include "core/rendering/style/ContentData.h" | 62 #include "core/rendering/style/ContentData.h" |
| 62 #include "core/rendering/style/CounterContent.h" | 63 #include "core/rendering/style/CounterContent.h" |
| 63 #include "core/rendering/style/RenderStyle.h" | 64 #include "core/rendering/style/RenderStyle.h" |
| 64 #include "core/rendering/style/ShadowList.h" | 65 #include "core/rendering/style/ShadowList.h" |
| 65 #include "core/rendering/style/ShapeValue.h" | 66 #include "core/rendering/style/ShapeValue.h" |
| 66 #include "platform/FontFamilyNames.h" | 67 #include "platform/FontFamilyNames.h" |
| 67 #include "platform/RuntimeEnabledFeatures.h" | 68 #include "platform/RuntimeEnabledFeatures.h" |
| (...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1529 { | 1530 { |
| 1530 if (!m_node) | 1531 if (!m_node) |
| 1531 return 0; | 1532 return 0; |
| 1532 if (m_node->isElementNode()) { | 1533 if (m_node->isElementNode()) { |
| 1533 if (PseudoElement* element = toElement(m_node)->pseudoElement(m_pseudoEl
ementSpecifier)) | 1534 if (PseudoElement* element = toElement(m_node)->pseudoElement(m_pseudoEl
ementSpecifier)) |
| 1534 return element; | 1535 return element; |
| 1535 } | 1536 } |
| 1536 return m_node.get(); | 1537 return m_node.get(); |
| 1537 } | 1538 } |
| 1538 | 1539 |
| 1539 static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element) | 1540 static void resolveAlignment(Node* styledNode, ItemPosition& position, OverflowA
lignment& overflow) |
| 1540 { | 1541 { |
| 1541 if (position != ItemPositionAuto) | 1542 if (position == ItemPositionAuto) { |
| 1542 return position; | 1543 if (Node* parent = NodeRenderingTraversal::parent(styledNode)) { |
| 1543 | 1544 if (RenderStyle* parentStyle = parent->computedStyle()) { |
| 1544 bool isFlexOrGrid = element && element->computedStyle() | 1545 position = parentStyle->alignItems(); |
| 1545 && element->computedStyle()->isDisplayFlexibleOrGridBox(); | 1546 overflow = parentStyle->alignItemsOverflowAlignment(); |
| 1546 | 1547 } |
| 1547 return isFlexOrGrid ? ItemPositionStretch : ItemPositionStart; | 1548 } |
| 1549 } |
| 1548 } | 1550 } |
| 1549 | 1551 |
| 1550 static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlig
nment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositi
onType positionType) | 1552 static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlig
nment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositi
onType positionType) |
| 1551 { | 1553 { |
| 1552 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated
(); | 1554 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated
(); |
| 1553 if (positionType == LegacyPosition) | 1555 if (positionType == LegacyPosition) |
| 1554 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); | 1556 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); |
| 1555 result->append(CSSPrimitiveValue::create(itemPosition)); | 1557 result->append(CSSPrimitiveValue::create(itemPosition)); |
| 1556 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign
mentDefault) | 1558 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign
mentDefault) |
| 1557 result->append(CSSPrimitiveValue::create(overflowAlignment)); | 1559 result->append(CSSPrimitiveValue::create(overflowAlignment)); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1821 } | 1823 } |
| 1822 case CSSPropertyDirection: | 1824 case CSSPropertyDirection: |
| 1823 return cssValuePool().createValue(style->direction()); | 1825 return cssValuePool().createValue(style->direction()); |
| 1824 case CSSPropertyDisplay: | 1826 case CSSPropertyDisplay: |
| 1825 return cssValuePool().createValue(style->display()); | 1827 return cssValuePool().createValue(style->display()); |
| 1826 case CSSPropertyEmptyCells: | 1828 case CSSPropertyEmptyCells: |
| 1827 return cssValuePool().createValue(style->emptyCells()); | 1829 return cssValuePool().createValue(style->emptyCells()); |
| 1828 case CSSPropertyAlignContent: | 1830 case CSSPropertyAlignContent: |
| 1829 return cssValuePool().createValue(style->alignContent()); | 1831 return cssValuePool().createValue(style->alignContent()); |
| 1830 case CSSPropertyAlignItems: | 1832 case CSSPropertyAlignItems: |
| 1831 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAut
o(style->alignItems(), styledNode), style->alignItemsOverflowAlignment(), NonLeg
acyPosition); | 1833 return valueForItemPositionWithOverflowAlignment(style->alignItems()
, style->alignItemsOverflowAlignment(), NonLegacyPosition); |
| 1832 case CSSPropertyAlignSelf: | 1834 case CSSPropertyAlignSelf: { |
| 1833 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAut
o(style->alignSelf(), styledNode->parentNode()), style->alignSelfOverflowAlignme
nt(), NonLegacyPosition); | 1835 ItemPosition alignSelf = style->alignSelf(); |
| 1836 OverflowAlignment overflow = style->alignSelfOverflowAlignment(); |
| 1837 resolveAlignment(styledNode, alignSelf, overflow); |
| 1838 return valueForItemPositionWithOverflowAlignment(alignSelf, overflow
, NonLegacyPosition); |
| 1839 } |
| 1834 case CSSPropertyFlex: | 1840 case CSSPropertyFlex: |
| 1835 return valuesForShorthandProperty(flexShorthand()); | 1841 return valuesForShorthandProperty(flexShorthand()); |
| 1836 case CSSPropertyFlexBasis: | 1842 case CSSPropertyFlexBasis: |
| 1837 return zoomAdjustedPixelValueForLength(style->flexBasis(), *style); | 1843 return zoomAdjustedPixelValueForLength(style->flexBasis(), *style); |
| 1838 case CSSPropertyFlexDirection: | 1844 case CSSPropertyFlexDirection: |
| 1839 return cssValuePool().createValue(style->flexDirection()); | 1845 return cssValuePool().createValue(style->flexDirection()); |
| 1840 case CSSPropertyFlexFlow: | 1846 case CSSPropertyFlexFlow: |
| 1841 return valuesForShorthandProperty(flexFlowShorthand()); | 1847 return valuesForShorthandProperty(flexFlowShorthand()); |
| 1842 case CSSPropertyFlexGrow: | 1848 case CSSPropertyFlexGrow: |
| 1843 return cssValuePool().createValue(style->flexGrow()); | 1849 return cssValuePool().createValue(style->flexGrow()); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1991 return cssValuePool().createValue(style->hyphenationString(), CSSPri
mitiveValue::CSS_STRING); | 1997 return cssValuePool().createValue(style->hyphenationString(), CSSPri
mitiveValue::CSS_STRING); |
| 1992 case CSSPropertyWebkitBorderFit: | 1998 case CSSPropertyWebkitBorderFit: |
| 1993 if (style->borderFit() == BorderFitBorder) | 1999 if (style->borderFit() == BorderFitBorder) |
| 1994 return cssValuePool().createIdentifierValue(CSSValueBorder); | 2000 return cssValuePool().createIdentifierValue(CSSValueBorder); |
| 1995 return cssValuePool().createIdentifierValue(CSSValueLines); | 2001 return cssValuePool().createIdentifierValue(CSSValueLines); |
| 1996 case CSSPropertyImageRendering: | 2002 case CSSPropertyImageRendering: |
| 1997 return CSSPrimitiveValue::create(style->imageRendering()); | 2003 return CSSPrimitiveValue::create(style->imageRendering()); |
| 1998 case CSSPropertyIsolation: | 2004 case CSSPropertyIsolation: |
| 1999 return cssValuePool().createValue(style->isolation()); | 2005 return cssValuePool().createValue(style->isolation()); |
| 2000 case CSSPropertyJustifyItems: | 2006 case CSSPropertyJustifyItems: |
| 2001 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAut
o(style->justifyItems(), styledNode), style->justifyItemsOverflowAlignment(), st
yle->justifyItemsPositionType()); | 2007 return valueForItemPositionWithOverflowAlignment(style->justifyItems
(), style->justifyItemsOverflowAlignment(), style->justifyItemsPositionType()); |
| 2002 case CSSPropertyJustifySelf: | 2008 case CSSPropertyJustifySelf: { |
| 2003 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAut
o(style->justifySelf(), styledNode->parentNode()), style->justifySelfOverflowAli
gnment(), NonLegacyPosition); | 2009 ItemPosition justifySelf = style->justifySelf(); |
| 2010 OverflowAlignment overflow = style->justifySelfOverflowAlignment(); |
| 2011 resolveAlignment(styledNode, justifySelf, overflow); |
| 2012 return valueForItemPositionWithOverflowAlignment(justifySelf, overfl
ow, NonLegacyPosition); |
| 2013 } |
| 2004 case CSSPropertyLeft: | 2014 case CSSPropertyLeft: |
| 2005 return valueForPositionOffset(*style, CSSPropertyLeft, renderer); | 2015 return valueForPositionOffset(*style, CSSPropertyLeft, renderer); |
| 2006 case CSSPropertyLetterSpacing: | 2016 case CSSPropertyLetterSpacing: |
| 2007 if (!style->letterSpacing()) | 2017 if (!style->letterSpacing()) |
| 2008 return cssValuePool().createIdentifierValue(CSSValueNormal); | 2018 return cssValuePool().createIdentifierValue(CSSValueNormal); |
| 2009 return zoomAdjustedPixelValue(style->letterSpacing(), *style); | 2019 return zoomAdjustedPixelValue(style->letterSpacing(), *style); |
| 2010 case CSSPropertyWebkitLineClamp: | 2020 case CSSPropertyWebkitLineClamp: |
| 2011 if (style->lineClamp().isNone()) | 2021 if (style->lineClamp().isNone()) |
| 2012 return cssValuePool().createIdentifierValue(CSSValueNone); | 2022 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 2013 return cssValuePool().createValue(style->lineClamp().value(), style-
>lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveVa
lue::CSS_NUMBER); | 2023 return cssValuePool().createValue(style->lineClamp().value(), style-
>lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveVa
lue::CSS_NUMBER); |
| (...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3008 return list.release(); | 3018 return list.release(); |
| 3009 } | 3019 } |
| 3010 | 3020 |
| 3011 void CSSComputedStyleDeclaration::trace(Visitor* visitor) | 3021 void CSSComputedStyleDeclaration::trace(Visitor* visitor) |
| 3012 { | 3022 { |
| 3013 visitor->trace(m_node); | 3023 visitor->trace(m_node); |
| 3014 CSSStyleDeclaration::trace(visitor); | 3024 CSSStyleDeclaration::trace(visitor); |
| 3015 } | 3025 } |
| 3016 | 3026 |
| 3017 } // namespace blink | 3027 } // namespace blink |
| OLD | NEW |