JavaScriptCore:
authorggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Apr 2006 21:24:42 +0000 (21:24 +0000)
committerggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Apr 2006 21:24:42 +0000 (21:24 +0000)
        Reviewed by Darin.

        * kjs/internal.cpp:
        (KJS::InterpreterImp::initGlobalObject): Add the built-in object
        prototype to the end of the global object's prototype chain instead of
        just blowing away its existing prototype. We need to do this because
        the window object has a meaningful prototype now.

LayoutTests:

        Layout test for document.defaultView

        * fast/dom/defaultView-expected.txt: Added.
        * fast/dom/defaultView.html: Added.
        * fast/events/event-view-toString-expected.txt: Updated to reflect new
        prototype chain for defaultView.

WebCore:

        Reviewed by Darin.

        - Fixed <rdar://problem/4478467> document.defaultView should return
        the window object

        Also made part of the window object autogenerated by IDL file.

        * DerivedSources.make: Added /page to IDL file search path, added
        JSDOMWindow.h, removed kjs_views.lut.h
        * WebCore.xcodeproj/project.pbxproj: Added missing files, removed
        obsolete files
        * bindings/js/kjs_dom.cpp:
        * bindings/js/kjs_events.cpp:
        * bindings/js/kjs_proxy.cpp:
        (WebCore::KJSProxy::initScriptIfNeeded):
        * bindings/js/kjs_views.cpp: Removed.
        * bindings/js/kjs_views.h: Removed.
        * bindings/js/kjs_window.cpp: Removed document property -- it now
        belongs to JSDOMWindow. Added toJS and toDOMWindow.
        (KJS::Window::Window):
        (KJS::Window::impl):
        (KJS::Window::getValueProperty):
        (KJS::Window::clear): Added call to setPrototype to ensure
        that the prototype gets cleared during navigation. (Previously
        this wasn't an issue because the window object had no real prototype.)
        (WebCore::toJS):
        (WebCore::toDOMWindow):
        * bindings/js/kjs_window.h:
        (KJS::Window::):
        * bindings/objc/DOMCSS.mm: Added NULL checks for the AbstractView
        (Presumably this is an issue after the window is closed.) Typedef-ed
        AbstractView as DOMWindow. I could have just replaced AbstractView
        with DOMWindow, but I think it's clearer to say, "There's this thing
        called the AbstractView, but really it's just the window."
        (-[DOMDocument getComputedStyle::]):
        (-[DOMDocument getMatchedCSSRules::]):
        * bindings/objc/DOMViews.mm:
        * bindings/objc/DOMViewsInternal.h:
        * bindings/scripts/CodeGeneratorJS.pm: Removed unused
        GetLegacyImplementationIncludes. Added support for DOMWindow and new
        "DoNotCache" attribute. Replaced C macros with text because (1) it
        makes the generated source easier to read and debug and (2) it made
        it much easier to implement the DoNotCache attribute.
        * bindings/scripts/IDLParser.pm: Return a hash reference instead of
        a hash, because otherwise an interface with more than one attribute
        returns too many arguments to be processed.
        * bridge/mac/FrameMac.mm:
        * dom/AbstractView.cpp: Removed.
        * dom/AbstractView.h: Removed.
        * dom/Document.cpp:
        (WebCore::Document::Document):
        (WebCore::Document::defaultView):
        * dom/Document.h:
        * dom/Document.idl:
        * dom/KeyboardEvent.idl:
        * dom/MouseEvent.idl:
        * dom/Position.cpp:
        * dom/UIEvent.idl:
        * dom/dom2_eventsimpl.h:
        * page/DOMWindow.cpp: Added.
        (WebCore::DOMWindow::DOMWindow):
        (WebCore::DOMWindow::frame):
        (WebCore::DOMWindow::disconnectFrame):
        (WebCore::DOMWindow::document):
        (WebCore::DOMWindow::getComputedStyle):
        (WebCore::DOMWindow::getMatchedCSSRules):
        * page/DOMWindow.h: Added.
        * page/DOMWindow.idl: Added.
        * page/Frame.cpp:
        (WebCore::Frame::~Frame): Disconnect the new DOMWindow object in
        addition to the Window object. Maybe we can unify this in the future.
        (WebCore::Frame::tree):
        (WebCore::Frame::domWindow):
        * page/Frame.h:
        * page/FramePrivate.h:

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

41 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/kjs/internal.cpp
LayoutTests/ChangeLog
LayoutTests/fast/dom/defaultView-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/defaultView.html [new file with mode: 0644]
LayoutTests/fast/loader/resources/window-clearing2.html [new file with mode: 0644]
LayoutTests/fast/loader/window-clearing-expected.txt [new file with mode: 0644]
LayoutTests/fast/loader/window-clearing.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/DerivedSources.make
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/kjs_dom.cpp
WebCore/bindings/js/kjs_events.cpp
WebCore/bindings/js/kjs_proxy.cpp
WebCore/bindings/js/kjs_views.cpp [deleted file]
WebCore/bindings/js/kjs_views.h [deleted file]
WebCore/bindings/js/kjs_window.cpp
WebCore/bindings/js/kjs_window.h
WebCore/bindings/objc/DOMCSS.mm
WebCore/bindings/objc/DOMViews.mm
WebCore/bindings/objc/DOMViewsInternal.h
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/bindings/scripts/IDLParser.pm
WebCore/bridge/mac/FrameMac.mm
WebCore/dom/AbstractView.cpp [deleted file]
WebCore/dom/AbstractView.h [deleted file]
WebCore/dom/Document.cpp
WebCore/dom/Document.h
WebCore/dom/Document.idl
WebCore/dom/KeyboardEvent.idl
WebCore/dom/MouseEvent.idl
WebCore/dom/Position.cpp
WebCore/dom/UIEvent.idl
WebCore/dom/dom2_eventsimpl.h
WebCore/page/DOMWindow.cpp [new file with mode: 0644]
WebCore/page/DOMWindow.h [new file with mode: 0644]
WebCore/page/DOMWindow.idl [new file with mode: 0644]
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/page/FramePrivate.h
WebCore/platform/mac/ClipboardMac.h

index be4d8574daf8aad972ac7402f96e81bd5a6dcdd5..5d4b894444278a1aa20a9c6eb36ba22f6d57aabf 100644 (file)
@@ -1,3 +1,13 @@
+2006-04-13  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Darin.
+
+        * kjs/internal.cpp:
+        (KJS::InterpreterImp::initGlobalObject): Add the built-in object
+        prototype to the end of the global object's prototype chain instead of
+        just blowing away its existing prototype. We need to do this because
+        the window object has a meaningful prototype now.
+
 2006-04-13  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Geoff.
index 6fd3234895a882b86d5df7d13b67fc5edbf6f250..1ed969043c59f76a3d4b17240777f7800f650bb9 100644 (file)
@@ -326,7 +326,10 @@ void InterpreterImp::initGlobalObject()
   ErrorPrototype *errorProto = new ErrorPrototype(&globExec, objProto, funcProto);
   b_ErrorPrototype = errorProto;
 
-  static_cast<JSObject*>(global)->setPrototype(b_ObjectPrototype);
+  JSObject* o = global;
+  while (o->prototype()->isObject())
+      o = static_cast<JSObject*>(o->prototype());
+  o->setPrototype(b_ObjectPrototype);
 
   // Constructors (Object, Array, etc.)
   b_Object = new ObjectObjectImp(&globExec, objProto, funcProto);
index 08e29bd6cf112dbef68f6d496ea39dcca430f604..aa875da5aab24c0bac65fdc416edf28aa8e00c8e 100644 (file)
@@ -1,3 +1,21 @@
+2006-04-12  Geoffrey Garen  <ggaren@apple.com>
+
+        Layout test for document.defaultView
+
+        * fast/dom/defaultView-expected.txt: Added.
+        * fast/dom/defaultView.html: Added.
+        * fast/events/event-view-toString-expected.txt: Updated to reflect new
+        prototype chain for defaultView.
+
+2006-04-12  Geoffrey Garen  <ggaren@apple.com>
+
+        Layout test to ensure that the window object gets cleared during a
+        navigation. I caused a regression in that area when working in window
+        object code.
+
+        * fast/loader/resources/window-clearing2.html: Added.
+        * fast/loader/window-clearing.html: Added.
+
 2006-04-13  Alexey Proskuryakov  <ap@nypop.com>
 
         Test created by Maciej.
diff --git a/LayoutTests/fast/dom/defaultView-expected.txt b/LayoutTests/fast/dom/defaultView-expected.txt
new file mode 100644 (file)
index 0000000..9f85a77
--- /dev/null
@@ -0,0 +1,11 @@
+This test checks that document.defaultView returns the window object, and that it implements all the methods and properties it should.
+
+If the test passes, you will see only PASS messages below.
+
+PASS: defaultView is the window object
+
+PASS: defaultView.document is the document object
+
+PASS: defaultView implements getComputedStyle
+
+PASS: defaultView implements getMatchedCSSRules
diff --git a/LayoutTests/fast/dom/defaultView.html b/LayoutTests/fast/dom/defaultView.html
new file mode 100644 (file)
index 0000000..a4c9779
--- /dev/null
@@ -0,0 +1,44 @@
+<html>
+<head>
+<script>
+function print(message) {
+    var paragraph = document.createElement("p");
+    paragraph.appendChild(document.createTextNode(message));
+    document.getElementById("console").appendChild(paragraph);
+}
+
+function test() {
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+    }
+    
+    if (window === document.defaultView)
+        print("PASS: defaultView is the window object");
+    else
+        print("FAIL: defaultView is not the window object");
+    
+    if (document.defaultView.document === document)
+        print("PASS: defaultView.document is the document object");
+    else
+        print("FAIL: defaultView.document is not the document object");
+    
+    if (document.defaultView.getComputedStyle)
+        print("PASS: defaultView implements getComputedStyle");
+    else
+        print("FAIL: defaultView does not implement getComputedStyle");
+    
+    if (document.defaultView.getMatchedCSSRules)
+        print("PASS: defaultView implements getMatchedCSSRules");
+    else
+        print("FAIL: defaultView does not implement getMatchedCSSRules");
+}
+</script>
+</head>
+<body onload="test();">
+<p>This test checks that document.defaultView returns the window object, and that it implements 
+all the methods and properties it should.</p>
+<p>If the test passes, you will see only PASS messages below.</p>
+<hr>
+<div id='console'/>
+</body>
+</html>
diff --git a/LayoutTests/fast/loader/resources/window-clearing2.html b/LayoutTests/fast/loader/resources/window-clearing2.html
new file mode 100644 (file)
index 0000000..c42918d
--- /dev/null
@@ -0,0 +1,34 @@
+<html>
+<head>
+<script>
+function print(message) {
+    var paragraph = document.createElement("p");
+    paragraph.appendChild(document.createTextNode(message));
+    document.getElementById("console").appendChild(paragraph);
+}
+
+function test() {
+    var count = 0;
+    var o = window;
+    do {
+        if (o.x)
+            print("FAIL: element " + count + " in the window's prototype chain was not cleared");
+        else
+            print("PASS: element " + count + " in the window's prototype chain was cleared");
+
+        ++count;
+        o = o.__proto__;
+    } while(o);
+    
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+</script>
+</head>
+<body onload="test();">
+<p>This test checks to ensure that the window object is cleared during a navigation.</p>
+<p>If the test passes, you will see only PASS messages below.</p>
+<hr>
+<div id='console'/>
+</body>
+</html>
diff --git a/LayoutTests/fast/loader/window-clearing-expected.txt b/LayoutTests/fast/loader/window-clearing-expected.txt
new file mode 100644 (file)
index 0000000..c76bb65
--- /dev/null
@@ -0,0 +1,9 @@
+This test checks to ensure that the window object is cleared during a navigation.
+
+If the test passes, you will see only PASS messages below.
+
+PASS: element 0 in the window's prototype chain was cleared
+
+PASS: element 1 in the window's prototype chain was cleared
+
+PASS: element 2 in the window's prototype chain was cleared
diff --git a/LayoutTests/fast/loader/window-clearing.html b/LayoutTests/fast/loader/window-clearing.html
new file mode 100644 (file)
index 0000000..fa95d74
--- /dev/null
@@ -0,0 +1,25 @@
+<html>
+<head>
+<script>
+function test() {
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.waitUntilDone();
+    }
+
+    // set up test variables -- they should be cleared
+    var o = window;
+    do {
+        o.x = 1;
+        o = o.__proto__;
+    } while(o);
+    
+    window.location.href="resources/window-clearing2.html";
+}
+</script>
+</head>
+<body onload="test();">
+<p>FAIL: Could not load resources/window-clearing2.html</p>
+<hr>
+</body>
+</html>
index 4df123395cd89f4c0485466662af9f984edcad7d..a6343b7f37eed23852fa15189385ca90193dad3f 100644 (file)
@@ -1,3 +1,81 @@
+2006-04-12  Geoffrey Garen  <ggaren@apple.com>
+
+        Reviewed by Darin.
+
+        - Fixed <rdar://problem/4478467> document.defaultView should return 
+        the window object
+        
+        Also made part of the window object autogenerated by IDL file.
+        
+        * DerivedSources.make: Added /page to IDL file search path, added
+        JSDOMWindow.h, removed kjs_views.lut.h
+        * WebCore.xcodeproj/project.pbxproj: Added missing files, removed
+        obsolete files
+        * bindings/js/kjs_dom.cpp:
+        * bindings/js/kjs_events.cpp:
+        * bindings/js/kjs_proxy.cpp:
+        (WebCore::KJSProxy::initScriptIfNeeded):
+        * bindings/js/kjs_views.cpp: Removed.
+        * bindings/js/kjs_views.h: Removed.
+        * bindings/js/kjs_window.cpp: Removed document property -- it now
+        belongs to JSDOMWindow. Added toJS and toDOMWindow.
+        (KJS::Window::Window):
+        (KJS::Window::impl):
+        (KJS::Window::getValueProperty):
+        (KJS::Window::clear): Added call to setPrototype to ensure
+        that the prototype gets cleared during navigation. (Previously
+        this wasn't an issue because the window object had no real prototype.)
+        (WebCore::toJS):
+        (WebCore::toDOMWindow):
+        * bindings/js/kjs_window.h:
+        (KJS::Window::):
+        * bindings/objc/DOMCSS.mm: Added NULL checks for the AbstractView
+        (Presumably this is an issue after the window is closed.) Typedef-ed
+        AbstractView as DOMWindow. I could have just replaced AbstractView
+        with DOMWindow, but I think it's clearer to say, "There's this thing
+        called the AbstractView, but really it's just the window."
+        (-[DOMDocument getComputedStyle::]):
+        (-[DOMDocument getMatchedCSSRules::]):
+        * bindings/objc/DOMViews.mm:
+        * bindings/objc/DOMViewsInternal.h:
+        * bindings/scripts/CodeGeneratorJS.pm: Removed unused
+        GetLegacyImplementationIncludes. Added support for DOMWindow and new
+        "DoNotCache" attribute. Replaced C macros with text because (1) it
+        makes the generated source easier to read and debug and (2) it made 
+        it much easier to implement the DoNotCache attribute.
+        * bindings/scripts/IDLParser.pm: Return a hash reference instead of
+        a hash, because otherwise an interface with more than one attribute
+        returns too many arguments to be processed.
+        * bridge/mac/FrameMac.mm:
+        * dom/AbstractView.cpp: Removed.
+        * dom/AbstractView.h: Removed.
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        (WebCore::Document::defaultView):
+        * dom/Document.h:
+        * dom/Document.idl:
+        * dom/KeyboardEvent.idl:
+        * dom/MouseEvent.idl:
+        * dom/Position.cpp:
+        * dom/UIEvent.idl:
+        * dom/dom2_eventsimpl.h:
+        * page/DOMWindow.cpp: Added.
+        (WebCore::DOMWindow::DOMWindow):
+        (WebCore::DOMWindow::frame):
+        (WebCore::DOMWindow::disconnectFrame):
+        (WebCore::DOMWindow::document):
+        (WebCore::DOMWindow::getComputedStyle):
+        (WebCore::DOMWindow::getMatchedCSSRules):
+        * page/DOMWindow.h: Added.
+        * page/DOMWindow.idl: Added.
+        * page/Frame.cpp:
+        (WebCore::Frame::~Frame): Disconnect the new DOMWindow object in
+        addition to the Window object. Maybe we can unify this in the future.
+        (WebCore::Frame::tree):
+        (WebCore::Frame::domWindow):
+        * page/Frame.h:
+        * page/FramePrivate.h:
+
 2006-04-13  Alexey Proskuryakov  <ap@nypop.com>
 
         Reviewed by Darin.
index c755f00083d50e92dabe1ec3030837d2bec699a8..8d22f9a3b8b9eda5c66c01a21c5379005962396e 100644 (file)
@@ -30,6 +30,7 @@ VPATH = \
     $(WebCore)/css \
     $(WebCore)/dom \
     $(WebCore)/html \
+    $(WebCore)/page \
 #
 
 .PHONY : all
@@ -53,6 +54,7 @@ all : \
     JSDOMParser.lut.h \
     JSDocument.h \
     JSDocumentType.h \
+    JSDOMWindow.h \
     JSElement.h \
     JSEntity.h \
     JSKeyboardEvent.h \
@@ -76,7 +78,6 @@ all : \
     kjs_html.lut.h \
     kjs_navigator.lut.h \
     kjs_traversal.lut.h \
-    kjs_views.lut.h \
     kjs_window.lut.h \
     ksvgcssproperties.h \
     ksvgcssvalues.h \
index e824ad4dacd4a420cda5b39acfbf815709ea21f6..7da6f4b9235ed456beaa346f538204f048e77c7b 100644 (file)
 /* End PBXAggregateTarget section */
 
 /* Begin PBXBuildFile section */
+               1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1403B99509EB13AF00797C7F /* DOMWindow.h */; };
+               1403B99809EB13AF00797C7F /* DOMWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1403B99609EB13AF00797C7F /* DOMWindow.cpp */; };
+               1403BA0C09EB18C700797C7F /* JSDOMWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1403BA0B09EB18C700797C7F /* JSDOMWindow.cpp */; };
+               1403BA0F09EB18F900797C7F /* JSDOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1403BA0E09EB18F800797C7F /* JSDOMWindow.h */; };
+               141B94E609EC4223000E9413 /* MouseEvent.idl in Resources */ = {isa = PBXBuildFile; fileRef = 141B94E509EC4223000E9413 /* MouseEvent.idl */; };
+               141B94EF09EC425A000E9413 /* UIEvent.idl in Resources */ = {isa = PBXBuildFile; fileRef = 141B94EE09EC425A000E9413 /* UIEvent.idl */; };
+               14813BF409EDF88E00F757E1 /* IDLParser.pm in Resources */ = {isa = PBXBuildFile; fileRef = 14813BF309EDF88E00F757E1 /* IDLParser.pm */; };
                14EC267F09CA07E000E1EEEC /* EventTargetNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 14EC267D09CA07E000E1EEEC /* EventTargetNode.h */; };
                14EC268009CA07E000E1EEEC /* EventTargetNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14EC267E09CA07E000E1EEEC /* EventTargetNode.cpp */; };
                550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; };
