Commit 638c3d52 authored by weinig's avatar weinig
Browse files

LayoutTests:

        Reviewed by Darin.

        - Update results for http://bugs.webkit.org/show_bug.cgi?id=13919
          Autogenerate the JS bindings for the CSSRule and its subclasses

        * fast/dom/Window/window-properties-expected.txt: adds new constructors
        * fast/dom/wrapper-classes-expected.txt: CSSStyleRule now passes!!

WebCore:

        Reviewed by Darin.

        Patch for http://bugs.webkit.org/show_bug.cgi?id=13919
        Autogenerate the JS bindings for the CSSRule and its subclasses

        - subclasses generated are CSSCharsetRule, CSSFontFaceRule, CSSImportRule
          CSSMediaRule, CSSPageRule and CSSStyleRule.

        * DerivedSources.make:
        * WebCore.pro:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSCSSRuleCustom.cpp: Added.
        (WebCore::toJS):
        * bindings/js/kjs_css.cpp:
        * bindings/js/kjs_css.h:
        * bindings/objc/DOMUtility.mm:
        (KJS::createDOMWrapper):
        * bindings/scripts/CodeGeneratorJS.pm:
        * css/CSSCharsetRule.h:
        (WebCore::CSSCharsetRule::setEncoding):
        * css/CSSCharsetRule.idl:
        * css/CSSFontFaceRule.idl:
        * css/CSSImportRule.idl:
        * css/CSSMediaRule.idl:
        * css/CSSPageRule.cpp:
        (WebCore::CSSPageRule::setSelectorText):
        * css/CSSPageRule.h:
        * css/CSSPageRule.idl:
        * css/CSSRule.cpp:
        (WebCore::CSSRule::setCssText):
        * css/CSSRule.h:
        * css/CSSRule.idl:
        * css/CSSStyleRule.cpp:
        (WebCore::CSSStyleRule::setSelectorText):
        * css/CSSStyleRule.h:
        * css/CSSStyleRule.idl:
        * page/DOMWindow.idl: add new constructors.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@21896 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 825e2e9b
2007-05-30 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
- Update results for http://bugs.webkit.org/show_bug.cgi?id=13919
Autogenerate the JS bindings for the CSSRule and its subclasses
* fast/dom/Window/window-properties-expected.txt: adds new constructors
* fast/dom/wrapper-classes-expected.txt: CSSStyleRule now passes!!
2007-05-30 Oliver Hunt <oliver@apple.com>
 
