diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-18 15:53:33 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-18 15:53:33 +0200 |
commit | 6bbb7fbbac94d0f511a7bd0cbd50854ab643bfb2 (patch) | |
tree | d9c68d1cca0b3e352f1e438561f3e504e641a08f /Source/WebCore/css/CSSParser.cpp | |
parent | d0424a769059c84ae20beb3c217812792ea6726b (diff) | |
download | qtwebkit-6bbb7fbbac94d0f511a7bd0cbd50854ab643bfb2.tar.gz |
Imported WebKit commit c7503cef7ecb236730d1309676ab9fc723fd061d (http://svn.webkit.org/repository/webkit/trunk@128886)
New snapshot with various build fixes
Diffstat (limited to 'Source/WebCore/css/CSSParser.cpp')
-rw-r--r-- | Source/WebCore/css/CSSParser.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index 09eb63666..efd9bae3a 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -199,6 +199,7 @@ CSSParserContext::CSSParserContext(CSSParserMode mode, const KURL& baseURL) , mode(mode) , isHTMLDocument(false) , isCSSCustomFilterEnabled(false) + , isCSSStickyPositionEnabled(false) , isCSSRegionsEnabled(false) , isCSSGridLayoutEnabled(false) #if ENABLE(CSS_VARIABLES) @@ -215,6 +216,7 @@ CSSParserContext::CSSParserContext(Document* document, const KURL& baseURL, cons , mode(document->inQuirksMode() ? CSSQuirksMode : CSSStrictMode) , isHTMLDocument(document->isHTMLDocument()) , isCSSCustomFilterEnabled(document->settings() ? document->settings()->isCSSCustomFilterEnabled() : false) + , isCSSStickyPositionEnabled(document->cssStickyPositionEnabled()) , isCSSRegionsEnabled(document->cssRegionsEnabled()) , isCSSGridLayoutEnabled(document->cssGridLayoutEnabled()) #if ENABLE(CSS_VARIABLES) @@ -232,6 +234,7 @@ bool operator==(const CSSParserContext& a, const CSSParserContext& b) && a.mode == b.mode && a.isHTMLDocument == b.isHTMLDocument && a.isCSSCustomFilterEnabled == b.isCSSCustomFilterEnabled + && a.isCSSStickyPositionEnabled == b.isCSSStickyPositionEnabled && a.isCSSRegionsEnabled == b.isCSSRegionsEnabled && a.isCSSGridLayoutEnabled == b.isCSSGridLayoutEnabled #if ENABLE(CSS_VARIABLES) @@ -670,7 +673,7 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int case CSSPropertyPosition: // static | relative | absolute | fixed | sticky | inherit if (valueID == CSSValueStatic || valueID == CSSValueRelative || valueID == CSSValueAbsolute || valueID == CSSValueFixed #if ENABLE(CSS_STICKY_POSITION) - || valueID == CSSValueWebkitSticky + || (parserContext.isCSSStickyPositionEnabled && valueID == CSSValueWebkitSticky) #endif ) return true; @@ -3200,18 +3203,19 @@ bool CSSParser::parseAnimationShorthand(bool important) bool CSSParser::parseTransitionShorthand(bool important) { - const unsigned numProperties = webkitTransitionShorthand().length(); + const unsigned numProperties = 4; + ASSERT(numProperties == webkitTransitionShorthand().length()); ShorthandScope scope(this, CSSPropertyWebkitTransition); - bool parsedProperty[] = { false, false, false, false }; - RefPtr<CSSValue> values[4]; + bool parsedProperty[numProperties] = { false }; + RefPtr<CSSValue> values[numProperties]; unsigned i; while (m_valueList->current()) { CSSParserValue* val = m_valueList->current(); if (val->unit == CSSParserValue::Operator && val->iValue == ',') { - // We hit the end. Fill in all remaining values with the initial value. + // We hit the end. Fill in all remaining values with the initial value. m_valueList->next(); for (i = 0; i < numProperties; ++i) { if (!parsedProperty[i]) @@ -10414,12 +10418,12 @@ static CSSPropertyID cssPropertyID(const CharacterType* propertyName, unsigned l const Property* hashTableEntry = findProperty(name, length); const CSSPropertyID propertyID = hashTableEntry ? static_cast<CSSPropertyID>(hashTableEntry->id) : CSSPropertyInvalid; - // 600 is comfortably larger than numCSSProperties to allow for growth - static const int CSSPropertyHistogramSize = 600; - COMPILE_ASSERT(CSSPropertyHistogramSize > numCSSProperties, number_of_css_properties_exceed_CSSPropertyHistogramSize); - - if (hasPrefix(buffer, length, "-webkit-") && propertyID != CSSPropertyInvalid) - HistogramSupport::histogramEnumeration("CSS.PrefixUsage", max(1, propertyID - firstCSSProperty), CSSPropertyHistogramSize); + static const int cssPropertyHistogramSize = numCSSProperties; + if (hasPrefix(buffer, length, "-webkit-") && propertyID != CSSPropertyInvalid) { + int histogramValue = propertyID - firstCSSProperty; + ASSERT(0 <= histogramValue && histogramValue < cssPropertyHistogramSize); + HistogramSupport::histogramEnumeration("CSS.PrefixUsage", histogramValue, cssPropertyHistogramSize); + } return propertyID; } |