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: http://svn.webkit.org/repository/webkit/trunk@142444 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Implement position-based sourcemapping for stylesheets
https://bugs.webkit.org/show_bug.cgi?id=109168

Source/WebCore:

Reviewed by Vsevolod Vlasov.

This change introduces support for position-based source maps for CSS stylesheets.
Sourcemaps and originating resources (sass, scss, etc.) are loaded synchronously
upon the CSS UISourceCode addition. RangeBasedSourceMap is removed as it is not used.

Test: http/tests/inspector/stylesheet-source-mapping.html

* inspector/front-end/CSSStyleModel.js:
(WebInspector.CSSStyleModel):
(WebInspector.CSSStyleModel.prototype.setSourceMapping):
(WebInspector.CSSStyleModel.prototype.rawLocationToUILocation):
(WebInspector.CSSStyleModel.LiveLocation.prototype.uiLocation):
(WebInspector.CSSLocation):
(WebInspector.CSSProperty):
(WebInspector.CSSProperty.parsePayload):
* inspector/front-end/CompilerScriptMapping.js:
(WebInspector.CompilerScriptMapping):
(WebInspector.CompilerScriptMapping.prototype.rawLocationToUILocation):
(WebInspector.CompilerScriptMapping.prototype.loadSourceMapForScript):
* inspector/front-end/SASSSourceMapping.js:
(WebInspector.SASSSourceMapping):
(WebInspector.SASSSourceMapping.prototype._styleSheetChanged.callback):
(WebInspector.SASSSourceMapping.prototype._styleSheetChanged):
(WebInspector.SASSSourceMapping.prototype._reloadCSS):
(WebInspector.SASSSourceMapping.prototype._resourceAdded.didRequestContent):
(WebInspector.SASSSourceMapping.prototype._resourceAdded):
(WebInspector.SASSSourceMapping.prototype._loadAndProcessSourceMap):
(WebInspector.SASSSourceMapping.prototype.loadSourceMapForStyleSheet):
(WebInspector.SASSSourceMapping.prototype._bindUISourceCode):
(WebInspector.SASSSourceMapping.prototype.rawLocationToUILocation):
(WebInspector.SASSSourceMapping.prototype.uiLocationToRawLocation):
(WebInspector.SASSSourceMapping.prototype._reset):
* inspector/front-end/SourceMap.js:
(WebInspector.SourceMap):
(WebInspector.SourceMap.load):
(WebInspector.SourceMap.prototype.findEntry):
(WebInspector.SourceMap.prototype.findEntryReversed):
(WebInspector.SourceMap.prototype._parseMap):
* inspector/front-end/StylesSourceMapping.js:
(WebInspector.StylesSourceMapping):
(WebInspector.StylesSourceMapping.prototype._bindUISourceCode):
* inspector/front-end/inspector.js:

LayoutTests:

Added test for the stylesheet source mappings, followed the API changes,
removed RangeBasedSourceMap tests as this type of sourcemap is gone.

Reviewed by Vsevolod Vlasov.

* http/tests/inspector/compiler-script-mapping-expected.txt:
* http/tests/inspector/compiler-script-mapping.html:
* http/tests/inspector/resources/example.css.map: Added.
* http/tests/inspector/resources/example.scss: Added.
* http/tests/inspector/stylesheet-source-mapping-expected.txt: Added.
* http/tests/inspector/stylesheet-source-mapping.html: Added.
* inspector/styles/range-based-mapping-expected.txt: Removed.
* inspector/styles/range-based-mapping.html: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142445 268f45cc-cd09-0410-ab3c-d52691b4dbfc