@@ -68,7 +75,6 @@
                656581F409D1508D000E61D7 /* kjs_html.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581DD09D1508D000E61D7 /* kjs_html.lut.h */; };
                656581F509D1508D000E61D7 /* kjs_navigator.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581DE09D1508D000E61D7 /* kjs_navigator.lut.h */; };
                656581F609D1508D000E61D7 /* kjs_traversal.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581DF09D1508D000E61D7 /* kjs_traversal.lut.h */; };
-               656581F709D1508D000E61D7 /* kjs_views.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581E009D1508D000E61D7 /* kjs_views.lut.h */; };
                656581F809D1508D000E61D7 /* kjs_window.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581E109D1508D000E61D7 /* kjs_window.lut.h */; };
                656581FB09D1508D000E61D7 /* ksvgcssproperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581E409D1508D000E61D7 /* ksvgcssproperties.h */; };
                656581FE09D1508D000E61D7 /* SVGElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581E709D1508D000E61D7 /* SVGElementFactory.h */; };
                93B70D7009EB0C7C009D8468 /* kjs_proxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B70D5409EB0C7C009D8468 /* kjs_proxy.h */; };
                93B70D7109EB0C7C009D8468 /* kjs_traversal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B70D5509EB0C7C009D8468 /* kjs_traversal.cpp */; };
                93B70D7209EB0C7C009D8468 /* kjs_traversal.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B70D5609EB0C7C009D8468 /* kjs_traversal.h */; };
