Ignore:
Timestamp:
Feb 11, 2013, 3:00:54 AM (13 years ago)
Author:
[email protected]
Message:

Implement CSSValue::equals(const CSSValue&) to optimise CSSValue comparison
https://bugs.webkit.org/show_bug.cgi?id=102901

Patch by Alexander Shalamov <[email protected]> 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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSReflectValue.h

    r140642 r142444  
    5555    void addSubresourceStyleURLs(ListHashSet<KURL>&, const StyleSheetContents*) const;
    5656
     57    bool equals(const CSSReflectValue&) const;
     58
    5759    void reportDescendantMemoryUsage(MemoryObjectInfo*) const;
    5860
Note: See TracChangeset for help on using the changeset viewer.