Reviewed by Mitz.
......@@ -69,6 +69,53 @@ window.CDATASection.prototype.replaceChild [function]
window.CDATASection.prototype.replaceData [function]
window.CDATASection.prototype.splitText [function]
window.CDATASection.prototype.substringData [function]
window.CSSCharsetRule [object CSSCharsetRuleConstructor]
window.CSSCharsetRule.prototype [object CSSCharsetRulePrototype]
window.CSSCharsetRule.prototype.CHARSET_RULE [number]
window.CSSCharsetRule.prototype.FONT_FACE_RULE [number]
window.CSSCharsetRule.prototype.IMPORT_RULE [number]
window.CSSCharsetRule.prototype.MEDIA_RULE [number]
window.CSSCharsetRule.prototype.PAGE_RULE [number]
window.CSSCharsetRule.prototype.STYLE_RULE [number]
window.CSSCharsetRule.prototype.UNKNOWN_RULE [number]
window.CSSFontFaceRule [object CSSFontFaceRuleConstructor]
window.CSSFontFaceRule.prototype [object CSSFontFaceRulePrototype]
window.CSSFontFaceRule.prototype.CHARSET_RULE [number]
window.CSSFontFaceRule.prototype.FONT_FACE_RULE [number]
window.CSSFontFaceRule.prototype.IMPORT_RULE [number]
window.CSSFontFaceRule.prototype.MEDIA_RULE [number]
window.CSSFontFaceRule.prototype.PAGE_RULE [number]
window.CSSFontFaceRule.prototype.STYLE_RULE [number]
window.CSSFontFaceRule.prototype.UNKNOWN_RULE [number]
window.CSSImportRule [object CSSImportRuleConstructor]
window.CSSImportRule.prototype [object CSSImportRulePrototype]
window.CSSImportRule.prototype.CHARSET_RULE [number]
window.CSSImportRule.prototype.FONT_FACE_RULE [number]
window.CSSImportRule.prototype.IMPORT_RULE [number]
window.CSSImportRule.prototype.MEDIA_RULE [number]
window.CSSImportRule.prototype.PAGE_RULE [number]
window.CSSImportRule.prototype.STYLE_RULE [number]
window.CSSImportRule.prototype.UNKNOWN_RULE [number]
window.CSSMediaRule [object CSSMediaRuleConstructor]
window.CSSMediaRule.prototype [object CSSMediaRulePrototype]
window.CSSMediaRule.prototype.CHARSET_RULE [number]
window.CSSMediaRule.prototype.FONT_FACE_RULE [number]
window.CSSMediaRule.prototype.IMPORT_RULE [number]
window.CSSMediaRule.prototype.MEDIA_RULE [number]
window.CSSMediaRule.prototype.PAGE_RULE [number]
window.CSSMediaRule.prototype.STYLE_RULE [number]
window.CSSMediaRule.prototype.UNKNOWN_RULE [number]
window.CSSMediaRule.prototype.deleteRule [function]
window.CSSMediaRule.prototype.insertRule [function]
window.CSSPageRule [object CSSPageRuleConstructor]
window.CSSPageRule.prototype [object CSSPageRulePrototype]
window.CSSPageRule.prototype.CHARSET_RULE [number]
window.CSSPageRule.prototype.FONT_FACE_RULE [number]
window.CSSPageRule.prototype.IMPORT_RULE [number]
window.CSSPageRule.prototype.MEDIA_RULE [number]
window.CSSPageRule.prototype.PAGE_RULE [number]
window.CSSPageRule.prototype.STYLE_RULE [number]
window.CSSPageRule.prototype.UNKNOWN_RULE [number]
window.CSSPrimitiveValue [object CSSPrimitiveValueConstructor]
window.CSSPrimitiveValue.CSS_ATTR [number]
window.CSSPrimitiveValue.CSS_CM [number]
......@@ -160,6 +207,8 @@ window.CSSStyleDeclaration.prototype.isPropertyImplicit [function]
window.CSSStyleDeclaration.prototype.item [function]
window.CSSStyleDeclaration.prototype.removeProperty [function]
window.CSSStyleDeclaration.prototype.setProperty [function]
window.CSSStyleRule [object CSSStyleRuleConstructor]
window.CSSStyleRule.prototype [printed above as window.CSSRule.prototype]
window.CSSValue [object CSSValueConstructor]
window.CSSValue.CSS_CUSTOM [number]
window.CSSValue.CSS_INHERIT [number]
......
......@@ -66,7 +66,7 @@ PASS jsWrapperClass(stylesheet) is 'CSSStyleSheet'
PASS objCWrapperClass(stylesheet) is 'DOMCSSStyleSheet'
PASS jsWrapperClass(stylesheet.cssRules) is 'CSSRuleList'
PASS objCWrapperClass(stylesheet.cssRules) is 'DOMCSSRuleList'
FAIL jsWrapperClass(stylesheet.cssRules.item(0)) should be CSSStyleRule. Was CSSRule.
PASS jsWrapperClass(stylesheet.cssRules.item(0)) is 'CSSStyleRule'
PASS objCWrapperClass(stylesheet.cssRules.item(0)) is 'DOMCSSStyleRule'
PASS jsWrapperClass(stylesheet.cssRules.item(0).style) is 'CSSStyleDeclaration'
PASS objCWrapperClass(stylesheet.cssRules.item(0).style) is 'DOMCSSStyleDeclaration'
......
2007-05-30 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
Patch for http://bugs.webkit.org/show_bug.cgi?id=13919
Autogenerate the JS bindings for the CSSRule and its subclasses
- subclasses generated are CSSCharsetRule, CSSFontFaceRule, CSSImportRule
CSSMediaRule, CSSPageRule and CSSStyleRule.
* DerivedSources.make:
* WebCore.pro:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSCSSRuleCustom.cpp: Added.
(WebCore::toJS):
* bindings/js/kjs_css.cpp:
* bindings/js/kjs_css.h:
* bindings/objc/DOMUtility.mm:
(KJS::createDOMWrapper):
* bindings/scripts/CodeGeneratorJS.pm:
* css/CSSCharsetRule.h:
(WebCore::CSSCharsetRule::setEncoding):
* css/CSSCharsetRule.idl:
* css/CSSFontFaceRule.idl:
* css/CSSImportRule.idl:
* css/CSSMediaRule.idl:
* css/CSSPageRule.cpp:
(WebCore::CSSPageRule::setSelectorText):
* css/CSSPageRule.h:
* css/CSSPageRule.idl:
* css/CSSRule.cpp:
(WebCore::CSSRule::setCssText):
* css/CSSRule.h:
* css/CSSRule.idl:
* css/CSSStyleRule.cpp:
(WebCore::CSSStyleRule::setSelectorText):
* css/CSSStyleRule.h:
* css/CSSStyleRule.idl:
* page/DOMWindow.idl: add new constructors.
2007-05-30 Mark Rowe <mrowe@apple.com>
 