-               93B70D7309EB0C7C009D8468 /* kjs_views.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B70D5709EB0C7C009D8468 /* kjs_views.cpp */; };
-               93B70D7409EB0C7C009D8468 /* kjs_views.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B70D5809EB0C7C009D8468 /* kjs_views.h */; };
                93B70D7509EB0C7C009D8468 /* kjs_window.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B70D5909EB0C7C009D8468 /* kjs_window.cpp */; };
                93B70D7609EB0C7C009D8468 /* kjs_window.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B70D5A09EB0C7C009D8468 /* kjs_window.h */; };
                93B780CA09B3B7FE00690162 /* WidgetClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B780C909B3B7FE00690162 /* WidgetClient.h */; };
                93F1991708245E59001E9ABC /* dom2_eventsimpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D30202DE4476018635CA /* dom2_eventsimpl.h */; };
                93F1991808245E59001E9ABC /* Range.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D30402DE4476018635CA /* Range.h */; };
                93F1991908245E59001E9ABC /* dom2_traversalimpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D30602DE4476018635CA /* dom2_traversalimpl.h */; };
-               93F1991A08245E59001E9ABC /* AbstractView.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D30802DE4476018635CA /* AbstractView.h */; };
                93F1992008245E59001E9ABC /* dom_xmlimpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D30002DE4476018635CA /* dom_xmlimpl.h */; };
                93F1992108245E59001E9ABC /* xml_tokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D30A02DE4476018635CA /* xml_tokenizer.h */; };
                93F1992908245E59001E9ABC /* KWQCString.h in Headers */ = {isa = PBXBuildFile; fileRef = F587868302DE3B8601EA4122 /* KWQCString.h */; };
                93F19AB808245E59001E9ABC /* dom2_eventsimpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D30102DE4476018635CA /* dom2_eventsimpl.cpp */; };
                93F19AB908245E59001E9ABC /* Range.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D30302DE4476018635CA /* Range.cpp */; };
                93F19ABA08245E59001E9ABC /* dom2_traversalimpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D30502DE4476018635CA /* dom2_traversalimpl.cpp */; };
-               93F19ABB08245E59001E9ABC /* AbstractView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D30702DE4476018635CA /* AbstractView.cpp */; };
                93F19ABC08245E59001E9ABC /* xml_tokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D30902DE4476018635CA /* xml_tokenizer.cpp */; };
                93F19ABE08245E59001E9ABC /* WebCoreCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5B2A4FD02E2220F018635CB /* WebCoreCache.mm */; };
                93F19ABF08245E59001E9ABC /* WebCoreJavaScript.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5B2A52C02E22573018635CB /* WebCoreJavaScript.mm */; };
 /* End PBXContainerItemProxy section */
 
 /* Begin PBXFileReference section */
+               1403B90C09EB124500797C7F /* DOMWindow.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMWindow.idl; sourceTree = "<group>"; };
+               1403B99509EB13AF00797C7F /* DOMWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindow.h; sourceTree = "<group>"; };
+               1403B99609EB13AF00797C7F /* DOMWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindow.cpp; sourceTree = "<group>"; };
+               1403BA0B09EB18C700797C7F /* JSDOMWindow.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMWindow.cpp; sourceTree = "<group>"; };
+               1403BA0E09EB18F800797C7F /* JSDOMWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSDOMWindow.h; sourceTree = "<group>"; };
+               141B94E509EC4223000E9413 /* MouseEvent.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = MouseEvent.idl; sourceTree = "<group>"; };
+               141B94EE09EC425A000E9413 /* UIEvent.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = UIEvent.idl; sourceTree = "<group>"; };
+               14813BF309EDF88E00F757E1 /* IDLParser.pm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.perl; name = IDLParser.pm; path = scripts/IDLParser.pm; sourceTree = "<group>"; };
                14EC267D09CA07E000E1EEEC /* EventTargetNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventTargetNode.h; sourceTree = "<group>"; };
                14EC267E09CA07E000E1EEEC /* EventTargetNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventTargetNode.cpp; sourceTree = "<group>"; };
                2D90660B0665D937006B6F1A /* ClipboardMac.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = ClipboardMac.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                656581DD09D1508D000E61D7 /* kjs_html.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_html.lut.h; sourceTree = "<group>"; };
                656581DE09D1508D000E61D7 /* kjs_navigator.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_navigator.lut.h; sourceTree = "<group>"; };
                656581DF09D1508D000E61D7 /* kjs_traversal.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_traversal.lut.h; sourceTree = "<group>"; };
-               656581E009D1508D000E61D7 /* kjs_views.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_views.lut.h; sourceTree = "<group>"; };
                656581E109D1508D000E61D7 /* kjs_window.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_window.lut.h; sourceTree = "<group>"; };
                656581E209D1508D000E61D7 /* ksvgcssproperties.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ksvgcssproperties.c; sourceTree = "<group>"; };
                656581E309D1508D000E61D7 /* ksvgcssproperties.gperf */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ksvgcssproperties.gperf; sourceTree = "<group>"; };
                93B70D5409EB0C7C009D8468 /* kjs_proxy.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_proxy.h; sourceTree = "<group>"; };
                93B70D5509EB0C7C009D8468 /* kjs_traversal.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = kjs_traversal.cpp; sourceTree = "<group>"; };
                93B70D5609EB0C7C009D8468 /* kjs_traversal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_traversal.h; sourceTree = "<group>"; };
-               93B70D5709EB0C7C009D8468 /* kjs_views.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = kjs_views.cpp; sourceTree = "<group>"; };
-               93B70D5809EB0C7C009D8468 /* kjs_views.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_views.h; sourceTree = "<group>"; };
                93B70D5909EB0C7C009D8468 /* kjs_window.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = kjs_window.cpp; sourceTree = "<group>"; };
                93B70D5A09EB0C7C009D8468 /* kjs_window.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_window.h; sourceTree = "<group>"; };
                93B780C909B3B7FE00690162 /* WidgetClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WidgetClient.h; sourceTree = "<group>"; };
                F523D30402DE4476018635CA /* Range.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Range.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F523D30502DE4476018635CA /* dom2_traversalimpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dom2_traversalimpl.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F523D30602DE4476018635CA /* dom2_traversalimpl.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = dom2_traversalimpl.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               F523D30702DE4476018635CA /* AbstractView.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AbstractView.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               F523D30802DE4476018635CA /* AbstractView.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = AbstractView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F523D30902DE4476018635CA /* xml_tokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xml_tokenizer.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F523D30A02DE4476018635CA /* xml_tokenizer.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = xml_tokenizer.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F5517DC2031AB56301A80180 /* WebCoreHistory.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreHistory.h; sourceTree = "<group>"; };
                                65DF31E309D1CC60000BE325 /* JSDOMImplementation.cpp */,
                                65DF31E409D1CC60000BE325 /* JSDOMImplementation.h */,
                                656581D609D1508D000E61D7 /* JSDOMParser.lut.h */,
+                               1403BA0B09EB18C700797C7F /* JSDOMWindow.cpp */,
+                               1403BA0E09EB18F800797C7F /* JSDOMWindow.h */,
                                65DF31E509D1CC60000BE325 /* JSElement.cpp */,
                                65DF31E609D1CC60000BE325 /* JSElement.h */,
                                65DF322D09D1DDBC000BE325 /* JSEntity.cpp */,
                                656581DD09D1508D000E61D7 /* kjs_html.lut.h */,
                                656581DE09D1508D000E61D7 /* kjs_navigator.lut.h */,
                                656581DF09D1508D000E61D7 /* kjs_traversal.lut.h */,
-                               656581E009D1508D000E61D7 /* kjs_views.lut.h */,
                                656581E109D1508D000E61D7 /* kjs_window.lut.h */,
                                656581E209D1508D000E61D7 /* ksvgcssproperties.c */,
                                656581E309D1508D000E61D7 /* ksvgcssproperties.gperf */,
                                65FEA86809833ADE00BED4AB /* Page.cpp */,
                                65A21467097A329100B9050A /* Page.h */,
                                65D1C1C909932B22000CB324 /* Plugin.h */,
