| 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 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1884 case CSSPropertyDirection: | 1884 case CSSPropertyDirection: |
| 1885 return cssValuePool().createValue(style->direction()); | 1885 return cssValuePool().createValue(style->direction()); |
| 1886 case CSSPropertyDisplay: | 1886 case CSSPropertyDisplay: |
| 1887 return cssValuePool().createValue(style->display()); | 1887 return cssValuePool().createValue(style->display()); |
| 1888 case CSSPropertyEmptyCells: | 1888 case CSSPropertyEmptyCells: |
| 1889 return cssValuePool().createValue(style->emptyCells()); | 1889 return cssValuePool().createValue(style->emptyCells()); |
| 1890 case CSSPropertyAlignContent: | 1890 case CSSPropertyAlignContent: |
| 1891 return cssValuePool().createValue(style->alignContent()); | 1891 return cssValuePool().createValue(style->alignContent()); |
| 1892 case CSSPropertyAlignItems: | 1892 case CSSPropertyAlignItems: |
| 1893 return valueForItemPositionWithOverflowAlignment(style->alignItems()
, style->alignItemsOverflowAlignment(), NonLegacyPosition); | 1893 return valueForItemPositionWithOverflowAlignment(style->alignItems()
, style->alignItemsOverflowAlignment(), NonLegacyPosition); |
| 1894 case CSSPropertyAlignSelf: { | 1894 case CSSPropertyAlignSelf: |
| 1895 ItemPosition alignSelf = style->alignSelf(); | 1895 return valueForItemPositionWithOverflowAlignment(style->alignSelf(),
style->alignSelfOverflowAlignment(), NonLegacyPosition); |
| 1896 if (alignSelf == ItemPositionAuto) { | |
| 1897 Node* parent = styledNode->parentNode(); | |
| 1898 if (parent && parent->computedStyle()) | |
| 1899 alignSelf = parent->computedStyle()->alignItems(); | |
| 1900 else | |
| 1901 alignSelf = ItemPositionStretch; | |
| 1902 } | |
| 1903 return valueForItemPositionWithOverflowAlignment(alignSelf, style->a
lignSelfOverflowAlignment(), NonLegacyPosition); | |
| 1904 } | |
| 1905 case CSSPropertyFlex: | 1896 case CSSPropertyFlex: |
| 1906 return valuesForShorthandProperty(flexShorthand()); | 1897 return valuesForShorthandProperty(flexShorthand()); |
| 1907 case CSSPropertyFlexBasis: | 1898 case CSSPropertyFlexBasis: |
| 1908 return zoomAdjustedPixelValueForLength(style->flexBasis(), *style); | 1899 return zoomAdjustedPixelValueForLength(style->flexBasis(), *style); |
| 1909 case CSSPropertyFlexDirection: | 1900 case CSSPropertyFlexDirection: |
| 1910 return cssValuePool().createValue(style->flexDirection()); | 1901 return cssValuePool().createValue(style->flexDirection()); |
| 1911 case CSSPropertyFlexFlow: | 1902 case CSSPropertyFlexFlow: |
| 1912 return valuesForShorthandProperty(flexFlowShorthand()); | 1903 return valuesForShorthandProperty(flexFlowShorthand()); |
| 1913 case CSSPropertyFlexGrow: | 1904 case CSSPropertyFlexGrow: |
| 1914 return cssValuePool().createValue(style->flexGrow()); | 1905 return cssValuePool().createValue(style->flexGrow()); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2058 return cssValuePool().createIdentifierValue(CSSValueAuto); | 2049 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 2059 return cssValuePool().createValue(style->hyphenationString(), CSSPri
mitiveValue::CSS_STRING); | 2050 return cssValuePool().createValue(style->hyphenationString(), CSSPri
mitiveValue::CSS_STRING); |
| 2060 case CSSPropertyWebkitBorderFit: | 2051 case CSSPropertyWebkitBorderFit: |
| 2061 if (style->borderFit() == BorderFitBorder) | 2052 if (style->borderFit() == BorderFitBorder) |
| 2062 return cssValuePool().createIdentifierValue(CSSValueBorder); | 2053 return cssValuePool().createIdentifierValue(CSSValueBorder); |
| 2063 return cssValuePool().createIdentifierValue(CSSValueLines); | 2054 return cssValuePool().createIdentifierValue(CSSValueLines); |
| 2064 case CSSPropertyImageRendering: | 2055 case CSSPropertyImageRendering: |
| 2065 return CSSPrimitiveValue::create(style->imageRendering()); | 2056 return CSSPrimitiveValue::create(style->imageRendering()); |
| 2066 case CSSPropertyIsolation: | 2057 case CSSPropertyIsolation: |
| 2067 return cssValuePool().createValue(style->isolation()); | 2058 return cssValuePool().createValue(style->isolation()); |
| 2068 case CSSPropertyJustifyItems: { | 2059 case CSSPropertyJustifyItems: |
| 2069 // FIXME: I would like this to be tested; is not possible with a lay
out test but it | 2060 return valueForItemPositionWithOverflowAlignment(style->justifyItems
(), style->justifyItemsOverflowAlignment(), style->justifyItemsPositionType()); |
| 2070 // should be possible using a method similar to https://codereview.c
hromium.org/351973004 | 2061 case CSSPropertyJustifySelf: |
| 2071 ItemPosition justifyItems = style->justifyItems(); | 2062 return valueForItemPositionWithOverflowAlignment(style->justifySelf(
), style->justifySelfOverflowAlignment(), NonLegacyPosition); |
| 2072 ItemPositionType positionType = style->justifyItemsPositionType(); | |
| 2073 if (justifyItems == ItemPositionAuto) { | |
| 2074 Node* parent = styledNode->parentNode(); | |
| 2075 // If the inherited value of justify-items includes the legacy k
eyword, 'auto' | |
| 2076 // computes to the the inherited value. | |
| 2077 if (parent && parent->computedStyle() && parent->computedStyle()
->justifyItemsPositionType()) { | |
| 2078 justifyItems = parent->computedStyle()->justifyItems(); | |
| 2079 positionType = parent->computedStyle()->justifyItemsPosition
Type(); | |
| 2080 // Otherwise, auto computes to: | |
| 2081 } else if (style->isDisplayFlexibleOrGridBox()) { | |
| 2082 // 'stretch' for flex containers and grid containers. | |
| 2083 justifyItems = ItemPositionStretch; | |
| 2084 } else { | |
| 2085 // 'start' for everything else. | |
| 2086 justifyItems = ItemPositionStart; | |
| 2087 } | |
| 2088 } | |
| 2089 return valueForItemPositionWithOverflowAlignment(justifyItems, style
->justifyItemsOverflowAlignment(), positionType); | |
| 2090 } | |
| 2091 case CSSPropertyJustifySelf: { | |
| 2092 // FIXME: I would like this to be tested; is not possible with a lay
out test but it | |
| 2093 // should be possible using a method similar to https://codereview.c
hromium.org/351973004 | |
| 2094 ItemPosition justifySelf = style->justifySelf(); | |
| 2095 if (justifySelf == ItemPositionAuto) { | |
| 2096 // The auto keyword computes to stretch on absolutely-positioned
elements, | |
| 2097 if (style->position() == AbsolutePosition) { | |
| 2098 justifySelf = ItemPositionStretch; | |
| 2099 } else { | |
| 2100 // and to the computed value of justify-items on the parent
(minus | |
| 2101 // any legacy keywords) on all other boxes. | |
| 2102 Node* parent = styledNode->parentNode(); | |
| 2103 if (parent && parent->computedStyle()) | |
| 2104 justifySelf = parent->computedStyle()->justifyItems(); | |
| 2105 } | |
| 2106 } | |
| 2107 return valueForItemPositionWithOverflowAlignment(justifySelf, style-
>justifySelfOverflowAlignment(), NonLegacyPosition); | |
| 2108 } | |
| 2109 case CSSPropertyLeft: | 2063 case CSSPropertyLeft: |
| 2110 return valueForPositionOffset(*style, CSSPropertyLeft, renderer); | 2064 return valueForPositionOffset(*style, CSSPropertyLeft, renderer); |
| 2111 case CSSPropertyLetterSpacing: | 2065 case CSSPropertyLetterSpacing: |
| 2112 if (!style->letterSpacing()) | 2066 if (!style->letterSpacing()) |
| 2113 return cssValuePool().createIdentifierValue(CSSValueNormal); | 2067 return cssValuePool().createIdentifierValue(CSSValueNormal); |
| 2114 return zoomAdjustedPixelValue(style->letterSpacing(), *style); | 2068 return zoomAdjustedPixelValue(style->letterSpacing(), *style); |
| 2115 case CSSPropertyWebkitLineClamp: | 2069 case CSSPropertyWebkitLineClamp: |
| 2116 if (style->lineClamp().isNone()) | 2070 if (style->lineClamp().isNone()) |
| 2117 return cssValuePool().createIdentifierValue(CSSValueNone); | 2071 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 2118 return cssValuePool().createValue(style->lineClamp().value(), style-
>lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveVa
lue::CSS_NUMBER); | 2072 return cssValuePool().createValue(style->lineClamp().value(), style-
>lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveVa
lue::CSS_NUMBER); |
| (...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3133 return list.release(); | 3087 return list.release(); |
| 3134 } | 3088 } |
| 3135 | 3089 |
| 3136 void CSSComputedStyleDeclaration::trace(Visitor* visitor) | 3090 void CSSComputedStyleDeclaration::trace(Visitor* visitor) |
| 3137 { | 3091 { |
| 3138 visitor->trace(m_node); | 3092 visitor->trace(m_node); |
| 3139 CSSStyleDeclaration::trace(visitor); | 3093 CSSStyleDeclaration::trace(visitor); |
| 3140 } | 3094 } |
| 3141 | 3095 |
| 3142 } // namespace WebCore | 3096 } // namespace WebCore |
| OLD | NEW |