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 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 { | 1513 { |
1514 if (!m_node) | 1514 if (!m_node) |
1515 return 0; | 1515 return 0; |
1516 if (m_node->isElementNode()) { | 1516 if (m_node->isElementNode()) { |
1517 if (PseudoElement* element = toElement(m_node)->pseudoElement(m_pseudoEl
ementSpecifier)) | 1517 if (PseudoElement* element = toElement(m_node)->pseudoElement(m_pseudoEl
ementSpecifier)) |
1518 return element; | 1518 return element; |
1519 } | 1519 } |
1520 return m_node.get(); | 1520 return m_node.get(); |
1521 } | 1521 } |
1522 | 1522 |
| 1523 static PassRefPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPo
sition itemPosition, OverflowAlignment overflowAlignment) |
| 1524 { |
| 1525 RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); |
| 1526 result->append(CSSPrimitiveValue::create(itemPosition)); |
| 1527 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign
mentDefault) |
| 1528 result->append(CSSPrimitiveValue::create(overflowAlignment)); |
| 1529 return result.release(); |
| 1530 } |
| 1531 |
1523 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
yID propertyID, EUpdateLayout updateLayout) const | 1532 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
yID propertyID, EUpdateLayout updateLayout) const |
1524 { | 1533 { |
1525 Node* styledNode = this->styledNode(); | 1534 Node* styledNode = this->styledNode(); |
1526 if (!styledNode) | 1535 if (!styledNode) |
1527 return 0; | 1536 return 0; |
1528 RenderObject* renderer = styledNode->renderer(); | 1537 RenderObject* renderer = styledNode->renderer(); |
1529 RefPtr<RenderStyle> style; | 1538 RefPtr<RenderStyle> style; |
1530 | 1539 |
1531 if (updateLayout) { | 1540 if (updateLayout) { |
1532 Document& document = styledNode->document(); | 1541 Document& document = styledNode->document(); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1849 } | 1858 } |
1850 case CSSPropertyDirection: | 1859 case CSSPropertyDirection: |
1851 return cssValuePool().createValue(style->direction()); | 1860 return cssValuePool().createValue(style->direction()); |
1852 case CSSPropertyDisplay: | 1861 case CSSPropertyDisplay: |
1853 return cssValuePool().createValue(style->display()); | 1862 return cssValuePool().createValue(style->display()); |
1854 case CSSPropertyEmptyCells: | 1863 case CSSPropertyEmptyCells: |
1855 return cssValuePool().createValue(style->emptyCells()); | 1864 return cssValuePool().createValue(style->emptyCells()); |
1856 case CSSPropertyAlignContent: | 1865 case CSSPropertyAlignContent: |
1857 return cssValuePool().createValue(style->alignContent()); | 1866 return cssValuePool().createValue(style->alignContent()); |
1858 case CSSPropertyAlignItems: | 1867 case CSSPropertyAlignItems: |
1859 return cssValuePool().createValue(style->alignItems()); | 1868 return valueForItemPositionWithOverflowAlignment(style->alignItems()
, style->alignItemsOverflowAlignment()); |
1860 case CSSPropertyAlignSelf: | 1869 case CSSPropertyAlignSelf: { |
1861 if (style->alignSelf() == AlignAuto) { | 1870 ItemPosition alignSelf = style->alignSelf(); |
| 1871 if (alignSelf == ItemPositionAuto) { |
1862 Node* parent = styledNode->parentNode(); | 1872 Node* parent = styledNode->parentNode(); |
1863 if (parent && parent->computedStyle()) | 1873 if (parent && parent->computedStyle()) |
1864 return cssValuePool().createValue(parent->computedStyle()->a
lignItems()); | 1874 alignSelf = parent->computedStyle()->alignItems(); |
1865 return cssValuePool().createValue(AlignStretch); | 1875 else |
| 1876 alignSelf = ItemPositionStretch; |
1866 } | 1877 } |
1867 return cssValuePool().createValue(style->alignSelf()); | 1878 return valueForItemPositionWithOverflowAlignment(alignSelf, style->a
lignSelfOverflowAlignment()); |
| 1879 } |
1868 case CSSPropertyFlex: | 1880 case CSSPropertyFlex: |
1869 return valuesForShorthandProperty(flexShorthand()); | 1881 return valuesForShorthandProperty(flexShorthand()); |
1870 case CSSPropertyFlexBasis: | 1882 case CSSPropertyFlexBasis: |
1871 return cssValuePool().createValue(style->flexBasis()); | 1883 return cssValuePool().createValue(style->flexBasis()); |
1872 case CSSPropertyFlexDirection: | 1884 case CSSPropertyFlexDirection: |
1873 return cssValuePool().createValue(style->flexDirection()); | 1885 return cssValuePool().createValue(style->flexDirection()); |
1874 case CSSPropertyFlexFlow: | 1886 case CSSPropertyFlexFlow: |
1875 return valuesForShorthandProperty(flexFlowShorthand()); | 1887 return valuesForShorthandProperty(flexFlowShorthand()); |
1876 case CSSPropertyFlexGrow: | 1888 case CSSPropertyFlexGrow: |
1877 return cssValuePool().createValue(style->flexGrow()); | 1889 return cssValuePool().createValue(style->flexGrow()); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1984 return cssValuePool().createIdentifierValue(CSSValueAuto); | 1996 return cssValuePool().createIdentifierValue(CSSValueAuto); |
1985 return cssValuePool().createValue(style->hyphenationString(), CSSPri
mitiveValue::CSS_STRING); | 1997 return cssValuePool().createValue(style->hyphenationString(), CSSPri
mitiveValue::CSS_STRING); |
1986 case CSSPropertyWebkitBorderFit: | 1998 case CSSPropertyWebkitBorderFit: |
1987 if (style->borderFit() == BorderFitBorder) | 1999 if (style->borderFit() == BorderFitBorder) |
1988 return cssValuePool().createIdentifierValue(CSSValueBorder); | 2000 return cssValuePool().createIdentifierValue(CSSValueBorder); |
1989 return cssValuePool().createIdentifierValue(CSSValueLines); | 2001 return cssValuePool().createIdentifierValue(CSSValueLines); |
1990 case CSSPropertyImageRendering: | 2002 case CSSPropertyImageRendering: |
1991 return CSSPrimitiveValue::create(style->imageRendering()); | 2003 return CSSPrimitiveValue::create(style->imageRendering()); |
1992 case CSSPropertyIsolation: | 2004 case CSSPropertyIsolation: |
1993 return cssValuePool().createValue(style->isolation()); | 2005 return cssValuePool().createValue(style->isolation()); |
1994 case CSSPropertyJustifySelf: { | 2006 case CSSPropertyJustifySelf: |
1995 RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); | 2007 return valueForItemPositionWithOverflowAlignment(style->justifySelf(
), style->justifySelfOverflowAlignment()); |
1996 result->append(CSSPrimitiveValue::create(style->justifySelf())); | |
1997 if (style->justifySelf() >= ItemPositionCenter && style->justifySelf
OverflowAlignment() != OverflowAlignmentDefault) | |
1998 result->append(CSSPrimitiveValue::create(style->justifySelfOverf
lowAlignment())); | |
1999 return result.release(); | |
2000 } | |
2001 case CSSPropertyLeft: | 2008 case CSSPropertyLeft: |
2002 return valueForPositionOffset(*style, CSSPropertyLeft, renderer); | 2009 return valueForPositionOffset(*style, CSSPropertyLeft, renderer); |
2003 case CSSPropertyLetterSpacing: | 2010 case CSSPropertyLetterSpacing: |
2004 if (!style->letterSpacing()) | 2011 if (!style->letterSpacing()) |
2005 return cssValuePool().createIdentifierValue(CSSValueNormal); | 2012 return cssValuePool().createIdentifierValue(CSSValueNormal); |
2006 return zoomAdjustedPixelValue(style->letterSpacing(), *style); | 2013 return zoomAdjustedPixelValue(style->letterSpacing(), *style); |
2007 case CSSPropertyWebkitLineClamp: | 2014 case CSSPropertyWebkitLineClamp: |
2008 if (style->lineClamp().isNone()) | 2015 if (style->lineClamp().isNone()) |
2009 return cssValuePool().createIdentifierValue(CSSValueNone); | 2016 return cssValuePool().createIdentifierValue(CSSValueNone); |
2010 return cssValuePool().createValue(style->lineClamp().value(), style-
>lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveVa
lue::CSS_NUMBER); | 2017 return cssValuePool().createValue(style->lineClamp().value(), style-
>lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveVa
lue::CSS_NUMBER); |
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3139 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB
ackgroundSize, CSSPropertyBackgroundOrigin, | 3146 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB
ackgroundSize, CSSPropertyBackgroundOrigin, |
3140 CSSPropertyB
ackgroundClip }; | 3147 CSSPropertyB
ackgroundClip }; |
3141 | 3148 |
3142 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); | 3149 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); |
3143 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash
Seperator)))); | 3150 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash
Seperator)))); |
3144 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe
perator)))); | 3151 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe
perator)))); |
3145 return list.release(); | 3152 return list.release(); |
3146 } | 3153 } |
3147 | 3154 |
3148 } // namespace WebCore | 3155 } // namespace WebCore |
OLD | NEW |