Commit a6188e22 authored by weinig's avatar weinig

LayoutTests:

        Reviewed by Darin.

        Update test for http://bugs.webkit.org/show_bug.cgi?id=14053
        Autogenerate JS binding for Rect

        * fast/dom/Window/window-properties-expected.txt:

WebCore:

        Reviewed by Darin.

        Patch for http://bugs.webkit.org/show_bug.cgi?id=14053
        Autogenerate JS binding for Rect

        - Renames RectImpl to Rect, DOMStyleSheetList to JSStyleSheetList 
          and DOMRGBColor to JSRGBColor
        - Moves JSStyleSheetList and JSRGBColor into the WebCore namespace.

        * DerivedSources.make:
        * WebCore.pro:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/kjs_css.cpp:
        (WebCore::):
        (WebCore::JSStyleSheetList::JSStyleSheetList):
        (WebCore::JSStyleSheetList::~JSStyleSheetList):
        (WebCore::JSStyleSheetList::getValueProperty):
        (WebCore::JSStyleSheetList::indexGetter):
        (WebCore::JSStyleSheetList::nameGetter):
        (WebCore::JSStyleSheetList::getOwnPropertySlot):
        (WebCore::toJS):
        (WebCore::JSStyleSheetListFunc::callAsFunction):
        (WebCore::JSRGBColor::JSRGBColor):
        (WebCore::JSRGBColor::~JSRGBColor):
        (WebCore::JSRGBColor::getOwnPropertySlot):
        (WebCore::JSRGBColor::getValueProperty):
        (WebCore::getJSRGBColor):
        * bindings/js/kjs_css.h:
        (WebCore::JSStyleSheetList::classInfo):
        (WebCore::JSStyleSheetList::):
        (WebCore::JSStyleSheetList::impl):
        (WebCore::JSRGBColor::classInfo):
        (WebCore::JSRGBColor::):
        (WebCore::JSRGBColor::impl):
        * bindings/objc/DOMUtility.mm:
        (KJS::createDOMWrapper):
        * bindings/scripts/CodeGeneratorJS.pm:
        * bindings/scripts/CodeGeneratorObjC.pm:
        * css/CSSBorderImageValue.cpp:
        (WebCore::CSSBorderImageValue::CSSBorderImageValue):
        * css/CSSBorderImageValue.h:
        * css/CSSPrimitiveValue.cpp:
        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
        (WebCore::CSSPrimitiveValue::cssText):
        * css/CSSPrimitiveValue.h:
        (WebCore::CSSPrimitiveValue::getRectValue):
        (WebCore::CSSPrimitiveValue::):
        * css/DashboardRegion.h:
        * css/Rect.h: Copied from css/RectImpl.h.
        (WebCore::Rect::~Rect):
        (WebCore::Rect::top):
        (WebCore::Rect::right):
        (WebCore::Rect::bottom):
        (WebCore::Rect::left):
        (WebCore::Rect::setTop):
        (WebCore::Rect::setRight):
        (WebCore::Rect::setBottom):
        (WebCore::Rect::setLeft):
        * css/Rect.idl:
        * css/RectImpl.h: Removed.
        * css/cssparser.cpp:
        (WebCore::CSSParser::parseShape):
        (WebCore::BorderImageParseContext::commitBorderImage):
        * css/cssstyleselector.cpp:
        (WebCore::CSSStyleSelector::applyProperty):
        * page/DOMWindow.idl:

