Implement CSSValue::equals(const CSSValue&) to optimise CSSValue comparison
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Feb 2013 11:00:54 +0000 (11:00 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 11 Feb 2013 11:00:54 +0000 (11:00 +0000)
commit0a57db9ac37608ed34e191a0e6175c7451ee62ec
tree4c068985ebe7b5289dce6e7597bfb298c4919fa6
parentdb66c0625733461fa05739c1eb446e8467c55be5
Implement CSSValue::equals(const CSSValue&) to optimise CSSValue comparison
https://bugs.webkit.org/show_bug.cgi?id=102901

Patch by Alexander Shalamov <alexander.shalamov@intel.com> on 2013-02-11
Reviewed by Antti Koivisto.

Source/WebCore:

Added comparison method to CSSValue and its children, so that the
css values could be compared efficiently. Before this patch, CSSValue
objects were compared using strings that were generated by the cssText() method.

Test: cssom/cssvalue-comparison.html

* css/CSSAspectRatioValue.cpp:
(WebCore::CSSAspectRatioValue::equals):
(WebCore):
* css/CSSAspectRatioValue.h:
(CSSAspectRatioValue):
* css/CSSBasicShapes.cpp:
(WebCore::CSSBasicShapeRectangle::equals):
(WebCore):
(WebCore::CSSBasicShapeCircle::equals):
(WebCore::CSSBasicShapeEllipse::equals):
(WebCore::CSSBasicShapePolygon::equals):
* css/CSSBasicShapes.h:
(CSSBasicShapeRectangle):
(CSSBasicShapeCircle):
(CSSBasicShapeEllipse):
(CSSBasicShapePolygon):
* css/CSSBorderImageSliceValue.cpp:
(WebCore::CSSBorderImageSliceValue::equals):
(WebCore):
* css/CSSBorderImageSliceValue.h:
(CSSBorderImageSliceValue):
* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcValue::equals):
(WebCore):
(WebCore::CSSCalcPrimitiveValue::equals):
(CSSCalcPrimitiveValue):
(WebCore::CSSCalcPrimitiveValue::type):
(WebCore::CSSCalcBinaryOperation::equals):
(CSSCalcBinaryOperation):
(WebCore::CSSCalcBinaryOperation::type):
* css/CSSCalculationValue.h:
(WebCore::CSSCalcExpressionNode::equals):
(CSSCalcExpressionNode):
(CSSCalcValue):
* css/CSSCanvasValue.cpp:
(WebCore::CSSCanvasValue::equals):
(WebCore):
* css/CSSCanvasValue.h:
(CSSCanvasValue):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
(WebCore::CSSComputedStyleDeclaration::cssPropertyMatches):
(WebCore::CSSComputedStyleDeclaration::getCSSPropertyValuesForSidesShorthand):
* css/CSSCrossfadeValue.cpp:
(WebCore::CSSCrossfadeValue::equals):
(WebCore):
* css/CSSCrossfadeValue.h:
(CSSCrossfadeValue):
* css/CSSCursorImageValue.cpp:
(WebCore::CSSCursorImageValue::equals):
(WebCore):
* css/CSSCursorImageValue.h:
(CSSCursorImageValue):
* css/CSSFontFaceSrcValue.cpp:
(WebCore::CSSFontFaceSrcValue::equals):
(WebCore):
* css/CSSFontFaceSrcValue.h:
(CSSFontFaceSrcValue):
* css/CSSFunctionValue.cpp:
(WebCore::CSSFunctionValue::equals):
(WebCore):
* css/CSSFunctionValue.h:
(CSSFunctionValue):
* css/CSSGradientValue.cpp:
(WebCore::CSSLinearGradientValue::equals):
(WebCore):
(WebCore::CSSRadialGradientValue::equals):
* css/CSSGradientValue.h:
(WebCore::CSSGradientColorStop::operator==):
(CSSLinearGradientValue):
(CSSRadialGradientValue):
* css/CSSImageValue.cpp:
(WebCore::CSSImageValue::equals):
(WebCore):
* css/CSSImageValue.h:
(CSSImageValue):
* css/CSSInheritedValue.h:
(WebCore::CSSInheritedValue::equals):
(CSSInheritedValue):
* css/CSSInitialValue.h:
(WebCore::CSSInitialValue::equals):
(CSSInitialValue):
* css/CSSLineBoxContainValue.h:
(WebCore::CSSLineBoxContainValue::equals):
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::equals):
(WebCore):
* css/CSSPrimitiveValue.h:
(CSSPrimitiveValue):
* css/CSSReflectValue.cpp:
(WebCore::CSSReflectValue::equals):
(WebCore):
* css/CSSReflectValue.h:
(CSSReflectValue):
* css/CSSTimingFunctionValue.cpp:
(WebCore::CSSCubicBezierTimingFunctionValue::equals):
(WebCore):
(WebCore::CSSStepsTimingFunctionValue::equals):
* css/CSSTimingFunctionValue.h:
(WebCore::CSSLinearTimingFunctionValue::equals):
(CSSLinearTimingFunctionValue):
(CSSCubicBezierTimingFunctionValue):
(CSSStepsTimingFunctionValue):
* css/CSSUnicodeRangeValue.cpp:
(WebCore::CSSUnicodeRangeValue::equals):
(WebCore):
* css/CSSUnicodeRangeValue.h:
(CSSUnicodeRangeValue):
* css/CSSValue.cpp:
(WebCore):
(WebCore::compareCSSValues):
(WebCore::CSSValue::equals):
* css/CSSValue.h:
(CSSValue):
(WebCore):
(WebCore::compareCSSValueVector):
(WebCore::compareCSSValuePtr):
* css/CSSValueList.cpp:
(WebCore::CSSValueList::removeAll):
(WebCore::CSSValueList::hasValue):
(WebCore::CSSValueList::equals):
(WebCore):
* css/CSSValueList.h:
(CSSValueList):
* css/CSSVariableValue.h:
(WebCore::CSSVariableValue::equals):
(CSSVariableValue):
* css/Counter.h:
(Counter):
(WebCore::Counter::equals):
* css/DashboardRegion.h:
(WebCore::DashboardRegion::equals):
* css/FontFeatureValue.cpp:
(WebCore::FontFeatureValue::equals):
(WebCore):
* css/FontFeatureValue.h:
(FontFeatureValue):
* css/FontValue.cpp:
(WebCore::FontValue::equals):
(WebCore):
* css/FontValue.h:
(FontValue):
* css/MediaQueryExp.h:
(WebCore::MediaQueryExp::operator==):
* css/Pair.h:
(WebCore::Pair::equals):
(Pair):
* css/Rect.h:
(WebCore::RectBase::equals):
(RectBase):
* css/ShadowValue.cpp:
(WebCore::ShadowValue::equals):
(WebCore):
* css/ShadowValue.h:
(ShadowValue):
* css/StylePropertySet.cpp:
(WebCore::StylePropertySet::get4Values):
(WebCore::StylePropertySet::propertyMatches):
* css/WebKitCSSArrayFunctionValue.cpp:
(WebCore::WebKitCSSArrayFunctionValue::equals):
(WebCore):
* css/WebKitCSSArrayFunctionValue.h:
(WebKitCSSArrayFunctionValue):
* css/WebKitCSSFilterValue.cpp:
(WebCore::WebKitCSSFilterValue::equals):
(WebCore):
* css/WebKitCSSFilterValue.h:
(WebKitCSSFilterValue):
* css/WebKitCSSMixFunctionValue.cpp:
(WebCore::WebKitCSSMixFunctionValue::equals):
(WebCore):
* css/WebKitCSSMixFunctionValue.h:
(WebKitCSSMixFunctionValue):
* css/WebKitCSSSVGDocumentValue.cpp:
(WebCore::WebKitCSSSVGDocumentValue::equals):
(WebCore):
* css/WebKitCSSSVGDocumentValue.h:
(WebKitCSSSVGDocumentValue):
* css/WebKitCSSShaderValue.cpp:
(WebCore::WebKitCSSShaderValue::equals):
(WebCore):
* css/WebKitCSSShaderValue.h:
(WebKitCSSShaderValue):
* css/WebKitCSSTransformValue.h:
(WebCore::WebKitCSSTransformValue::equals):
* editing/EditingStyle.cpp:
(WebCore::HTMLAttributeEquivalent::valueIsPresentInStyle):
* svg/SVGColor.cpp:
(WebCore::SVGColor::equals):
(WebCore):
* svg/SVGColor.h:
(SVGColor):
* svg/SVGPaint.cpp:
(WebCore::SVGPaint::equals):
(WebCore):
* svg/SVGPaint.h:
(SVGPaint):

