+2012-02-21 Alexis Menard <alexis.menard@openbossa.org>
+
+ Little optimization for CSSParser::parseFillShorthand.
+ https://bugs.webkit.org/show_bug.cgi?id=79042
+
+ Reviewed by Hajime Morita.
+
+ Remove one extra loop that we can combine with the following one
+ which adds the properties to the parser's list of properties. I also
+ removed a useless check.
+ Instruments shows on the css-parser-yui benchmark an improvement
+ of 13ms (from 77ms spent in the function to 64ms).
+
+ No new tests : refactoring, existings tests should cover.
+
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseFillShorthand):
+
2012-02-20 David Hyatt <hyatt@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=79046
return false;
}
- // Fill in any remaining properties with the initial value.
- for (i = 0; i < numProperties; ++i) {
+ // Now add all of the properties we found.
+ for (i = 0; i < numProperties; i++) {
+ // Fill in any remaining properties with the initial value.
if (!parsedProperty[i]) {
addFillValue(values[i], cssValuePool()->createImplicitInitialValue());
if (properties[i] == CSSPropertyBackgroundPosition || properties[i] == CSSPropertyWebkitMaskPosition)
addFillValue(positionYValue, cssValuePool()->createImplicitInitialValue());
if (properties[i] == CSSPropertyBackgroundRepeat || properties[i] == CSSPropertyWebkitMaskRepeat)
addFillValue(repeatYValue, cssValuePool()->createImplicitInitialValue());
- if ((properties[i] == CSSPropertyBackgroundOrigin || properties[i] == CSSPropertyWebkitMaskOrigin) && !parsedProperty[i]) {
+ if ((properties[i] == CSSPropertyBackgroundOrigin || properties[i] == CSSPropertyWebkitMaskOrigin)) {
// If background-origin wasn't present, then reset background-clip also.
addFillValue(clipValue, cssValuePool()->createImplicitInitialValue());
}
}
- }
-
- // Now add all of the properties we found.
- for (i = 0; i < numProperties; i++) {
if (properties[i] == CSSPropertyBackgroundPosition) {
addProperty(CSSPropertyBackgroundPositionX, values[i].release(), important);
// it's OK to call positionYValue.release() since we only see CSSPropertyBackgroundPosition once