-
darin@apple.com authored
Reviewed by Sam. - reduce use of DeprecatedString and memory allocations in processing of CSS - remove unnecessary double -> float -> double trip in the CSS parser - cleaned up names and structure in CSS grammar * css/CSSGrammar.y: Remove getPropertyID and getValueID. Both are now in CSSParser.cpp instead, and they now work on ParseString and String objects and don't require the caller to put the string into a char*. Gave members of the %union more sensible names, removed duplicates, and sorted into a logical order. Put the %expect back in, rather than leaving it commented out. * css/CSSParser.cpp: (WebCore::equalIgnoringCase): Added. (WebCore::hasPrefix): Added. (WebCore::CSSParser::parseTransitionProperty): Changed to call the new cssPropertyID, which obviates the need to call lower() and utf8() or to allocate memory at all. Also used equalIgnoringCase rather than putting the value into a String just to compare it. (WebCore::CSSParser::lex): Replaced convertASCIIToFloat with charactersToDouble. This change along with the CSSGrammar.y change, removes the double -> float -> double round trip, and affects the result of one layout test. (WebCore::cssPropertyID): Added. Gets the property ID from the gperf hash table, but without allocating any memory. (WebCore::cssValueKeywordID): Ditto. * css/CSSParser.h: Removed declaration for deprecatedString function (now used only in CSSParser.cpp; soon to be deleted). Added cssPropertyID and cssValueKeywordID functions. * css/CSSStyleDeclaration.cpp: (WebCore::CSSStyleDeclaration::getPropertyCSSValue): Call cssPropertyID instead of propertyID. (WebCore::CSSStyleDeclaration::getPropertyValue): Ditto. (WebCore::CSSStyleDeclaration::getPropertyPriority): Ditto. (WebCore::CSSStyleDeclaration::getPropertyShorthand): Ditto. (WebCore::CSSStyleDeclaration::isPropertyImplicit): Ditto. (WebCore::CSSStyleDeclaration::setProperty): Ditto. (WebCore::CSSStyleDeclaration::removeProperty): Ditto. (WebCore::CSSStyleDeclaration::isPropertyName): Ditto. * css/CSSStyleDeclaration.h: Removed unnecessary includes, unnecessary Noncopyable boilerplate, and the getPropertyID function declaration along with its associated apology comment. * css/makevalues.pl: Generate constants instead of macros for CSS value numbers (but not an enumeration, like properties, since you rarely have any reason to handle all values, but often have a reason to handle all properties). Renamed the constant for the number of CSS value keywords from CSS_VAL_TOTAL to numCSSValueKeywords, and added maxCSSValueKeywordLength. * platform/text/String.cpp: (WebCore::charactersToDouble): Made this function more efficient by using a stack buffer rather than a CString. LayoutTests: Reviewed by Sam. - generate new results for the one test that was altered by the double -> float -> double trip taken by numeric values in the CSS parser This test appears under three different names in three different parts of our test suite. * platform/mac/css1/box_properties/acid_test-expected.checksum: Updated. * platform/mac/css1/box_properties/acid_test-expected.png: Ditto. * platform/mac/css1/box_properties/acid_test-expected.txt: Ditto. * platform/mac/css2.1/t09-c5526c-display-00-e-expected.checksum: Ditto. * platform/mac/css2.1/t09-c5526c-display-00-e-expected.png: Ditto. * platform/mac/css2.1/t09-c5526c-display-00-e-expected.txt: Ditto. * platform/mac/fast/block/basic/011-expected.checksum: Ditto. * platform/mac/fast/block/basic/011-expected.png: Ditto. * platform/mac/fast/block/basic/011-expected.txt: Ditto. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@30393 268f45cc-cd09-0410-ab3c-d52691b4dbfc
9413c168