Parse '-webkit-filter' property syntax
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Oct 2011 23:27:54 +0000 (23:27 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Oct 2011 23:27:54 +0000 (23:27 +0000)
commiteeab4ce370036bd3744929b2ef9a1d4f6af252d7
tree9a724057213c2dfc23cdd2376c49a145ee253da3
parent711b7a3f1543041465c652b9a34478b3f45cbbef
Parse '-webkit-filter' property syntax
https://bugs.webkit.org/show_bug.cgi?id=68473

Reviewed by Nikolas Zimmermann.

Parse the new -webkit-filter property, looking for shorthand
functions then testing number, type and value of parameters.

Note that support for drop-shadow() was omitted from this
patch because parsing CSS shadow syntax was going to require some
refactoring of the box and text shadow code. The followup
bug is https://bugs.webkit.org/show_bug.cgi?id=69108.

Also, computed style will return null for filters at the moment.
That's https://bugs.webkit.org/show_bug.cgi?id=68477.

Tests: css3/filters/filter-property-parsing-invalid.html
       css3/filters/filter-property-parsing.html

* CMakeLists.txt:
* CodeGenerators.pri:
* DerivedSources.cpp:
* DerivedSources.make:
* GNUmakefile.list.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
    Build files updated for new WebKitCSSFilterValue classes.
* bindings/js/JSCSSValueCustom.cpp:
(WebCore::toJS):
* bindings/objc/DOMCSS.mm:
    Test if value is WebKitCSSFilterValue.
* css/CSSParser.cpp:
(WebCore::filterInfoForName):
(WebCore::CSSParser::isValidFilterArgument):
(WebCore::CSSParser::parseFilter):
* css/CSSParser.h:
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
(WebCore::filterOperationForType):
(WebCore::CSSStyleSelector::createFilterOperations):
* css/CSSStyleSelector.h:
    Handle the new shorthand functions in -webkit-filter.
* css/CSSValue.h:
(WebCore::CSSValue::isWebKitCSSFilterValue):
    Add virtual function that returns false here.
* css/WebKitCSSFilterValue.cpp: Added.
(WebCore::WebKitCSSFilterValue::WebKitCSSFilterValue):
(WebCore::WebKitCSSFilterValue::~WebKitCSSFilterValue):
(WebCore::WebKitCSSFilterValue::cssText):
* css/WebKitCSSFilterValue.h: Added.
(WebCore::WebKitCSSFilterValue::create):
(WebCore::WebKitCSSFilterValue::operationType):
(WebCore::WebKitCSSFilterValue::isWebKitCSSFilterValue):
* css/WebKitCSSFilterValue.idl: Added.
    WebKitCSSFilterValue modelled closely on WebKitCSSTransformValue,
    basically identifying the type of operation in a CSSValueList.
* page/DOMWindow.idl:
    New WebKitCSSFilterValue constructor.
* platform/graphics/filters/FilterOperation.h:
(WebCore::BlurFilterOperation::create):
(WebCore::BlurFilterOperation::stdDeviationX):
(WebCore::BlurFilterOperation::stdDeviationY):
(WebCore::BlurFilterOperation::BlurFilterOperation):
(WebCore::SharpenFilterOperation::create):
(WebCore::SharpenFilterOperation::radius):
(WebCore::SharpenFilterOperation::threshold):
(WebCore::SharpenFilterOperation::SharpenFilterOperation):
    Use Length rather than double for parameters that are CSS lengths.

New tests that exercise the -webkit-filter syntax, with
(nearly) all the function shorthands. Since this patch also
added a global WebKitCSSFilterValue interface, the window
tests needed update, but only on the platforms that have
ENABLE(CSS_FILTERS).

* css3/filters/filter-property-expected.txt:
* css3/filters/filter-property-parsing-expected.txt: Added.
* css3/filters/filter-property-parsing-invalid-expected.txt: Added.
* css3/filters/filter-property-parsing-invalid.html: Added.
* css3/filters/filter-property-parsing.html: Added.
* css3/filters/script-tests/filter-property-parsing-invalid.js: Added.
(testInvalidFilterRule):
* css3/filters/script-tests/filter-property-parsing.js: Added.
(jsWrapperClass):
(shouldBeType):
(testFilterRule):
* css3/filters/script-tests/filter-property.js:
    Updated old test which was missing quotes, plus new tests that
    exercise the shorthand feature.
* platform/mac/fast/dom/Window/window-properties-expected.txt:
* platform/mac/fast/dom/Window/window-property-descriptors-expected.txt:
* platform/mac/fast/dom/prototype-inheritance-2-expected.txt: Added.
* platform/mac/fast/js/global-constructors-expected.txt:
* platform/win/fast/dom/Window/window-properties-expected.txt: Copied from LayoutTests/platform/mac/fast/dom/Window/window-properties-expected.txt.
* platform/win/fast/dom/Window/window-property-descriptors-expected.txt:
* platform/win/fast/dom/prototype-inheritance-2-expected.txt: Added.
* platform/win/fast/js/global-constructors-expected.txt:
    Updated isAppleWebkit() platform files for the new WebKitCSSFilterValue
    API exposed on Window.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@96764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
39 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/filters/filter-property-expected.txt
LayoutTests/css3/filters/filter-property-parsing-expected.txt [new file with mode: 0644]
LayoutTests/css3/filters/filter-property-parsing-invalid-expected.txt [new file with mode: 0644]
LayoutTests/css3/filters/filter-property-parsing-invalid.html [new file with mode: 0644]
LayoutTests/css3/filters/filter-property-parsing.html [new file with mode: 0644]
LayoutTests/css3/filters/script-tests/filter-property-parsing-invalid.js [new file with mode: 0644]
LayoutTests/css3/filters/script-tests/filter-property-parsing.js [new file with mode: 0644]
LayoutTests/css3/filters/script-tests/filter-property.js
LayoutTests/platform/mac/fast/dom/Window/window-properties-expected.txt
LayoutTests/platform/mac/fast/dom/Window/window-property-descriptors-expected.txt
LayoutTests/platform/mac/fast/dom/prototype-inheritance-2-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/js/global-constructors-expected.txt
LayoutTests/platform/win/fast/dom/Window/window-properties-expected.txt [new file with mode: 0644]
LayoutTests/platform/win/fast/dom/Window/window-property-descriptors-expected.txt
LayoutTests/platform/win/fast/dom/prototype-inheritance-2-expected.txt [new file with mode: 0644]
LayoutTests/platform/win/fast/js/global-constructors-expected.txt
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/CodeGenerators.pri
Source/WebCore/DerivedSources.cpp
Source/WebCore/DerivedSources.make
Source/WebCore/GNUmakefile.list.am
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.pro
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSCSSValueCustom.cpp
Source/WebCore/bindings/objc/DOMCSS.mm
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParser.h
Source/WebCore/css/CSSStyleSelector.cpp
Source/WebCore/css/CSSStyleSelector.h
Source/WebCore/css/CSSValue.h
Source/WebCore/css/WebKitCSSFilterValue.cpp [new file with mode: 0644]
Source/WebCore/css/WebKitCSSFilterValue.h [new file with mode: 0644]
Source/WebCore/css/WebKitCSSFilterValue.idl [new file with mode: 0644]
Source/WebCore/page/DOMWindow.idl
Source/WebCore/platform/graphics/filters/FilterOperation.h