+                               1403B90C09EB124500797C7F /* DOMWindow.idl */,
+                               1403B99509EB13AF00797C7F /* DOMWindow.h */,
+                               1403B99609EB13AF00797C7F /* DOMWindow.cpp */,
                                6522BCDE09C9DAA800C9BA7A /* ResourceRequest.h */,
                        );
                        path = page;
                BC1A3790097C6F970019F3D8 /* bindings */ = {
                        isa = PBXGroup;
                        children = (
+                               14813BF309EDF88E00F757E1 /* IDLParser.pm */,
                                BC1A3793097C6FB10019F3D8 /* js */,
                                BC1A3794097C6FC40019F3D8 /* objc */,
                        );
                                93B70D5409EB0C7C009D8468 /* kjs_proxy.h */,
                                93B70D5509EB0C7C009D8468 /* kjs_traversal.cpp */,
                                93B70D5609EB0C7C009D8468 /* kjs_traversal.h */,
-                               93B70D5709EB0C7C009D8468 /* kjs_views.cpp */,
-                               93B70D5809EB0C7C009D8468 /* kjs_views.h */,
                                93B70D5909EB0C7C009D8468 /* kjs_window.cpp */,
                                93B70D5A09EB0C7C009D8468 /* kjs_window.h */,
                        );
                F523D32402DE4478018635CA /* dom */ = {
                        isa = PBXGroup;
                        children = (
-                               F523D30702DE4476018635CA /* AbstractView.cpp */,
-                               F523D30802DE4476018635CA /* AbstractView.h */,
                                BC3B364705C9D5E200E42902 /* AtomicStringList.h */,
                                A8C4A7FC09D563270003AC8D /* Attr.cpp */,
                                A8C4A7FB09D563270003AC8D /* Attr.h */,
                                A8C4A7F409D563270003AC8D /* MappedAttribute.cpp */,
                                A8C4A7F309D563270003AC8D /* MappedAttribute.h */,
                                A8C4A84B09D5649D0003AC8D /* MappedAttributeEntry.h */,
+                               141B94E509EC4223000E9413 /* MouseEvent.idl */,
                                93EEC1F309C2877700C515D1 /* MutationEvent.idl */,
                                A8C4A7F209D563270003AC8D /* NamedAttrMap.cpp */,
                                A8C4A7F109D563270003AC8D /* NamedAttrMap.h */,
                                6550B69B099DF0270090D781 /* Text.cpp */,
                                6550B69C099DF0270090D781 /* Text.h */,
                                93EEC1F609C2877700C515D1 /* Text.idl */,
+                               141B94EE09EC425A000E9413 /* UIEvent.idl */,
                                93EEC1F709C2877700C515D1 /* WheelEvent.idl */,
                                F523D30902DE4476018635CA /* xml_tokenizer.cpp */,
                                F523D30A02DE4476018635CA /* xml_tokenizer.h */,
                                93F1991708245E59001E9ABC /* dom2_eventsimpl.h in Headers */,
                                93F1991808245E59001E9ABC /* Range.h in Headers */,
                                93F1991908245E59001E9ABC /* dom2_traversalimpl.h in Headers */,
-                               93F1991A08245E59001E9ABC /* AbstractView.h in Headers */,
                                93F1992008245E59001E9ABC /* dom_xmlimpl.h in Headers */,
                                93F1992108245E59001E9ABC /* xml_tokenizer.h in Headers */,
                                93F1992908245E59001E9ABC /* KWQCString.h in Headers */,
                                656581F409D1508D000E61D7 /* kjs_html.lut.h in Headers */,
                                656581F509D1508D000E61D7 /* kjs_navigator.lut.h in Headers */,
                                656581F609D1508D000E61D7 /* kjs_traversal.lut.h in Headers */,
-                               656581F709D1508D000E61D7 /* kjs_views.lut.h in Headers */,
                                656581F809D1508D000E61D7 /* kjs_window.lut.h in Headers */,
                                656581FB09D1508D000E61D7 /* ksvgcssproperties.h in Headers */,
                                656581FE09D1508D000E61D7 /* SVGElementFactory.h in Headers */,
                                93B70D6E09EB0C7C009D8468 /* kjs_navigator.h in Headers */,
                                93B70D7009EB0C7C009D8468 /* kjs_proxy.h in Headers */,
                                93B70D7209EB0C7C009D8468 /* kjs_traversal.h in Headers */,
-                               93B70D7409EB0C7C009D8468 /* kjs_views.h in Headers */,
                                93B70D7609EB0C7C009D8468 /* kjs_window.h in Headers */,
+                               1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */,
+                               1403BA0F09EB18F900797C7F /* JSDOMWindow.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                A88AD3A40952486D001DD196 /* WKSpecularLightingFilter.cikernel in Resources */,
                                A88AD3A70952486D001DD196 /* WKSpotLightFilter.cikernel in Resources */,
                                A7638A92099592C30007E14F /* WKDisplacementMapFilter.cikernel in Resources */,
+                               141B94E609EC4223000E9413 /* MouseEvent.idl in Resources */,
+                               141B94EF09EC425A000E9413 /* UIEvent.idl in Resources */,
+                               14813BF409EDF88E00F757E1 /* IDLParser.pm in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                93F19AB808245E59001E9ABC /* dom2_eventsimpl.cpp in Sources */,
                                93F19AB908245E59001E9ABC /* Range.cpp in Sources */,
                                93F19ABA08245E59001E9ABC /* dom2_traversalimpl.cpp in Sources */,
-                               93F19ABB08245E59001E9ABC /* AbstractView.cpp in Sources */,
                                93F19ABC08245E59001E9ABC /* xml_tokenizer.cpp in Sources */,
                                93F19ABE08245E59001E9ABC /* WebCoreCache.mm in Sources */,
                                93F19ABF08245E59001E9ABC /* WebCoreJavaScript.mm in Sources */,
                                93B70D6D09EB0C7C009D8468 /* kjs_navigator.cpp in Sources */,
                                93B70D6F09EB0C7C009D8468 /* kjs_proxy.cpp in Sources */,
                                93B70D7109EB0C7C009D8468 /* kjs_traversal.cpp in Sources */,
-                               93B70D7309EB0C7C009D8468 /* kjs_views.cpp in Sources */,
                                93B70D7509EB0C7C009D8468 /* kjs_window.cpp in Sources */,
+                               1403B99809EB13AF00797C7F /* DOMWindow.cpp in Sources */,
+                               1403BA0C09EB18C700797C7F /* JSDOMWindow.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index fe352313ef6ad99a8741ef9c0c1f29b0d7676af0..66fa013592334ae98e683f53932b14eedf2a9208 100644 (file)
@@ -50,7 +50,6 @@
 #include "kjs_css.h"
 #include "kjs_events.h"
 #include "kjs_traversal.h"
-#include "kjs_views.h"
 #include "kjs_window.h"
 #include "RenderCanvas.h"
 
index 7f56f7597d66c119c15fd8722333d71b146ef572..9536d0f5b40f78f4cd194967a570a7d348bf27da 100644 (file)
@@ -32,7 +32,6 @@
 #include "html_imageimpl.h"
 #include "HTMLNames.h"
 #include "kjs_proxy.h"
-#include "kjs_views.h"
 #include "kjs_window.h"
 
 #include "kjs_events.lut.h"
index aec6d39e77b72ce999191f2f0a17b94e112b9e2e..df92fef148beb3059ce3f51534cbeaaecb43b349 100644 (file)
@@ -24,6 +24,7 @@
 #include "kjs_events.h"
 #include "kjs_window.h"
 #include "Frame.h"
+#include "JSDOMWindow.h"
 
 #if SVG_SUPPORT
 #include "JSSVGLazyEventListener.h"
@@ -142,7 +143,7 @@ void KJSProxy::initScriptIfNeeded()
 
   // Build the global object - which is a Window instance
   JSLock lock;
-  JSObject *globalObject( new Window(m_frame) );
+  JSObject* globalObject = new JSDOMWindow(m_frame->domWindow());
 
   // Create a KJS interpreter for this frame
   m_script = new ScriptInterpreter(globalObject, m_frame);
diff --git a/WebCore/bindings/js/kjs_views.cpp b/WebCore/bindings/js/kjs_views.cpp
deleted file mode 100644 (file)
index ecd662c..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- *  This file is part of the KDE libraries
- *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
- *  Copyright (C) 2004 Apple Computer, Inc.
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include "config.h"
-#include "kjs_views.h"
-
-#include "kjs_css.h"
-
-#include "AbstractView.h"
-#include "Element.h"
-#include "Document.h"
-#include "css/css_stylesheetimpl.h"
-#include "css/css_ruleimpl.h"
-
-using namespace WebCore;
-
-#include "kjs_views.lut.h"
-
-namespace KJS {
-
-// -------------------------------------------------------------------------
-
-const ClassInfo DOMAbstractView::info = { "AbstractView", 0, &DOMAbstractViewTable, 0 };
-/*
-@begin DOMAbstractViewTable 2
-  document              DOMAbstractView::Document_              DontDelete|ReadOnly
-@end
-@begin DOMAbstractViewProtoTable 1
-  getComputedStyle      DOMAbstractView::GetComputedStyle       DontDelete|Function 2
-  getMatchedCSSRules    DOMAbstractView::GetMatchedCSSRules     DontDelete|Function 2
-@end
-*/
-
-KJS_DEFINE_PROTOTYPE(DOMAbstractViewProto)
-KJS_IMPLEMENT_PROTOFUNC(DOMAbstractViewProtoFunc)
-KJS_IMPLEMENT_PROTOTYPE("DOMAbstractView",DOMAbstractViewProto,DOMAbstractViewProtoFunc)
-
-DOMAbstractView::DOMAbstractView(ExecState *exec, AbstractView *av)
-  : m_impl(av)
-{
-  setPrototype(DOMAbstractViewProto::self(exec));
-}
-
-DOMAbstractView::~DOMAbstractView()
-{
-    ScriptInterpreter::forgetDOMObject(m_impl.get());
-}
-
-JSValue *DOMAbstractView::getValueProperty(ExecState *exec, int token)
-{
-    assert(token == Document_);
-    return toJS(exec, impl()->document());
-}
-
-bool DOMAbstractView::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
-{
-    return getStaticValueSlot<DOMAbstractView, DOMObject>(exec, &DOMAbstractViewTable, this, propertyName, slot);
-}
-
-JSValue *DOMAbstractViewProtoFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const List &args)
-{
-  if (!thisObj->inherits(&DOMAbstractView::info))
-    return throwError(exec, TypeError);
-  AbstractView &abstractView = *static_cast<DOMAbstractView *>(thisObj)->impl();
-  switch (id) {
-    case DOMAbstractView::GetComputedStyle: {
-        Element *arg0 = toElement(args[0]);
-        if (!arg0)
-          return jsUndefined(); // throw exception?
-        else {
-          arg0->document()->updateLayoutIgnorePendingStylesheets();
-          return toJS(exec, abstractView.getComputedStyle(arg0, WebCore::String(args[1]->toString(exec)).impl()));
-        }
-      }
-    case DOMAbstractView::GetMatchedCSSRules: {
-        Element *arg0 = toElement(args[0]);
-        if (!arg0)
-            return jsUndefined(); // throw exception?
-        else {
-            // No need to update layout, since we just want the back-end rules.
-            return toJS(exec, abstractView.getMatchedCSSRules(arg0, WebCore::String(args[1]->toString(exec)).impl()).get());
-        }
-    }
-  }
-  return jsUndefined();
-}
-
-JSValue *toJS(ExecState *exec, AbstractView *av)
-{
-  return cacheDOMObject<AbstractView, DOMAbstractView>(exec, av);
-}
-
-AbstractView *toAbstractView(JSValue *val)
-{
-  if (!val || !val->isObject(&DOMAbstractView::info))
-    return 0;
-  return static_cast<DOMAbstractView *>(val)->impl();
-}
-
-}
diff --git a/WebCore/bindings/js/kjs_views.h b/WebCore/bindings/js/kjs_views.h
deleted file mode 100644 (file)
index cea444c..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-// -*- c-basic-offset: 2 -*-
-/*
- *  This file is part of the KDE libraries
- *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#ifndef KJS_VIEWS_H_
-#define KJS_VIEWS_H_
-
-#include "kjs_dom.h"
-
-namespace WebCore {
-    class AbstractView;
-}
-
-namespace KJS {
-
-  class DOMAbstractView : public DOMObject {
-  public:
-    DOMAbstractView(ExecState *, WebCore::AbstractView *av);
-    ~DOMAbstractView();
-    virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
-    JSValue *getValueProperty(ExecState *exec, int token);
-    // no put - all read-only
-    virtual const ClassInfo* classInfo() const { return &info; }
-    static const ClassInfo info;
-    WebCore::AbstractView *impl() const { return m_impl.get(); }
-    enum { Document_, GetComputedStyle, GetMatchedCSSRules };
-  private:
-    RefPtr<WebCore::AbstractView> m_impl;
-  };
-
-  JSValue* toJS(ExecState*, WebCore::AbstractView*);
-
-  WebCore::AbstractView *toAbstractView(JSValue *);
-
-} // namespace
-
-#endif
index dea61bb14ffb529c046a18613a581620725658d7..bfd86e2b83373678595774c3d1b56edc212cbffb 100644 (file)
 #include "config.h"
 #include "kjs_window.h"
 
+#include "DOMWindow.h"
 #include "Element.h"
 #include "EventNames.h"
 #include "Frame.h"
 #include "FrameTree.h"
 #include "HTMLDocument.h"
 #include "JSDOMParser.h"
+#include "JSDOMWindow.h"
 #include "JSMutationEvent.h"
 #include "JSRange.h"
 #include "JSXMLHttpRequest.h"
@@ -202,7 +204,6 @@ const ClassInfo Window::info = { "Window", 0, &WindowTable, 0 };
   defaultStatus Window::DefaultStatus   DontDelete
   defaultstatus Window::DefaultStatus   DontDelete
   status        Window::Status          DontDelete
-  document      Window::Document_       DontDelete|ReadOnly
   Node          Window::Node            DontDelete
   Event         Window::EventCtor       DontDelete
   Range         Window::Range           DontDelete
@@ -307,8 +308,8 @@ const ClassInfo Window::info = { "Window", 0, &WindowTable, 0 };
 */
 KJS_IMPLEMENT_PROTOFUNC(WindowFunc)
 
