Reviewed by Maciej.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 May 2005 21:10:26 +0000 (21:10 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 May 2005 21:10:26 +0000 (21:10 +0000)
        No new layout tests required.

        - remove all dependencies on exceptions and RTTI (but don't turn them off yet, that will be in a later patch)

        * WebCore.pbproj/project.pbxproj: Set a new KHTML_NO_CPLUSPLUS_DOM define.
        Removed all C++ DOM wrapper files that we don't need to compile any more.

        * khtml/dom/css_stylesheet.h: Added more KHTML_NO_CPLUSPLUS_DOM checks so we don't include any
        headers when including this file.

        * khtml/dom/dom2_events.h: Fixed up KHTML_NO_CPLUSPLUS_DOM checks so that everything but EventListener
        is turned off when that's on. Also moved the public so that the constants from KeyboardEvent are public.
        * khtml/dom/dom2_events.cpp: Put everything except for EventListener inside KHTML_NO_CPLUSPLUS_DOM.

        * khtml/dom/dom2_range.h: Added KHTML_NO_CPLUSPLUS_DOM checks so that only the constants are defined,
        no classes.

        * khtml/dom/dom2_traversal.cpp: Put everything except for NodeFilterCondition inside KHTML_NO_CPLUSPLUS_DOM.

        * khtml/dom/dom_node.h: Added more KHTML_NO_CPLUSPLUS_DOM checks so we don't include any
        headers when including this file.

        * khtml/ecma/kjs_binding.cpp:
        (KJS::DOMObject::get): Removed exception-handling code. Now we can eliminate tryGet altogether.
        (KJS::DOMObject::put): Ditto.
        (KJS::DOMFunction::get): Ditto.
        (KJS::DOMFunction::call): Ditto.

        * khtml/editing/visible_text.h: Added an include of <qstring.h>.

        * khtml/misc/loader.h: Added isKHTMLLoader.
        * khtml/misc/loader.cpp: (Loader::isKHTMLLoader): Added. Poor-man's replacement for dynamic_cast.

        * khtml/rendering/render_form.h:
        * khtml/rendering/render_form.cpp: (RenderFormElement::slotTextChanged): Added. Hack to make KWQSlot work
        for this function.

        * khtml/xml/dom2_rangeimpl.h: Added a forward declaration of class DOMString, needed now that the C++
        DOM wrappers aren't defining it.

        * khtml/xml/dom_docimpl.cpp:
        (DocumentImpl::defaultEventHandler): Changed to call handleEventImpl so we don't have to make the
        C++ DOM wrapper for the event.
        * khtml/xml/dom_nodeimpl.cpp:
        (NodeImpl::handleLocalEvents): Ditto.
        (ContainerNodeImpl::insertBefore): Used SharedPtr<NodeImpl> rather than Node to protect the child node.
        (ContainerNodeImpl::replaceChild): Ditto.
        (ContainerNodeImpl::appendChild): Ditto.
        (ContainerNodeImpl::addChild): Ditto.

        * kwq/DOM.mm:
        (ObjCNodeFilterCondition::acceptNode): Update to add a KHTML_NO_CPLUSPLUS_DOM check since FilterCondition
        has a different API depending on the state.
        (-[DOMDocument createNodeIterator::::]): Rewrote to use NodeFilterImpl instead of NodeFilter.
        (-[DOMDocument createTreeWalker::::]): Ditto.

        * kwq/KWQAccObject.mm:
        (-[KWQAccObject role]): Use identifier instead of casting to Node and using elementId.
        (-[KWQAccObject title]): Ditto.
        (-[KWQAccObject accessibilityIsIgnored]): Ditto.
        (-[KWQAccObject rendererForView:]): Ditto.

        * kwq/KWQFrame.mm: (QFrame::setFrameStyle): Use isKHTMLView instead of dynamic_cast.

        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::currentForm): Use focusNode instead of activeNode.
        (KWQKHTMLPart::nextKeyViewInFrame): Use isWidget instead of dynamic_cast.
        (KWQKHTMLPart::currentEventIsMouseDownInWidget): Use KHTMLView's nodeUnderMouse instead of our public one
        that uses a DOM C++ wrapper.
        (KWQKHTMLPart::partForWidget): Use isKHTMLView instead of dynamic_cast.
        (KWQKHTMLPart::passSubframeEventToSubframe): Use isWidget instead of dynamic_cast.

        * kwq/KWQObject.h: Made isXXX functions all public since we use them in a few more places now.
        Also added isKHTMLLoader.
        * kwq/KWQObject.mm: (QObject::isKHTMLLoader): Added. Returns false by default.

        * kwq/KWQSlot.mm: Removed all uses of dynamic_cast.

        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge stringForRange:]): Used plainText instead of text.
        (-[WebCoreBridge copyRenderNode:copier:]): Used isWidget instead of dynamic_cast.

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

25 files changed:
WebCore/ChangeLog-2005-08-23
WebCore/WebCore.pbproj/project.pbxproj
WebCore/khtml/dom/css_stylesheet.h
WebCore/khtml/dom/dom2_events.cpp
WebCore/khtml/dom/dom2_events.h
WebCore/khtml/dom/dom2_range.h
WebCore/khtml/dom/dom2_traversal.cpp
WebCore/khtml/dom/dom_node.h
WebCore/khtml/ecma/kjs_binding.cpp
WebCore/khtml/editing/visible_text.h
WebCore/khtml/misc/loader.cpp
WebCore/khtml/misc/loader.h
WebCore/khtml/rendering/render_form.cpp
WebCore/khtml/rendering/render_form.h
WebCore/khtml/xml/dom2_rangeimpl.h
WebCore/khtml/xml/dom_docimpl.cpp
WebCore/khtml/xml/dom_nodeimpl.cpp
WebCore/kwq/DOM.mm
WebCore/kwq/KWQAccObject.mm
WebCore/kwq/KWQFrame.mm
WebCore/kwq/KWQKHTMLPart.mm
WebCore/kwq/KWQObject.h
WebCore/kwq/KWQObject.mm
WebCore/kwq/KWQSlot.mm
WebCore/kwq/WebCoreBridge.mm

