2006-09-14 Anders Carlsson <acarlsson@apple.com>
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Sep 2006 01:56:44 +0000 (01:56 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Sep 2006 01:56:44 +0000 (01:56 +0000)
        Reviewed by Tim O.

        Add USE defines for the generic JavaScriptCore bindings as well as NPAPI bindings.

        * bindings/js/kjs_binding.cpp:
        (KJS::ScriptInterpreter::createLanguageInstanceForValue):
        * bindings/js/kjs_dom.cpp:
        (KJS::getRuntimeObject):
        * bridge/mac/FrameMac.h:
        * config.h:
        * html/HTMLAppletElement.cpp:
        (WebCore::HTMLAppletElement::~HTMLAppletElement):
        (WebCore::HTMLAppletElement::detach):
        * html/HTMLAppletElement.h:
        * html/HTMLEmbedElement.cpp:
        (WebCore::HTMLEmbedElement::~HTMLEmbedElement):
        (WebCore::HTMLEmbedElement::detach):
        * html/HTMLEmbedElement.h:
        * html/HTMLObjectElement.cpp:
        (WebCore::HTMLObjectElement::~HTMLObjectElement):
        (WebCore::HTMLObjectElement::detach):
        * html/HTMLObjectElement.h:
        * html/HTMLPlugInElement.cpp:
        (WebCore::HTMLPlugInElement::HTMLPlugInElement):
        (WebCore::HTMLPlugInElement::~HTMLPlugInElement):
        (WebCore::HTMLPlugInElement::createNPObject):
        * html/HTMLPlugInElement.h:
        * page/Frame.h:

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

14 files changed:
WebCore/ChangeLog
WebCore/bindings/js/kjs_binding.cpp
WebCore/bindings/js/kjs_dom.cpp
WebCore/bridge/mac/FrameMac.h
WebCore/config.h
WebCore/html/HTMLAppletElement.cpp
WebCore/html/HTMLAppletElement.h
WebCore/html/HTMLEmbedElement.cpp
WebCore/html/HTMLEmbedElement.h
WebCore/html/HTMLObjectElement.cpp
WebCore/html/HTMLObjectElement.h
WebCore/html/HTMLPlugInElement.cpp
WebCore/html/HTMLPlugInElement.h
WebCore/page/Frame.h

index 4ed111326c107ad69871f8ef38b4422bafea24a3..25da356122b176c0b6071185c11459ad0cf8f8c6 100644 (file)
@@ -1,3 +1,34 @@
+2006-09-14  Anders Carlsson  <acarlsson@apple.com>
+
+        Reviewed by Tim O.
+
+        Add USE defines for the generic JavaScriptCore bindings as well as NPAPI bindings.
+        
+        * bindings/js/kjs_binding.cpp:
+        (KJS::ScriptInterpreter::createLanguageInstanceForValue):
+        * bindings/js/kjs_dom.cpp:
+        (KJS::getRuntimeObject):
+        * bridge/mac/FrameMac.h:
+        * config.h:
+        * html/HTMLAppletElement.cpp:
+        (WebCore::HTMLAppletElement::~HTMLAppletElement):
+        (WebCore::HTMLAppletElement::detach):
+        * html/HTMLAppletElement.h:
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::~HTMLEmbedElement):
+        (WebCore::HTMLEmbedElement::detach):
+        * html/HTMLEmbedElement.h:
+        * html/HTMLObjectElement.cpp:
+        (WebCore::HTMLObjectElement::~HTMLObjectElement):
+        (WebCore::HTMLObjectElement::detach):
+        * html/HTMLObjectElement.h:
+        * html/HTMLPlugInElement.cpp:
+        (WebCore::HTMLPlugInElement::HTMLPlugInElement):
+        (WebCore::HTMLPlugInElement::~HTMLPlugInElement):
+        (WebCore::HTMLPlugInElement::createNPObject):
+        * html/HTMLPlugInElement.h:
+        * page/Frame.h:
+
 2006-09-13  David Hyatt  <hyatt@apple.com>
 
         Clean up the XBL and XSLT ifdefs to be consistent with the SVG