-Window::Window(Frame *f)
-  : m_frame(f)
+Window::Window(DOMWindow* window)
+  : m_frame(window->frame())
   , screen(0)
   , history(0)
   , frames(0)
@@ -342,6 +343,11 @@ Window::~Window()
         i2->second->clearWindowObj();
 }
 
+DOMWindow* Window::impl() const
+{
+     return m_frame->domWindow();
+}
+
 ScriptInterpreter *Window::interpreter() const
 {
     return m_frame->jScript()->interpreter();
@@ -806,14 +812,6 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
      return jsUndefined();
 
    switch (token) {
-   case Document_:
-     if (!m_frame->document()) {
-       m_frame->createEmptyDocument();
-       m_frame->begin();
-       m_frame->write("<HTML><BODY>");
-       m_frame->end();
-     }
-     return toJS(exec, m_frame->document());
    case Onabort:
      return getListener(exec, abortEvent);
    case Onblur:
@@ -1348,8 +1346,8 @@ void Window::clear()
       *m_returnValueSlot = returnValue;
 
   clearAllTimeouts();
-
   clearProperties();
+  setPrototype(JSDOMWindowProto::self()); // clear the prototype
 
   // there's likely to be lots of garbage now
   Collector::collect();
@@ -2493,3 +2491,19 @@ void DOMWindowTimer::fired()
 }
 
 } // namespace KJS
+
+using namespace KJS;
+
+namespace WebCore {
+
+JSValue* toJS(ExecState*, DOMWindow* domWindow)
+{
+    return Window::retrieve(domWindow->frame());
+}
+
+DOMWindow* toDOMWindow(JSValue* val)
+{
+    return val->isObject(&JSDOMWindow::info) ? static_cast<JSDOMWindow*>(val)->impl() : 0;
+}
+    
+} // namespace WebCore
\ No newline at end of file
index 181067105a02d3c095bad4f4e33b27461c1200a4..38d1b2ffa3b36c1c808f7ea10a9d6fd7621119e8 100644 (file)
 
 namespace WebCore {
     class AtomicString;
+    class DOMWindow;
     class Frame;
     class FrameView;
+    class JSDOMWindow;
     class Node;
 }
 