index 1c30b5db98bb275c7857bd55cc46e0eef53e168a..4f4761779e58b7f043157ce13a20433024f59f1f 100644 (file)
@@ -1,3 +1,88 @@
+2005-05-16  Darin Adler  <darin@apple.com>
+
+        Reviewed by Maciej.
+        No new layout tests required.
+
+        - remove all dependencies on exceptions and RTTI (but don't turn them off yet, that will be in a later patch)
+
+        * WebCore.pbproj/project.pbxproj: Set a new KHTML_NO_CPLUSPLUS_DOM define.
+        Removed all C++ DOM wrapper files that we don't need to compile any more.
+
+        * khtml/dom/css_stylesheet.h: Added more KHTML_NO_CPLUSPLUS_DOM checks so we don't include any
+        headers when including this file.
+
+        * khtml/dom/dom2_events.h: Fixed up KHTML_NO_CPLUSPLUS_DOM checks so that everything but EventListener
+        is turned off when that's on. Also moved the public so that the constants from KeyboardEvent are public.
+        * khtml/dom/dom2_events.cpp: Put everything except for EventListener inside KHTML_NO_CPLUSPLUS_DOM.
+
+        * khtml/dom/dom2_range.h: Added KHTML_NO_CPLUSPLUS_DOM checks so that only the constants are defined,
+        no classes.
+
+        * khtml/dom/dom2_traversal.cpp: Put everything except for NodeFilterCondition inside KHTML_NO_CPLUSPLUS_DOM.
+
+        * khtml/dom/dom_node.h: Added more KHTML_NO_CPLUSPLUS_DOM checks so we don't include any
+        headers when including this file.
+
+        * khtml/ecma/kjs_binding.cpp:
+        (KJS::DOMObject::get): Removed exception-handling code. Now we can eliminate tryGet altogether.
+        (KJS::DOMObject::put): Ditto.
+        (KJS::DOMFunction::get): Ditto.
+        (KJS::DOMFunction::call): Ditto.
+
+        * khtml/editing/visible_text.h: Added an include of <qstring.h>.
+
+        * khtml/misc/loader.h: Added isKHTMLLoader.
+        * khtml/misc/loader.cpp: (Loader::isKHTMLLoader): Added. Poor-man's replacement for dynamic_cast.
+
+        * khtml/rendering/render_form.h:
+        * khtml/rendering/render_form.cpp: (RenderFormElement::slotTextChanged): Added. Hack to make KWQSlot work
+        for this function.
+
+        * khtml/xml/dom2_rangeimpl.h: Added a forward declaration of class DOMString, needed now that the C++
+        DOM wrappers aren't defining it.
+
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::defaultEventHandler): Changed to call handleEventImpl so we don't have to make the
+        C++ DOM wrapper for the event.
+        * khtml/xml/dom_nodeimpl.cpp:
+        (NodeImpl::handleLocalEvents): Ditto.
+        (ContainerNodeImpl::insertBefore): Used SharedPtr<NodeImpl> rather than Node to protect the child node.
+        (ContainerNodeImpl::replaceChild): Ditto.
+        (ContainerNodeImpl::appendChild): Ditto.
+        (ContainerNodeImpl::addChild): Ditto.
+
+        * kwq/DOM.mm:
+        (ObjCNodeFilterCondition::acceptNode): Update to add a KHTML_NO_CPLUSPLUS_DOM check since FilterCondition
+        has a different API depending on the state.
+        (-[DOMDocument createNodeIterator::::]): Rewrote to use NodeFilterImpl instead of NodeFilter.
+        (-[DOMDocument createTreeWalker::::]): Ditto.
+
+        * kwq/KWQAccObject.mm:
+        (-[KWQAccObject role]): Use identifier instead of casting to Node and using elementId.
+        (-[KWQAccObject title]): Ditto.
+        (-[KWQAccObject accessibilityIsIgnored]): Ditto.
+        (-[KWQAccObject rendererForView:]): Ditto.
+
+        * kwq/KWQFrame.mm: (QFrame::setFrameStyle): Use isKHTMLView instead of dynamic_cast.
+
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::currentForm): Use focusNode instead of activeNode.
+        (KWQKHTMLPart::nextKeyViewInFrame): Use isWidget instead of dynamic_cast.
+        (KWQKHTMLPart::currentEventIsMouseDownInWidget): Use KHTMLView's nodeUnderMouse instead of our public one
+        that uses a DOM C++ wrapper.
+        (KWQKHTMLPart::partForWidget): Use isKHTMLView instead of dynamic_cast.
+        (KWQKHTMLPart::passSubframeEventToSubframe): Use isWidget instead of dynamic_cast.
+
+        * kwq/KWQObject.h: Made isXXX functions all public since we use them in a few more places now.
+        Also added isKHTMLLoader.
+        * kwq/KWQObject.mm: (QObject::isKHTMLLoader): Added. Returns false by default.
+
+        * kwq/KWQSlot.mm: Removed all uses of dynamic_cast.
+
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge stringForRange:]): Used plainText instead of text.
+        (-[WebCoreBridge copyRenderNode:copier:]): Used isWidget instead of dynamic_cast.
+
 2005-05-16  Darin Adler  <darin@apple.com>
 
         - attempt to get things building under "Saffron" development tools
index 9f86bc0e3ee8903d495a65f811c5356aa776f1ac..99f238e5fe19170ccbb180fa0b6b2c4532b7882b 100644 (file)
                                GCC_OPTIMIZATION_LEVEL = s;
                                GCC_PRECOMPILE_PREFIX_HEADER = YES;
                                GCC_PREFIX_HEADER = WebCorePrefix.h;
-                               GCC_PREPROCESSOR_DEFINITIONS = "$(DEBUG_DEFINES) APPLE_CHANGES";
+                               GCC_PREPROCESSOR_DEFINITIONS = "$(DEBUG_DEFINES) APPLE_CHANGES KHTML_NO_CPLUSPLUS_DOM";
                                GCC_TREAT_WARNINGS_AS_ERRORS = YES;
                                GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
                                GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
                                93F198B408245E59001E9ABC,
                                93F198B508245E59001E9ABC,
                                93F198B608245E59001E9ABC,
-                               93F198B708245E59001E9ABC,
-                               93F198B808245E59001E9ABC,
-                               93F198B908245E59001E9ABC,
-                               93F198BA08245E59001E9ABC,
                                93F198BB08245E59001E9ABC,
-                               93F198BC08245E59001E9ABC,
                                93F198BD08245E59001E9ABC,
                                93F198BE08245E59001E9ABC,
                                93F198BF08245E59001E9ABC,
-                               93F198C008245E59001E9ABC,
-                               93F198C108245E59001E9ABC,
                                93F198C208245E59001E9ABC,
                                93F198C308245E59001E9ABC,
                                93F198C408245E59001E9ABC,
                        settings = {
                        };
                };