WebKit:

        Reviewed by Darin.

        Patch for http://bugs.webkit.org/show_bug.cgi?id=14053
        Autogenerate JS binding for Rect

        - Fix conflicts by using ::Rect instead of Rect.

        * Plugins/WebBaseNetscapePluginView.mm:
        (-[WebBaseNetscapePluginView saveAndSetNewPortStateForUpdate:]):
        (-[WebBaseNetscapePluginView sendEvent:]):
        (-[WebBaseNetscapePluginView tellQuickTimeToChill]):
        (-[WebBaseNetscapePluginView invalidateRegion:]):
        (-[WebBaseNetscapePluginView _printedPluginBitmap]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@23557 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2e0bc343
2007-06-15 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
Update test for http://bugs.webkit.org/show_bug.cgi?id=14053
Autogenerate JS binding for Rect
* fast/dom/Window/window-properties-expected.txt:
2007-06-14 Anders Carlsson <andersca@apple.com>
Reviewed by Darin.
......@@ -818,6 +818,8 @@ window.RangeException.INVALID_NODE_TYPE_ERR [number]
window.RangeException.prototype [object RangeExceptionPrototype]
window.RangeException.prototype.BAD_BOUNDARYPOINTS_ERR [number]
window.RangeException.prototype.INVALID_NODE_TYPE_ERR [number]
window.Rect [object RectConstructor]
window.Rect.prototype [object RectPrototype]
window.ReferenceError [function]
window.StyleSheet [printed above as window.CSSStyleSheet]
window.SyntaxError [function]
......
2007-06-15 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
Patch for http://bugs.webkit.org/show_bug.cgi?id=14053
Autogenerate JS binding for Rect
- Renames RectImpl to Rect, DOMStyleSheetList to JSStyleSheetList
and DOMRGBColor to JSRGBColor
- Moves JSStyleSheetList and JSRGBColor into the WebCore namespace.
* DerivedSources.make:
* WebCore.pro:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/kjs_css.cpp:
(WebCore::):
(WebCore::JSStyleSheetList::JSStyleSheetList):
(WebCore::JSStyleSheetList::~JSStyleSheetList):
(WebCore::JSStyleSheetList::getValueProperty):
(WebCore::JSStyleSheetList::indexGetter):
(WebCore::JSStyleSheetList::nameGetter):
(WebCore::JSStyleSheetList::getOwnPropertySlot):
(WebCore::toJS):
(WebCore::JSStyleSheetListFunc::callAsFunction):
(WebCore::JSRGBColor::JSRGBColor):
(WebCore::JSRGBColor::~JSRGBColor):
(WebCore::JSRGBColor::getOwnPropertySlot):
(WebCore::JSRGBColor::getValueProperty):
(WebCore::getJSRGBColor):
* bindings/js/kjs_css.h:
(WebCore::JSStyleSheetList::classInfo):
(WebCore::JSStyleSheetList::):
(WebCore::JSStyleSheetList::impl):
(WebCore::JSRGBColor::classInfo):
(WebCore::JSRGBColor::):
(WebCore::JSRGBColor::impl):
* bindings/objc/DOMUtility.mm:
(KJS::createDOMWrapper):
* bindings/scripts/CodeGeneratorJS.pm:
* bindings/scripts/CodeGeneratorObjC.pm:
* css/CSSBorderImageValue.cpp:
(WebCore::CSSBorderImageValue::CSSBorderImageValue):
* css/CSSBorderImageValue.h:
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::cssText):
* css/CSSPrimitiveValue.h:
(WebCore::CSSPrimitiveValue::getRectValue):
(WebCore::CSSPrimitiveValue::):
* css/DashboardRegion.h:
* css/Rect.h: Copied from css/RectImpl.h.
(WebCore::Rect::~Rect):
(WebCore::Rect::top):
(WebCore::Rect::right):
(WebCore::Rect::bottom):
(WebCore::Rect::left):
(WebCore::Rect::setTop):
(WebCore::Rect::setRight):
(WebCore::Rect::setBottom):
(WebCore::Rect::setLeft):
* css/Rect.idl:
* css/RectImpl.h: Removed.
* css/cssparser.cpp:
(WebCore::CSSParser::parseShape):
(WebCore::BorderImageParseContext::commitBorderImage):
* css/cssstyleselector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
* page/DOMWindow.idl:
2007-06-14 George Staikos <staikos@kde.org>
Reviewed by Lars.
......@@ -406,6 +406,7 @@ all : \
JSProcessingInstruction.h \
JSRange.h \
JSRangeException.h \
JSRect.h \
JSSVGZoomEvent.h \
JSSVGAElement.h \
JSSVGAngle.h \
......
......@@ -159,6 +159,7 @@ IDL_BINDINGS += \
css/CSSValue.idl \
css/CSSValueList.idl \
css/MediaList.idl \
css/Rect.idl \
css/StyleSheet.idl \
dom/Attr.idl \
dom/CharacterData.idl \
......
......@@ -1720,7 +1720,6 @@
A80E6D070A1989CA007FB8C5 /* CSSBorderImageValue.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CDD0A1989CA007FB8C5 /* CSSBorderImageValue.h */; };
A80E6D080A1989CA007FB8C5 /* CSSInitialValue.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CDE0A1989CA007FB8C5 /* CSSInitialValue.h */; };
A80E6D090A1989CA007FB8C5 /* CSSRuleList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80E6CDF0A1989CA007FB8C5 /* CSSRuleList.cpp */; };
A80E6D0A0A1989CA007FB8C5 /* RectImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CE00A1989CA007FB8C5 /* RectImpl.h */; };
A80E6D0B0A1989CA007FB8C5 /* DashboardRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CE10A1989CA007FB8C5 /* DashboardRegion.h */; };
A80E6D0C0A1989CA007FB8C5 /* CSSStyleRule.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CE20A1989CA007FB8C5 /* CSSStyleRule.h */; };
A80E6D0D0A1989CA007FB8C5 /* CSSRule.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CE30A1989CA007FB8C5 /* CSSRule.h */; };
......@@ -2762,6 +2761,7 @@
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 = (); }; };
BC4368E80C226E32005EFB5F /* Rect.h in Headers */ = {isa = PBXBuildFile; fileRef = BC4368E70C226E32005EFB5F /* Rect.h */; };
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 */; };
......@@ -2946,6 +2946,8 @@
BCFB2F42097A24B500BA703D /* SegmentedString.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFB2F40097A24B500BA703D /* SegmentedString.h */; };
BCFB2F76097A2E1A00BA703D /* Arena.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCFB2F74097A2E1A00BA703D /* Arena.cpp */; };
BCFB2F77097A2E1A00BA703D /* Arena.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFB2F75097A2E1A00BA703D /* Arena.h */; };
BCFE2F110C1B58370020235F /* JSRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCFE2F0F0C1B58370020235F /* JSRect.cpp */; };
BCFE2F120C1B58380020235F /* JSRect.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFE2F100C1B58370020235F /* JSRect.h */; };
BCFE8E320A02A1D30009E61D /* WebCoreTextRenderer.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCFE8E310A02A1D30009E61D /* WebCoreTextRenderer.mm */; };
C6D74AD509AA282E000B0A52 /* ModifySelectionListLevel.h in Headers */ = {isa = PBXBuildFile; fileRef = C6D74AD309AA282E000B0A52 /* ModifySelectionListLevel.h */; };
C6D74AE409AA290A000B0A52 /* ModifySelectionListLevel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6D74AE309AA290A000B0A52 /* ModifySelectionListLevel.cpp */; };
......@@ -4859,7 +4861,6 @@
A80E6CDD0A1989CA007FB8C5 /* CSSBorderImageValue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSBorderImageValue.h; sourceTree = "<group>"; };
A80E6CDE0A1989CA007FB8C5 /* CSSInitialValue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSInitialValue.h; sourceTree = "<group>"; };
A80E6CDF0A1989CA007FB8C5 /* CSSRuleList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSRuleList.cpp; sourceTree = "<group>"; };
A80E6CE00A1989CA007FB8C5 /* RectImpl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RectImpl.h; sourceTree = "<group>"; };
A80E6CE10A1989CA007FB8C5 /* DashboardRegion.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DashboardRegion.h; sourceTree = "<group>"; };
A80E6CE20A1989CA007FB8C5 /* CSSStyleRule.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSStyleRule.h; sourceTree = "<group>"; };
A80E6CE30A1989CA007FB8C5 /* CSSRule.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSRule.h; sourceTree = "<group>"; };
......@@ -6054,6 +6055,7 @@
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>"; };
BC4368E70C226E32005EFB5F /* Rect.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Rect.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>"; };
......@@ -6243,6 +6245,8 @@
BCFB2F40097A24B500BA703D /* SegmentedString.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SegmentedString.h; sourceTree = "<group>"; };
BCFB2F74097A2E1A00BA703D /* Arena.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Arena.cpp; sourceTree = "<group>"; };
BCFB2F75097A2E1A00BA703D /* Arena.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Arena.h; sourceTree = "<group>"; };
BCFE2F0F0C1B58370020235F /* JSRect.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSRect.cpp; sourceTree = "<group>"; };
BCFE2F100C1B58370020235F /* JSRect.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSRect.h; sourceTree = "<group>"; };
BCFE8E310A02A1D30009E61D /* WebCoreTextRenderer.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreTextRenderer.mm; sourceTree = "<group>"; };
BE855F7F0701E83500239769 /* WebCoreView.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
BE8560510701F91100239769 /* WebCoreView.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebCoreView.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
......@@ -6466,8 +6470,6 @@
14DFB33F0A7DF7630018F769 /* Derived Sources */ = {
isa = PBXGroup;
children = (
BCCBAD3E0C18C14200CE890F /* JSHTMLCollection.cpp */,
BCCBAD3F0C18C14200CE890F /* JSHTMLCollection.h */,
65DF31D809D1C122000BE325 /* JSAttr.cpp */,
65DF31D909D1C123000BE325 /* JSAttr.h */,
65DF323309D1DE65000BE325 /* JSCanvasGradient.cpp */,
......@@ -6550,6 +6552,8 @@
A80E7E950A1A83E3007FB8C5 /* JSHTMLButtonElement.h */,
938E665F09F09B81008A48EC /* JSHTMLCanvasElement.cpp */,
938E666109F09B87008A48EC /* JSHTMLCanvasElement.h */,
BCCBAD3E0C18C14200CE890F /* JSHTMLCollection.cpp */,
BCCBAD3F0C18C14200CE890F /* JSHTMLCollection.h */,
1A85B1E00A1B240500D8C87C /* JSHTMLDirectoryElement.cpp */,
1A85B1E10A1B240500D8C87C /* JSHTMLDirectoryElement.h */,
1A85B2B40A1B2AC700D8C87C /* JSHTMLDivElement.cpp */,
......@@ -6676,6 +6680,8 @@
65DF31EE09D1CC60000BE325 /* JSRange.h */,
D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */,
D23CA55C0AB0EAAE005108A5 /* JSRangeException.h */,
BCFE2F0F0C1B58370020235F /* JSRect.cpp */,
BCFE2F100C1B58370020235F /* JSRect.h */,
BCE013980C0BEF180043860A /* JSStyleSheet.cpp */,
BCE013990C0BEF180043860A /* JSStyleSheet.h */,
B20111050AB7740500DB0E68 /* JSSVGAElement.cpp */,
......@@ -9691,7 +9697,7 @@
93CA4C9F09DF93FA00DF8677 /* quirks.css */,
858C38EF0AA8FDD100B187A4 /* RGBColor.idl */,
A80E79960A19BD21007FB8C5 /* Rect.idl */,
A80E6CE00A1989CA007FB8C5 /* RectImpl.h */,
BC4368E70C226E32005EFB5F /* Rect.h */,
A80E6CCA0A1989CA007FB8C5 /* ShadowValue.cpp */,
A80E6CBE0A1989CA007FB8C5 /* ShadowValue.h */,
A80E734C0A199C77007FB8C5 /* StyleBase.cpp */,
......@@ -10572,7 +10578,6 @@
A80E6D040A1989CA007FB8C5 /* Counter.h in Headers */,
A80E6D070A1989CA007FB8C5 /* CSSBorderImageValue.h in Headers */,
A80E6D080A1989CA007FB8C5 /* CSSInitialValue.h in Headers */,
A80E6D0A0A1989CA007FB8C5 /* RectImpl.h in Headers */,
A80E6D0B0A1989CA007FB8C5 /* DashboardRegion.h in Headers */,
A80E6D0C0A1989CA007FB8C5 /* CSSStyleRule.h in Headers */,
A80E6D0D0A1989CA007FB8C5 /* CSSRule.h in Headers */,
......@@ -11552,6 +11557,8 @@
BCD9C2C70C17B6EC005C90A2 /* JSEventTargetNode.lut.h in Headers */,
BCCBAD410C18C14200CE890F /* JSHTMLCollection.h in Headers */,
BC6DC7A10C1A4BFA004E2017 /* JSHTMLAllCollection.h in Headers */,
BCFE2F120C1B58380020235F /* JSRect.h in Headers */,
BC4368E80C226E32005EFB5F /* Rect.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -11589,7 +11596,6 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
knownRegions = (
English,
......@@ -12976,6 +12982,7 @@
BCD9C2C20C17B69E005C90A2 /* JSNodeList.cpp in Sources */,
BCCBAD3B0C18BFF800CE890F /* JSHTMLCollectionCustom.cpp in Sources */,
BCCBAD400C18C14200CE890F /* JSHTMLCollection.cpp in Sources */,
BCFE2F110C1B58370020235F /* JSRect.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -39,219 +39,172 @@
#include "kjs_css.lut.h"
using namespace WebCore;
using namespace HTMLNames;
namespace WebCore {
namespace KJS {
using namespace KJS;
using namespace HTMLNames;
const ClassInfo DOMStyleSheetList::info = { "StyleSheetList", 0, &DOMStyleSheetListTable, 0 };
const ClassInfo JSStyleSheetList::info = { "StyleSheetList", 0, &JSStyleSheetListTable, 0 };
/*
@begin DOMStyleSheetListTable 2
length DOMStyleSheetList::Length DontDelete|ReadOnly
item DOMStyleSheetList::Item DontDelete|Function 1
@begin JSStyleSheetListTable 2
length WebCore::JSStyleSheetList::Length DontDelete|ReadOnly
item WebCore::JSStyleSheetList::Item DontDelete|Function 1
@end
*/
KJS_IMPLEMENT_PROTOTYPE_FUNCTION(DOMStyleSheetListFunc) // not really a prototype, but doesn't matter
DOMStyleSheetList::DOMStyleSheetList(ExecState* exec, StyleSheetList* ssl, Document* doc)
: m_impl(ssl)
, m_doc(doc)
KJS_IMPLEMENT_PROTOTYPE_FUNCTION(JSStyleSheetListFunc) // not really a prototype, but doesn't matter
JSStyleSheetList::JSStyleSheetList(ExecState* exec, StyleSheetList* styleSheetList, Document* doc)
: m_impl(styleSheetList)
, m_doc(doc)
{
setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
}
DOMStyleSheetList::~DOMStyleSheetList()
JSStyleSheetList::~JSStyleSheetList()
{
ScriptInterpreter::forgetDOMObject(m_impl.get());
ScriptInterpreter::forgetDOMObject(m_impl.get());
}
JSValue* DOMStyleSheetList::getValueProperty(ExecState* exec, int token) const
JSValue* JSStyleSheetList::getValueProperty(ExecState* exec, int token) const
{
switch(token) {
case Length:
return jsNumber(m_impl->length());
default:
ASSERT(0);
return jsUndefined();
switch (token) {
case Length:
return jsNumber(m_impl->length());
default:
ASSERT_NOT_REACHED();
return jsUndefined();
}
}
JSValue* DOMStyleSheetList::indexGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
JSValue* JSStyleSheetList::indexGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
{
DOMStyleSheetList *thisObj = static_cast<DOMStyleSheetList*>(slot.slotBase());
return toJS(exec, thisObj->m_impl->item(slot.index()));
JSStyleSheetList* thisObj = static_cast<JSStyleSheetList*>(slot.slotBase());
return toJS(exec, thisObj->m_impl->item(slot.index()));
}
JSValue* DOMStyleSheetList::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
JSValue* JSStyleSheetList::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
{
DOMStyleSheetList *thisObj = static_cast<DOMStyleSheetList*>(slot.slotBase());
Element *element = thisObj->m_doc->getElementById(propertyName);
return toJS(exec, static_cast<HTMLStyleElement*>(element)->sheet());
JSStyleSheetList* thisObj = static_cast<JSStyleSheetList*>(slot.slotBase());
Element* element = thisObj->m_doc->getElementById(propertyName);
return toJS(exec, static_cast<HTMLStyleElement*>(element)->sheet());
}
bool DOMStyleSheetList::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
bool JSStyleSheetList::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
const HashEntry* entry = Lookup::findEntry(&DOMStyleSheetListTable, propertyName);
const HashEntry* entry = Lookup::findEntry(&JSStyleSheetListTable, propertyName);
if (entry) {
switch(entry->value) {
case Length:
slot.setStaticEntry(this, entry, staticValueGetter<DOMStyleSheetList>);
return true;
case Item:
slot.setStaticEntry(this, entry, staticFunctionGetter<DOMStyleSheetListFunc>);
return true;
if (entry) {
switch(entry->value) {
case Length:
slot.setStaticEntry(this, entry, staticValueGetter<JSStyleSheetList>);
return true;
case Item:
slot.setStaticEntry(this, entry, staticFunctionGetter<JSStyleSheetListFunc>);
return true;
}
}
}
StyleSheetList &styleSheetList = *m_impl;
// Retrieve stylesheet by index
bool ok;
unsigned u = propertyName.toUInt32(&ok);
if (ok && u < styleSheetList.length()) {
slot.setCustomIndex(this, u, indexGetter);
return true;
}
// IE also supports retrieving a stylesheet by name, using the name/id of the <style> tag
// (this is consistent with all the other collections)
// ### Bad implementation because returns a single element (are IDs always unique?)
// and doesn't look for name attribute (see implementation above).
// But unicity of stylesheet ids is good practice anyway ;)
Element *element = m_doc->getElementById(propertyName);
if (element && element->hasTagName(styleTag)) {
slot.setCustom(this, nameGetter);
return true;
}
return DOMObject::getOwnPropertySlot(exec, propertyName, slot);
}
JSValue* toJS(ExecState* exec, StyleSheetList *ssl, Document *doc)
{
// Can't use the cacheDOMObject macro because of the doc argument
DOMObject *ret;
if (!ssl)
return jsNull();
ScriptInterpreter* interp = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter());
if ((ret = interp->getDOMObject(ssl)))
return ret;
else {
ret = new DOMStyleSheetList(exec, ssl, doc);
interp->putDOMObject(ssl, ret);
return ret;
}
}
StyleSheetList* styleSheetList = m_impl.get();
JSValue* DOMStyleSheetListFunc::callAsFunction(ExecState* exec, JSObject* thisObj, const List &args)
{
if (!thisObj->inherits(&KJS::DOMStyleSheetList::info))
return throwError(exec, TypeError);
StyleSheetList &styleSheetList = *static_cast<DOMStyleSheetList*>(thisObj)->impl();
if (id == DOMStyleSheetList::Item)
return toJS(exec, styleSheetList.item(args[0]->toInt32(exec)));
return jsUndefined();
}
// -------------------------------------------------------------------------
// Retrieve stylesheet by index
bool ok;
unsigned u = propertyName.toUInt32(&ok);
if (ok && u < styleSheetList->length()) {
slot.setCustomIndex(this, u, indexGetter);
return true;
}
const ClassInfo DOMRGBColor::info = { "RGBColor", 0, &DOMRGBColorTable, 0 };
// IE also supports retrieving a stylesheet by name, using the name/id of the <style> tag
// (this is consistent with all the other collections)
// ### Bad implementation because returns a single element (are IDs always unique?)
// and doesn't look for name attribute (see implementation above).
// But unicity of stylesheet ids is good practice anyway ;)
Element* element = m_doc->getElementById(propertyName);
if (element && element->hasTagName(styleTag)) {
slot.setCustom(this, nameGetter);
return true;
}
/*
@begin DOMRGBColorTable 3
red DOMRGBColor::Red DontDelete|ReadOnly
green DOMRGBColor::Green DontDelete|ReadOnly
blue DOMRGBColor::Blue DontDelete|ReadOnly
@end
*/
DOMRGBColor::DOMRGBColor(ExecState* exec, unsigned color)
: m_color(color)
{
setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
return DOMObject::getOwnPropertySlot(exec, propertyName, slot);
}
DOMRGBColor::~DOMRGBColor()
JSValue* toJS(ExecState* exec, StyleSheetList* styleSheetList, Document* doc)
{
//rgbColors.remove(rgbColor.handle());
}
// Can't use the cacheDOMObject macro because of the doc argument
if (!styleSheetList)
return jsNull();
bool DOMRGBColor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticValueSlot<DOMRGBColor, DOMObject>(exec, &DOMRGBColorTable, this, propertyName, slot);
}
ScriptInterpreter* interp = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter());
DOMObject* ret = interp->getDOMObject(styleSheetList);
if (ret)
return ret;
JSValue* DOMRGBColor::getValueProperty(ExecState* exec, int token) const
{
int color = m_color;
switch (token) {
case Red:
color >>= 8;
// fall through
case Green:
color >>= 8;
// fall through
case Blue:
return toJS(exec, new CSSPrimitiveValue(color & 0xFF, CSSPrimitiveValue::CSS_NUMBER));
default:
return NULL;
}
ret = new JSStyleSheetList(exec, styleSheetList, doc);
interp->putDOMObject(styleSheetList, ret);
return ret;
}
JSValue* getDOMRGBColor(ExecState* exec, unsigned c)
JSValue* JSStyleSheetListFunc::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
{
// ### implement equals for RGBColor since they're not refcounted objects
return new DOMRGBColor(exec, c);
if (!thisObj->inherits(&JSStyleSheetList::info))
return throwError(exec, TypeError);
StyleSheetList* styleSheetList = static_cast<JSStyleSheetList*>(thisObj)->impl();
if (id == JSStyleSheetList::Item)
return toJS(exec, styleSheetList->item(args[0]->toInt32(exec)));
return jsUndefined();
}
// -------------------------------------------------------------------------
const ClassInfo DOMRect::info = { "Rect", 0, &DOMRectTable, 0 };
const ClassInfo JSRGBColor::info = { "RGBColor", 0, &JSRGBColorTable, 0 };
/*
@begin DOMRectTable 4
top DOMRect::Top DontDelete|ReadOnly
right DOMRect::Right DontDelete|ReadOnly
bottom DOMRect::Bottom DontDelete|ReadOnly
left DOMRect::Left DontDelete|ReadOnly
@begin JSRGBColorTable 3
red WebCore::JSRGBColor::Red DontDelete|ReadOnly
green WebCore::JSRGBColor::Green DontDelete|ReadOnly
blue WebCore::JSRGBColor::Blue DontDelete|ReadOnly
@end
*/
DOMRect::DOMRect(ExecState* exec, RectImpl* r)
: m_rect(r)
JSRGBColor::JSRGBColor(ExecState* exec, unsigned color)
: m_color(color)
{
setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
}
DOMRect::~DOMRect()
JSRGBColor::~JSRGBColor()
{
ScriptInterpreter::forgetDOMObject(m_rect.get());
}
bool DOMRect::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
bool JSRGBColor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticValueSlot<DOMRect, DOMObject>(exec, &DOMRectTable, this, propertyName, slot);
return getStaticValueSlot<JSRGBColor, DOMObject>(exec, &JSRGBColorTable, this, propertyName, slot);
}
JSValue* DOMRect::getValueProperty(ExecState* exec, int token) const
JSValue* JSRGBColor::getValueProperty(ExecState* exec, int token) const
{
RectImpl &rect = *m_rect;
switch (token) {
case Top:
return toJS(exec, rect.top());
case Right:
return toJS(exec, rect.right());
case Bottom:
return toJS(exec, rect.bottom());
case Left:
return toJS(exec, rect.left());
default:
return NULL;
}
int color = m_color;
switch (token) {
case Red:
color >>= 8;
// fall through
case Green:
color >>= 8;
// fall through
case Blue:
return toJS(exec, new CSSPrimitiveValue(color & 0xFF, CSSPrimitiveValue::CSS_NUMBER));
default:
return 0;
}
}
JSValue* toJS(ExecState* exec, RectImpl *r)
JSValue* getJSRGBColor(ExecState* exec, unsigned color)
{
return cacheDOMObject<RectImpl, DOMRect>(exec, r);
// FIXME: implement equals for RGBColor since they're not refcounted objects
return new JSRGBColor(exec, color);
}
}
} // namespace WebCore
......@@ -24,76 +24,64 @@
#define kjs_css_h
#include "Color.h"
#include "RectImpl.h"
#include "JSStyleSheet.h"
#include "kjs_binding.h"
namespace WebCore {
class Counter;
class CSSStyleSheet;
class StyleSheet;
class StyleSheetList;
}
namespace KJS {
class DOMStyleSheetList : public DOMObject {
public:
DOMStyleSheetList(ExecState*, WebCore::StyleSheetList*, WebCore::Document*);
virtual ~DOMStyleSheetList();
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
JSValue* getValueProperty(ExecState*, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
virtual bool toBoolean(ExecState*) const { return true; }
static const ClassInfo info;
WebCore::StyleSheetList* impl() const { return m_impl.get(); }
enum { Item, Length };
private:
static JSValue* indexGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
static JSValue* nameGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
RefPtr<WebCore::StyleSheetList> m_impl;
RefPtr<WebCore::Document> m_doc;
};
// The document is only used for get-stylesheet-by-name (make optional if necessary)
JSValue* toJS(ExecState*, WebCore::StyleSheetList*, WebCore::Document*);
class DOMRGBColor : public DOMObject {
public:
DOMRGBColor(ExecState*, unsigned color);
~DOMRGBColor();
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
JSValue* getValueProperty(ExecState*, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { Red, Green, Blue };
unsigned impl() const { return m_color; }
private:
unsigned m_color;
};
JSValue* getDOMRGBColor(ExecState*, unsigned color);
class DOMRect : public DOMObject {
public:
DOMRect(ExecState*, WebCore::RectImpl* r);
~DOMRect();
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
JSValue* getValueProperty(ExecState*, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;