@@ -83,10 +85,11 @@ namespace KJS {
     friend class Location;
     friend class WindowFunc;
     friend class ScheduledAction;
-  public:
-    Window(WebCore::Frame*);
+  protected:
+    Window(WebCore::DOMWindow*);
   public:
     ~Window();
+    WebCore::DOMWindow* impl() const;
     void disconnectFrame();
     /**
      * Returns and registers a window object. In case there's already a Window
@@ -149,7 +152,7 @@ namespace KJS {
     UnprotectedListenersMap jsUnprotectedEventListeners;
     virtual const ClassInfo* classInfo() const { return &info; }
     static const ClassInfo info;
-    enum { Closed, Crypto, DefaultStatus, Status, Document_, Node, EventCtor, MutationEventCtor, Range,
+    enum { Closed, Crypto, DefaultStatus, Status, Node, EventCtor, MutationEventCtor, Range,
            NodeFilter, DOMException, CSSRule, Frames, History_, Event_, InnerHeight,
            InnerWidth, Length, Location_, Locationbar, Name, Navigator_, ClientInformation,
            Menubar, OffscreenBuffering, Opener, OuterHeight, OuterWidth, PageXOffset, PageYOffset,
@@ -271,4 +274,9 @@ namespace KJS {
 
 } // namespace
 
+namespace WebCore {
+    KJS::JSValue* toJS(KJS::ExecState*, DOMWindow*);
+    DOMWindow* toDOMWindow(KJS::JSValue*);
+} // namespace WebCore
+
 #endif
index 947f2cfcdd35c01eb86e8195eb8f78cadc92c643..24736554673fbea0693e34a5bd73727c401d631d 100644 (file)
@@ -26,8 +26,8 @@
 #import "config.h"
 #import "DOMCSS.h"
 
-#import "AbstractView.h"
 #import "DOMInternal.h"
+#import "DOMWindow.h"
 #import "Document.h"
 #import "FoundationExtras.h"
 #import "css_ruleimpl.h"
@@ -37,6 +37,8 @@
 
 using namespace WebCore;
 
+typedef DOMWindow AbstractView;
+
 @interface DOMStyleSheet (WebCoreInternal)
 + (DOMStyleSheet *)_DOMStyleSheetWith:(StyleSheet *)impl;
 @end
@@ -2512,15 +2514,25 @@ void removeWrapperForRGB(RGBA32 value)
 
 - (DOMCSSStyleDeclaration *)getComputedStyle:(DOMElement *)elt :(NSString *)pseudoElt
 {
-    Element *element = [elt _element];
+    Element* element = [elt _element];
+    AbstractView* defaultView = [self _document]->defaultView();
     String pseudoEltString(pseudoElt);
-    return [DOMCSSStyleDeclaration _styleDeclarationWith:[self _document]->defaultView()->getComputedStyle(element, pseudoEltString.impl())];
+    
+    if (!defaultView)
+        return nil;
+    
+    return [DOMCSSStyleDeclaration _styleDeclarationWith:defaultView->getComputedStyle(element, pseudoEltString.impl()).get()];
 }
 
 - (DOMCSSRuleList *)getMatchedCSSRules:(DOMElement *)elt :(NSString *)pseudoElt
 {
+    AbstractView* defaultView = [self _document]->defaultView();
+
+    if (!defaultView)
+        return nil;
+    
     // The parameter of "false" is handy for the DOM inspector and lets us see user agent and user rules.
-    return [DOMCSSRuleList _ruleListWith: AbstractView([self _document]).getMatchedCSSRules([elt _element], String(pseudoElt).impl(), false).get()];
+    return [DOMCSSRuleList _ruleListWith:defaultView->getMatchedCSSRules([elt _element], String(pseudoElt).impl(), false).get()];
 }
 
 @end
index 37a5051ca78032f0b39c81c863c7bec141f488c0..d64f44e0db7a15f80b26c6e89854a65637e760fe 100644 (file)
 #import "config.h"
 #import "DOMViews.h"
 
-#import "AbstractView.h"
 #import "DOMInternal.h"
 #import "DOMViewsInternal.h"
 #import "Document.h"
 
+namespace WebCore {
+    typedef DOMWindow AbstractView;
+}
 using WebCore::AbstractView;
+using WebCore::DOMWindow;
 
-ALLOW_DOM_CAST(AbstractView)
+ALLOW_DOM_CAST(DOMWindow)
 
 @implementation DOMAbstractView
 
index b97c0c220d4d0409864c0fee69905f8c28ccbcbb..4557c20e37175b9854dc4a1b871f58ac931f7883 100644 (file)
  */
 
 #import "DOMViews.h"
+#import "DOMWindow.h"
 
 namespace WebCore {
-    class AbstractView;
+    typedef DOMWindow AbstractView;
 }
 
 @interface DOMAbstractView (WebCoreInternal)
index 3f91f0550411503f40889018de6cc678bfdae209..9b553723f38f96d5b5bbe5c21aab3ade0b80def7 100644 (file)
@@ -120,6 +120,8 @@ sub GetLegacyHeaderIncludes
   my $legacyParent = shift;
   if ($legacyParent eq "JSCanvasRenderingContext2DBase") {
     return "#include \"JSCanvasRenderingContext2DBase.h\"\n\n";
+  } elsif ($legacyParent eq "KJS::Window") {
+      return "#include \"kjs_window.h\"\n\n";
   } elsif ($module eq "events") {
     return "#include \"kjs_events.h\"\n\n";
   } elsif ($module eq "core") {
@@ -142,6 +144,7 @@ sub AddIncludesForType
   
   if ($type eq "DocumentType" or 
       $type eq "Document" or
+      $type eq "DOMWindow" or
       $type eq "DOMImplementation" or
       $type eq "NodeList" or 
       $type eq "Text" or 
@@ -152,12 +155,13 @@ sub AddIncludesForType
       $type eq "DocumentFragment" or
       $type eq "Node" or
       $type eq "Attr" or
-      $type eq "AbstractView" or
       $type eq "Comment" or
       $type eq "Element") {
     $implIncludes{"${type}.h"} = 1;
   } elsif ($type eq "CSSStyleSheet" or $type eq "StyleSheet") {
     $implIncludes{"css_stylesheetimpl.h"} = 1;
+  } elsif ($type eq "CSSRuleList") {
+    $implIncludes{"css_ruleimpl.h"} = 1;
   } elsif ($type eq "CSSPrimitiveValue" or $type eq "Counter" or $type eq "Rect" or $type eq "RGBColor") {
     $implIncludes{"css_valueimpl.h"} = 1;
   } elsif ($type eq "CSSStyleDeclaration") {
@@ -195,19 +199,6 @@ sub AddIncludesForType
   }
 }
 
-sub GetLegacyImplementationIncludes
-{
-  my $interfaceName = shift;
-  
-  if ($module eq "events") {
-    return "#include \"dom2_eventsimpl.h\"\n";
-  } elsif ($module eq "core") {
-    return "#include \"${interfaceName}.h\"\n";
-  } else {
-    die ("Don't know what headers to include for module $module");
-  }  
-}
-
 sub GenerateHeader
 {
   my $object = shift;
@@ -259,7 +250,11 @@ sub GenerateHeader
   push(@headerContent, "public:\n");
   
   # Constructor
-  push(@headerContent, "    $className(KJS::ExecState*, $implClassName*);\n");
+  if ($dataNode->extendedAttributes->{"DoNotCache"}) {
+      push(@headerContent, "    $className($implClassName*);\n");
+  } else {
+      push(@headerContent, "    $className(KJS::ExecState*, $implClassName*);\n");
+  }
     
   # Destructor
   if (!$hasParent or $interfaceName eq "Document") {
@@ -356,13 +351,33 @@ sub GenerateHeader
     push(@headerContent, "$implClassName* to${interfaceName}(KJS::JSValue*);\n\n");
   }
 
-  # Add prototype declaration
+  # Add prototype declaration -- code adopted from the KJS_DEFINE_PROTOTYPE and KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE macros
   if ($numFunctions > 0) {
-    if ($hasParent) {
-      push(@headerContent, "KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE(${className}Proto, ${parentClassName}Proto);\n\n");
-    } else {
-      push(@headerContent, "KJS_DEFINE_PROTOTYPE(${className}Proto);\n\n");
-    }
+      push(@headerContent, "class ${className}Proto : public KJS::JSObject {\n");
+      if (!$dataNode->extendedAttributes->{"DoNotCache"}) {
+          push(@headerContent, "    friend KJS::JSObject* KJS_GCC_ROOT_NS_HACK cacheGlobalObject<${className}Proto>(KJS::ExecState*, const KJS::Identifier& propertyName);\n");
+      }
+      push(@headerContent, "public:\n");
+      if ($dataNode->extendedAttributes->{"DoNotCache"}) {
+          push(@headerContent, "    static KJS::JSObject* self();\n");
+      } else {
+          push(@headerContent, "    static KJS::JSObject* self(KJS::ExecState* exec);\n");
+      }
+      push(@headerContent, "    virtual const KJS::ClassInfo* classInfo() const { return &info; }\n");
+      push(@headerContent, "    static const KJS::ClassInfo info;\n");
+      push(@headerContent, "    bool getOwnPropertySlot(KJS::ExecState*, const KJS::Identifier&, KJS::PropertySlot&);\n");
+      push(@headerContent, "protected:\n");
+      if ($dataNode->extendedAttributes->{"DoNotCache"}) {
+          push(@headerContent, "    ${className}Proto() { }\n");
+      } else {
+          push(@headerContent, "    ${className}Proto(KJS::ExecState* exec)\n");
+          if ($hasParent) {
+              push(@headerContent, "        : KJS::JSObject(${parentClassName}Proto::self(exec)) { }\n");
+          } else {
+              push(@headerContent, "        : KJS::JSObject(exec->lexicalInterpreter()->builtinObjectPrototype()) { }\n");
+          }
+      }
+      push(@headerContent, "};\n\n");
   }
   
   push(@headerContent, "}\n\n#endif\n");
@@ -508,8 +523,35 @@ sub GenerateImplementation
                                \@hashKeys, \@hashValues,
                                \@hashSpecials, \@hashParameters);
 
-    push(@implContent, "KJS_IMPLEMENT_PROTOFUNC(${className}ProtoFunc)\n");
-    push(@implContent, "KJS_IMPLEMENT_PROTOTYPE(\"$className\", ${className}Proto, ${className}ProtoFunc)\n\n");
+    push(@implContent, "class ${className}ProtoFunc : public InternalFunctionImp {\n");
+    push(@implContent, "public:\n");
+    push(@implContent, "    ${className}ProtoFunc(ExecState* exec, int i, int len, const Identifier& name)\n");
+    push(@implContent, "    : InternalFunctionImp(static_cast<FunctionPrototype*>(exec->lexicalInterpreter()->builtinFunctionPrototype()), name)\n");
+    push(@implContent, "    , id(i)\n");
+    push(@implContent, "    {\n");
+    push(@implContent, "        put(exec, lengthPropertyName, jsNumber(len), DontDelete|ReadOnly|DontEnum);\n");
+    push(@implContent, "    }\n");
+    push(@implContent, "    virtual JSValue* callAsFunction(ExecState* exec, JSObject* thisObj, const List& args);\n");
+    push(@implContent, "private:\n");
+    push(@implContent, "    int id;\n");
+    push(@implContent, "};\n\n");
+
+    push(@implContent, "const ClassInfo ${className}Proto::info = { \"$className\", 0, &${className}ProtoTable, 0 };\n\n");
+    if ($dataNode->extendedAttributes->{"DoNotCache"}) {
+        push(@implContent, "JSObject* ${className}Proto::self()\n");
+        push(@implContent, "{\n");
+        push(@implContent, "    return new ${className}Proto();\n");
+        push(@implContent, "}\n\n");
+    } else {
+        push(@implContent, "JSObject* ${className}Proto::self(ExecState* exec)\n");
+        push(@implContent, "{\n");
+        push(@implContent, "    return ::cacheGlobalObject<${className}Proto>(exec, \"[[${className}.prototype]]\");\n");
+        push(@implContent, "}\n\n");
+    }
+    push(@implContent, "bool ${className}Proto::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)\n");
+    push(@implContent, "{\n");
+    push(@implContent, "    return getStaticFunctionSlot<${className}ProtoFunc, JSObject>(exec, &${className}ProtoTable, this, propertyName, slot);\n");
+    push(@implContent, "}\n\n");
   }
   
   # - Initialize static ClassInfo object
@@ -528,17 +570,24 @@ sub GenerateImplementation
   push(@implContent, "0 };\n\n");
     
   # Constructor
-  push(@implContent, "${className}::$className(ExecState* exec, $implClassName* impl)\n");
-  if ($hasParent) {
-    push(@implContent, "    : $parentClassName(exec, impl)\n");
+  if ($dataNode->extendedAttributes->{"DoNotCache"}) {
+      push(@implContent, "${className}::$className($implClassName* impl)\n");
+      push(@implContent, "    : $parentClassName(impl)\n");
   } else {
-    push(@implContent, "    : m_impl(impl)\n");
+      push(@implContent, "${className}::$className(ExecState* exec, $implClassName* impl)\n");
+      if ($hasParent) {
+          push(@implContent, "    : $parentClassName(exec, impl)\n");
+      } else {
+          push(@implContent, "    : m_impl(impl)\n");
+      }
   }
   
-  if ($numFunctions ne 0) {
-    push(@implContent, "{\n    setPrototype(${className}Proto::self(exec));\n}\n\n");
+  if ($dataNode->extendedAttributes->{"DoNotCache"}) {
+      push(@implContent, "{\n    setPrototype(${className}Proto::self());\n}\n\n");
+  } elsif ($numFunctions ne 0) {
+      push(@implContent, "{\n    setPrototype(${className}Proto::self(exec));\n}\n\n");
   } else {
-    push(@implContent, "{\n}\n\n");    
+      push(@implContent, "{\n}\n\n");    
   }
   
   # Destructor
@@ -728,8 +777,6 @@ sub GetNativeType
     return "AtomicString";
   } elsif ($type eq "DOMString") {
     return "String";
-  } elsif ($type eq "views::AbstractView") {
-    return "AbstractView*";
   } elsif ($type eq "Node" or
            $type eq "Element" or
            $type eq "Attr" or
@@ -742,6 +789,8 @@ sub GetNativeType
     return "Range::CompareHow";
   } elsif ($type eq "EventTarget") {
     return "EventTargetNode*";
+  } elsif ($type eq "DOMWindow") {
+    return "DOMWindow*";
   } else {
     die "Don't know the native type of $type";
   }
@@ -767,8 +816,6 @@ sub TypeCanFailConversion
       return 0;
   } elsif ($type eq "DOMString") {
       return 0;
-  } elsif ($type eq "views::AbstractView") {
-      return 0;
   } elsif ($type eq "Node") {
       return 0;
   } elsif ($type eq "Element") {
@@ -784,6 +831,8 @@ sub TypeCanFailConversion
       return 0;
   }  elsif ($type eq "NodeFilter") {
       return 0;
+  } elsif ($type eq "DOMWindow") {
+      return 0;
   } else {
     die "Don't know whether a JS value can fail conversion to type $type."
   }