-               93F198B708245E59001E9ABC = {
-                       fileRef = F523D1A302DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F198B808245E59001E9ABC = {
-                       fileRef = F523D18B02DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F198B908245E59001E9ABC = {
-                       fileRef = F523D18D02DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F198BA08245E59001E9ABC = {
-                       fileRef = F523D18F02DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
                93F198BB08245E59001E9ABC = {
                        fileRef = F523D19002DE4322018635CA;
                        isa = PBXBuildFile;
                        settings = {
                        };
                };
-               93F198BC08245E59001E9ABC = {
-                       fileRef = F523D19102DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
                93F198BD08245E59001E9ABC = {
                        fileRef = F523D19302DE4322018635CA;
                        isa = PBXBuildFile;
                        settings = {
                        };
                };
-               93F198C008245E59001E9ABC = {
-                       fileRef = F523D19902DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F198C108245E59001E9ABC = {
-                       fileRef = F523D19B02DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
                93F198C208245E59001E9ABC = {
                        fileRef = F523D1A502DE4322018635CA;
                        isa = PBXBuildFile;
                                93F19A6608245E59001E9ABC,
                                93F19A6708245E59001E9ABC,
                                93F19A6808245E59001E9ABC,
-                               93F19A6908245E59001E9ABC,
-                               93F19A6A08245E59001E9ABC,
-                               93F19A6B08245E59001E9ABC,
-                               93F19A6C08245E59001E9ABC,
-                               93F19A6D08245E59001E9ABC,
                                93F19A6E08245E59001E9ABC,
-                               93F19A6F08245E59001E9ABC,
                                93F19A7008245E59001E9ABC,
-                               93F19A7108245E59001E9ABC,
-                               93F19A7208245E59001E9ABC,
                                93F19A7308245E59001E9ABC,
-                               93F19A7408245E59001E9ABC,
                                93F19A7508245E59001E9ABC,
-                               93F19A7608245E59001E9ABC,
-                               93F19A7708245E59001E9ABC,
-                               93F19A7808245E59001E9ABC,
-                               93F19A7908245E59001E9ABC,
-                               93F19A7A08245E59001E9ABC,
-                               93F19A7B08245E59001E9ABC,
-                               93F19A7C08245E59001E9ABC,
-                               93F19A7D08245E59001E9ABC,
-                               93F19A7E08245E59001E9ABC,
-                               93F19A7F08245E59001E9ABC,
-                               93F19A8008245E59001E9ABC,
-                               93F19A8108245E59001E9ABC,
-                               93F19A8208245E59001E9ABC,
                                93F19A8308245E59001E9ABC,
                                93F19A8408245E59001E9ABC,
                                93F19A8508245E59001E9ABC,
                        settings = {
                        };
                };
-               93F19A6908245E59001E9ABC = {
-                       fileRef = F523D18502DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F19A6A08245E59001E9ABC = {
-                       fileRef = F523D18702DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F19A6B08245E59001E9ABC = {
-                       fileRef = F523D18902DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F19A6C08245E59001E9ABC = {
-                       fileRef = F523D18C02DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F19A6D08245E59001E9ABC = {
-                       fileRef = F523D18E02DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
                93F19A6E08245E59001E9ABC = {
                        fileRef = F523D19202DE4322018635CA;
                        isa = PBXBuildFile;
                        settings = {
                        };
                };
-               93F19A6F08245E59001E9ABC = {
-                       fileRef = F523D19402DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
                93F19A7008245E59001E9ABC = {
                        fileRef = F523D19602DE4322018635CA;
                        isa = PBXBuildFile;
                        settings = {
                        };
                };
-               93F19A7108245E59001E9ABC = {
-                       fileRef = F523D19802DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F19A7208245E59001E9ABC = {
-                       fileRef = F523D19A02DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
                93F19A7308245E59001E9ABC = {
                        fileRef = F523D19C02DE4322018635CA;
                        isa = PBXBuildFile;
                        settings = {
                        };
                };
-               93F19A7408245E59001E9ABC = {
-                       fileRef = F523D19E02DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
                93F19A7508245E59001E9ABC = {
                        fileRef = F523D1A002DE4322018635CA;
                        isa = PBXBuildFile;
                        settings = {
                        };
                };
-               93F19A7608245E59001E9ABC = {
-                       fileRef = F523D1A202DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F19A7708245E59001E9ABC = {
-                       fileRef = F523D1A402DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F19A7808245E59001E9ABC = {
-                       fileRef = F523D1A602DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F19A7908245E59001E9ABC = {
-                       fileRef = F523D1A802DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F19A7A08245E59001E9ABC = {
-                       fileRef = F523D1AA02DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F19A7B08245E59001E9ABC = {
-                       fileRef = F523D1AC02DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F19A7C08245E59001E9ABC = {
-                       fileRef = F523D1AE02DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F19A7D08245E59001E9ABC = {
-                       fileRef = F523D1B002DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F19A7E08245E59001E9ABC = {
-                       fileRef = F523D1B202DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F19A7F08245E59001E9ABC = {
-                       fileRef = F523D1B402DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F19A8008245E59001E9ABC = {
-                       fileRef = F523D1B602DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F19A8108245E59001E9ABC = {
-                       fileRef = F523D1B802DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
-               93F19A8208245E59001E9ABC = {
-                       fileRef = F523D1BA02DE4322018635CA;
-                       isa = PBXBuildFile;
-                       settings = {
-                       };
-               };
                93F19A8308245E59001E9ABC = {
                        fileRef = F523D1F402DE4369018635CA;
                        isa = PBXBuildFile;
index 4f29ff208774bbaa904dc38b038d60eadfa07592..6336b7007a607bb1177363dacfb118fd47713173 100644 (file)
  * Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved.
  *
  */
+
 #ifndef _CSS_css_stylesheet_h_
 #define _CSS_css_stylesheet_h_
 
+#if !KHTML_NO_CPLUSPLUS_DOM
+
 #include <dom/dom_string.h>
 #include <dom/dom_node.h>
 #include <dom/dom_misc.h>
 
+#endif
 
 namespace DOM {
 
index 4e5e5fb0c483f511daa89c01471d2e7dd8ed7123..83b6309ad8d8d09aac7e43ac863efcd25e922713 100644 (file)
 
 #include "dom/dom2_events.h"
 
+#include "xml/dom2_eventsimpl.h"
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
 #include "dom/dom2_views.h"
 #include "dom/dom_exception.h"
-#include "xml/dom2_eventsimpl.h"
+
+#endif
 
 using namespace DOM;
 
@@ -58,6 +63,8 @@ DOMString EventListener::eventListenerType()
 
 // -----------------------------------------------------------------------------
 
+#if !KHTML_NO_CPLUSPLUS_DOM
+
 Event::Event()
 {
     impl = 0;
@@ -763,3 +770,4 @@ void KeyboardEvent::initKeyboardEvent(const DOMString &typeArg,
         shiftKeyArg,metaKeyArg,altGraphKeyArg);
 }
                                     
+#endif
index 2631140f3246521023d5d97b28bfbfec80703543..4117ad4961177e4f3c35847a1240694acab040d3 100644 (file)
 #ifndef _DOM_Events_h_
 #define _DOM_Events_h_
 
-#include <dom/dom_node.h>
 #include <dom/dom_misc.h>
+#include <dom/dom_string.h>
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
+#include <dom/dom_node.h>
+
+#endif
 
 namespace DOM {
 
+#if !KHTML_NO_CPLUSPLUS_DOM
+
 class Event;
 class EventException;
 class UIEvent;
@@ -37,13 +45,16 @@ class MutationEvent;
 class KeyboardEvent;
 class AbstractView;
 
-class EventListenerImpl;
-class EventImpl;
 class UIEventImpl;
 class MouseEventImpl;
 class MutationEventImpl;
 class KeyboardEventImpl;
 
+#endif
+
+class EventListenerImpl;
+class EventImpl;
+
 #if KHTML_NO_CPLUSPLUS_DOM
 typedef EventImpl *EventListenerEvent;
 #else
@@ -728,9 +739,10 @@ class KeyboardEvent
 
 {
 
+public:
+
 #if !KHTML_NO_CPLUSPLUS_DOM
 
-public:
     KeyboardEvent();
     KeyboardEvent(const KeyboardEvent &other);
     KeyboardEvent(const Event &other);
index 81279aee19ad5b0bf79624f598d21b4a3f0a8cf0..53eb8e4d118de8a24c36f709b09e4b01d8652c1e 100644 (file)
 #ifndef _dom2_range_h_
 #define _dom2_range_h_
 
+#include <dom/dom_node.h>
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
 #include <dom/dom_doc.h>
 #include <dom/dom_misc.h>
 
+#endif
+
 namespace DOM {
 
+#if !KHTML_NO_CPLUSPLUS_DOM
+
 class DocumentFragment;
 class Node;
 class DOMString;
@@ -44,9 +52,14 @@ class RangeImpl;
 
 class DOMException;
 
+#endif
+
 // Introduced in DOM Level 2:
 class RangeException {
 public:
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
     RangeException(unsigned short _code) { code = _code; }
     RangeException(const RangeException &other) { code = other.code; }
 
@@ -54,6 +67,9 @@ public:
        { code = other.code; return *this; }
 
     virtual ~RangeException() {}
+
+#endif
+
     /**
      * An integer indicating the type of error generated.
      *
@@ -64,16 +80,29 @@ public:
         _EXCEPTION_OFFSET              = 2000,
         _EXCEPTION_MAX                 = 2999
     };
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
     unsigned short code;
-};
 
+#endif
+};
 
 class Range
 {
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
     friend class DocumentImpl;
     friend class Document;
     friend class RangeImpl;
+
+#endif
+
 public:
+
+#if !KHTML_NO_CPLUSPLUS_DOM
+
     Range();
     Range(const Document rootContainer);
     Range(const Range &other);
@@ -272,6 +301,8 @@ public:
      */
     void selectNodeContents ( const Node &refNode );
 
+#endif
+
     enum CompareHow {
        START_TO_START = 0,
        START_TO_END = 1,
@@ -279,6 +310,8 @@ public:
        END_TO_START = 3
     };
 
+#if !KHTML_NO_CPLUSPLUS_DOM
+
     /**
      * Compare the end-points of two ranges in a document.
      *
@@ -472,6 +505,9 @@ protected:
 
 private:
     void throwException(int exceptioncode) const;
+
+#endif
+
 };
 
 // Used determine how to interpret the offsets used in DOM Ranges.
index ce15be86119d11ab37a76075f1a678bf1ff78f59..3836b315a69856c7b6a9109198393ce9876e9074 100644 (file)
 
 #include "dom/dom2_traversal.h"
 
+#if !KHTML_NO_CPLUSPLUS_DOM
+
 #include "dom/dom_exception.h"
 #include "dom/dom_string.h"
 #include "xml/dom2_traversalimpl.h"
 
+#endif
+
 namespace DOM {
 
 // --------------------------------------------------------------
 
-short NodeFilterCondition::acceptNode(const Node &) const
+short NodeFilterCondition::acceptNode(FilterNode) const
 {
     return NodeFilter::FILTER_ACCEPT;
 }
 
 // --------------------------------------------------------------
 
+#if !KHTML_NO_CPLUSPLUS_DOM
+
 NodeFilter::NodeFilter() : impl(0)
 {
 }
@@ -345,5 +351,6 @@ Node TreeWalker::nextNode()
     return 0;
 }
 
-} // namespace DOM
+#endif
 
+} // namespace DOM
index 156064dd467a8bd1e2c5276b4c853dd4823c4c51..a94af2ab6298cc45e59004b8c4ff797e0b530122 100644 (file)
 #ifndef _DOM_Node_h_
 #define _DOM_Node_h_
 
+#if !KHTML_NO_CPLUSPLUS_DOM
+
 #include <qstring.h>
 
 class QRect;
 
+#endif
+
 namespace DOM {
 
 #if !KHTML_NO_CPLUSPLUS_DOM
index 666a2ab302228379d1bb4e42e2c22e141a5104c1..f5b8268768d5dc413bb951a84625fd4ad1459426 100644 (file)
@@ -30,6 +30,7 @@
 #include "dom/dom2_range.h"
 #include "xml/dom_nodeimpl.h"
 #include "xml/dom2_eventsimpl.h"
+#include "dom/css_stylesheet.h"
 
 #include <kdebug.h>
 
@@ -50,41 +51,13 @@ namespace KJS {
 
 Value DOMObject::get(ExecState *exec, const Identifier &p) const
 {
-  Value result;
-  try {
-    result = tryGet(exec,p);
-  }
-  catch (DOM::DOMException e) {
-    // ### translate code into readable string ?
-    // ### oh, and s/QString/i18n or I18N_NOOP (the code in kjs uses I18N_NOOP... but where is it translated ?)
-    //     and where does it appear to the user ?
-    Object err = Error::create(exec, GeneralError, QString("DOM exception %1").arg(e.code).local8Bit());
-    err.put(exec, "code", Number(e.code));
-    exec->setException( err );
-    result = Undefined();
-  }
-  catch (...) {
-    kdError(6070) << "Unknown exception in DOMObject::get()" << endl;
-    result = String("Unknown exception");
-  }
-
-  return result;
+  return tryGet(exec,p);
 }
 
 void DOMObject::put(ExecState *exec, const Identifier &propertyName,
                     const Value &value, int attr)
 {
-  try {
-    tryPut(exec, propertyName, value, attr);
-  }
-  catch (DOM::DOMException e) {
-    Object err = Error::create(exec, GeneralError, QString("DOM exception %1").arg(e.code).local8Bit());
-    err.put(exec, "code", Number(e.code));
-    exec->setException(err);
-  }
-  catch (...) {
-    kdError(6070) << "Unknown exception in DOMObject::put()" << endl;
-  }
+  tryPut(exec, propertyName, value, attr);
 }
 
 UString DOMObject::toString(ExecState *) const
@@ -94,57 +67,12 @@ UString DOMObject::toString(ExecState *) const
 
 Value DOMFunction::get(ExecState *exec, const Identifier &propertyName) const
 {
-  Value result;
-  try {
-    result = tryGet(exec, propertyName);
-  }
-  catch (DOM::DOMException e) {
-    result = Undefined();
-    Object err = Error::create(exec, GeneralError, QString("DOM exception %1").arg(e.code).local8Bit());
-    err.put(exec, "code", Number(e.code));
-    exec->setException(err);
-  }
-  catch (...) {
-    kdError(6070) << "Unknown exception in DOMFunction::get()" << endl;
-    result = String("Unknown exception");
-  }
-
-  return result;
+  return tryGet(exec, propertyName);
 }
 
 Value DOMFunction::call(ExecState *exec, Object &thisObj, const List &args)
 {
-  Value val;
-  try {
-    val = tryCall(exec, thisObj, args);
-  }
-  // pity there's no way to distinguish between these in JS code
-  catch (DOM::DOMException e) {
-    Object err = Error::create(exec, GeneralError, QString("DOM Exception %1").arg(e.code).local8Bit());
-    err.put(exec, "code", Number(e.code));
-    exec->setException(err);
-  }
-  catch (DOM::RangeException e) {
-    Object err = Error::create(exec, GeneralError, QString("DOM Range Exception %1").arg(e.code).local8Bit());
-    err.put(exec, "code", Number(e.code));
-    exec->setException(err);
-  }
-  catch (DOM::CSSException e) {
-    Object err = Error::create(exec, GeneralError, QString("CSS Exception %1").arg(e.code).local8Bit());
-    err.put(exec, "code", Number(e.code));
-    exec->setException(err);
-  }
-  catch (DOM::EventException e) {
-    Object err = Error::create(exec, GeneralError, QString("DOM Event Exception %1").arg(e.code).local8Bit());
-    err.put(exec, "code", Number(e.code));
-    exec->setException(err);
-  }
-  catch (...) {
-    kdError(6070) << "Unknown exception in DOMFunction::call()" << endl;
-    Object err = Error::create(exec, GeneralError, "Unknown exception");
-    exec->setException(err);
-  }
-  return val;
+  return tryCall(exec, thisObj, args);
 }
 
 static QPtrDict<DOMObject> * staticDomObjects = 0;
index 762b89c5a5b9f6b63021321e896b71bbe16b5b5f..d8830145830077cfec265628a0b85ddb33eec8ce 100644 (file)
@@ -28,6 +28,8 @@
 
 #include "xml/dom2_rangeimpl.h"
 
+#include <qstring.h>
+
 namespace khtml {
 
 class InlineTextBox;
index 552f87c72def7112b037dee350724cc942bfaa12..d548d38c6df4a3ec0ce26d2a9755119f61590f0a 100644 (file)
@@ -1787,6 +1787,15 @@ KIO::Job *Loader::jobForRequest( const DOM::DOMString &url ) const
     return 0;
 }
 
+#if APPLE_CHANGES
+
+bool Loader::isKHTMLLoader() const
+{
+    return true;
+}
+
+#endif
+
 // ----------------------------------------------------------------------------
 
 
index bb6df85f43167496a7ccbc39c5f5f39eb94ca938..ac1a6a070186b7ef0dcc5c0a21fbcef81248b9f1 100644 (file)
@@ -569,6 +569,10 @@ protected:
     private:
        void servePendingRequests();
 
+#if APPLE_CHANGES
+        virtual bool isKHTMLLoader() const;
+#endif
+
        QPtrList<Request> m_requestsPending;
        QPtrDict<Request> m_requestsLoading;
 
index 60a3995868ded3f4d0e594734ebbbe5e48f2fecb..3db091bc775ab381fd4326ec6d12e07e0f047530 100644 (file)
@@ -251,6 +251,11 @@ void RenderFormElement::addIntrinsicMarginsIfAllowed(RenderStyle* _style)
     }
 }
 
+void RenderFormElement::slotTextChanged(const QString &)
+{
+    // do nothing
+}
+
 #endif
 
 // -------------------------------------------------------------------------
index 7eb006bda1640e49135beb5f1ce94d196217b904..a3a3602f6f1b54f56f7e8d6c4ed68d331366475d 100644 (file)
@@ -105,6 +105,11 @@ public:
 public slots:
     virtual void slotClicked();
 
+#if APPLE_CHANGES
+    // Hack to make KWQSlot code work.
+    virtual void slotTextChanged(const QString &string);
+#endif
+
 protected:
     virtual bool isRenderButton() const { return false; }
     virtual bool isEditable() const { return false; }
index 570dcc8fbf673e1e2b2a94ccd65542a3d69b91c3..837136733e5636c15994840fcc18a69ea9d4f584 100644 (file)
@@ -35,6 +35,7 @@ namespace DOM {
 
 class DocumentFragmentImpl;
 class DocumentPtr;
+class DOMString;
 class NodeImpl;
 class Position;
 
index 55b0539e1aab8813c81cc6f6e466a4a747a59221..9a2483add847c230ab8633b0a86f8dff2dcdb1da 100644 (file)
@@ -2683,10 +2683,9 @@ void DocumentImpl::defaultEventHandler(EventImpl *evt)
     // if any html event listeners are registered on the window, then dispatch them here
     QPtrList<RegisteredEventListener> listenersCopy = m_windowEventListeners;
     QPtrListIterator<RegisteredEventListener> it(listenersCopy);
-    Event ev(evt);
     for (; it.current(); ++it) {
         if (it.current()->id == evt->id()) {
-            it.current()->listener->handleEvent(ev, true);
+            it.current()->listener->handleEventImpl(evt, true);
        }
     }
 
index ca25db0633d7acb1c8abde24e1d4abf12443e981..5cecbd451442749df102ad7f849c3589ab8f6172 100644 (file)
@@ -906,10 +906,9 @@ void NodeImpl::handleLocalEvents(EventImpl *evt, bool useCapture)
 
     QPtrList<RegisteredEventListener> listenersCopy = *m_regdListeners;
     QPtrListIterator<RegisteredEventListener> it(listenersCopy);
-    Event ev = evt;
     for (; it.current(); ++it) {
         if (it.current()->id == evt->id() && it.current()->useCapture == useCapture) {
-            it.current()->listener->handleEvent(ev, false);
+            it.current()->listener->handleEventImpl(evt, false);
         }
     }
 
@@ -1726,7 +1725,7 @@ NodeImpl *ContainerNodeImpl::insertBefore ( NodeImpl *newChild, NodeImpl *refChi
     if(!refChild)
         return appendChild(newChild, exceptioncode);
 
-    Node protectNewChild(newChild); // make sure the new child is ref'd and deref'd so we don't leak it
+    SharedPtr<NodeImpl> protectNewChild(newChild); // make sure the new child is ref'd and deref'd so we don't leak it
 
     // Make sure adding the new child is ok
     checkAddChild(newChild, exceptioncode);
@@ -1795,7 +1794,7 @@ NodeImpl *ContainerNodeImpl::replaceChild ( NodeImpl *newChild, NodeImpl *oldChi
 {
     exceptioncode = 0;
 
-    Node protectNewChild(newChild); // make sure the new child is ref'd and deref'd so we don't leak it
+    SharedPtr<NodeImpl> protectNewChild(newChild); // make sure the new child is ref'd and deref'd so we don't leak it
 
     if ( oldChild == newChild ) // nothing to do
        return oldChild;
@@ -1957,7 +1956,7 @@ NodeImpl *ContainerNodeImpl::appendChild ( NodeImpl *newChild, int &exceptioncod
 {
     exceptioncode = 0;
 
-    Node protectNewChild(newChild); // make sure the new child is ref'd and deref'd so we don't leak it
+    SharedPtr<NodeImpl> protectNewChild(newChild); // make sure the new child is ref'd and deref'd so we don't leak it
 
     // Make sure adding the new child is ok
     checkAddChild(newChild, exceptioncode);
@@ -2065,7 +2064,7 @@ NodeImpl *ContainerNodeImpl::addChild(NodeImpl *newChild)
 {
     // do not add applyChanges here! This function is only used during parsing
 
-    Node protectNewChild(newChild); // make sure the new child is ref'd and deref'd so we don't leak it
+    SharedPtr<NodeImpl> protectNewChild(newChild); // make sure the new child is ref'd and deref'd so we don't leak it
 
     // short check for consistency with DTD
     if(!isXMLElementNode() && !newChild->isXMLElementNode() && !childAllowed(newChild))
index 85b47d99f3f2aef26da370a61bc5a5ed47c3ef12..645e433d9926364b6b57c9c9746a217c0f54e50c 100644 (file)
 #import "KWQFoundationExtras.h"
 #import "KWQKHTMLPart.h"
 
-// Temporary: Remove when the real FilterNode is checked in.
-namespace DOM {
-    typedef const Node &FilterNode;
-}
-
-using DOM::Attr;
 using DOM::AttrImpl;
 using DOM::CharacterDataImpl;
 using DOM::DocumentFragmentImpl;
@@ -74,12 +68,10 @@ using DOM::DocumentImpl;
 using DOM::DOMImplementationImpl;
 using DOM::DOMString;
 using DOM::DOMStringImpl;
-using DOM::Element;
 using DOM::ElementImpl;
 using DOM::EntityImpl;
 using DOM::FilterNode;
 using DOM::HTMLElementImpl;
-using DOM::NamedNodeMap;
 using DOM::NamedNodeMapImpl;
 using DOM::Node;
 using DOM::NodeFilter;
@@ -2197,32 +2189,46 @@ ObjCNodeFilterCondition::~ObjCNodeFilterCondition()
 
 short ObjCNodeFilterCondition::acceptNode(FilterNode n) const
 {
-    if (n.isNull())
+#if KHTML_NO_CPLUSPLUS_DOM
+    NodeImpl *node = n;
+#else
+    NodeImpl *node = n.handle();
+#endif
+    if (!node)
         return NodeFilter::FILTER_REJECT;
-
-    return [m_filter acceptNode:[DOMNode _nodeWithImpl:n.handle()]];
+    return [m_filter acceptNode:[DOMNode _nodeWithImpl:node]];
 }
 
 @implementation DOMDocument (DOMDocumentTraversal)
 
 - (DOMNodeIterator *)createNodeIterator:(DOMNode *)root :(unsigned long)whatToShow :(id <DOMNodeFilter>)filter :(BOOL)expandEntityReferences
 {
-    NodeFilter cppFilter;
-    if (filter)
-        cppFilter = NodeFilter(new ObjCNodeFilterCondition(filter));
+    NodeFilterImpl *cppFilter = 0;
+    if (filter) {
+        cppFilter = new NodeFilterImpl(new ObjCNodeFilterCondition(filter));
+        cppFilter->ref();
+    }
     int exceptionCode = 0;
-    NodeIteratorImpl *impl = [self _documentImpl]->createNodeIterator([root _nodeImpl], whatToShow, cppFilter.handle(), expandEntityReferences, exceptionCode);
+    NodeIteratorImpl *impl = [self _documentImpl]->createNodeIterator([root _nodeImpl], whatToShow, cppFilter, expandEntityReferences, exceptionCode);
+    if (cppFilter) {
+        cppFilter->deref();
+    }
     raiseOnDOMError(exceptionCode);
     return [DOMNodeIterator _nodeIteratorWithImpl:impl filter:filter];
 }
 
 - (DOMTreeWalker *)createTreeWalker:(DOMNode *)root :(unsigned long)whatToShow :(id <DOMNodeFilter>)filter :(BOOL)expandEntityReferences
 {
-    NodeFilter cppFilter;
-    if (filter)
-        cppFilter = NodeFilter(new ObjCNodeFilterCondition(filter));
+    NodeFilterImpl *cppFilter;
+    if (filter) {
+        cppFilter = new NodeFilterImpl(new ObjCNodeFilterCondition(filter));
+        cppFilter->ref();
+    }
     int exceptionCode = 0;
-    TreeWalkerImpl *impl = [self _documentImpl]->createTreeWalker([root _nodeImpl], whatToShow, cppFilter.handle(), expandEntityReferences, exceptionCode);
+    TreeWalkerImpl *impl = [self _documentImpl]->createTreeWalker([root _nodeImpl], whatToShow, cppFilter, expandEntityReferences, exceptionCode);
+    if (cppFilter) {
+        cppFilter->deref();
+    }
     raiseOnDOMError(exceptionCode);
     return [DOMTreeWalker _treeWalkerWithImpl:impl filter:filter];
 }
index e99161d66022c62fd5231efba0cc27dcd24e76fc..834126d5fcbf2cff81037b05700a58e909853dcd 100644 (file)
@@ -373,8 +373,7 @@ extern "C" void NSAccessibilityUnregisterUniqueIdForUIElement(id element);
     }
     if (m_renderer->isListMarker())
         return @"AXListMarker";
-    if (m_renderer->element() && m_renderer->element()->isHTMLElement() &&
-        Node(m_renderer->element()).elementId() == ID_BUTTON)
+    if (m_renderer->element() && m_renderer->element()->identifier() == ID_BUTTON)
         return NSAccessibilityButtonRole;
     if (m_renderer->isText())
         return NSAccessibilityStaticTextRole;
@@ -540,7 +539,7 @@ extern "C" void NSAccessibilityUnregisterUniqueIdForUIElement(id element);
     if (!m_renderer || m_areaElement || !m_renderer->element())
         return nil;
     
-    if (m_renderer->element()->isHTMLElement() && Node(m_renderer->element()).elementId() == ID_BUTTON)
+    if (m_renderer->element()->isHTMLElement() && m_renderer->element()->identifier() == ID_BUTTON)
         return [self textUnderElement];
     if (m_renderer->element()->isLink())
         return [self textUnderElement];
@@ -630,7 +629,7 @@ static QRect boundingBoxRect(RenderObject* obj)
     return (!m_renderer->isListMarker() && !m_renderer->isCanvas() && 
             !m_renderer->isImage() &&
             !(m_renderer->element() && m_renderer->element()->isHTMLElement() &&
-              Node(m_renderer->element()).elementId() == ID_BUTTON));
+              m_renderer->element()->identifier() == ID_BUTTON));
 }
 
 - (NSArray *)accessibilityAttributeNames
@@ -1870,7 +1869,7 @@ static void AXAttributedStringAppendReplaced (NSMutableAttributedString *attrStr
     if (!part)
         return NULL;
         
-    DocumentImpl *document = static_cast<DocumentImpl *>(part->document().handle());
+    DocumentImpl *document = part->xmlDocImpl();
     if (!document)
         return NULL;
         
index e151234ffeaeb849d7954924e2b38e8e8f92f5e1..75b80d1a090523014f1467552ad818a7cb4f3acd 100644 (file)
@@ -35,10 +35,8 @@ void QFrame::setFrameStyle(int s)
     _frameStyle = s;
 
     // Tell the other side of the bridge about the frame style change.
-    KHTMLView *view = dynamic_cast<KHTMLView *>(this);
-    if (view) {
-        KHTMLPart *part = view->part();
-        if (part) {
+    if (isKHTMLView()) {
+        if (KHTMLPart *part = static_cast<KHTMLView *>(this)->part()) {
            KWQ_BLOCK_EXCEPTIONS;
             [KWQ(part)->bridge() setHasBorder:(s != NoFrame)];
            KWQ_UNBLOCK_EXCEPTIONS;
index 7a45310469f18b5753c9793b314e3b36fa6cce5f..408d5c56947942fda74f8ecf994bc096655b3469 100644 (file)
@@ -129,7 +129,6 @@ using khtml::RenderImage;
 using khtml::RenderLayer;
 using khtml::RenderListItem;
 using khtml::RenderObject;
-using khtml::RenderPart;
 using khtml::RenderStyle;
 using khtml::RenderTableCell;
 using khtml::RenderText;
@@ -383,7 +382,7 @@ static HTMLFormElementImpl *scanForForm(NodeImpl *start)
 HTMLFormElementImpl *KWQKHTMLPart::currentForm() const
 {
     // start looking either at the active (first responder) node, or where the selection is
-    NodeImpl *start = activeNode().handle();
+    NodeImpl *start = d->m_doc ? d->m_doc->focusNode() : 0;
     if (!start) {
         start = selectionStart();
     }
@@ -1220,10 +1219,11 @@ NSView *KWQKHTMLPart::nextKeyViewInFrame(NodeImpl *node, KWQSelectionDirection d
         if (!node) {
             return nil;
         }
-        RenderWidget *renderWidget = dynamic_cast<RenderWidget *>(node->renderer());
-        if (renderWidget) {
+        RenderObject *renderer = node->renderer();
+        if (renderer->isWidget()) {
+            RenderWidget *renderWidget = static_cast<RenderWidget *>(renderer);
             QWidget *widget = renderWidget->widget();
-            KHTMLView *childFrameWidget = dynamic_cast<KHTMLView *>(widget);
+            KHTMLView *childFrameWidget = widget->isKHTMLView() ? static_cast<KHTMLView *>(widget) : 0;
             NSView *view = nil;
             if (childFrameWidget) {
                 view = KWQ(childFrameWidget->part())->nextKeyViewInFrame(0, direction);
@@ -1315,7 +1315,7 @@ bool KWQKHTMLPart::currentEventIsMouseDownInWidget(QWidget *candidate)
     
     NodeImpl *node = nodeForWidget(candidate);
     ASSERT(node);
-    return partForNode(node)->nodeUnderMouse() == node;
+    return partForNode(node)->d->m_view->nodeUnderMouse() == node;
 }
 
 bool KWQKHTMLPart::currentEventIsKeyboardOptionTab()
@@ -1621,9 +1621,8 @@ KWQKHTMLPart *KWQKHTMLPart::partForWidget(const QWidget *widget)
     }
     
     // Assume all widgets are either form controls, or KHTMLViews.
-    const KHTMLView *view = dynamic_cast<const KHTMLView *>(widget);
-    ASSERT(view);
-    return KWQ(view->part());
+    ASSERT(widget->isKHTMLView());
+    return KWQ(static_cast<const KHTMLView *>(widget)->part());
 }
 
 WebCoreBridge *KWQKHTMLPart::bridgeForWidget(const QWidget *widget)
@@ -2535,11 +2534,11 @@ bool KWQKHTMLPart::passSubframeEventToSubframe(NodeImpl::MouseEvent &event)
             if (!node) {
                 return false;
             }
-            RenderPart *renderPart = dynamic_cast<RenderPart *>(node->renderer());
-            if (!renderPart) {
+            RenderObject *renderer = node->renderer();
+            if (!renderer || !renderer->isWidget()) {
                 return false;
             }
-            if (!passWidgetMouseDownEventToWidget(renderPart)) {
+            if (!passWidgetMouseDownEventToWidget(static_cast<RenderWidget *>(renderer))) {
                 return false;
             }
             _mouseDownWasInSubframe = true;
index e785d27842d30b5e661dda94074955e7bb6aeee8..f06fda2f074f41be5af32ff5747ccbad956f7999 100644 (file)
@@ -109,6 +109,13 @@ public:
     static bool defersTimers() { return _defersTimers; }
     static void setDefersTimers(bool defers);
 
+    virtual bool isKHTMLLoader() const;
+    virtual bool isKHTMLPart() const;
+    virtual bool isKHTMLView() const;
+    virtual bool isKPartsReadOnlyPart() const;
+    virtual bool isQFrame() const;
+    virtual bool isQScrollView() const;
+
 private:
     void _addTimer(NSTimer *timer, int _timerId);
 
@@ -130,12 +137,6 @@ private:
     
     static bool _defersTimers;
 
-    virtual bool isKHTMLPart() const;
-    virtual bool isKHTMLView() const;
-    virtual bool isKPartsReadOnlyPart() const;
-    virtual bool isQFrame() const;
-    virtual bool isQScrollView() const;
-
     friend class KWQGuardedPtrBase;
     friend class KWQSignal;
     friend class KWQObjectSenderScope;
index bef719442f3c9158ae2b4707309951e2cf974def..bf558ddd1317e1da2d5b361c1ad8af1a39a2b0c5 100644 (file)
@@ -383,6 +383,11 @@ bool QObject::inherits(const char *className) const
     return false;
 }
 
+bool QObject::isKHTMLLoader() const
+{
+    return false;
+}
+
 bool QObject::isKHTMLPart() const
 {
     return false;
index 1b3f754db1923f6382085a5a34835bef7be80870..740f0dfb0ffb04a789d9197f1156ae3f11825daa 100644 (file)
@@ -72,8 +72,7 @@ enum FunctionNumber {
     slotStateChanged,
     slotSubmitFormAgain,
     slotTextChanged,
-    slotTextChangedWithString_RenderLineEdit,
-    slotTextChangedWithString_RenderFileButton,
+    slotTextChangedWithString,
     slotValueChanged,
     slotWidgetDestructed,
     slotData_Loader,
@@ -90,7 +89,6 @@ KWQSlot::KWQSlot(QObject *object, const char *member)
 {
     #define CASE(function, parameters, type) \
         if (KWQNamesMatch(member, "SLOT:" #function #parameters)) { \
-            ASSERT(dynamic_cast<type *>(object)); \
             m_function = function; \
         } else
     
@@ -116,50 +114,36 @@ KWQSlot::KWQSlot(QObject *object, const char *member)
     #undef CASE
 
     if (KWQNamesMatch(member, SIGNAL(finishedParsing()))) {
-        ASSERT(dynamic_cast<DocumentImpl *>(object));
         m_function = signalFinishedParsing;
     } else if (KWQNamesMatch(member, SLOT(slotChildCompleted(bool)))) {
-        ASSERT(dynamic_cast<KHTMLPart *>(object));
         m_function = slotChildCompletedWithBool;
     } else if (KWQNamesMatch(member, SLOT(parentDestroyed()))) {
-        ASSERT(dynamic_cast<WindowQObject *>(object));
         m_function = slotParentDestroyed;
     } else if (KWQNamesMatch(member, SLOT(submitFormAgain()))) {
-        ASSERT(dynamic_cast<KHTMLPart *>(object));
         m_function = slotSubmitFormAgain;
     } else if (KWQNamesMatch(member, SLOT(slotTextChanged(const QString &)))) {
-        ASSERT(dynamic_cast<RenderLineEdit *>(object) || dynamic_cast<RenderFileButton *>(object));
-       if (dynamic_cast<RenderLineEdit *>(object)) {
-           m_function = slotTextChangedWithString_RenderLineEdit;
-       } else {
-           m_function = slotTextChangedWithString_RenderFileButton;
-       }
+        m_function = slotTextChangedWithString;
     } else if (KWQNamesMatch(member, SLOT(slotData(KIO::Job *, const char *, int)))) {
-       ASSERT(dynamic_cast<Loader *>(object) || dynamic_cast<XMLHttpRequestQObject *>(object));
-       if (dynamic_cast<Loader *>(object)) {
+       if (object->isKHTMLLoader()) {
            m_function = slotData_Loader;
        } else {
            m_function = slotData_XMLHttpRequest;
        }
     } else if (KWQNamesMatch(member, SLOT(slotRedirection(KIO::Job *, const KURL&)))) {
-       ASSERT(dynamic_cast<KHTMLPart *>(object) || dynamic_cast<XMLHttpRequestQObject *>(object));
-       if (dynamic_cast<KHTMLPart *>(object)) {
+       if (object->isKHTMLPart()) {
            m_function = slotRedirection_KHTMLPart;
        } else {
            m_function = slotRedirection_XMLHttpRequest;
        }
     } else if (KWQNamesMatch(member, SLOT(slotFinished(KIO::Job *, NSData *)))) {
-       ASSERT(dynamic_cast<khtml::Loader *>(object));
        m_function = slotFinished_Loader;        
     } else if (KWQNamesMatch(member, SLOT(slotFinished(KIO::Job *)))) {
-       ASSERT(dynamic_cast<KHTMLPart *>(object) || dynamic_cast<XMLHttpRequestQObject *>(object));
-       if (dynamic_cast<KHTMLPart *>(object)) {
+       if (object->isKHTMLPart()) {
            m_function = slotFinished_KHTMLPart;
        } else {
            m_function = slotFinished_XMLHttpRequest;
        }
     } else if (KWQNamesMatch(member, SLOT(slotReceivedResponse(KIO::Job *, NSURLResponse *)))) {
-       ASSERT(dynamic_cast<khtml::Loader *>(object));
        m_function = slotReceivedResponse;
     } else {
         ERROR("trying to create a slot for unknown member %s", member);
@@ -249,12 +233,9 @@ void KWQSlot::call(const QString &string) const
     }
     
     switch (m_function) {
-        case slotTextChangedWithString_RenderLineEdit:
-            static_cast<RenderLineEdit *>(m_object.pointer())->slotTextChanged(string);
+        case slotTextChangedWithString:
+            static_cast<RenderFormElement *>(m_object.pointer())->slotTextChanged(string);
            return;
-        case slotTextChangedWithString_RenderFileButton:
-            static_cast<RenderFileButton *>(m_object.pointer())->slotTextChanged(string);
-            return;
     }
     
     call();
index 4bd41fe199137aecf6839aef704308e78e0a44dd..1759a4e90a506497114510055c6b8d6a413ee87b 100644 (file)
@@ -96,7 +96,6 @@ using DOM::DocumentFragmentImpl;
 using DOM::DocumentImpl;
 using DOM::DocumentTypeImpl;
 using DOM::DOMString;
-using DOM::Element;
 using DOM::ElementImpl;
 using DOM::HTMLElementImpl;
 using DOM::HTMLFormElementImpl;
@@ -616,7 +615,7 @@ static bool initializedKJS = FALSE;
 
 - (NSString *)stringForRange:(DOMRange *)range
 {
-    QString text = _part->text([range _rangeImpl]);
+    QString text = plainText([range _rangeImpl]);
     text.replace(QChar('\\'), _part->backslashAsCurrencySymbol());
     return [[text.getNSString() copy] autorelease];
 }
@@ -804,8 +803,8 @@ static BOOL nowPrinting(WebCoreBridge *self)
           
     NSString *name = [[NSString alloc] initWithUTF8String:node->renderName()];
     
-    RenderPart *nodeRenderPart = dynamic_cast<RenderPart *>(node);
-    QWidget *widget = nodeRenderPart ? nodeRenderPart->widget() : 0;
+    RenderWidget *renderWidget = node->isWidget() ? static_cast<RenderWidget *>(node) : 0;
+    QWidget *widget = renderWidget ? renderWidget->widget() : 0;
     NSView *view = widget ? widget->getView() : nil;
     
     int nx, ny;