index 2b3f0e6ef150cd9e5599af69f950502f0ec754df..93e2b530f63912d34713d09c8d6fd3874fd5b417 100644 (file)
@@ -236,11 +236,12 @@ void *ScriptInterpreter::createLanguageInstanceForValue (ExecState *exec, int la
 {
     void *result = 0;
     
-#if __APPLE__
+#if PLATFORM(MAC)
     // FIXME: Need to implement bindings support.
     if (language == Bindings::Instance::ObjectiveCLanguage)
         result = createObjcInstanceForValue (exec, value, origin, current);
-    
+#endif
+#if USE(JAVASCRIPTCORE_BINDINGS)
     if (!result)
         result = Interpreter::createLanguageInstanceForValue (exec, language, value, origin, current);
 #endif
index c3816c6f82d1d6d4084379a2f174b7e33275b5d3..10dead0a8e3d36e906fc1d5334025117f50a7fa8 100644 (file)
@@ -69,7 +69,7 @@
 #include "SVGElement.h"
 #endif
 
-#if __APPLE__
+#if USE(JAVASCRIPTCORE_BINDINGS)
 #include <JavaScriptCore/runtime_object.h>
 #endif
 
@@ -1036,7 +1036,7 @@ JSValue* getRuntimeObject(ExecState* exec, Node* n)
     if (!n)
         return 0;
 
-#if __APPLE__
+#if USE(JAVASCRIPTCORE_BINDINGS)
     if (n->hasTagName(objectTag) || n->hasTagName(embedTag) || n->hasTagName(appletTag)) {
         HTMLPlugInElement* plugInElement = static_cast<HTMLPlugInElement*>(n);
         if (plugInElement->getInstance())
index 10481de14ed0573780afe6fa1a9e40d546d10b93..948da89c778e83a48ede44fff7091d8b85744c9a 100644 (file)
@@ -248,6 +248,7 @@ public:
     virtual KJS::Bindings::Instance* getEmbedInstanceForWidget(Widget*);
     virtual KJS::Bindings::Instance* getObjectInstanceForWidget(Widget*);
     virtual KJS::Bindings::Instance* getAppletInstanceForWidget(Widget*);
+    virtual KJS::Bindings::RootObject* bindingRootObject();
     void addPluginRootObject(KJS::Bindings::RootObject* root);
     
     virtual void registerCommandForUndo(PassRefPtr<EditCommand>);
@@ -283,7 +284,6 @@ public:
     virtual bool isSecureKeyboardEntry();
 
     KJS::Bindings::RootObject* executionContextForDOM();
-    KJS::Bindings::RootObject* bindingRootObject();
     
     WebScriptObject* windowScriptObject();
     NPObject* windowScriptNPObject();
index b4e965709df67fe239207167b4ab374bf1cd6d5e..876d22bfd0a8d6304c5c75ce21e52aa902e43a98 100644 (file)
@@ -72,3 +72,8 @@ typedef float CGFloat;
 #if !COMPILER(MSVC) // can't get this to compile on Visual C++ yet
 #define AVOID_STATIC_CONSTRUCTORS 1
 #endif
+
+#if PLATFORM(MAC)
+#define KXMLCORE_USE_JAVASCRIPTCORE_BINDINGS 1
+#define KXMLCORE_USE_NPOBJECT 1
+#endif
index 479ff04bf648400bb8c4190c5a3baff7ba025a87..d3f76d380dee588f39e0fe6a3f1555317d4e36c8 100644 (file)
@@ -42,7 +42,7 @@ HTMLAppletElement::HTMLAppletElement(Document *doc)
 
 HTMLAppletElement::~HTMLAppletElement()
 {
-#if PLATFORM(MAC)
+#if USE(JAVASCRIPTCORE_BINDINGS)
     // m_instance should have been cleaned up in detach().
     assert(!m_instance);
 #endif
@@ -138,7 +138,7 @@ RenderObject *HTMLAppletElement::createRenderer(RenderArena *arena, RenderStyle
     return new (document()->renderArena()) RenderInline(this);
 }
 
-#if PLATFORM(MAC)
+#if USE(JAVASCRIPTCORE_BINDINGS)
 KJS::Bindings::Instance *HTMLAppletElement::getInstance() const
 {
     Frame *frame = document()->frame();
@@ -171,7 +171,7 @@ void HTMLAppletElement::closeRenderer()
 
 void HTMLAppletElement::detach()
 {
-#if PLATFORM(MAC)
+#if USE(JAVASCRIPTCORE_BINDINGS)
     m_instance = 0;
 #endif
     HTMLPlugInElement::detach();
index 4e49a04175926f40eae526f1c575c1e472ee7753..afd41412ddeaa64c62de4d93c54e7473fbab4dba 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "HTMLPlugInElement.h"
 
-#if PLATFORM(MAC)
+#if USE(JAVASCRIPTCORE_BINDINGS)
 #include <JavaScriptCore/runtime.h>
 #else
 namespace KJS { namespace Bindings { class Instance; } }
@@ -53,7 +53,7 @@ public:
     virtual void closeRenderer();
     virtual void detach();
     
-#if PLATFORM(MAC)
+#if USE(JAVASCRIPTCORE_BINDINGS)
     virtual KJS::Bindings::Instance* getInstance() const;
 #endif
 
index 1a3bb77dd946e9f64a7bf5cba8d94fbaaede405e..90025d7b421207dbaf87afaddc804b6c5d2d21e2 100644 (file)
@@ -47,13 +47,13 @@ HTMLEmbedElement::HTMLEmbedElement(Document* doc)
 
 HTMLEmbedElement::~HTMLEmbedElement()
 {
-#if PLATFORM(MAC)
+#if USE(JAVASCRIPTCORE_BINDINGS)
     // m_instance should have been cleaned up in detach().
     assert(!m_instance);
 #endif
 }
 
-#if PLATFORM(MAC)
+#if USE(JAVASCRIPTCORE_BINDINGS)
 KJS::Bindings::Instance *HTMLEmbedElement::getInstance() const
 {
     Frame* frame = document()->frame();
@@ -159,7 +159,7 @@ void HTMLEmbedElement::attach()
 
 void HTMLEmbedElement::detach()
 {
-#if PLATFORM(MAC)
+#if USE(JAVASCRIPTCORE_BINDINGS)
     m_instance = 0;
 #endif
     HTMLPlugInElement::detach();
index b9a060f546362f107dfbb46d50822ae57e9bb039..01f2afcff09b4fe08a0febcbd8d8cea90dfd3b4b 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "HTMLPlugInElement.h"
 
-#if PLATFORM(MAC)
+#if USE(JAVASCRIPTCORE_BINDINGS)
 #include <JavaScriptCore/runtime.h>
 #else
 namespace KJS { namespace Bindings { class Instance; } }
@@ -57,7 +57,7 @@ public:
     
     virtual bool isURLAttribute(Attribute*) const;
 
-#if PLATFORM(MAC)
+#if USE(JAVASCRIPTCORE_BINDINGS)
     virtual KJS::Bindings::Instance* getInstance() const;
 #endif
 
index 6315bc65f85ad93a22818d306c1f888548ed97a8..5b2b5408fb67a3095bfda375556970d498807050 100644 (file)
@@ -59,7 +59,7 @@ HTMLObjectElement::HTMLObjectElement(Document *doc)
 
 HTMLObjectElement::~HTMLObjectElement()
 {
-#if PLATFORM(MAC)
+#if USE(JAVASCRIPTCORE_BINDINGS)
     // m_instance should have been cleaned up in detach().
     assert(!m_instance);
 #endif
@@ -67,7 +67,7 @@ HTMLObjectElement::~HTMLObjectElement()
     delete m_imageLoader;
 }
 
-#if PLATFORM(MAC)
+#if USE(JAVASCRIPTCORE_BINDINGS)
 KJS::Bindings::Instance *HTMLObjectElement::getInstance() const
 {
     Frame* frame = document()->frame();
@@ -254,7 +254,7 @@ void HTMLObjectElement::detach()
         needWidgetUpdate = true;
     }
 
-#if PLATFORM(MAC)
+#if USE(JAVASCRIPTCORE_BINDINGS)
     m_instance = 0;
 #endif
     HTMLPlugInElement::detach();
index d4568845348c3c9b1c6c5273b2fc1a9a922f2acc..f956cfb744433341f1846ad00138c32d32f4077b 100644 (file)
@@ -27,7 +27,7 @@
 
 #include "HTMLPlugInElement.h"
 
-#if PLATFORM(MAC)
+#if USE(JAVASCRIPTCORE_BINDINGS)
 #include <JavaScriptCore/runtime.h>
 #else
 namespace KJS { namespace Bindings { class Instance; } }
@@ -68,7 +68,7 @@ public:
 
     void renderFallbackContent();
 
-#if PLATFORM(MAC)
+#if USE(JAVASCRIPTCORE_BINDINGS)
     virtual KJS::Bindings::Instance* getInstance() const;
 #endif
 
index cb3fb78266029fcaecb0c5a19a59124c79a933b9..8b832d284b493e1f3372237306eb2d051137334f 100644 (file)
@@ -32,8 +32,7 @@
 #include "kjs_dom.h"
 #include "kjs_proxy.h"
 
-#if PLATFORM(MAC)
-#include "FrameMac.h"
+#if USE(NPOBJECT)
 #include <JavaScriptCore/npruntime_impl.h>
 #include <JavaScriptCore/NP_jsobject.h>
 #endif
@@ -49,7 +48,7 @@ using namespace HTMLNames;
 
 HTMLPlugInElement::HTMLPlugInElement(const QualifiedName& tagName, Document* doc)
     : HTMLElement(tagName, doc)
-#if PLATFORM(MAC)
+#if USE(NPOBJECT)
     , m_NPObject(0)
 #endif
 {
@@ -57,7 +56,7 @@ HTMLPlugInElement::HTMLPlugInElement(const QualifiedName& tagName, Document* doc
 
 HTMLPlugInElement::~HTMLPlugInElement()
 {
-#if PLATFORM(MAC)
+#if USE(NPOBJECT)
     if (m_NPObject) {
         _NPN_ReleaseObject(m_NPObject);
         m_NPObject = 0;
@@ -157,7 +156,7 @@ void HTMLPlugInElement::detach()
     HTMLElement::detach();
 }
 
-#if PLATFORM(MAC)
+#if USE(NPOBJECT)
 
 NPObject* HTMLPlugInElement::createNPObject()
 {
@@ -178,7 +177,7 @@ NPObject* HTMLPlugInElement::createNPObject()
         return _NPN_CreateNoScriptObject();
 
     // Wrap the JSObject in an NPObject
-    const RootObject *executionContext = Mac(frame)->bindingRootObject();
+    const RootObject *executionContext = frame->bindingRootObject();
     return _NPN_CreateScriptObject(0, jsElementValue->getObject(), executionContext, executionContext);
 }
 
@@ -189,6 +188,6 @@ NPObject* HTMLPlugInElement::getNPObject()
     return m_NPObject;
 }
 
-#endif /* PLATFORM(MAC) */
+#endif /* USE(NPOBJECT) */
 
 }
index beef8b1f597f8451e5212ca0398520b60e2b31a2..75c8ce07cb529bb6c361a766918db5cb2d66db7a 100644 (file)
 #define HTMLPlugInElement_H
 
 #include "HTMLElement.h"
-#if PLATFORM(MAC)
+#if USE(JAVASCRIPTCORE_BINDINGS)
 #include <JavaScriptCore/runtime.h>
+#endif
+#if USE(NPOBJECT)
 #include <JavaScriptCore/npruntime.h>
 #endif
 
@@ -57,22 +59,26 @@ public:
     
     String width() const;
     void setWidth(const String&);
-    
-#if PLATFORM(MAC)
+
+#if USE(JAVASCRIPTCORE_BINDINGS)
     virtual KJS::Bindings::Instance* getInstance() const = 0;
+#endif
+#if USE(NPOBJECT)
     virtual NPObject* getNPObject();
 #endif
 
     void setFrameName(const AtomicString& frameName) { m_frameName = frameName; }
 private:
-#if PLATFORM(MAC)
+#if USE(NPOBJECT)
     NPObject* createNPObject();
 #endif
 
 protected:
     String oldNameAttr;
-#if PLATFORM(MAC)
+#if USE(JAVASCRIPTCORE_BINDINGS)
     mutable RefPtr<KJS::Bindings::Instance> m_instance;
+#endif
+#if USE(NPOBJECT)
     NPObject* m_NPObject;
 #endif
 private:
index 25d1c18fe79a35efcdc1e970d5cc1e20cc393d2f..2ee1866585bdc6931077ee0c73d66fa61799403a 100644 (file)
@@ -48,6 +48,7 @@ namespace KJS {
 
     namespace Bindings {
         class Instance;
+        class RootObject;
     }
 }
 
@@ -535,6 +536,8 @@ public:
   virtual KJS::Bindings::Instance* getEmbedInstanceForWidget(Widget*) = 0;
   virtual KJS::Bindings::Instance* getObjectInstanceForWidget(Widget*) = 0;
   virtual KJS::Bindings::Instance* getAppletInstanceForWidget(Widget*) = 0;
+  virtual KJS::Bindings::RootObject* bindingRootObject() = 0;
+
   virtual void markMisspellingsInAdjacentWords(const VisiblePosition&) = 0;
   virtual void markMisspellings(const Selection&) = 0;
   virtual void addMessageToConsole(const String& message,  unsigned int lineNumber, const String& sourceID) = 0;