@@ -821,9 +870,6 @@ sub JSValueToNative
     } else {
       return "$value->toString(exec)";
     }
-  } elsif ($type eq "views::AbstractView") {
-    $implIncludes{"kjs_views.h"} = 1;
-    return "toAbstractView($value)";
   } elsif ($type eq "Node") {
     $implIncludes{"kjs_dom.h"} = 1;
     return "toNode($value)";
@@ -845,6 +891,9 @@ sub JSValueToNative
   } elsif ($type eq "NodeFilter") {
     $implIncludes{"kjs_traversal.h"} = 1;
     return "toNodeFilter($value)";
+  } elsif ($type eq "DOMWindow") {
+    $implIncludes{"kjs_window.h"} = 1;
+    return "toDOMWindow($value)";
   } else {
     die "Don't know how to convert a JS value of type $type."
   }
@@ -923,6 +972,9 @@ sub NativeToJSValue
     $implIncludes{"css_stylesheetimpl.h"} = 1;
     $implIncludes{"kjs_css.h"} = 1;
     return "toJS(exec, $value, impl)";    
+  } elsif ($type eq "CSSRuleList") {
+    $implIncludes{"css_ruleimpl.h"} = 1;
+    return "toJS(exec, $value)";  
   } elsif ($type eq "CSSStyleDeclaration" or $type eq "Rect") {
     $implIncludes{"css_valueimpl.h"} = 1;
     $implIncludes{"kjs_css.h"} = 1;
@@ -937,13 +989,13 @@ sub NativeToJSValue
   } elsif ($type eq "CanvasGradient" or $type eq "Counter" or $type eq "Range") {
     $implIncludes{"JS$type.h"} = 1;
     return "toJS(exec, $value)";
-  } elsif ($type eq "views::AbstractView") {
-    $implIncludes{"kjs_views.h"} = 1;
-    return "toJS(exec, $value)";
   } elsif ($type eq "NodeIterator" or
           $type eq "TreeWalker") {
     $implIncludes{"kjs_traversal.h"} = 1;
     return "toJS(exec, $value)";
+  } elsif ($type eq "DOMWindow") {
+    $implIncludes{"kjs_window.h"} = 1;
+    return "toJS(exec, $value)";
   } else {
     die "Don't know how to convert a value of type $type to a JS Value";
   }
index fb2317457b50d2638ce590537d9720a4ad7fa548..d831c881cf86eb9239c7c452e247c2822459ff53 100644 (file)
@@ -153,7 +153,7 @@ sub parseExtendedAttributes
     $attrs{$name} = $value;
   }
   
-  return %attrs;
+  return \%attrs;
 }
 
 sub ParseInterface
index 6fefa57089fc1ea33f7d755281bbc5cb50fb40c1..31e53cdc090902639d4471e08e86c972067cca42 100644 (file)
@@ -33,6 +33,7 @@
 #import "Cache.h"
 #import "Cursor.h"
 #import "DOMInternal.h"
+#import "DOMWindow.h"
 #import "EventNames.h"
 #import "FloatRect.h"
 #import "FoundationExtras.h"
diff --git a/WebCore/dom/AbstractView.cpp b/WebCore/dom/AbstractView.cpp
deleted file mode 100644 (file)
index c49fb26..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * This file is part of the DOM implementation for KDE.
- *
- * (C) 2001 Peter Kelly (pmk@post.com)
- * Copyright (C) 2004, 2006 Apple Computer, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- */
-
-#include "config.h"
-#include "AbstractView.h"
-
-#include "Document.h"
-#include "Element.h"
-#include "CSSComputedStyleDeclaration.h"
-#include "cssstyleselector.h"
-
-namespace WebCore {
-
-AbstractView::AbstractView(Document *doc)
-{
-    m_document = doc;
-}
-
-AbstractView::~AbstractView()
-{
-}
-
-CSSStyleDeclaration *AbstractView::getComputedStyle(Element *elt, StringImpl *pseudoElt)
-{
-    // FIXME: This should work even if we do not have a renderer.
-    // FIXME: This needs to work with pseudo elements.
-    if (!elt || !elt->renderer())
-        return 0;
-
-    return new CSSComputedStyleDeclaration(elt);
-}
-
-RefPtr<CSSRuleList> AbstractView::getMatchedCSSRules(Element* elt, StringImpl* pseudoElt, bool authorOnly)
-{
-    if (pseudoElt && pseudoElt->length())
-        return m_document->styleSelector()->pseudoStyleRulesForElement(elt, pseudoElt, authorOnly);
-    return m_document->styleSelector()->styleRulesForElement(elt, authorOnly);
-}
-
-}
diff --git a/WebCore/dom/AbstractView.h b/WebCore/dom/AbstractView.h
deleted file mode 100644 (file)
index c61913e..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * This file is part of the DOM implementation for KDE.
- *
- * (C) 2001 Peter Kelly (pmk@post.com)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef _DOM_ViewsImpl_h_
-#define _DOM_ViewsImpl_h_
-
-#include "css_valueimpl.h"
-
-namespace WebCore {
-
-class Document;
-class CSSStyleDeclaration;
-class CSSRuleList;
-class Element;
-class StringImpl;
-
-// Introduced in DOM Level 2:
-class AbstractView : public Shared<AbstractView>
-{
-public:
-    AbstractView(Document *_document);
-    ~AbstractView();
-
-    Document *document() const { return m_document; }
-    CSSStyleDeclaration *getComputedStyle(Element *elt, StringImpl *pseudoElt);
-    RefPtr<CSSRuleList> getMatchedCSSRules(Element *elt, StringImpl *pseudoElt, bool authorOnly = true);
-
-protected:
-    Document *m_document;
-};
-
-}; //namespace
-#endif
index 94f541694d6714d237e114ed3c7f81c76ba51275..c012d9373936ec2aae6f8ff629167793dae23398 100644 (file)
@@ -25,7 +25,6 @@
 #include "config.h"
 #include "Document.h"
 
-#include "AbstractView.h"
 #include "AccessibilityObjectCache.h"
 #include "CDATASection.h"
 #include "CSSValueKeywords.h"
@@ -235,7 +234,6 @@ Document::Document(DOMImplementation* impl, FrameView *v)
     m_attrNames = 0;
     m_attrNameAlloc = 0;
     m_attrNameCount = 0;
-    m_defaultView = new AbstractView(this);
     m_listenerTypes = 0;
     m_inDocument = true;
     m_styleSelectorDirty = false;
@@ -2181,9 +2179,12 @@ void Document::notifyBeforeNodeRemoval(Node *n)
         it.current()->notifyBeforeNodeRemoval(n);
 }
 
-AbstractView *Document::defaultView() const
+DOMWindow* Document::defaultView() const
 {
-    return m_defaultView.get();
+    if (!frame())
+        return 0;
+    
+    return frame()->domWindow();
 }
 
 PassRefPtr<Event> Document::createEvent(const String &eventType, ExceptionCode& ec)
