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 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 ASSERT_ARG(keywordSize, keywordSize); | 1272 ASSERT_ARG(keywordSize, keywordSize); |
1273 ASSERT_ARG(keywordSize, keywordSize <= 8); | 1273 ASSERT_ARG(keywordSize, keywordSize <= 8); |
1274 return static_cast<CSSValueID>(CSSValueXxSmall + keywordSize - 1); | 1274 return static_cast<CSSValueID>(CSSValueXxSmall + keywordSize - 1); |
1275 } | 1275 } |
1276 | 1276 |
1277 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringK
eyword() const | 1277 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getFontSizeCSSValuePreferringK
eyword() const |
1278 { | 1278 { |
1279 if (!m_node) | 1279 if (!m_node) |
1280 return 0; | 1280 return 0; |
1281 | 1281 |
1282 m_node->document()->updateLayoutIgnorePendingStylesheets(); | 1282 m_node->document().updateLayoutIgnorePendingStylesheets(); |
1283 | 1283 |
1284 RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier); | 1284 RefPtr<RenderStyle> style = m_node->computedStyle(m_pseudoElementSpecifier); |
1285 if (!style) | 1285 if (!style) |
1286 return 0; | 1286 return 0; |
1287 | 1287 |
1288 if (int keywordSize = style->fontDescription().keywordSize()) | 1288 if (int keywordSize = style->fontDescription().keywordSize()) |
1289 return cssValuePool().createIdentifierValue(cssIdentifierForFontSizeKeyw
ord(keywordSize)); | 1289 return cssValuePool().createIdentifierValue(cssIdentifierForFontSizeKeyw
ord(keywordSize)); |
1290 | 1290 |
1291 | 1291 |
1292 return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(),
style.get()); | 1292 return zoomAdjustedPixelValue(style->fontDescription().computedPixelSize(),
style.get()); |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 | 1605 |
1606 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
yID propertyID, EUpdateLayout updateLayout) const | 1606 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert
yID propertyID, EUpdateLayout updateLayout) const |
1607 { | 1607 { |
1608 Node* styledNode = this->styledNode(); | 1608 Node* styledNode = this->styledNode(); |
1609 if (!styledNode) | 1609 if (!styledNode) |
1610 return 0; | 1610 return 0; |
1611 RenderObject* renderer = styledNode->renderer(); | 1611 RenderObject* renderer = styledNode->renderer(); |
1612 RefPtr<RenderStyle> style; | 1612 RefPtr<RenderStyle> style; |
1613 | 1613 |
1614 if (updateLayout) { | 1614 if (updateLayout) { |
1615 Document* document = styledNode->document(); | 1615 Document& document = styledNode->document(); |
1616 | 1616 |
1617 document->updateStyleForNodeIfNeeded(styledNode); | 1617 document.updateStyleForNodeIfNeeded(styledNode); |
1618 | 1618 |
1619 // The style recalc could have caused the styled node to be discarded or
replaced | 1619 // The style recalc could have caused the styled node to be discarded or
replaced |
1620 // if it was a PseudoElement so we need to update it. | 1620 // if it was a PseudoElement so we need to update it. |
1621 styledNode = this->styledNode(); | 1621 styledNode = this->styledNode(); |
1622 renderer = styledNode->renderer(); | 1622 renderer = styledNode->renderer(); |
1623 | 1623 |
1624 style = computeRenderStyle(propertyID); | 1624 style = computeRenderStyle(propertyID); |
1625 | 1625 |
1626 bool forceFullLayout = isLayoutDependent(propertyID, style, renderer) | 1626 bool forceFullLayout = isLayoutDependent(propertyID, style, renderer) |
1627 || styledNode->isInShadowTree() | 1627 || styledNode->isInShadowTree() |
1628 || (document->styleResolverIfExists() && document->styleResolverIfEx
ists()->hasViewportDependentMediaQueries() && document->ownerElement()) | 1628 || (document.styleResolverIfExists() && document.styleResolverIfExis
ts()->hasViewportDependentMediaQueries() && document.ownerElement()) |
1629 || document->seamlessParentIFrame(); | 1629 || document.seamlessParentIFrame(); |
1630 | 1630 |
1631 if (forceFullLayout) { | 1631 if (forceFullLayout) { |
1632 document->updateLayoutIgnorePendingStylesheets(); | 1632 document.updateLayoutIgnorePendingStylesheets(); |
1633 styledNode = this->styledNode(); | 1633 styledNode = this->styledNode(); |
1634 style = computeRenderStyle(propertyID); | 1634 style = computeRenderStyle(propertyID); |
1635 renderer = styledNode->renderer(); | 1635 renderer = styledNode->renderer(); |
1636 } | 1636 } |
1637 } else { | 1637 } else { |
1638 style = computeRenderStyle(propertyID); | 1638 style = computeRenderStyle(propertyID); |
1639 } | 1639 } |
1640 | 1640 |
1641 if (!style) | 1641 if (!style) |
1642 return 0; | 1642 return 0; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1812 return cssValuePool().createValue(style->borderLeftStyle()); | 1812 return cssValuePool().createValue(style->borderLeftStyle()); |
1813 case CSSPropertyBorderTopWidth: | 1813 case CSSPropertyBorderTopWidth: |
1814 return zoomAdjustedPixelValue(style->borderTopWidth(), style.get()); | 1814 return zoomAdjustedPixelValue(style->borderTopWidth(), style.get()); |
1815 case CSSPropertyBorderRightWidth: | 1815 case CSSPropertyBorderRightWidth: |
1816 return zoomAdjustedPixelValue(style->borderRightWidth(), style.get()
); | 1816 return zoomAdjustedPixelValue(style->borderRightWidth(), style.get()
); |
1817 case CSSPropertyBorderBottomWidth: | 1817 case CSSPropertyBorderBottomWidth: |
1818 return zoomAdjustedPixelValue(style->borderBottomWidth(), style.get(
)); | 1818 return zoomAdjustedPixelValue(style->borderBottomWidth(), style.get(
)); |
1819 case CSSPropertyBorderLeftWidth: | 1819 case CSSPropertyBorderLeftWidth: |
1820 return zoomAdjustedPixelValue(style->borderLeftWidth(), style.get())
; | 1820 return zoomAdjustedPixelValue(style->borderLeftWidth(), style.get())
; |
1821 case CSSPropertyBottom: | 1821 case CSSPropertyBottom: |
1822 return valueForPositionOffset(style.get(), CSSPropertyBottom, render
er, m_node->document()->renderView()); | 1822 return valueForPositionOffset(style.get(), CSSPropertyBottom, render
er, m_node->document().renderView()); |
1823 case CSSPropertyWebkitBoxAlign: | 1823 case CSSPropertyWebkitBoxAlign: |
1824 return cssValuePool().createValue(style->boxAlign()); | 1824 return cssValuePool().createValue(style->boxAlign()); |
1825 case CSSPropertyWebkitBoxDecorationBreak: | 1825 case CSSPropertyWebkitBoxDecorationBreak: |
1826 if (style->boxDecorationBreak() == DSLICE) | 1826 if (style->boxDecorationBreak() == DSLICE) |
1827 return cssValuePool().createIdentifierValue(CSSValueSlice); | 1827 return cssValuePool().createIdentifierValue(CSSValueSlice); |
1828 return cssValuePool().createIdentifierValue(CSSValueClone); | 1828 return cssValuePool().createIdentifierValue(CSSValueClone); |
1829 case CSSPropertyWebkitBoxDirection: | 1829 case CSSPropertyWebkitBoxDirection: |
1830 return cssValuePool().createValue(style->boxDirection()); | 1830 return cssValuePool().createValue(style->boxDirection()); |
1831 case CSSPropertyWebkitBoxFlex: | 1831 case CSSPropertyWebkitBoxFlex: |
1832 return cssValuePool().createValue(style->boxFlex(), CSSPrimitiveValu
e::CSS_NUMBER); | 1832 return cssValuePool().createValue(style->boxFlex(), CSSPrimitiveValu
e::CSS_NUMBER); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1946 case CSSPropertyFloat: | 1946 case CSSPropertyFloat: |
1947 if (style->display() != NONE && style->hasOutOfFlowPosition()) | 1947 if (style->display() != NONE && style->hasOutOfFlowPosition()) |
1948 return cssValuePool().createIdentifierValue(CSSValueNone); | 1948 return cssValuePool().createIdentifierValue(CSSValueNone); |
1949 return cssValuePool().createValue(style->floating()); | 1949 return cssValuePool().createValue(style->floating()); |
1950 case CSSPropertyFont: { | 1950 case CSSPropertyFont: { |
1951 RefPtr<FontValue> computedFont = FontValue::create(); | 1951 RefPtr<FontValue> computedFont = FontValue::create(); |
1952 computedFont->style = valueForFontStyle(style.get()); | 1952 computedFont->style = valueForFontStyle(style.get()); |
1953 computedFont->variant = valueForFontVariant(style.get()); | 1953 computedFont->variant = valueForFontVariant(style.get()); |
1954 computedFont->weight = valueForFontWeight(style.get()); | 1954 computedFont->weight = valueForFontWeight(style.get()); |
1955 computedFont->size = valueForFontSize(style.get()); | 1955 computedFont->size = valueForFontSize(style.get()); |
1956 computedFont->lineHeight = valueForLineHeight(style.get(), m_node->d
ocument()->renderView()); | 1956 computedFont->lineHeight = valueForLineHeight(style.get(), m_node->d
ocument().renderView()); |
1957 computedFont->family = valueForFontFamily(style.get()); | 1957 computedFont->family = valueForFontFamily(style.get()); |
1958 return computedFont.release(); | 1958 return computedFont.release(); |
1959 } | 1959 } |
1960 case CSSPropertyFontFamily: { | 1960 case CSSPropertyFontFamily: { |
1961 RefPtr<CSSValueList> fontFamilyList = valueForFontFamily(style.get()
); | 1961 RefPtr<CSSValueList> fontFamilyList = valueForFontFamily(style.get()
); |
1962 // If there's only a single family, return that as a CSSPrimitiveVal
ue. | 1962 // If there's only a single family, return that as a CSSPrimitiveVal
ue. |
1963 // NOTE: Gecko always returns this as a comma-separated CSSPrimitive
Value string. | 1963 // NOTE: Gecko always returns this as a comma-separated CSSPrimitive
Value string. |
1964 if (fontFamilyList->length() == 1) | 1964 if (fontFamilyList->length() == 1) |
1965 return fontFamilyList->item(0); | 1965 return fontFamilyList->item(0); |
1966 return fontFamilyList.release(); | 1966 return fontFamilyList.release(); |
(...skipping 12 matching lines...) Expand all Loading... |
1979 return cssValuePool().createIdentifierValue(CSSValueNormal); | 1979 return cssValuePool().createIdentifierValue(CSSValueNormal); |
1980 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1980 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
1981 for (unsigned i = 0; i < featureSettings->size(); ++i) { | 1981 for (unsigned i = 0; i < featureSettings->size(); ++i) { |
1982 const FontFeature& feature = featureSettings->at(i); | 1982 const FontFeature& feature = featureSettings->at(i); |
1983 RefPtr<FontFeatureValue> featureValue = FontFeatureValue::create
(feature.tag(), feature.value()); | 1983 RefPtr<FontFeatureValue> featureValue = FontFeatureValue::create
(feature.tag(), feature.value()); |
1984 list->append(featureValue.release()); | 1984 list->append(featureValue.release()); |
1985 } | 1985 } |
1986 return list.release(); | 1986 return list.release(); |
1987 } | 1987 } |
1988 case CSSPropertyGridAutoColumns: | 1988 case CSSPropertyGridAutoColumns: |
1989 return valueForGridTrackSize(style->gridAutoColumns(), style.get(),
m_node->document()->renderView()); | 1989 return valueForGridTrackSize(style->gridAutoColumns(), style.get(),
m_node->document().renderView()); |
1990 case CSSPropertyGridAutoFlow: | 1990 case CSSPropertyGridAutoFlow: |
1991 return cssValuePool().createValue(style->gridAutoFlow()); | 1991 return cssValuePool().createValue(style->gridAutoFlow()); |
1992 case CSSPropertyGridAutoRows: | 1992 case CSSPropertyGridAutoRows: |
1993 return valueForGridTrackSize(style->gridAutoRows(), style.get(), m_n
ode->document()->renderView()); | 1993 return valueForGridTrackSize(style->gridAutoRows(), style.get(), m_n
ode->document().renderView()); |
1994 case CSSPropertyGridDefinitionColumns: | 1994 case CSSPropertyGridDefinitionColumns: |
1995 return valueForGridTrackList(style->gridDefinitionColumns(), style->
orderedNamedGridColumnLines(), style.get(), m_node->document()->renderView()); | 1995 return valueForGridTrackList(style->gridDefinitionColumns(), style->
orderedNamedGridColumnLines(), style.get(), m_node->document().renderView()); |
1996 case CSSPropertyGridDefinitionRows: | 1996 case CSSPropertyGridDefinitionRows: |
1997 return valueForGridTrackList(style->gridDefinitionRows(), style->ord
eredNamedGridRowLines(), style.get(), m_node->document()->renderView()); | 1997 return valueForGridTrackList(style->gridDefinitionRows(), style->ord
eredNamedGridRowLines(), style.get(), m_node->document().renderView()); |
1998 | 1998 |
1999 case CSSPropertyGridColumnStart: | 1999 case CSSPropertyGridColumnStart: |
2000 return valueForGridPosition(style->gridColumnStart()); | 2000 return valueForGridPosition(style->gridColumnStart()); |
2001 case CSSPropertyGridColumnEnd: | 2001 case CSSPropertyGridColumnEnd: |
2002 return valueForGridPosition(style->gridColumnEnd()); | 2002 return valueForGridPosition(style->gridColumnEnd()); |
2003 case CSSPropertyGridRowStart: | 2003 case CSSPropertyGridRowStart: |
2004 return valueForGridPosition(style->gridRowStart()); | 2004 return valueForGridPosition(style->gridRowStart()); |
2005 case CSSPropertyGridRowEnd: | 2005 case CSSPropertyGridRowEnd: |
2006 return valueForGridPosition(style->gridRowEnd()); | 2006 return valueForGridPosition(style->gridRowEnd()); |
2007 case CSSPropertyGridColumn: | 2007 case CSSPropertyGridColumn: |
(...skipping 28 matching lines...) Expand all Loading... |
2036 if (style->hyphenationString().isNull()) | 2036 if (style->hyphenationString().isNull()) |
2037 return cssValuePool().createIdentifierValue(CSSValueAuto); | 2037 return cssValuePool().createIdentifierValue(CSSValueAuto); |
2038 return cssValuePool().createValue(style->hyphenationString(), CSSPri
mitiveValue::CSS_STRING); | 2038 return cssValuePool().createValue(style->hyphenationString(), CSSPri
mitiveValue::CSS_STRING); |
2039 case CSSPropertyWebkitBorderFit: | 2039 case CSSPropertyWebkitBorderFit: |
2040 if (style->borderFit() == BorderFitBorder) | 2040 if (style->borderFit() == BorderFitBorder) |
2041 return cssValuePool().createIdentifierValue(CSSValueBorder); | 2041 return cssValuePool().createIdentifierValue(CSSValueBorder); |
2042 return cssValuePool().createIdentifierValue(CSSValueLines); | 2042 return cssValuePool().createIdentifierValue(CSSValueLines); |
2043 case CSSPropertyImageRendering: | 2043 case CSSPropertyImageRendering: |
2044 return CSSPrimitiveValue::create(style->imageRendering()); | 2044 return CSSPrimitiveValue::create(style->imageRendering()); |
2045 case CSSPropertyLeft: | 2045 case CSSPropertyLeft: |
2046 return valueForPositionOffset(style.get(), CSSPropertyLeft, renderer
, m_node->document()->renderView()); | 2046 return valueForPositionOffset(style.get(), CSSPropertyLeft, renderer
, m_node->document().renderView()); |
2047 case CSSPropertyLetterSpacing: | 2047 case CSSPropertyLetterSpacing: |
2048 if (!style->letterSpacing()) | 2048 if (!style->letterSpacing()) |
2049 return cssValuePool().createIdentifierValue(CSSValueNormal); | 2049 return cssValuePool().createIdentifierValue(CSSValueNormal); |
2050 return zoomAdjustedPixelValue(style->letterSpacing(), style.get()); | 2050 return zoomAdjustedPixelValue(style->letterSpacing(), style.get()); |
2051 case CSSPropertyWebkitLineClamp: | 2051 case CSSPropertyWebkitLineClamp: |
2052 if (style->lineClamp().isNone()) | 2052 if (style->lineClamp().isNone()) |
2053 return cssValuePool().createIdentifierValue(CSSValueNone); | 2053 return cssValuePool().createIdentifierValue(CSSValueNone); |
2054 return cssValuePool().createValue(style->lineClamp().value(), style-
>lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveVa
lue::CSS_NUMBER); | 2054 return cssValuePool().createValue(style->lineClamp().value(), style-
>lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveVa
lue::CSS_NUMBER); |
2055 case CSSPropertyLineHeight: | 2055 case CSSPropertyLineHeight: |
2056 return valueForLineHeight(style.get(), m_node->document()->renderVie
w()); | 2056 return valueForLineHeight(style.get(), m_node->document().renderView
()); |
2057 case CSSPropertyListStyleImage: | 2057 case CSSPropertyListStyleImage: |
2058 if (style->listStyleImage()) | 2058 if (style->listStyleImage()) |
2059 return style->listStyleImage()->cssValue(); | 2059 return style->listStyleImage()->cssValue(); |
2060 return cssValuePool().createIdentifierValue(CSSValueNone); | 2060 return cssValuePool().createIdentifierValue(CSSValueNone); |
2061 case CSSPropertyListStylePosition: | 2061 case CSSPropertyListStylePosition: |
2062 return cssValuePool().createValue(style->listStylePosition()); | 2062 return cssValuePool().createValue(style->listStylePosition()); |
2063 case CSSPropertyListStyleType: | 2063 case CSSPropertyListStyleType: |
2064 return cssValuePool().createValue(style->listStyleType()); | 2064 return cssValuePool().createValue(style->listStyleType()); |
2065 case CSSPropertyWebkitLocale: | 2065 case CSSPropertyWebkitLocale: |
2066 if (style->locale().isNull()) | 2066 if (style->locale().isNull()) |
2067 return cssValuePool().createIdentifierValue(CSSValueAuto); | 2067 return cssValuePool().createIdentifierValue(CSSValueAuto); |
2068 return cssValuePool().createValue(style->locale(), CSSPrimitiveValue
::CSS_STRING); | 2068 return cssValuePool().createValue(style->locale(), CSSPrimitiveValue
::CSS_STRING); |
2069 case CSSPropertyMarginTop: { | 2069 case CSSPropertyMarginTop: { |
2070 Length marginTop = style->marginTop(); | 2070 Length marginTop = style->marginTop(); |
2071 if (marginTop.isFixed() || !renderer || !renderer->isBox()) | 2071 if (marginTop.isFixed() || !renderer || !renderer->isBox()) |
2072 return zoomAdjustedPixelValueForLength(marginTop, style.get()); | 2072 return zoomAdjustedPixelValueForLength(marginTop, style.get()); |
2073 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginTop(), st
yle.get()); | 2073 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginTop(), st
yle.get()); |
2074 } | 2074 } |
2075 case CSSPropertyMarginRight: { | 2075 case CSSPropertyMarginRight: { |
2076 Length marginRight = style->marginRight(); | 2076 Length marginRight = style->marginRight(); |
2077 if (marginRight.isFixed() || !renderer || !renderer->isBox()) | 2077 if (marginRight.isFixed() || !renderer || !renderer->isBox()) |
2078 return zoomAdjustedPixelValueForLength(marginRight, style.get())
; | 2078 return zoomAdjustedPixelValueForLength(marginRight, style.get())
; |
2079 float value; | 2079 float value; |
2080 if (marginRight.isPercent() || marginRight.isViewportPercentage()) | 2080 if (marginRight.isPercent() || marginRight.isViewportPercentage()) { |
2081 // RenderBox gives a marginRight() that is the distance between
the right-edge of the child box | 2081 // RenderBox gives a marginRight() that is the distance between
the right-edge of the child box |
2082 // and the right-edge of the containing box, when display == BLO
CK. Let's calculate the absolute | 2082 // and the right-edge of the containing box, when display == BLO
CK. Let's calculate the absolute |
2083 // value of the specified margin-right % instead of relying on R
enderBox's marginRight() value. | 2083 // value of the specified margin-right % instead of relying on R
enderBox's marginRight() value. |
2084 value = minimumValueForLength(marginRight, toRenderBox(renderer)
->containingBlockLogicalWidthForContent(), m_node->document()->renderView()); | 2084 value = minimumValueForLength(marginRight, toRenderBox(renderer)
->containingBlockLogicalWidthForContent(), m_node->document().renderView()); |
2085 else | 2085 } else { |
2086 value = toRenderBox(renderer)->marginRight(); | 2086 value = toRenderBox(renderer)->marginRight(); |
| 2087 } |
2087 return zoomAdjustedPixelValue(value, style.get()); | 2088 return zoomAdjustedPixelValue(value, style.get()); |
2088 } | 2089 } |
2089 case CSSPropertyMarginBottom: { | 2090 case CSSPropertyMarginBottom: { |
2090 Length marginBottom = style->marginBottom(); | 2091 Length marginBottom = style->marginBottom(); |
2091 if (marginBottom.isFixed() || !renderer || !renderer->isBox()) | 2092 if (marginBottom.isFixed() || !renderer || !renderer->isBox()) |
2092 return zoomAdjustedPixelValueForLength(marginBottom, style.get()
); | 2093 return zoomAdjustedPixelValueForLength(marginBottom, style.get()
); |
2093 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginBottom(),
style.get()); | 2094 return zoomAdjustedPixelValue(toRenderBox(renderer)->marginBottom(),
style.get()); |
2094 } | 2095 } |
2095 case CSSPropertyMarginLeft: { | 2096 case CSSPropertyMarginLeft: { |
2096 Length marginLeft = style->marginLeft(); | 2097 Length marginLeft = style->marginLeft(); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2187 case CSSPropertyPageBreakInside: { | 2188 case CSSPropertyPageBreakInside: { |
2188 EPageBreak pageBreak = style->pageBreakInside(); | 2189 EPageBreak pageBreak = style->pageBreakInside(); |
2189 ASSERT(pageBreak != PBALWAYS); | 2190 ASSERT(pageBreak != PBALWAYS); |
2190 if (pageBreak == PBALWAYS) | 2191 if (pageBreak == PBALWAYS) |
2191 return 0; | 2192 return 0; |
2192 return cssValuePool().createValue(style->pageBreakInside()); | 2193 return cssValuePool().createValue(style->pageBreakInside()); |
2193 } | 2194 } |
2194 case CSSPropertyPosition: | 2195 case CSSPropertyPosition: |
2195 return cssValuePool().createValue(style->position()); | 2196 return cssValuePool().createValue(style->position()); |
2196 case CSSPropertyRight: | 2197 case CSSPropertyRight: |
2197 return valueForPositionOffset(style.get(), CSSPropertyRight, rendere
r, m_node->document()->renderView()); | 2198 return valueForPositionOffset(style.get(), CSSPropertyRight, rendere
r, m_node->document().renderView()); |
2198 case CSSPropertyWebkitRubyPosition: | 2199 case CSSPropertyWebkitRubyPosition: |
2199 return cssValuePool().createValue(style->rubyPosition()); | 2200 return cssValuePool().createValue(style->rubyPosition()); |
2200 case CSSPropertyTableLayout: | 2201 case CSSPropertyTableLayout: |
2201 return cssValuePool().createValue(style->tableLayout()); | 2202 return cssValuePool().createValue(style->tableLayout()); |
2202 case CSSPropertyTextAlign: | 2203 case CSSPropertyTextAlign: |
2203 return cssValuePool().createValue(style->textAlign()); | 2204 return cssValuePool().createValue(style->textAlign()); |
2204 case CSSPropertyTextAlignLast: | 2205 case CSSPropertyTextAlignLast: |
2205 return cssValuePool().createValue(style->textAlignLast()); | 2206 return cssValuePool().createValue(style->textAlignLast()); |
2206 case CSSPropertyTextDecoration: | 2207 case CSSPropertyTextDecoration: |
2207 return valuesForShorthandProperty(textDecorationShorthand()); | 2208 return valuesForShorthandProperty(textDecorationShorthand()); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2263 return cssValuePool().createIdentifierValue(CSSValueClip); | 2264 return cssValuePool().createIdentifierValue(CSSValueClip); |
2264 case CSSPropertyWebkitTextSecurity: | 2265 case CSSPropertyWebkitTextSecurity: |
2265 return cssValuePool().createValue(style->textSecurity()); | 2266 return cssValuePool().createValue(style->textSecurity()); |
2266 case CSSPropertyWebkitTextStrokeColor: | 2267 case CSSPropertyWebkitTextStrokeColor: |
2267 return currentColorOrValidColor(renderer, style.get(), CSSPropertyWe
bkitTextStrokeColor); | 2268 return currentColorOrValidColor(renderer, style.get(), CSSPropertyWe
bkitTextStrokeColor); |
2268 case CSSPropertyWebkitTextStrokeWidth: | 2269 case CSSPropertyWebkitTextStrokeWidth: |
2269 return zoomAdjustedPixelValue(style->textStrokeWidth(), style.get())
; | 2270 return zoomAdjustedPixelValue(style->textStrokeWidth(), style.get())
; |
2270 case CSSPropertyTextTransform: | 2271 case CSSPropertyTextTransform: |
2271 return cssValuePool().createValue(style->textTransform()); | 2272 return cssValuePool().createValue(style->textTransform()); |
2272 case CSSPropertyTop: | 2273 case CSSPropertyTop: |
2273 return valueForPositionOffset(style.get(), CSSPropertyTop, renderer,
m_node->document()->renderView()); | 2274 return valueForPositionOffset(style.get(), CSSPropertyTop, renderer,
m_node->document().renderView()); |
2274 case CSSPropertyTouchAction: | 2275 case CSSPropertyTouchAction: |
2275 return cssValuePool().createValue(style->touchAction()); | 2276 return cssValuePool().createValue(style->touchAction()); |
2276 case CSSPropertyUnicodeBidi: | 2277 case CSSPropertyUnicodeBidi: |
2277 return cssValuePool().createValue(style->unicodeBidi()); | 2278 return cssValuePool().createValue(style->unicodeBidi()); |
2278 case CSSPropertyVerticalAlign: | 2279 case CSSPropertyVerticalAlign: |
2279 switch (style->verticalAlign()) { | 2280 switch (style->verticalAlign()) { |
2280 case BASELINE: | 2281 case BASELINE: |
2281 return cssValuePool().createIdentifierValue(CSSValueBaseline
); | 2282 return cssValuePool().createIdentifierValue(CSSValueBaseline
); |
2282 case MIDDLE: | 2283 case MIDDLE: |
2283 return cssValuePool().createIdentifierValue(CSSValueMiddle); | 2284 return cssValuePool().createIdentifierValue(CSSValueMiddle); |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2535 if (!style->hasPerspective()) | 2536 if (!style->hasPerspective()) |
2536 return cssValuePool().createIdentifierValue(CSSValueNone); | 2537 return cssValuePool().createIdentifierValue(CSSValueNone); |
2537 return zoomAdjustedPixelValue(style->perspective(), style.get()); | 2538 return zoomAdjustedPixelValue(style->perspective(), style.get()); |
2538 case CSSPropertyWebkitPerspectiveOrigin: { | 2539 case CSSPropertyWebkitPerspectiveOrigin: { |
2539 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 2540 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
2540 if (renderer) { | 2541 if (renderer) { |
2541 LayoutRect box; | 2542 LayoutRect box; |
2542 if (renderer->isBox()) | 2543 if (renderer->isBox()) |
2543 box = toRenderBox(renderer)->borderBoxRect(); | 2544 box = toRenderBox(renderer)->borderBoxRect(); |
2544 | 2545 |
2545 RenderView* renderView = m_node->document()->renderView(); | 2546 RenderView* renderView = m_node->document().renderView(); |
2546 list->append(zoomAdjustedPixelValue(minimumValueForLength(style-
>perspectiveOriginX(), box.width(), renderView), style.get())); | 2547 list->append(zoomAdjustedPixelValue(minimumValueForLength(style-
>perspectiveOriginX(), box.width(), renderView), style.get())); |
2547 list->append(zoomAdjustedPixelValue(minimumValueForLength(style-
>perspectiveOriginY(), box.height(), renderView), style.get())); | 2548 list->append(zoomAdjustedPixelValue(minimumValueForLength(style-
>perspectiveOriginY(), box.height(), renderView), style.get())); |
2548 } | 2549 } |
2549 else { | 2550 else { |
2550 list->append(zoomAdjustedPixelValueForLength(style->perspectiveO
riginX(), style.get())); | 2551 list->append(zoomAdjustedPixelValueForLength(style->perspectiveO
riginX(), style.get())); |
2551 list->append(zoomAdjustedPixelValueForLength(style->perspectiveO
riginY(), style.get())); | 2552 list->append(zoomAdjustedPixelValueForLength(style->perspectiveO
riginY(), style.get())); |
2552 | 2553 |
2553 } | 2554 } |
2554 return list.release(); | 2555 return list.release(); |
2555 } | 2556 } |
2556 case CSSPropertyWebkitRtlOrdering: | 2557 case CSSPropertyWebkitRtlOrdering: |
2557 return cssValuePool().createIdentifierValue(style->rtlOrdering() ? C
SSValueVisual : CSSValueLogical); | 2558 return cssValuePool().createIdentifierValue(style->rtlOrdering() ? C
SSValueVisual : CSSValueLogical); |
2558 case CSSPropertyWebkitTapHighlightColor: | 2559 case CSSPropertyWebkitTapHighlightColor: |
2559 return currentColorOrValidColor(renderer, style.get(), CSSPropertyWe
bkitTapHighlightColor); | 2560 return currentColorOrValidColor(renderer, style.get(), CSSPropertyWe
bkitTapHighlightColor); |
2560 case CSSPropertyWebkitUserDrag: | 2561 case CSSPropertyWebkitUserDrag: |
2561 return cssValuePool().createValue(style->userDrag()); | 2562 return cssValuePool().createValue(style->userDrag()); |
2562 case CSSPropertyWebkitUserSelect: | 2563 case CSSPropertyWebkitUserSelect: |
2563 return cssValuePool().createValue(style->userSelect()); | 2564 return cssValuePool().createValue(style->userSelect()); |
2564 case CSSPropertyBorderBottomLeftRadius: | 2565 case CSSPropertyBorderBottomLeftRadius: |
2565 return valueForBorderRadiusCorner(style->borderBottomLeftRadius(), s
tyle.get(), m_node->document()->renderView()); | 2566 return valueForBorderRadiusCorner(style->borderBottomLeftRadius(), s
tyle.get(), m_node->document().renderView()); |
2566 case CSSPropertyBorderBottomRightRadius: | 2567 case CSSPropertyBorderBottomRightRadius: |
2567 return valueForBorderRadiusCorner(style->borderBottomRightRadius(),
style.get(), m_node->document()->renderView()); | 2568 return valueForBorderRadiusCorner(style->borderBottomRightRadius(),
style.get(), m_node->document().renderView()); |
2568 case CSSPropertyBorderTopLeftRadius: | 2569 case CSSPropertyBorderTopLeftRadius: |
2569 return valueForBorderRadiusCorner(style->borderTopLeftRadius(), styl
e.get(), m_node->document()->renderView()); | 2570 return valueForBorderRadiusCorner(style->borderTopLeftRadius(), styl
e.get(), m_node->document().renderView()); |
2570 case CSSPropertyBorderTopRightRadius: | 2571 case CSSPropertyBorderTopRightRadius: |
2571 return valueForBorderRadiusCorner(style->borderTopRightRadius(), sty
le.get(), m_node->document()->renderView()); | 2572 return valueForBorderRadiusCorner(style->borderTopRightRadius(), sty
le.get(), m_node->document().renderView()); |
2572 case CSSPropertyClip: { | 2573 case CSSPropertyClip: { |
2573 if (!style->hasClip()) | 2574 if (!style->hasClip()) |
2574 return cssValuePool().createIdentifierValue(CSSValueAuto); | 2575 return cssValuePool().createIdentifierValue(CSSValueAuto); |
2575 RefPtr<Rect> rect = Rect::create(); | 2576 RefPtr<Rect> rect = Rect::create(); |
2576 rect->setTop(zoomAdjustedPixelValue(style->clip().top().value(), sty
le.get())); | 2577 rect->setTop(zoomAdjustedPixelValue(style->clip().top().value(), sty
le.get())); |
2577 rect->setRight(zoomAdjustedPixelValue(style->clip().right().value(),
style.get())); | 2578 rect->setRight(zoomAdjustedPixelValue(style->clip().right().value(),
style.get())); |
2578 rect->setBottom(zoomAdjustedPixelValue(style->clip().bottom().value(
), style.get())); | 2579 rect->setBottom(zoomAdjustedPixelValue(style->clip().bottom().value(
), style.get())); |
2579 rect->setLeft(zoomAdjustedPixelValue(style->clip().left().value(), s
tyle.get())); | 2580 rect->setLeft(zoomAdjustedPixelValue(style->clip().left().value(), s
tyle.get())); |
2580 return cssValuePool().createValue(rect.release()); | 2581 return cssValuePool().createValue(rect.release()); |
2581 } | 2582 } |
2582 case CSSPropertySpeak: | 2583 case CSSPropertySpeak: |
2583 return cssValuePool().createValue(style->speak()); | 2584 return cssValuePool().createValue(style->speak()); |
2584 case CSSPropertyWebkitTransform: | 2585 case CSSPropertyWebkitTransform: |
2585 return computedTransform(renderer, style.get()); | 2586 return computedTransform(renderer, style.get()); |
2586 case CSSPropertyWebkitTransformOrigin: { | 2587 case CSSPropertyWebkitTransformOrigin: { |
2587 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | 2588 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
2588 if (renderer) { | 2589 if (renderer) { |
2589 LayoutRect box; | 2590 LayoutRect box; |
2590 if (renderer->isBox()) | 2591 if (renderer->isBox()) |
2591 box = toRenderBox(renderer)->borderBoxRect(); | 2592 box = toRenderBox(renderer)->borderBoxRect(); |
2592 | 2593 |
2593 RenderView* renderView = m_node->document()->renderView(); | 2594 RenderView* renderView = m_node->document().renderView(); |
2594 list->append(zoomAdjustedPixelValue(minimumValueForLength(style-
>transformOriginX(), box.width(), renderView), style.get())); | 2595 list->append(zoomAdjustedPixelValue(minimumValueForLength(style-
>transformOriginX(), box.width(), renderView), style.get())); |
2595 list->append(zoomAdjustedPixelValue(minimumValueForLength(style-
>transformOriginY(), box.height(), renderView), style.get())); | 2596 list->append(zoomAdjustedPixelValue(minimumValueForLength(style-
>transformOriginY(), box.height(), renderView), style.get())); |
2596 if (style->transformOriginZ() != 0) | 2597 if (style->transformOriginZ() != 0) |
2597 list->append(zoomAdjustedPixelValue(style->transformOriginZ(
), style.get())); | 2598 list->append(zoomAdjustedPixelValue(style->transformOriginZ(
), style.get())); |
2598 } else { | 2599 } else { |
2599 list->append(zoomAdjustedPixelValueForLength(style->transformOri
ginX(), style.get())); | 2600 list->append(zoomAdjustedPixelValueForLength(style->transformOri
ginX(), style.get())); |
2600 list->append(zoomAdjustedPixelValueForLength(style->transformOri
ginY(), style.get())); | 2601 list->append(zoomAdjustedPixelValueForLength(style->transformOri
ginY(), style.get())); |
2601 if (style->transformOriginZ() != 0) | 2602 if (style->transformOriginZ() != 0) |
2602 list->append(zoomAdjustedPixelValue(style->transformOriginZ(
), style.get())); | 2603 list->append(zoomAdjustedPixelValue(style->transformOriginZ(
), style.get())); |
2603 } | 2604 } |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2746 } | 2747 } |
2747 case CSSPropertyBorderBottom: | 2748 case CSSPropertyBorderBottom: |
2748 return valuesForShorthandProperty(borderBottomShorthand()); | 2749 return valuesForShorthandProperty(borderBottomShorthand()); |
2749 case CSSPropertyBorderColor: | 2750 case CSSPropertyBorderColor: |
2750 return valuesForSidesShorthand(borderColorShorthand()); | 2751 return valuesForSidesShorthand(borderColorShorthand()); |
2751 case CSSPropertyBorderLeft: | 2752 case CSSPropertyBorderLeft: |
2752 return valuesForShorthandProperty(borderLeftShorthand()); | 2753 return valuesForShorthandProperty(borderLeftShorthand()); |
2753 case CSSPropertyBorderImage: | 2754 case CSSPropertyBorderImage: |
2754 return valueForNinePieceImage(style->borderImage(), style.get()); | 2755 return valueForNinePieceImage(style->borderImage(), style.get()); |
2755 case CSSPropertyBorderRadius: | 2756 case CSSPropertyBorderRadius: |
2756 return valueForBorderRadiusShorthand(style.get(), m_node->document()
->renderView()); | 2757 return valueForBorderRadiusShorthand(style.get(), m_node->document()
.renderView()); |
2757 case CSSPropertyBorderRight: | 2758 case CSSPropertyBorderRight: |
2758 return valuesForShorthandProperty(borderRightShorthand()); | 2759 return valuesForShorthandProperty(borderRightShorthand()); |
2759 case CSSPropertyBorderStyle: | 2760 case CSSPropertyBorderStyle: |
2760 return valuesForSidesShorthand(borderStyleShorthand()); | 2761 return valuesForSidesShorthand(borderStyleShorthand()); |
2761 case CSSPropertyBorderTop: | 2762 case CSSPropertyBorderTop: |
2762 return valuesForShorthandProperty(borderTopShorthand()); | 2763 return valuesForShorthandProperty(borderTopShorthand()); |
2763 case CSSPropertyBorderWidth: | 2764 case CSSPropertyBorderWidth: |
2764 return valuesForSidesShorthand(borderWidthShorthand()); | 2765 return valuesForSidesShorthand(borderWidthShorthand()); |
2765 case CSSPropertyWebkitColumnRule: | 2766 case CSSPropertyWebkitColumnRule: |
2766 return valuesForShorthandProperty(webkitColumnRuleShorthand()); | 2767 return valuesForShorthandProperty(webkitColumnRuleShorthand()); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2943 { | 2944 { |
2944 if (i >= length()) | 2945 if (i >= length()) |
2945 return ""; | 2946 return ""; |
2946 | 2947 |
2947 return getPropertyNameString(computableProperties()[i]); | 2948 return getPropertyNameString(computableProperties()[i]); |
2948 } | 2949 } |
2949 | 2950 |
2950 bool CSSComputedStyleDeclaration::cssPropertyMatches(CSSPropertyID propertyID, c
onst CSSValue* propertyValue) const | 2951 bool CSSComputedStyleDeclaration::cssPropertyMatches(CSSPropertyID propertyID, c
onst CSSValue* propertyValue) const |
2951 { | 2952 { |
2952 if (propertyID == CSSPropertyFontSize && propertyValue->isPrimitiveValue() &
& m_node) { | 2953 if (propertyID == CSSPropertyFontSize && propertyValue->isPrimitiveValue() &
& m_node) { |
2953 m_node->document()->updateLayoutIgnorePendingStylesheets(); | 2954 m_node->document().updateLayoutIgnorePendingStylesheets(); |
2954 RenderStyle* style = m_node->computedStyle(m_pseudoElementSpecifier); | 2955 RenderStyle* style = m_node->computedStyle(m_pseudoElementSpecifier); |
2955 if (style && style->fontDescription().keywordSize()) { | 2956 if (style && style->fontDescription().keywordSize()) { |
2956 CSSValueID sizeValue = cssIdentifierForFontSizeKeyword(style->fontDe
scription().keywordSize()); | 2957 CSSValueID sizeValue = cssIdentifierForFontSizeKeyword(style->fontDe
scription().keywordSize()); |
2957 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(proper
tyValue); | 2958 const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(proper
tyValue); |
2958 if (primitiveValue->isValueID() && primitiveValue->getValueID() == s
izeValue) | 2959 if (primitiveValue->isValueID() && primitiveValue->getValueID() == s
izeValue) |
2959 return true; | 2960 return true; |
2960 } | 2961 } |
2961 } | 2962 } |
2962 RefPtr<CSSValue> value = getPropertyCSSValue(propertyID); | 2963 RefPtr<CSSValue> value = getPropertyCSSValue(propertyID); |
2963 return value && propertyValue && value->equals(*propertyValue); | 2964 return value && propertyValue && value->equals(*propertyValue); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3153 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB
ackgroundSize, CSSPropertyBackgroundOrigin, | 3154 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB
ackgroundSize, CSSPropertyBackgroundOrigin, |
3154 CSSPropertyB
ackgroundClip }; | 3155 CSSPropertyB
ackgroundClip }; |
3155 | 3156 |
3156 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); | 3157 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); |
3157 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash
Seperator)))); | 3158 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash
Seperator)))); |
3158 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe
perator)))); | 3159 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa
ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe
perator)))); |
3159 return list.release(); | 3160 return list.release(); |
3160 } | 3161 } |
3161 | 3162 |
3162 } // namespace WebCore | 3163 } // namespace WebCore |
OLD | NEW |