LayoutTests:

New layout test to verify that CSSValue objects comparison works properly.

* cssom/cssvalue-comparison-expected.txt: Added.
* cssom/cssvalue-comparison.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142444 268f45cc-cd09-0410-ab3c-d52691b4dbfc
71 files changed:
LayoutTests/ChangeLog
LayoutTests/cssom/cssvalue-comparison-expected.txt [new file with mode: 0644]
LayoutTests/cssom/cssvalue-comparison.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSAspectRatioValue.cpp
Source/WebCore/css/CSSAspectRatioValue.h
Source/WebCore/css/CSSBasicShapes.cpp
Source/WebCore/css/CSSBasicShapes.h
Source/WebCore/css/CSSBorderImageSliceValue.cpp
Source/WebCore/css/CSSBorderImageSliceValue.h
Source/WebCore/css/CSSCalculationValue.cpp
Source/WebCore/css/CSSCalculationValue.h
Source/WebCore/css/CSSCanvasValue.cpp
Source/WebCore/css/CSSCanvasValue.h
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSCrossfadeValue.cpp
Source/WebCore/css/CSSCrossfadeValue.h
Source/WebCore/css/CSSCursorImageValue.cpp
Source/WebCore/css/CSSCursorImageValue.h
Source/WebCore/css/CSSFontFaceSrcValue.cpp
Source/WebCore/css/CSSFontFaceSrcValue.h
Source/WebCore/css/CSSFunctionValue.cpp
Source/WebCore/css/CSSFunctionValue.h
Source/WebCore/css/CSSGradientValue.cpp
Source/WebCore/css/CSSGradientValue.h
Source/WebCore/css/CSSImageValue.cpp
Source/WebCore/css/CSSImageValue.h
Source/WebCore/css/CSSInheritedValue.h
Source/WebCore/css/CSSInitialValue.h
Source/WebCore/css/CSSLineBoxContainValue.h
Source/WebCore/css/CSSPrimitiveValue.cpp
Source/WebCore/css/CSSPrimitiveValue.h
Source/WebCore/css/CSSReflectValue.cpp
Source/WebCore/css/CSSReflectValue.h
Source/WebCore/css/CSSTimingFunctionValue.cpp
Source/WebCore/css/CSSTimingFunctionValue.h
Source/WebCore/css/CSSUnicodeRangeValue.cpp
Source/WebCore/css/CSSUnicodeRangeValue.h
Source/WebCore/css/CSSValue.cpp
Source/WebCore/css/CSSValue.h
Source/WebCore/css/CSSValueList.cpp
Source/WebCore/css/CSSValueList.h
Source/WebCore/css/CSSVariableValue.h
Source/WebCore/css/Counter.h
Source/WebCore/css/DashboardRegion.h
Source/WebCore/css/FontFeatureValue.cpp
Source/WebCore/css/FontFeatureValue.h
Source/WebCore/css/FontValue.cpp
Source/WebCore/css/FontValue.h
Source/WebCore/css/MediaQueryExp.h
Source/WebCore/css/Pair.h
Source/WebCore/css/Rect.h
Source/WebCore/css/ShadowValue.cpp
Source/WebCore/css/ShadowValue.h
Source/WebCore/css/StylePropertySet.cpp
Source/WebCore/css/WebKitCSSArrayFunctionValue.cpp
Source/WebCore/css/WebKitCSSArrayFunctionValue.h
Source/WebCore/css/WebKitCSSFilterValue.cpp
Source/WebCore/css/WebKitCSSFilterValue.h
Source/WebCore/css/WebKitCSSMixFunctionValue.cpp
Source/WebCore/css/WebKitCSSMixFunctionValue.h
Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp
Source/WebCore/css/WebKitCSSSVGDocumentValue.h
Source/WebCore/css/WebKitCSSShaderValue.cpp
Source/WebCore/css/WebKitCSSShaderValue.h
Source/WebCore/css/WebKitCSSTransformValue.h
Source/WebCore/editing/EditingStyle.cpp
Source/WebCore/svg/SVGColor.cpp
Source/WebCore/svg/SVGColor.h
Source/WebCore/svg/SVGPaint.cpp
Source/WebCore/svg/SVGPaint.h