index de160093fccb375b334dcc03d70d3f326afe9b9c..021cd6b97bd7d9648b9f16a7169ba4e91df9a09c 100644 (file)
@@ -49,13 +49,13 @@ namespace XBL {
 namespace WebCore {
 
     class AccessibilityObjectCache;
-    class AbstractView;
     class CDATASection;
     class CSSStyleDeclaration;
     class CSSStyleSelector;
     class CSSStyleSheet;
     class Comment;
     class DOMImplementation;
+    class DOMWindow;
     class DocLoader;
     class DocumentFragment;
     class DocumentType;
@@ -382,7 +382,7 @@ public:
     void attachNodeIterator(NodeIterator*);
     void detachNodeIterator(NodeIterator*);
     void notifyBeforeNodeRemoval(Node*);
-    AbstractView* defaultView() const;
+    DOMWindow* defaultView() const;
     PassRefPtr<Event> createEvent(const String& eventType, ExceptionCode&);
 
     // keep track of what types of event listeners are registered, so we don't
@@ -599,7 +599,6 @@ protected:
     unsigned short m_namespaceURICount;
 
     DeprecatedPtrList<NodeIterator> m_nodeIterators;
-    RefPtr<AbstractView> m_defaultView;
 
     unsigned short m_listenerTypes;
     RefPtr<StyleSheetList> m_styleSheets;
index c1fe663fce08546adad87ab258f608704d263ced..d2b8d0af7b546ebb299d0915b2e4038f979139ab 100644 (file)
@@ -97,7 +97,7 @@ module core {
 
         // DOM Level 2 Abstract Views (DocumentView interface)
 
-        readonly attribute views::AbstractView defaultView;
+        readonly attribute DOMWindow defaultView;
 
         // DOM Level 2 Style (DocumentStyle interface)
 
index 34e9697bc2b5986dbf7386d4644492e650ef7381..bfc1caa7ae871fc2df373a4c9854a6959a289569 100644 (file)
@@ -32,7 +32,7 @@ module events {
         void initKeyboardEvent(in AtomicString typeArg, 
                                in boolean canBubbleArg, 
                                in boolean cancelableArg, 
-                               in views::AbstractView viewArg, 
+                               in DOMWindow viewArg, 
                                in DOMString keyIdentifier,
                                in unsigned long keyLocationArg,
                                in boolean ctrlKeyArg,
index ed4ca6febb1bc456209d97c7946fe3d01aa7b2d0..0df6622de6c316959433133b5e1d90a396ce42b2 100644 (file)
@@ -41,7 +41,7 @@ module events {
         void               initMouseEvent(in AtomicString typeArg, 
                                           in boolean canBubbleArg, 
                                           in boolean cancelableArg, 
-                                          in views::AbstractView viewArg, 
+                                          in DOMWindow viewArg, 
                                           in long detailArg, 
                                           in long screenXArg, 
                                           in long screenYArg, 
index 47bfc79b4e8beaa6903c44214a3ad04f91ecd8bf..7d710cd61150c7cbed793414e7e7dd658203404e 100644 (file)
@@ -31,7 +31,6 @@
 #include "Logging.h"
 #include "RenderBlock.h"
 #include "CSSComputedStyleDeclaration.h"
-#include "AbstractView.h"
 #include "htmlediting.h"
 #include "HTMLNames.h"
 #include "TextIterator.h"
index c66d69c1fbde43799053961d2fc8a66e20bdd0e6..672035f3007652b243bfa7ff58a773f46573b69e 100644 (file)
@@ -23,7 +23,7 @@ module events {
 
     interface [LegacyParent=KJS::DOMEvent] UIEvent : Event {
 
-        readonly attribute views::AbstractView  view;
+        readonly attribute DOMWindow  view;
         readonly attribute long                 detail;
         
         readonly attribute long                 keyCode;
@@ -37,7 +37,7 @@ module events {
         void               initUIEvent(in AtomicString typeArg, 
                                        in boolean canBubbleArg, 
                                        in boolean cancelableArg, 
-                                       in views::AbstractView viewArg, 
+                                       in DOMWindow viewArg, 
                                        in long detailArg);
     };
 
index 1601528ab7862ea3b7c20286b291fb3846f9cf92..e14e4c8bc017a7abc32c8cb377ee12c5ab7cf768 100644 (file)
 #ifndef DOM_EVENTSIMPL_H
 #define DOM_EVENTSIMPL_H
 
-#include "AbstractView.h"
+#include "AtomicString.h"
+#include "DOMWindow.h"
 #include "Node.h"
 
 class DeprecatedStringList;
 
 namespace WebCore {
 
+class CachedImage;
 class Clipboard;
 class EventListener;
 class EventTargetNode;
@@ -40,6 +42,7 @@ class IntPoint;
 class PlatformKeyboardEvent;
 
 typedef unsigned long long DOMTimeStamp;
+typedef DOMWindow AbstractView;
 
 const int EventExceptionOffset = 100;
 const int EventExceptionMax = 199;
diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp
new file mode 100644 (file)
index 0000000..ef0260d
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2006 Apple Computer, 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 "DOMWindow.h"
+
+#include "cssstyleselector.h"
+#include "CSSComputedStyleDeclaration.h"
+#include "Document.h"
+#include "Element.h"
+#include "Frame.h"
+
+namespace WebCore {
+
+DOMWindow::DOMWindow(Frame* f)
+    : m_frame(f)
+{
+}
+
+Frame* DOMWindow::frame()
+{
+    return m_frame;
+}
+
+void DOMWindow::disconnectFrame()
+{
+    m_frame = 0;
+}
+
+Document* DOMWindow::document() const
+{
+    if (!m_frame)
+        return 0;
+    
+    if (!m_frame->document()) {
+        m_frame->createEmptyDocument();
+        m_frame->begin();
+        m_frame->write("<HTML><BODY>");
+        m_frame->end();
+    }
+    return m_frame->document();
+}
+
+PassRefPtr<CSSStyleDeclaration> DOMWindow::getComputedStyle(Element* elt, const String&) const
+{
+    // FIXME: This should work even if we do not have a renderer.
+    // FIXME: This needs to work with pseudo elements.
+    if (!elt || !elt->renderer())
+        return 0;
+    
+    return new CSSComputedStyleDeclaration(elt);
+}
+
+PassRefPtr<CSSRuleList> DOMWindow::getMatchedCSSRules(Element* elt, const String& pseudoElt, bool authorOnly) const
+{
+    if (!m_frame || !m_frame->document())
+        return 0;
+    
+    if (!pseudoElt.isEmpty())
+        return m_frame->document()->styleSelector()->pseudoStyleRulesForElement(elt, pseudoElt.impl(), authorOnly);
+    return m_frame->document()->styleSelector()->styleRulesForElement(elt, authorOnly);
+}
+
+} // namespace WebCore
diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h
new file mode 100644 (file)
index 0000000..fd24680
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2006 Apple Computer, 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. 
+ */
+
+#ifndef DOMWindow_h
+#define DOMWindow_h
+
+#include "Shared.h"
+#include <kxmlcore/Noncopyable.h>
+#include <kxmlcore/PassRefPtr.h>
+
+namespace WebCore {
+    class CSSRuleList;
+    class CSSStyleDeclaration;
+    class Document;
+    class Element;
+    class Frame;
+    class String;
+    
+    class DOMWindow : public Shared<DOMWindow>, Noncopyable {
+    public:
+        DOMWindow(Frame*);
+        Frame* frame();
+        void disconnectFrame();
+
+        // DOM Level 2 AbstractView Interface
+        Document* document() const;
+        
+        // DOM Level 2 Style Interface
+        PassRefPtr<CSSStyleDeclaration> getComputedStyle(Element*, const String& pseudoElt) const;
+
+        // WebKit extension for the Web Inspector
+        PassRefPtr<CSSRuleList> getMatchedCSSRules(Element*, const String& pseudoElt, bool authorOnly = true) const;
+        
+    private:
+        Frame* m_frame;
+    };
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl
new file mode 100644 (file)
index 0000000..3c82603
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2006 Apple Computer, 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. 
+ */
+
+module window {
+
+    // You can't cache the Window object in the global object because it *is* the global object.
+    // For the same reason, there's no need to.
+    interface [LegacyParent=KJS::Window, DoNotCache] DOMWindow {
+        // DOM Level 2 AbstractView Interface
+        readonly attribute Document document;
+        
+        // DOM Level 2 Style Interface
+        CSSStyleDeclaration getComputedStyle(in Element elt,
+                                             in DOMString pseudoElt);
+
+        // WebKit extension for the Web Inspector
+        CSSRuleList getMatchedCSSRules(in Element elt,
+                                       in DOMString pseudoElt,
+                                       in [ConvertUndefinedToTrue] boolean authorOnly);
+        
+    };
+
+}
index f5e6c9aa6cdb533146b26cd6989f585ce4094406..eee0d2c17dafc4ca6d85574ff45fa0fe6e916e17 100644 (file)
@@ -36,6 +36,7 @@
 #include "CachedCSSStyleSheet.h"
 #include "DOMImplementation.h"
 #include "DocLoader.h"
+#include "DOMWindow.h"
 #include "EditingText.h"
 #include "EventNames.h"
 #include "FloatRect.h"
@@ -175,6 +176,9 @@ Frame::~Frame()
             w = 0;
         }
 
+    if (d->m_domWindow)
+        d->m_domWindow->disconnectFrame();
+            
     setOpener(0);
     HashSet<Frame*> openedBy = d->m_openedFrames;
     HashSet<Frame*>::iterator end = openedBy.end();
@@ -3251,9 +3255,17 @@ bool Frame::isLoadingMainResource() const
     return d->m_bLoadingMainResource;
 }
 
-FrameTree *Frame::tree() const
+FrameTreeFrame::tree() const
 {
-    return& d->m_treeNode;
+    return &d->m_treeNode;
+}
+
+DOMWindow* Frame::domWindow() const
+{
+    if (!d->m_domWindow)
+        d->m_domWindow = new DOMWindow(const_cast<Frame*>(this));
+
+    return d->m_domWindow.get();
 }
 
 KURL Frame::url() const
index a58b19d0974ade469363ce101a0d12245bce71dc..ffb586ceaeb5e04f253f701d2e2b6b4b688a2112 100644 (file)
@@ -59,6 +59,7 @@ class CSSComputedStyleDeclaration;
 class CSSMutableStyleDeclaration;
 class CSSStyleDeclaration;
 class DrawContentsEvent;
+class DOMWindow;
 class EditCommandPtr;
 class FramePrivate;
 class FrameTree;
@@ -797,6 +798,7 @@ public:
   // split out controller objects
   FrameTree* tree() const;
   SelectionController& selection() const;
+  DOMWindow* domWindow() const;
 
  private:
   friend class FramePrivate;
index 75171aca03c07355dae3cc5e6eefb234b1ce1235..e24eedfeb2c82ef937c8c54be3af82459cba7048 100644 (file)
@@ -111,6 +111,7 @@ namespace WebCore {
 
         Page* m_page;
         FrameTree m_treeNode;
+        RefPtr<DOMWindow> m_domWindow;
 
         Vector<RefPtr<Plugin> > m_plugins;
 
index f9d9c33381b62cf680253f3b69acfeb6e42837e9..b407e69da0f38fca2c9e5d5d1ce14328d634791b 100644 (file)
@@ -31,6 +31,7 @@
 #include "Image.h"
 #include "IntPoint.h"
 #include "dom2_eventsimpl.h"
+#include "CachedObjectClient.h"
 
 #ifdef __OBJC__
 @class NSImage;
@@ -110,7 +111,4 @@ private:
 
 }
 
-// FIXME: Remove when everything is in the WebCore namespace.
-using WebCore::ClipboardMac;
-
 #endif