Build fixes after r21889. Add missing #includes.
......@@ -300,9 +300,15 @@ all : \
HTMLEntityNames.c \
JSAttr.h \
JSCDATASection.h \
JSCSSCharsetRule.h \
JSCSSFontFaceRule.h \
JSCSSImportRule.h \
JSCSSMediaRule.h \
JSCSSPageRule.h \
JSCSSPrimitiveValue.h \
JSCSSRule.h \
JSCSSRuleList.h \
JSCSSStyleRule.h \
JSCSSValue.h \
JSCSSValueList.h \
JSCanvasGradient.h \
......
......@@ -161,10 +161,16 @@ LUT_TABLE_FILES += \
IDL_BINDINGS += \
css/Counter.idl \
css/CSSCharsetRule.idl \
css/CSSFontFaceRule.idl \
css/CSSImportRule.idl \
css/CSSMediaRule.idl \
css/CSSPageRule.idl \
css/CSSPrimitiveValue.idl \
css/CSSRule.idl \
css/CSSRuleList.idl \
css/CSSStyleDeclaration.idl \
css/CSSStyleRule.idl \
css/CSSValue.idl \
css/CSSValueList.idl \
css/MediaList.idl \
......@@ -268,6 +274,7 @@ IDL_BINDINGS += \
SOURCES += \
bindings/js/JSCanvasRenderingContext2DCustom.cpp \
bindings/js/JSCSSRuleCustom.cpp \
bindings/js/JSCSSStyleDeclarationCustom.cpp \
bindings/js/JSCustomXPathNSResolver.cpp \
bindings/js/JSDocumentCustom.cpp \
......
......@@ -2767,6 +2767,19 @@
BC3C39B60C0D3D8D005F4D7A /* JSMediaList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC3C39B40C0D3D8D005F4D7A /* JSMediaList.cpp */; };
BC3C39B70C0D3D8D005F4D7A /* JSMediaList.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3C39B50C0D3D8D005F4D7A /* JSMediaList.h */; };
BC3FCAA90AC3DB5800BA54AD /* PlatformScrollBar.h in Headers */ = {isa = PBXBuildFile; fileRef = BC3FCAA80AC3DB5800BA54AD /* PlatformScrollBar.h */; settings = {ATTRIBUTES = (); }; };
BC46C1EE0C0DDBDF0020CFC3 /* JSCSSRuleCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC46C1ED0C0DDBDF0020CFC3 /* JSCSSRuleCustom.cpp */; };
BC46C1FA0C0DDC8F0020CFC3 /* JSCSSCharsetRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC46C1F00C0DDC8F0020CFC3 /* JSCSSCharsetRule.cpp */; };
BC46C1FB0C0DDC8F0020CFC3 /* JSCSSCharsetRule.h in Headers */ = {isa = PBXBuildFile; fileRef = BC46C1F10C0DDC8F0020CFC3 /* JSCSSCharsetRule.h */; };
BC46C1FC0C0DDC8F0020CFC3 /* JSCSSFontFaceRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC46C1F20C0DDC8F0020CFC3 /* JSCSSFontFaceRule.cpp */; };
BC46C1FD0C0DDC8F0020CFC3 /* JSCSSFontFaceRule.h in Headers */ = {isa = PBXBuildFile; fileRef = BC46C1F30C0DDC8F0020CFC3 /* JSCSSFontFaceRule.h */; };
BC46C1FE0C0DDC8F0020CFC3 /* JSCSSImportRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC46C1F40C0DDC8F0020CFC3 /* JSCSSImportRule.cpp */; };
BC46C1FF0C0DDC8F0020CFC3 /* JSCSSImportRule.h in Headers */ = {isa = PBXBuildFile; fileRef = BC46C1F50C0DDC8F0020CFC3 /* JSCSSImportRule.h */; };
BC46C2000C0DDC8F0020CFC3 /* JSCSSMediaRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC46C1F60C0DDC8F0020CFC3 /* JSCSSMediaRule.cpp */; };
BC46C2010C0DDC8F0020CFC3 /* JSCSSMediaRule.h in Headers */ = {isa = PBXBuildFile; fileRef = BC46C1F70C0DDC8F0020CFC3 /* JSCSSMediaRule.h */; };
BC46C2020C0DDC8F0020CFC3 /* JSCSSPageRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC46C1F80C0DDC8F0020CFC3 /* JSCSSPageRule.cpp */; };
BC46C2030C0DDC8F0020CFC3 /* JSCSSPageRule.h in Headers */ = {isa = PBXBuildFile; fileRef = BC46C1F90C0DDC8F0020CFC3 /* JSCSSPageRule.h */; };
BC46C2060C0DDCA10020CFC3 /* JSCSSStyleRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC46C2040C0DDCA10020CFC3 /* JSCSSStyleRule.cpp */; };
BC46C2070C0DDCA10020CFC3 /* JSCSSStyleRule.h in Headers */ = {isa = PBXBuildFile; fileRef = BC46C2050C0DDCA10020CFC3 /* JSCSSStyleRule.h */; };
BC4918C60BFEA050009D6316 /* JSHTMLFrameElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4918C00BFEA050009D6316 /* JSHTMLFrameElement.cpp */; };
BC4918C70BFEA050009D6316 /* JSHTMLFrameElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4918C10BFEA050009D6316 /* JSHTMLFrameElement.h */; };
BC4918C80BFEA050009D6316 /* JSHTMLIFrameElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC4918C20BFEA050009D6316 /* JSHTMLIFrameElement.cpp */; };
......@@ -6027,6 +6040,19 @@
BC3C39B40C0D3D8D005F4D7A /* JSMediaList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaList.cpp; sourceTree = "<group>"; };
BC3C39B50C0D3D8D005F4D7A /* JSMediaList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSMediaList.h; sourceTree = "<group>"; };
BC3FCAA80AC3DB5800BA54AD /* PlatformScrollBar.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PlatformScrollBar.h; sourceTree = "<group>"; };
BC46C1ED0C0DDBDF0020CFC3 /* JSCSSRuleCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSRuleCustom.cpp; sourceTree = "<group>"; };
BC46C1F00C0DDC8F0020CFC3 /* JSCSSCharsetRule.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSCharsetRule.cpp; sourceTree = "<group>"; };
BC46C1F10C0DDC8F0020CFC3 /* JSCSSCharsetRule.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSCSSCharsetRule.h; sourceTree = "<group>"; };
BC46C1F20C0DDC8F0020CFC3 /* JSCSSFontFaceRule.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSFontFaceRule.cpp; sourceTree = "<group>"; };
BC46C1F30C0DDC8F0020CFC3 /* JSCSSFontFaceRule.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSCSSFontFaceRule.h; sourceTree = "<group>"; };
BC46C1F40C0DDC8F0020CFC3 /* JSCSSImportRule.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSImportRule.cpp; sourceTree = "<group>"; };
BC46C1F50C0DDC8F0020CFC3 /* JSCSSImportRule.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSCSSImportRule.h; sourceTree = "<group>"; };
BC46C1F60C0DDC8F0020CFC3 /* JSCSSMediaRule.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSMediaRule.cpp; sourceTree = "<group>"; };
BC46C1F70C0DDC8F0020CFC3 /* JSCSSMediaRule.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSCSSMediaRule.h; sourceTree = "<group>"; };
BC46C1F80C0DDC8F0020CFC3 /* JSCSSPageRule.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSPageRule.cpp; sourceTree = "<group>"; };
BC46C1F90C0DDC8F0020CFC3 /* JSCSSPageRule.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSCSSPageRule.h; sourceTree = "<group>"; };
BC46C2040C0DDCA10020CFC3 /* JSCSSStyleRule.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSStyleRule.cpp; sourceTree = "<group>"; };
BC46C2050C0DDCA10020CFC3 /* JSCSSStyleRule.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSCSSStyleRule.h; sourceTree = "<group>"; };
BC4918C00BFEA050009D6316 /* JSHTMLFrameElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLFrameElement.cpp; sourceTree = "<group>"; };
BC4918C10BFEA050009D6316 /* JSHTMLFrameElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLFrameElement.h; sourceTree = "<group>"; };
BC4918C20BFEA050009D6316 /* JSHTMLIFrameElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLIFrameElement.cpp; sourceTree = "<group>"; };
......@@ -6418,6 +6444,16 @@
93F9B6DF0BA0FB7200854064 /* JSComment.h */,
930705D709E0C9B700B17FE4 /* JSCounter.cpp */,
930705D909E0C9BF00B17FE4 /* JSCounter.h */,
BC46C1F00C0DDC8F0020CFC3 /* JSCSSCharsetRule.cpp */,
BC46C1F10C0DDC8F0020CFC3 /* JSCSSCharsetRule.h */,
BC46C1F20C0DDC8F0020CFC3 /* JSCSSFontFaceRule.cpp */,
BC46C1F30C0DDC8F0020CFC3 /* JSCSSFontFaceRule.h */,
BC46C1F40C0DDC8F0020CFC3 /* JSCSSImportRule.cpp */,
BC46C1F50C0DDC8F0020CFC3 /* JSCSSImportRule.h */,
BC46C1F60C0DDC8F0020CFC3 /* JSCSSMediaRule.cpp */,
BC46C1F70C0DDC8F0020CFC3 /* JSCSSMediaRule.h */,
BC46C1F80C0DDC8F0020CFC3 /* JSCSSPageRule.cpp */,
BC46C1F90C0DDC8F0020CFC3 /* JSCSSPageRule.h */,
930705E809E0C9F000B17FE4 /* JSCSSPrimitiveValue.cpp */,
930705EA09E0C9F600B17FE4 /* JSCSSPrimitiveValue.h */,
14CF7B3109F6ECD700EB3665 /* JSCSSRule.cpp */,
......@@ -6426,6 +6462,8 @@
A8D05FA60A23B301005E7203 /* JSCSSRuleList.h */,
142011B40A003133008303F9 /* JSCSSStyleDeclaration.cpp */,
142011B50A003133008303F9 /* JSCSSStyleDeclaration.h */,
BC46C2040C0DDCA10020CFC3 /* JSCSSStyleRule.cpp */,
BC46C2050C0DDCA10020CFC3 /* JSCSSStyleRule.h */,
14CF78A309F58CBF00EB3665 /* JSCSSValue.cpp */,
14CF78A509F58CD800EB3665 /* JSCSSValue.h */,
A8D05FA90A23B30F005E7203 /* JSCSSValueList.cpp */,
......@@ -9197,6 +9235,7 @@
BC4EDEF70C08F414007EDD49 /* Custom */ = {
isa = PBXGroup;
children = (
BC46C1ED0C0DDBDF0020CFC3 /* JSCSSRuleCustom.cpp */,
1A9EF4560A1B957D00332B63 /* JSCanvasRenderingContext2DCustom.cpp */,
BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */,
929264760B61FC7200B41D34 /* JSDocumentCustom.cpp */,
......@@ -11444,6 +11483,12 @@
BC6D44ED0C07F2ED0072D2C9 /* JSHTMLEmbedElement.h in Headers */,
BCE0139B0C0BEF180043860A /* JSStyleSheet.h in Headers */,
BC3C39B70C0D3D8D005F4D7A /* JSMediaList.h in Headers */,
BC46C1FB0C0DDC8F0020CFC3 /* JSCSSCharsetRule.h in Headers */,
BC46C1FD0C0DDC8F0020CFC3 /* JSCSSFontFaceRule.h in Headers */,
BC46C1FF0C0DDC8F0020CFC3 /* JSCSSImportRule.h in Headers */,
BC46C2010C0DDC8F0020CFC3 /* JSCSSMediaRule.h in Headers */,
BC46C2030C0DDC8F0020CFC3 /* JSCSSPageRule.h in Headers */,
BC46C2070C0DDCA10020CFC3 /* JSCSSStyleRule.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -12847,6 +12892,13 @@
BCE0139A0C0BEF180043860A /* JSStyleSheet.cpp in Sources */,
BC98A27D0C0C9950004BEBF7 /* JSStyleSheetCustom.cpp in Sources */,
BC3C39B60C0D3D8D005F4D7A /* JSMediaList.cpp in Sources */,
BC46C1EE0C0DDBDF0020CFC3 /* JSCSSRuleCustom.cpp in Sources */,
BC46C1FA0C0DDC8F0020CFC3 /* JSCSSCharsetRule.cpp in Sources */,
BC46C1FC0C0DDC8F0020CFC3 /* JSCSSFontFaceRule.cpp in Sources */,
BC46C1FE0C0DDC8F0020CFC3 /* JSCSSImportRule.cpp in Sources */,
BC46C2000C0DDC8F0020CFC3 /* JSCSSMediaRule.cpp in Sources */,
BC46C2020C0DDC8F0020CFC3 /* JSCSSPageRule.cpp in Sources */,
BC46C2060C0DDCA10020CFC3 /* JSCSSStyleRule.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "JSCSSRule.h"
#include "CSSCharsetRule.h"
#include "CSSFontFaceRule.h"
#include "CSSImportRule.h"
#include "CSSMediaRule.h"
#include "CSSPageRule.h"
#include "CSSRule.h"
#include "CSSStyleRule.h"
#include "JSCSSCharsetRule.h"
#include "JSCSSFontFaceRule.h"
#include "JSCSSImportRule.h"
#include "JSCSSMediaRule.h"
#include "JSCSSPageRule.h"
#include "JSCSSStyleRule.h"
#include "kjs_binding.h"
namespace WebCore {
KJS::JSValue* toJS(KJS::ExecState* exec, CSSRule* rule)
{
if (!rule)
return KJS::jsNull();
KJS::ScriptInterpreter* interp = static_cast<KJS::ScriptInterpreter*>(exec->dynamicInterpreter());
KJS::DOMObject* ret = interp->getDOMObject(rule);
if (ret)
return ret;
switch (rule->type()) {
case CSSRule::STYLE_RULE:
ret = new JSCSSStyleRule(exec, static_cast<CSSStyleRule*>(rule));
break;
case CSSRule::MEDIA_RULE:
ret = new JSCSSMediaRule(exec, static_cast<CSSMediaRule*>(rule));
break;
case CSSRule::FONT_FACE_RULE:
ret = new JSCSSFontFaceRule(exec, static_cast<CSSFontFaceRule*>(rule));
break;
case CSSRule::PAGE_RULE:
ret = new JSCSSPageRule(exec, static_cast<CSSPageRule*>(rule));
break;
case CSSRule::IMPORT_RULE:
ret = new JSCSSImportRule(exec, static_cast<CSSImportRule*>(rule));
break;
case CSSRule::CHARSET_RULE:
ret = new JSCSSCharsetRule(exec, static_cast<CSSCharsetRule*>(rule));
break;
default:
ret = new JSCSSRule(exec, rule);
break;
}
interp->putDOMObject(rule, ret);
return ret;
}
} // namespace WebCore
......@@ -25,14 +25,8 @@
#include "config.h"
#include "kjs_css.h"
#include "CSSCharsetRule.h"
#include "CSSFontFaceRule.h"
#include "CSSImportRule.h"
#include "CSSMediaRule.h"
#include "CSSPageRule.h"
#include "CSSRule.h"
#include "CSSRuleList.h"
#include "CSSStyleRule.h"
#include "CSSValueList.h"
#include "Document.h"
#include "HTMLNames.h"
......@@ -42,9 +36,7 @@
#include "JSCSSRuleList.h"
#include "JSCSSStyleDeclaration.h"
#include "JSCSSValueList.h"
#include "JSMediaList.h"
#include "JSStyleSheet.h"
#include "MediaList.h"
#include "StyleSheetList.h"
#include "kjs_dom.h"
......@@ -257,228 +249,6 @@ JSValue* DOMCSSStyleSheetPrototypeFunction::callAsFunction(ExecState* exec, JSOb
// -------------------------------------------------------------------------
KJS_IMPLEMENT_PROTOTYPE_FUNCTION(DOMCSSRuleFunc) // Not a prototype, but doesn't matter
DOMCSSRule::DOMCSSRule(ExecState* exec, CSSRule* r)
: m_impl(r)
{
}
DOMCSSRule::~DOMCSSRule()
{
ScriptInterpreter::forgetDOMObject(m_impl.get());
}
const ClassInfo DOMCSSRule::info = { "CSSRule", 0, &DOMCSSRuleTable, 0 };
const ClassInfo DOMCSSRule::style_info = { "CSSStyleRule", &DOMCSSRule::info, &DOMCSSStyleRuleTable, 0 };
const ClassInfo DOMCSSRule::media_info = { "CSSMediaRule", &DOMCSSRule::info, &DOMCSSMediaRuleTable, 0 };
const ClassInfo DOMCSSRule::fontface_info = { "CSSFontFaceRule", &DOMCSSRule::info, &DOMCSSFontFaceRuleTable, 0 };
const ClassInfo DOMCSSRule::page_info = { "CSSPageRule", &DOMCSSRule::info, &DOMCSSPageRuleTable, 0 };
const ClassInfo DOMCSSRule::import_info = { "CSSImportRule", &DOMCSSRule::info, &DOMCSSImportRuleTable, 0 };
const ClassInfo DOMCSSRule::charset_info = { "CSSCharsetRule", &DOMCSSRule::info, &DOMCSSCharsetRuleTable, 0 };
const ClassInfo* DOMCSSRule::classInfo() const
{
CSSRule& cssRule = *m_impl;
switch (cssRule.type()) {
case CSSRule::STYLE_RULE:
return &style_info;
case CSSRule::MEDIA_RULE:
return &media_info;
case CSSRule::FONT_FACE_RULE:
return &fontface_info;
case CSSRule::PAGE_RULE:
return &page_info;
case CSSRule::IMPORT_RULE:
return &import_info;
case CSSRule::CHARSET_RULE:
return &charset_info;
case CSSRule::UNKNOWN_RULE:
default:
return &info;
}
}
/*
@begin DOMCSSRuleTable 4
type DOMCSSRule::Type DontDelete|ReadOnly
cssText DOMCSSRule::CssText DontDelete|ReadOnly
parentStyleSheet DOMCSSRule::ParentStyleSheet DontDelete|ReadOnly
parentRule DOMCSSRule::ParentRule DontDelete|ReadOnly
@end
@begin DOMCSSStyleRuleTable 2
selectorText DOMCSSRule::Style_SelectorText DontDelete
style DOMCSSRule::Style_Style DontDelete|ReadOnly
@end
@begin DOMCSSMediaRuleTable 4
media DOMCSSRule::Media_Media DontDelete|ReadOnly
cssRules DOMCSSRule::Media_CssRules DontDelete|ReadOnly
insertRule DOMCSSRule::Media_InsertRule DontDelete|Function 2
deleteRule DOMCSSRule::Media_DeleteRule DontDelete|Function 1
@end
@begin DOMCSSFontFaceRuleTable 1
style DOMCSSRule::FontFace_Style DontDelete|ReadOnly
@end
@begin DOMCSSPageRuleTable 2
selectorText DOMCSSRule::Page_SelectorText DontDelete
style DOMCSSRule::Page_Style DontDelete|ReadOnly
@end
@begin DOMCSSImportRuleTable 3
href DOMCSSRule::Import_Href DontDelete|ReadOnly
media DOMCSSRule::Import_Media DontDelete|ReadOnly
styleSheet DOMCSSRule::Import_StyleSheet DontDelete|ReadOnly
@end
@begin DOMCSSCharsetRuleTable 1
encoding DOMCSSRule::Charset_Encoding DontDelete
@end
*/
bool DOMCSSRule::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
// first try the properties specific to this rule type
const HashTable* table = DOMCSSRule::classInfo()->propHashTable;
if (table) {
const HashEntry* entry = Lookup::findEntry(table, propertyName);
if (entry) {
// FIXME: for now we single out the media rule functions.
// This is a temporary hack since we should try to generate
// them. See http://bugs.webkit.org/show_bug.cgi?id=11898
if (entry->attr & Function)
return getStaticPropertySlot<DOMCSSRuleFunc, DOMCSSRule, DOMObject>(exec, &DOMCSSMediaRuleTable, this, propertyName, slot);
slot.setStaticEntry(this, entry, staticValueGetter<DOMCSSRule>);
return true;
}
}
// now the stuff that applies to all rules
return getStaticPropertySlot<DOMCSSRuleFunc, DOMCSSRule, DOMObject>(exec, &DOMCSSRuleTable, this, propertyName, slot);
}
JSValue* DOMCSSRule::getValueProperty(ExecState* exec, int token) const
{
CSSRule &cssRule = *m_impl;
switch (token) {
case Type:
return jsNumber(cssRule.type());
case CssText:
return jsStringOrNull(cssRule.cssText());
case ParentStyleSheet:
return toJS(exec,cssRule.parentStyleSheet());
case ParentRule:
return toJS(exec,cssRule.parentRule());
// for STYLE_RULE:
case Style_SelectorText:
return jsStringOrNull(static_cast<CSSStyleRule*>(m_impl.get())->selectorText());
case Style_Style:
return toJS(exec, static_cast<CSSStyleRule*>(m_impl.get())->style());
// for MEDIA_RULE:
case Media_Media:
return toJS(exec, static_cast<CSSMediaRule*>(m_impl.get())->media());
case Media_CssRules:
return toJS(exec, static_cast<CSSMediaRule*>(m_impl.get())->cssRules());
// for FONT_FACE_RULE:
case FontFace_Style:
return toJS(exec, static_cast<CSSFontFaceRule*>(m_impl.get())->style());
// for PAGE_RULE:
case Page_SelectorText:
return jsStringOrNull(static_cast<CSSPageRule*>(m_impl.get())->selectorText());
case Page_Style:
return toJS(exec, static_cast<CSSPageRule*>(m_impl.get())->style());
// for IMPORT_RULE:
case Import_Href:
return jsStringOrNull(static_cast<CSSImportRule*>(m_impl.get())->href());
case Import_Media:
return toJS(exec, static_cast<CSSImportRule*>(m_impl.get())->media());
case Import_StyleSheet:
return toJS(exec, static_cast<CSSImportRule*>(m_impl.get())->styleSheet());
// for CHARSET_RULE:
case Charset_Encoding:
return jsStringOrNull(static_cast<CSSCharsetRule*>(m_impl.get())->encoding());
default:
ASSERT(0);
}
return jsUndefined();
}
void DOMCSSRule::put(ExecState* exec, const Identifier &propertyName, JSValue* value, int attr)
{
const HashTable* table = DOMCSSRule::classInfo()->propHashTable; // get the right hashtable
if (table) {
const HashEntry* entry = Lookup::findEntry(table, propertyName);
if (entry) {
if (entry->attr & Function) {
// function: put as override property
JSObject::put(exec, propertyName, value, attr);
return;
} else if ((entry->attr & ReadOnly) == 0) {
// let lookupPut print the warning if not
putValueProperty(exec, entry->value, value, attr);
return;
}
}
}
lookupPut<DOMCSSRule, DOMObject>(exec, propertyName, value, attr, &DOMCSSRuleTable, this);
}
void DOMCSSRule::putValueProperty(ExecState* exec, int token, JSValue* value, int)
{
switch (token) {
// for STYLE_RULE:
case Style_SelectorText:
static_cast<CSSStyleRule*>(m_impl.get())->setSelectorText(valueToStringWithNullCheck(exec, value));
return;
// for PAGE_RULE:
case Page_SelectorText:
static_cast<CSSPageRule*>(m_impl.get())->setSelectorText(valueToStringWithNullCheck(exec, value));
return;
// for CHARSET_RULE:
case Charset_Encoding:
static_cast<CSSCharsetRule*>(m_impl.get())->setEncoding(valueToStringWithNullCheck(exec, value));
return;
}
}
JSValue* DOMCSSRuleFunc::callAsFunction(ExecState* exec, JSObject* thisObj, const List &args)
{
if (!thisObj->inherits(&KJS::DOMCSSRule::info))
return throwError(exec, TypeError);
CSSRule& cssRule = *static_cast<DOMCSSRule*>(thisObj)->impl();
if (cssRule.type() == CSSRule::MEDIA_RULE) {
CSSMediaRule& rule = static_cast<CSSMediaRule&>(cssRule);
switch (id) {
case DOMCSSRule::Media_InsertRule: {
ExceptionCode ec = 0;
JSValue* result = jsNumber(rule.insertRule(args[0]->toString(exec), args[1]->toInt32(exec), ec));
setDOMException(exec, ec);
return result;
}
case DOMCSSRule::Media_DeleteRule: {
ExceptionCode ec = 0;
rule.deleteRule(args[0]->toInt32(exec), ec);
setDOMException(exec, ec);
}
}
}
return jsUndefined();
}
JSValue* toJS(ExecState* exec, CSSRule *r)
{
return cacheDOMObject<CSSRule, JSCSSRule>(exec, r);
}
// -------------------------------------------------------------------------
const ClassInfo DOMCSSValue::info = { "CSSValue", 0, &DOMCSSValueTable, 0 };