[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:09:40 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 366d08666e28589777ec595efa44b67b57ca1404
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Apr 25 18:05:43 2002 +0000
WebCore:
Rework plugin code to prepare to move more of it into WebKit.
* khtml/rendering/render_applet.cpp:
(RenderApplet::RenderApplet): Create a widget for the applet using
the new simpler API.
* kwq/kdecore/kconfig.h:
* kwq/KWQKConfigBase.mm: Eliminate KConfigBase.
Set things up so we are poised to handle the other non-plugin
config keys easily in the future.
* kwq/KWQKHTMLPart.mm: (KHTMLPart::requestObject): Use the new simpler
IFPluginWidgetCreate API instead of the older WCPluginWidget one.
* kwq/qt/qstring.h: Add simpler conversions to/from NSString.
* kwq/KWQString.mm: (QString::fromNSString): New.
* kwq/WCPluginWidget.h: Made this API simpler both for the C++
side and the Objective-C side. There's now no class, and only one
function that needs to be supplied (normally by WebKit).
* kwq/WCJavaAppletWidget.h: Same thing for the Java case.
* kwq/WCJavaAppletWidget.mm:
(IFSetJavaAppletViewCreationFunction): New.
(IFJavaAppletWidgetCreate): New. Most of the code that was in here
is now moved into WebKit.
* kwq/WCPluginWidget.mm:
(IFSetPluginViewCreationFunction): New.
(IFPluginWidgetCreate): New. Most of the code that was in here
is now moved into WebKit.
* libwebcore.exp: Update for new function names.
WebKit:
Rework plugin code to prepare to move more of here from WebCore.
* Plugins.subproj/IFPluginView.mm:
(IFPluginViewCreate): New. Does all the work of creating an NSView
for a plug-in, including stuff previously done in WebCore.
(IFJavaAppletViewCreate): Same as above, for Java applets.
(+[IFPluginView load]): Set up the function pointers using the new
improved WebCore API.
* Plugins.subproj/IFNullPluginView.mm:
(-[IFNullPluginView load]): Remove this setup because now there's
no separate call to set up a null plug-in.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1075 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 174bb0b..e882f81 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,36 @@
+:RU2002-04-25 Darin Adler <darin at apple.com>
+
+ * khtml/rendering/render_applet.cpp:
+ (RenderApplet::RenderApplet): Create a widget for the applet using
+ the new simpler API.
+
+ * kwq/kdecore/kconfig.h:
+ * kwq/KWQKConfigBase.mm: Eliminate KConfigBase.
+ Set things up so we are poised to handle the other non-plugin
+ config keys easily in the future.
+
+ * kwq/KWQKHTMLPart.mm: (KHTMLPart::requestObject): Use the new simpler
+ IFPluginWidgetCreate API instead of the older WCPluginWidget one.
+
+ * kwq/qt/qstring.h: Add simpler conversions to/from NSString.
+ * kwq/KWQString.mm: (QString::fromNSString): New.
+
+ * kwq/WCPluginWidget.h: Made this API simpler both for the C++
+ side and the Objective-C side. There's now no class, and only one
+ function that needs to be supplied (normally by WebKit).
+ * kwq/WCJavaAppletWidget.h: Same thing for the Java case.
+
+ * kwq/WCJavaAppletWidget.mm:
+ (IFSetJavaAppletViewCreationFunction): New.
+ (IFJavaAppletWidgetCreate): New. Most of the code that was in here
+ is now moved into WebKit.
+ * kwq/WCPluginWidget.mm:
+ (IFSetPluginViewCreationFunction): New.
+ (IFPluginWidgetCreate): New. Most of the code that was in here
+ is now moved into WebKit.
+
+ * libwebcore.exp: Update for new function names.
+
2002-04-24 Chris Blumenberg <cblu at apple.com>
Renamed [IFWebDataSource frame] to [IFWebDataSource webFrame]
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 174bb0b..e882f81 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,36 @@
+:RU2002-04-25 Darin Adler <darin at apple.com>
+
+ * khtml/rendering/render_applet.cpp:
+ (RenderApplet::RenderApplet): Create a widget for the applet using
+ the new simpler API.
+
+ * kwq/kdecore/kconfig.h:
+ * kwq/KWQKConfigBase.mm: Eliminate KConfigBase.
+ Set things up so we are poised to handle the other non-plugin
+ config keys easily in the future.
+
+ * kwq/KWQKHTMLPart.mm: (KHTMLPart::requestObject): Use the new simpler
+ IFPluginWidgetCreate API instead of the older WCPluginWidget one.
+
+ * kwq/qt/qstring.h: Add simpler conversions to/from NSString.
+ * kwq/KWQString.mm: (QString::fromNSString): New.
+
+ * kwq/WCPluginWidget.h: Made this API simpler both for the C++
+ side and the Objective-C side. There's now no class, and only one
+ function that needs to be supplied (normally by WebKit).
+ * kwq/WCJavaAppletWidget.h: Same thing for the Java case.
+
+ * kwq/WCJavaAppletWidget.mm:
+ (IFSetJavaAppletViewCreationFunction): New.
+ (IFJavaAppletWidgetCreate): New. Most of the code that was in here
+ is now moved into WebKit.
+ * kwq/WCPluginWidget.mm:
+ (IFSetPluginViewCreationFunction): New.
+ (IFPluginWidgetCreate): New. Most of the code that was in here
+ is now moved into WebKit.
+
+ * libwebcore.exp: Update for new function names.
+
2002-04-24 Chris Blumenberg <cblu at apple.com>
Renamed [IFWebDataSource frame] to [IFWebDataSource webFrame]
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 174bb0b..e882f81 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,36 @@
+:RU2002-04-25 Darin Adler <darin at apple.com>
+
+ * khtml/rendering/render_applet.cpp:
+ (RenderApplet::RenderApplet): Create a widget for the applet using
+ the new simpler API.
+
+ * kwq/kdecore/kconfig.h:
+ * kwq/KWQKConfigBase.mm: Eliminate KConfigBase.
+ Set things up so we are poised to handle the other non-plugin
+ config keys easily in the future.
+
+ * kwq/KWQKHTMLPart.mm: (KHTMLPart::requestObject): Use the new simpler
+ IFPluginWidgetCreate API instead of the older WCPluginWidget one.
+
+ * kwq/qt/qstring.h: Add simpler conversions to/from NSString.
+ * kwq/KWQString.mm: (QString::fromNSString): New.
+
+ * kwq/WCPluginWidget.h: Made this API simpler both for the C++
+ side and the Objective-C side. There's now no class, and only one
+ function that needs to be supplied (normally by WebKit).
+ * kwq/WCJavaAppletWidget.h: Same thing for the Java case.
+
+ * kwq/WCJavaAppletWidget.mm:
+ (IFSetJavaAppletViewCreationFunction): New.
+ (IFJavaAppletWidgetCreate): New. Most of the code that was in here
+ is now moved into WebKit.
+ * kwq/WCPluginWidget.mm:
+ (IFSetPluginViewCreationFunction): New.
+ (IFPluginWidgetCreate): New. Most of the code that was in here
+ is now moved into WebKit.
+
+ * libwebcore.exp: Update for new function names.
+
2002-04-24 Chris Blumenberg <cblu at apple.com>
Renamed [IFWebDataSource frame] to [IFWebDataSource webFrame]
diff --git a/WebCore/khtml/rendering/render_applet.cpp b/WebCore/khtml/rendering/render_applet.cpp
index b1459f8..bd01c07 100644
--- a/WebCore/khtml/rendering/render_applet.cpp
+++ b/WebCore/khtml/rendering/render_applet.cpp
@@ -52,15 +52,13 @@ RenderApplet::RenderApplet(HTMLElementImpl *applet, QMap<QString, QString> args
#ifdef APPLE_CHANGES
// FIXME:MERGE Is this needed any more?
- NodeImpl *child = element()->firstChild();
- while(child) {
- if(child->id() == ID_PARAM) {
+ for (NodeImpl *child = element()->firstChild(); child; child = child->nextSibling()) {
+ if (child->id() == ID_PARAM) {
HTMLParamElementImpl *p = static_cast<HTMLParamElementImpl *>(child);
args.insert(p->name(), p->value());
}
- child = child->nextSibling();
}
- setQWidget( new WCJavaAppletWidget(args));
+ setQWidget(IFJavaAppletWidgetCreate(args));
#else /* APPLE_CHANGES not defined */
KJavaAppletContext *context = 0;
KHTMLView *_view = applet->getDocument()->view();
diff --git a/WebCore/kwq/KWQKConfigBase.h b/WebCore/kwq/KWQKConfigBase.h
index e1ab727..7313738 100644
--- a/WebCore/kwq/KWQKConfigBase.h
+++ b/WebCore/kwq/KWQKConfigBase.h
@@ -26,117 +26,43 @@
#ifndef KCONFIG_H_
#define KCONFIG_H_
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include <qt/qstring.h>
-#include <qobject.h>
-#include <qcolor.h>
-#include <qfont.h>
-#include <qdatetime.h>
-#include <qstring.h>
-#include <qstringlist.h>
-#include <qvariant.h>
-#include <qmap.h>
-#include <qcolor.h>
-#include <KWQStrList.h>
+class QColor;
+class QStringList;
-// class KConfigBase ===========================================================
+class KWQKConfigImpl;
-class KConfigBase {
+class KConfig {
public:
- // structs -----------------------------------------------------------------
- // typedefs ----------------------------------------------------------------
- // enums -------------------------------------------------------------------
- // constants ---------------------------------------------------------------
- // static member functions -------------------------------------------------
-
- // constructors, copy constructors, and destructors ------------------------
-
- KConfigBase();
- virtual ~KConfigBase();
-
- // member functions --------------------------------------------------------
+ KConfig(const QString &n, bool bReadOnly=false, bool bUseKDEGlobals = true);
+ ~KConfig();
void setGroup(const QString &pGroup);
- void writeEntry(const QString &pKey, const QStringList &rValue,
- char sep=',', bool bPersistent=true, bool bGlobal=false,
- bool bNLS=false);
-
- QString readEntry(const char *pKey,
- const QString& aDefault=QString::null) const;
+ QString readEntry(const char *pKey, const QString& aDefault=QString::null) const;
int readNumEntry(const char *pKey, int nDefault=0) const;
-
- unsigned int readUnsignedNumEntry(const char *pKey,
- unsigned int nDefault=0) const;
+ unsigned int readUnsignedNumEntry(const char *pKey, unsigned int nDefault=0) const;
bool readBoolEntry(const char *pKey, bool nDefault=0) const;
QColor readColorEntry(const char *pKey, const QColor *pDefault=0L) const;
+ // used only for form completions
+ void writeEntry(const QString &pKey, const QStringList &rValue,
+ char sep=',', bool bPersistent=true, bool bGlobal=false,
+ bool bNLS=false);
QStringList readListEntry(const QString &pKey, char sep=',') const;
- // operators ---------------------------------------------------------------
-
-// protected -------------------------------------------------------------------
-// private ---------------------------------------------------------------------
-
-private:
-
-// add copy constructor
-// this private declaration prevents copying
-#ifdef _KWQ_PEDANTIC_
- KConfigBase(const KConfigBase &);
-#endif
-
-// add assignment operator
-// this private declaration prevents assignment
-#ifdef _KWQ_PEDANTIC_
- KConfigBase &operator=(const KConfigBase &);
-#endif
-
-}; // class KConfigBase ========================================================
-
-
-// class KConfig ===============================================================
-
-class KConfig : public KConfigBase {
-public:
-
- // structs -----------------------------------------------------------------
- // typedefs ----------------------------------------------------------------
- // enums -------------------------------------------------------------------
- // constants ---------------------------------------------------------------
- // static member functions -------------------------------------------------
-
- // constructors, copy constructors, and destructors ------------------------
-
- KConfig(const QString &n, bool bReadOnly=false, bool bUseKDEGlobals = true);
- virtual ~KConfig();
-
- // member functions --------------------------------------------------------
- // operators ---------------------------------------------------------------
-
-// protected -------------------------------------------------------------------
-// private ---------------------------------------------------------------------
-
private:
-// add copy constructor
-// this private declaration prevents copying
-#ifdef _KWQ_PEDANTIC_
KConfig(const KConfig &);
-#endif
-
-// add assignment operator
-// this private declaration prevents assignment
-#ifdef _KWQ_PEDANTIC_
KConfig &operator=(const KConfig &);
-#endif
+
+ KWQKConfigImpl *impl;
-}; // class KConfig ============================================================
+};
#endif
diff --git a/WebCore/kwq/KWQKConfigBase.mm b/WebCore/kwq/KWQKConfigBase.mm
index cc36632..d5be042 100644
--- a/WebCore/kwq/KWQKConfigBase.mm
+++ b/WebCore/kwq/KWQKConfigBase.mm
@@ -23,78 +23,66 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <kwqdebug.h>
-#include <kconfig.h>
+#import <kconfig.h>
+
+#import <kwqdebug.h>
+#import <qcolor.h>
+#import <qstringlist.h>
#import <WCPlugin.h>
#import <WCPluginDatabase.h>
-enum files{
- pluginsinfo
+class KWQKConfigImpl
+{
+public:
+ bool isPluginInfo;
+ int pluginIndex;
};
-int file;
-unsigned group;
-
-//FIX ME:
-static QString *tempQString = NULL;
-static QColor *tempQColor = NULL;
-static QStringList *tempQStringList = NULL;
-
-
-KConfigBase::KConfigBase()
+KConfig::KConfig(const QString &n, bool bReadOnly, bool bUseKDEGlobals)
{
- _logNotYetImplemented();
+ impl = new KWQKConfigImpl;
+ impl->isPluginInfo = n.contains("pluginsinfo");
+ impl->pluginIndex = 0;
}
-
-KConfigBase::~KConfigBase()
+KConfig::~KConfig()
{
- _logNotYetImplemented();
+ delete impl;
}
-
-void KConfigBase::setGroup(const QString &pGroup)
+void KConfig::setGroup(const QString &pGroup)
{
- _logPartiallyImplemented();
-
- if(file == pluginsinfo){
- group = pGroup.toUInt();
+ if (impl->isPluginInfo) {
+ impl->pluginIndex = pGroup.toUInt();
}
}
-
-void KConfigBase::writeEntry(const QString &pKey, const QStringList &rValue,
+void KConfig::writeEntry(const QString &pKey, const QStringList &rValue,
char sep=',', bool bPersistent=true, bool bGlobal=false,
bool bNLS=false)
{
_logNotYetImplemented();
}
-
-
-QString KConfigBase::readEntry(const char *pKey,
- const QString& aDefault=QString::null) const
+QString KConfig::readEntry(const char *pKey, const QString& aDefault=QString::null) const
{
- _logPartiallyImplemented();
-
- if(file == pluginsinfo){
+ if (impl->isPluginInfo) {
WCPlugin *plugin;
NSArray *mimeTypes;
NSMutableString *bigMimeString;
- NSString *bigMimeString2;
uint i;
- plugin = [[[WCPluginDatabase installedPlugins] plugins] objectAtIndex:group];
- if(strcmp(pKey, "name") == 0){
+ plugin = [[[WCPluginDatabase installedPlugins] plugins] objectAtIndex:impl->pluginIndex];
+ if (strcmp(pKey, "name") == 0) {
return NSSTRING_TO_QSTRING([plugin name]);
- }else if(strcmp(pKey, "file") == 0){
+ } else if (strcmp(pKey, "file") == 0) {
return NSSTRING_TO_QSTRING([plugin filename]);
- }else if(strcmp(pKey, "description") == 0){
+ } else if (strcmp(pKey, "description") == 0) {
return NSSTRING_TO_QSTRING([plugin pluginDescription]);
- }else if(strcmp(pKey, "mime") == 0){
+ } else if (strcmp(pKey, "mime") == 0) {
mimeTypes = [plugin mimeTypes];
- bigMimeString = [NSMutableString stringWithCapacity:1000];
- for(i=0; i<[mimeTypes count]; i++){
+ bigMimeString = [NSMutableString string];
+ for(i = 0; i < [mimeTypes count]; i++) {
[bigMimeString appendString:[[mimeTypes objectAtIndex:i] objectAtIndex:0]]; // mime type
[bigMimeString appendString:@":"];
[bigMimeString appendString:[[mimeTypes objectAtIndex:i] objectAtIndex:1]]; // mime's extension
@@ -102,78 +90,46 @@ QString KConfigBase::readEntry(const char *pKey,
[bigMimeString appendString:[[mimeTypes objectAtIndex:i] objectAtIndex:2]]; // mime's description
[bigMimeString appendString:@";"];
}
- bigMimeString2 = [NSString stringWithString:bigMimeString];
- [bigMimeString2 retain];
- return NSSTRING_TO_QSTRING(bigMimeString2);
+ return NSSTRING_TO_QSTRING(bigMimeString);
}
}
- if(tempQString == NULL) {
- tempQString = new QString();
- }
- return *tempQString;
+
+ _logNotYetImplemented();
+ return QString();
}
-
-
-int KConfigBase::readNumEntry(const char *pKey, int nDefault=0) const
+int KConfig::readNumEntry(const char *pKey, int nDefault) const
{
- _logPartiallyImplemented();
-
- if(file == pluginsinfo){
+ if (impl->isPluginInfo) {
return [[[WCPluginDatabase installedPlugins] plugins] count];
}
- return 0;
-}
-
-
-
-unsigned int KConfigBase::readUnsignedNumEntry(const char *pKey,
- unsigned int nDefault=0) const
-{
_logNotYetImplemented();
- return 0;
+ return nDefault;
}
-
-bool KConfigBase::readBoolEntry(const char *pKey, bool nDefault=0) const
+unsigned int KConfig::readUnsignedNumEntry(const char *pKey, unsigned int nDefault) const
{
_logNotYetImplemented();
- return FALSE;
+ return nDefault;
}
-QColor KConfigBase::readColorEntry(const char *pKey, const QColor *pDefault=0L) const
+bool KConfig::readBoolEntry(const char *pKey, bool nDefault) const
{
_logNotYetImplemented();
- if (tempQColor == NULL) {
- tempQColor = new QColor(0,0,0);
- }
- return *tempQColor;
+ return nDefault;
}
-QStringList KConfigBase::readListEntry(const QString &pKey, char sep=',') const
+QColor KConfig::readColorEntry(const char *pKey, const QColor *pDefault) const
{
_logNotYetImplemented();
- if (tempQStringList == NULL) {
- tempQStringList = new QStringList();
- }
- return *tempQStringList;
+ return pDefault ? *pDefault : QColor(0,0,0);
}
-// class KConfig ===============================================================
-
-KConfig::KConfig(const QString &n, bool bReadOnly=false, bool bUseKDEGlobals = true)
-{
- _logPartiallyImplemented();
- if(n.contains(pluginsinfo)){
- file = pluginsinfo;
- }
-}
-
-
-KConfig::~KConfig()
+QStringList KConfig::readListEntry(const QString &pKey, char sep) const
{
_logNotYetImplemented();
+ return QStringList();
}
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 482bdf7..b91ba7b 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -917,8 +917,7 @@ bool KHTMLPart::requestObject( khtml::RenderPart *frame, const QString &url, con
// The plugins array is an attempt to avoid multiple creations of the same plug-in.
// FIXME: Can't have multiple plug-ins with the same URL on a page
if(!d->plugins.contains(url)) {
- WCPluginWidget *pluginWidget = new WCPluginWidget(completeURL(url).url(), serviceType, args, d->m_baseURL.url());
- frame->setWidget(pluginWidget);
+ frame->setWidget(IFPluginWidgetCreate(completeURL(url).url(), serviceType, args, d->m_baseURL.url()));
d->plugins.append(url);
}
return true;
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.mm b/WebCore/kwq/KWQKHTMLPartImpl.mm
index 482bdf7..b91ba7b 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.mm
+++ b/WebCore/kwq/KWQKHTMLPartImpl.mm
@@ -917,8 +917,7 @@ bool KHTMLPart::requestObject( khtml::RenderPart *frame, const QString &url, con
// The plugins array is an attempt to avoid multiple creations of the same plug-in.
// FIXME: Can't have multiple plug-ins with the same URL on a page
if(!d->plugins.contains(url)) {
- WCPluginWidget *pluginWidget = new WCPluginWidget(completeURL(url).url(), serviceType, args, d->m_baseURL.url());
- frame->setWidget(pluginWidget);
+ frame->setWidget(IFPluginWidgetCreate(completeURL(url).url(), serviceType, args, d->m_baseURL.url()));
d->plugins.append(url);
}
return true;
diff --git a/WebCore/kwq/KWQString.h b/WebCore/kwq/KWQString.h
index 5a22b42..23f7c2e 100644
--- a/WebCore/kwq/KWQString.h
+++ b/WebCore/kwq/KWQString.h
@@ -26,31 +26,6 @@
#ifndef QSTRING_H_
#define QSTRING_H_
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// USING_BORROWED_QSTRING ======================================================
-#ifdef USING_BORROWED_QSTRING
-
-#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
-// These macros are TEMPORARY hacks to convert between NSString and QString.
-// They should be replaced with correct implementations. They should only be
-// used for immutable strings.
-#define _FAST_QSTRING_TO_NSSTRING(aString) \
- [NSString stringWithCString: aString.latin1()]
-#define QSTRING_TO_NSSTRING(aString) \
- [NSString stringWithCString: aString.latin1()]
-#define QSTRING_TO_NSSTRING_LENGTH(aString,l) \
- [NSString stringWithCString: aString.latin1() length: l]
-#define NSSTRING_TO_QSTRING(aString) \
- QString([aString cString])
-#endif
-
-#include <_qstring.h>
-
-#else
-
#define Fixed MacFixed
#define Rect MacRect
#define Boolean MacBoolean
@@ -61,27 +36,20 @@
#include "qcstring.h"
-#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
-
-// Use with extreme caution. Only use _FAST_QSTRING_TO_NSSTRING if you
-// understand the reference count of the QString's underlying CFString.
-// In cases where QSTRING_TO_NSSTRING is called many times consider using
-// _FAST_QSTRING_TO_NSSTRING to save on unnecessary autoreleasing.
-#define _FAST_QSTRING_TO_NSSTRING(aString) \
- ((NSString *)(aString.getCFMutableString()))
-
-#define QSTRING_TO_NSSTRING(aString) \
- [[(NSString *)(aString.getCFMutableString()) retain] autorelease]
+#define _FAST_QSTRING_TO_NSSTRING(aString) (aString).getNSString()
+#define QSTRING_TO_NSSTRING(aString) (aString).getNSString()
#define QSTRING_TO_NSSTRING_LENGTH(aString,l) \
- [[[(NSString *)(aString.getCFMutableString()) substringToIndex: l] retain] autorelease]
-#define NSSTRING_TO_QSTRING(aString) \
- QString::fromCFMutableString((CFMutableStringRef)aString)
-
-#endif
+ [[[(aString).getNSString() substringToIndex: l] retain] autorelease]
+#define NSSTRING_TO_QSTRING(aString) QString::fromNSString(aString)
-class QString;
class QRegExp;
+#ifdef __OBJC__
+ at class NSString;
+#else
+typedef void NSString;
+#endif
+
// QChar class =================================================================
class QChar {
@@ -349,12 +317,10 @@ public:
static QString number(double);
static QString fromLatin1(const char * /* NOTE: len NOT used */ );
-#ifdef USING_BORROWED_KURL
- static QString fromLocal8Bit(const char *, int len=-1);
-#endif
static QString fromStringWithEncoding(const char *, int, CFStringEncoding);
static QString fromCFMutableString(CFMutableStringRef);
static QString fromCFString(CFStringRef);
+ static QString fromNSString(NSString *);
static QString gstring_toQString(CFMutableStringRef *ref, UniChar *uchars, int len);
static CFMutableStringRef gstring_toCFString(CFMutableStringRef *ref, UniChar *uchars, int len);
@@ -367,7 +333,7 @@ public:
QString(const QChar *, uint);
QString(const char *);
QString(const char *, int len);
-
+
QString(const QString &);
~QString();
@@ -475,6 +441,7 @@ public:
QString visual();
CFMutableStringRef getCFMutableString() const;
+ NSString *getNSString() const;
// operators ---------------------------------------------------------------
@@ -611,10 +578,14 @@ inline QString::operator const char *() const
inline CFMutableStringRef QString::getCFMutableString() const
{
- // not sure this is right, but if it is, it must be inline
return s;
}
+inline NSString *QString::getNSString() const
+{
+ return (NSString *)s;
+}
+
inline bool operator==(const char *chs, const QString &qs)
{
return qs == chs;
@@ -705,6 +676,4 @@ public:
}; // class QConstString =======================================================
-#endif // USING_BORROWED_QSTRING
-
#endif
diff --git a/WebCore/kwq/KWQString.mm b/WebCore/kwq/KWQString.mm
index 85e2a96..f343b6a 100644
--- a/WebCore/kwq/KWQString.mm
+++ b/WebCore/kwq/KWQString.mm
@@ -143,13 +143,17 @@ QString QString::fromCFMutableString(CFMutableStringRef cfs)
QString QString::fromCFString(CFStringRef cfs)
{
- CFMutableStringRef ref;
QString qs;
- ref = CFStringCreateMutableCopy(NULL, 0, cfs);
- qs = QString::fromCFMutableString(ref);
- CFRelease(ref);
-
+ qs.s = CFStringCreateMutableCopy(NULL, 0, cfs);
+ return qs;
+}
+
+QString QString::fromNSString(NSString *nss)
+{
+ QString qs;
+
+ qs.s = CFStringCreateMutableCopy(NULL, 0, (CFStringRef)nss);
return qs;
}
diff --git a/WebCore/kwq/WCJavaAppletWidget.h b/WebCore/kwq/WCJavaAppletWidget.h
index 740392d..7c479cb 100644
--- a/WebCore/kwq/WCJavaAppletWidget.h
+++ b/WebCore/kwq/WCJavaAppletWidget.h
@@ -26,41 +26,22 @@
#ifndef WCJavaAppletWidget_H_
#define WCJavaAppletWidget_H_
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "qwidget.h"
-#include "qstring.h"
#include <qmap.h>
-
-// class WCJavaAppletWidget ===============================================================
-
-class WCJavaAppletWidget : public QWidget {
-public:
+#include <qstring.h>
- // typedefs ----------------------------------------------------------------
- // enums -------------------------------------------------------------------
- // constants ---------------------------------------------------------------
- // static member functions -------------------------------------------------
-
- // constructors, copy constructors, and destructors ------------------------
+class QWidget;
- WCJavaAppletWidget(QMap<QString, QString> args);
- ~WCJavaAppletWidget();
-
- // member functions --------------------------------------------------------
-
- // operators ---------------------------------------------------------------
-
-// protected -------------------------------------------------------------------
-// private ---------------------------------------------------------------------
+#ifdef __OBJC__
+ at class NSDictionary;
+ at class NSView;
+#else
+typedef void NSDictionary;
+typedef void NSView;
+#endif
-private:
- WCJavaAppletWidget(const WCJavaAppletWidget &);
- WCJavaAppletWidget &operator=(const WCJavaAppletWidget &);
-
+QWidget *IFJavaAppletWidgetCreate(const QMap<QString, QString> &args);
-}; // class WCJavaAppletWidget ============================================================
+typedef NSView *(*IFJavaAppletViewCreationFunction)(NSDictionary *arguments);
+void IFSetJavaAppletViewCreationFunction(IFJavaAppletViewCreationFunction);
#endif
diff --git a/WebCore/kwq/WCJavaAppletWidget.mm b/WebCore/kwq/WCJavaAppletWidget.mm
index fc9045d..8fd1a6a 100644
--- a/WebCore/kwq/WCJavaAppletWidget.mm
+++ b/WebCore/kwq/WCJavaAppletWidget.mm
@@ -23,42 +23,25 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <Foundation/Foundation.h>
-#import <WCJavaAppletWidget.h>
-#import <WCPluginDatabase.h>
-#import <WCPlugin.h>
-#import <KWQView.h>
+#import "WCJavaAppletWidget.h"
+#import <qwidget.h>
-#include <kwqdebug.h>
-#include <WCPluginWidget.h>
+static IFJavaAppletViewCreationFunction creationFunction = NULL;
-
-WCJavaAppletWidget::WCJavaAppletWidget(QMap<QString, QString> args)
+void IFSetJavaAppletViewCreationFunction(IFJavaAppletViewCreationFunction f)
{
- NSMutableDictionary *arguments;
- WCPlugin *plugin;
- QMap<QString, QString>::Iterator it;
- WCIFPluginMakeFunc WCIFPluginMake;
-
- WCIFPluginMake = WCIFPluginMakeFunction();
-
- plugin = [[WCPluginDatabase installedPlugins] getPluginForFilename:@"Java.plugin"];
- if(plugin == nil){
- printf("Could not find Java plugin!\n");
- return;
- }
-
- arguments = [NSMutableDictionary dictionaryWithCapacity:10];
- [arguments setObject:QSTRING_TO_NSSTRING(args["baseURL"]) forKey:@"DOCBASE"];
- for( it = args.begin(); it != args.end(); ++it ){
- if(it.key() != "baseURL")
- [arguments setObject:QSTRING_TO_NSSTRING(it.data()) forKey:QSTRING_TO_NSSTRING(it.key())];
- }
- setView(WCIFPluginMake(NSMakeRect(0,0,0,0), plugin, nil, @"application/x-java-applet", arguments, NP_EMBED));
+ creationFunction = f;
}
-WCJavaAppletWidget::~WCJavaAppletWidget()
+QWidget *IFJavaAppletWidgetCreate(const QMap<QString, QString> &args)
{
-
+ NSMutableDictionary *argsDictionary = [NSMutableDictionary dictionaryWithCapacity:args.count()];
+ for (QMap<QString, QString>::ConstIterator it = args.begin(); it != args.end(); ++it) {
+ [argsDictionary setObject:it.data().getNSString() forKey:it.key().getNSString()];
+ }
+ QWidget *widget = new QWidget();
+ if (creationFunction) {
+ widget->setView(creationFunction(argsDictionary));
+ }
+ return widget;
}
-
diff --git a/WebCore/kwq/WCPluginWidget.h b/WebCore/kwq/WCPluginWidget.h
index 4354bdc..2bad54e 100644
--- a/WebCore/kwq/WCPluginWidget.h
+++ b/WebCore/kwq/WCPluginWidget.h
@@ -26,51 +26,17 @@
#ifndef WCPluginWidget_H_
#define WCPluginWidget_H_
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "qwidget.h"
-#include "qstring.h"
-#import <WCPlugin.h>
-
-typedef id (*WCIFPluginMakeFunc)(NSRect rect, WCPlugin *plugin, NSString *url, NSString *mimeType, NSDictionary *arguments, uint16 mode);
-void WCSetIFPluginMakeFunc(WCIFPluginMakeFunc func);
-
-typedef id (*WCIFNullPluginMakeFunc)(NSRect rect, NSString *mimeType, NSDictionary *arguments);
-void WCSetIFNullPluginMakeFunc(WCIFNullPluginMakeFunc func);
-
-// class WCPluginWidget ===============================================================
-
-class WCPluginWidget : public QWidget {
-public:
-
- // typedefs ----------------------------------------------------------------
- // enums -------------------------------------------------------------------
- // constants ---------------------------------------------------------------
- // static member functions -------------------------------------------------
-
- // constructors, copy constructors, and destructors ------------------------
-
- WCPluginWidget(const QString &url=0, const QString &serviceType=0, const QStringList &args=QStringList(), const QString &baseURL=0);
- ~WCPluginWidget();
-
- // member functions --------------------------------------------------------
-
-
- // operators ---------------------------------------------------------------
-
-// protected -------------------------------------------------------------------
-// private ---------------------------------------------------------------------
+class QString;
+class QStringList;
+class QWidget;
-private:
- WCPluginWidget(const WCPluginWidget &);
- WCPluginWidget &operator=(const WCPluginWidget &);
-
+ at class NSArray;
+ at class NSString;
+ at class NSView;
-}; // class WCPluginWidget ============================================================
+QWidget *IFPluginWidgetCreate(const QString &url, const QString &serviceType, const QStringList &args, const QString &baseURL);
-WCIFPluginMakeFunc WCIFPluginMakeFunction();
-WCIFNullPluginMakeFunc WCIFNullPluginMakeFunction();
+typedef NSView *(*IFPluginViewCreationFunction)(NSString *url, NSString *serviceType, NSArray *arguments, NSString *baseURL);
+void IFSetPluginViewCreationFunction(IFPluginViewCreationFunction);
#endif
diff --git a/WebCore/kwq/WCPluginWidget.mm b/WebCore/kwq/WCPluginWidget.mm
index a539be4..8d92970 100644
--- a/WebCore/kwq/WCPluginWidget.mm
+++ b/WebCore/kwq/WCPluginWidget.mm
@@ -23,87 +23,25 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import <Foundation/Foundation.h>
-#import <WCPluginWidget.h>
-#import <WCPluginDatabase.h>
-#import <KWQView.h>
-#include <kwqdebug.h>
+#import "WCPluginWidget.h"
+#import <qwidget.h>
- at interface IFPluginView : NSObject
-- initWithFrame: (NSRect) r plugin: (WCPlugin *)plug url: (NSString *)location mime:(NSString *)mime arguments:(NSDictionary *)arguments mode:(uint16)mode;
- at end
+static IFPluginViewCreationFunction creationFunction = 0;
-static WCIFPluginMakeFunc WCIFPluginMake = NULL;
-
-void WCSetIFPluginMakeFunc(WCIFPluginMakeFunc func)
-{
- WCIFPluginMake = func;
-}
-
- at interface IFNullPluginView : NSObject
-- initWithFrame: (NSRect) r mimeType:(NSString *)mime arguments:(NSDictionary *)arguments;
- at end
-
-static WCIFNullPluginMakeFunc WCIFNullPluginMake = NULL;
-
-void WCSetIFNullPluginMakeFunc(WCIFNullPluginMakeFunc func)
+void IFSetPluginViewCreationFunction(IFPluginViewCreationFunction f)
{
- WCIFNullPluginMake = func;
+ creationFunction = f;
}
-
-
-WCPluginWidget::WCPluginWidget(const QString &url, const QString &serviceType, const QStringList &args, const QString &baseURL)
+QWidget *IFPluginWidgetCreate(const QString &url, const QString &serviceType, const QStringList &args, const QString &baseURL)
{
- NSMutableDictionary *arguments;
- NSString *arg, *mime=nil, *URL;
- NSRange r1, r2, r3;
- WCPlugin *plugin;
- uint i;
-
- URL = QSTRING_TO_NSSTRING(url);
- arguments = [NSMutableDictionary dictionaryWithCapacity:10];
- for(i=0; i<args.count(); i++){
- if(!args[i].contains("__KHTML__")){
- arg = QSTRING_TO_NSSTRING(args[i]);
- r1 = [arg rangeOfString:@"="]; // parse out attributes and values
- r2 = [arg rangeOfString:@"\""];
- r3.location = r2.location + 1;
- r3.length = [arg length] - r2.location - 2; // don't include quotes
- [arguments setObject:[arg substringWithRange:r3] forKey:[arg substringToIndex:r1.location]];
- }
+ NSMutableArray *argsArray = [NSMutableArray arrayWithCapacity:args.count()];
+ for (uint i = 0; i < args.count(); i++) {
+ [argsArray addObject:args[i].getNSString()];
}
- if(baseURL)
- [arguments setObject:QSTRING_TO_NSSTRING(baseURL) forKey:@"WebKitBaseURL"];
-
- if(serviceType.isNull()){
- plugin = [[WCPluginDatabase installedPlugins] getPluginForExtension:[URL pathExtension]];
- if(plugin != nil){
- mime = [plugin mimeTypeForURL:URL];
- }
- }else{
- plugin = [[WCPluginDatabase installedPlugins] getPluginForMimeType:QSTRING_TO_NSSTRING(serviceType)];
- mime = QSTRING_TO_NSSTRING(serviceType);
+ QWidget *widget = new QWidget();
+ if (creationFunction) {
+ widget->setView(creationFunction(url.getNSString(), serviceType.getNSString(), argsArray, baseURL.getNSString()));
}
-
- if(plugin == nil){
- setView(WCIFNullPluginMake(NSMakeRect(0,0,0,0), mime, arguments));
- }else{
- setView(WCIFPluginMake(NSMakeRect(0,0,0,0), plugin, URL, mime, arguments, NP_EMBED));
- }
-}
-
-WCPluginWidget::~WCPluginWidget()
-{
-
-}
-
-WCIFPluginMakeFunc WCIFPluginMakeFunction()
-{
- return WCIFPluginMake;
-}
-
-WCIFNullPluginMakeFunc WCIFNullPluginMakeFunction()
-{
- return WCIFNullPluginMake;
+ return widget;
}
diff --git a/WebCore/kwq/kdecore/kconfig.h b/WebCore/kwq/kdecore/kconfig.h
index e1ab727..7313738 100644
--- a/WebCore/kwq/kdecore/kconfig.h
+++ b/WebCore/kwq/kdecore/kconfig.h
@@ -26,117 +26,43 @@
#ifndef KCONFIG_H_
#define KCONFIG_H_
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include <qt/qstring.h>
-#include <qobject.h>
-#include <qcolor.h>
-#include <qfont.h>
-#include <qdatetime.h>
-#include <qstring.h>
-#include <qstringlist.h>
-#include <qvariant.h>
-#include <qmap.h>
-#include <qcolor.h>
-#include <KWQStrList.h>
+class QColor;
+class QStringList;
-// class KConfigBase ===========================================================
+class KWQKConfigImpl;
-class KConfigBase {
+class KConfig {
public:
- // structs -----------------------------------------------------------------
- // typedefs ----------------------------------------------------------------
- // enums -------------------------------------------------------------------
- // constants ---------------------------------------------------------------
- // static member functions -------------------------------------------------
-
- // constructors, copy constructors, and destructors ------------------------
-
- KConfigBase();
- virtual ~KConfigBase();
-
- // member functions --------------------------------------------------------
+ KConfig(const QString &n, bool bReadOnly=false, bool bUseKDEGlobals = true);
+ ~KConfig();
void setGroup(const QString &pGroup);
- void writeEntry(const QString &pKey, const QStringList &rValue,
- char sep=',', bool bPersistent=true, bool bGlobal=false,
- bool bNLS=false);
-
- QString readEntry(const char *pKey,
- const QString& aDefault=QString::null) const;
+ QString readEntry(const char *pKey, const QString& aDefault=QString::null) const;
int readNumEntry(const char *pKey, int nDefault=0) const;
-
- unsigned int readUnsignedNumEntry(const char *pKey,
- unsigned int nDefault=0) const;
+ unsigned int readUnsignedNumEntry(const char *pKey, unsigned int nDefault=0) const;
bool readBoolEntry(const char *pKey, bool nDefault=0) const;
QColor readColorEntry(const char *pKey, const QColor *pDefault=0L) const;
+ // used only for form completions
+ void writeEntry(const QString &pKey, const QStringList &rValue,
+ char sep=',', bool bPersistent=true, bool bGlobal=false,
+ bool bNLS=false);
QStringList readListEntry(const QString &pKey, char sep=',') const;
- // operators ---------------------------------------------------------------
-
-// protected -------------------------------------------------------------------
-// private ---------------------------------------------------------------------
-
-private:
-
-// add copy constructor
-// this private declaration prevents copying
-#ifdef _KWQ_PEDANTIC_
- KConfigBase(const KConfigBase &);
-#endif
-
-// add assignment operator
-// this private declaration prevents assignment
-#ifdef _KWQ_PEDANTIC_
- KConfigBase &operator=(const KConfigBase &);
-#endif
-
-}; // class KConfigBase ========================================================
-
-
-// class KConfig ===============================================================
-
-class KConfig : public KConfigBase {
-public:
-
- // structs -----------------------------------------------------------------
- // typedefs ----------------------------------------------------------------
- // enums -------------------------------------------------------------------
- // constants ---------------------------------------------------------------
- // static member functions -------------------------------------------------
-
- // constructors, copy constructors, and destructors ------------------------
-
- KConfig(const QString &n, bool bReadOnly=false, bool bUseKDEGlobals = true);
- virtual ~KConfig();
-
- // member functions --------------------------------------------------------
- // operators ---------------------------------------------------------------
-
-// protected -------------------------------------------------------------------
-// private ---------------------------------------------------------------------
-
private:
-// add copy constructor
-// this private declaration prevents copying
-#ifdef _KWQ_PEDANTIC_
KConfig(const KConfig &);
-#endif
-
-// add assignment operator
-// this private declaration prevents assignment
-#ifdef _KWQ_PEDANTIC_
KConfig &operator=(const KConfig &);
-#endif
+
+ KWQKConfigImpl *impl;
-}; // class KConfig ============================================================
+};
#endif
diff --git a/WebCore/kwq/qt/qstring.h b/WebCore/kwq/qt/qstring.h
index 5a22b42..23f7c2e 100644
--- a/WebCore/kwq/qt/qstring.h
+++ b/WebCore/kwq/qt/qstring.h
@@ -26,31 +26,6 @@
#ifndef QSTRING_H_
#define QSTRING_H_
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// USING_BORROWED_QSTRING ======================================================
-#ifdef USING_BORROWED_QSTRING
-
-#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
-// These macros are TEMPORARY hacks to convert between NSString and QString.
-// They should be replaced with correct implementations. They should only be
-// used for immutable strings.
-#define _FAST_QSTRING_TO_NSSTRING(aString) \
- [NSString stringWithCString: aString.latin1()]
-#define QSTRING_TO_NSSTRING(aString) \
- [NSString stringWithCString: aString.latin1()]
-#define QSTRING_TO_NSSTRING_LENGTH(aString,l) \
- [NSString stringWithCString: aString.latin1() length: l]
-#define NSSTRING_TO_QSTRING(aString) \
- QString([aString cString])
-#endif
-
-#include <_qstring.h>
-
-#else
-
#define Fixed MacFixed
#define Rect MacRect
#define Boolean MacBoolean
@@ -61,27 +36,20 @@
#include "qcstring.h"
-#if (defined(__APPLE__) && defined(__OBJC__) && defined(__cplusplus))
-
-// Use with extreme caution. Only use _FAST_QSTRING_TO_NSSTRING if you
-// understand the reference count of the QString's underlying CFString.
-// In cases where QSTRING_TO_NSSTRING is called many times consider using
-// _FAST_QSTRING_TO_NSSTRING to save on unnecessary autoreleasing.
-#define _FAST_QSTRING_TO_NSSTRING(aString) \
- ((NSString *)(aString.getCFMutableString()))
-
-#define QSTRING_TO_NSSTRING(aString) \
- [[(NSString *)(aString.getCFMutableString()) retain] autorelease]
+#define _FAST_QSTRING_TO_NSSTRING(aString) (aString).getNSString()
+#define QSTRING_TO_NSSTRING(aString) (aString).getNSString()
#define QSTRING_TO_NSSTRING_LENGTH(aString,l) \
- [[[(NSString *)(aString.getCFMutableString()) substringToIndex: l] retain] autorelease]
-#define NSSTRING_TO_QSTRING(aString) \
- QString::fromCFMutableString((CFMutableStringRef)aString)
-
-#endif
+ [[[(aString).getNSString() substringToIndex: l] retain] autorelease]
+#define NSSTRING_TO_QSTRING(aString) QString::fromNSString(aString)
-class QString;
class QRegExp;
+#ifdef __OBJC__
+ at class NSString;
+#else
+typedef void NSString;
+#endif
+
// QChar class =================================================================
class QChar {
@@ -349,12 +317,10 @@ public:
static QString number(double);
static QString fromLatin1(const char * /* NOTE: len NOT used */ );
-#ifdef USING_BORROWED_KURL
- static QString fromLocal8Bit(const char *, int len=-1);
-#endif
static QString fromStringWithEncoding(const char *, int, CFStringEncoding);
static QString fromCFMutableString(CFMutableStringRef);
static QString fromCFString(CFStringRef);
+ static QString fromNSString(NSString *);
static QString gstring_toQString(CFMutableStringRef *ref, UniChar *uchars, int len);
static CFMutableStringRef gstring_toCFString(CFMutableStringRef *ref, UniChar *uchars, int len);
@@ -367,7 +333,7 @@ public:
QString(const QChar *, uint);
QString(const char *);
QString(const char *, int len);
-
+
QString(const QString &);
~QString();
@@ -475,6 +441,7 @@ public:
QString visual();
CFMutableStringRef getCFMutableString() const;
+ NSString *getNSString() const;
// operators ---------------------------------------------------------------
@@ -611,10 +578,14 @@ inline QString::operator const char *() const
inline CFMutableStringRef QString::getCFMutableString() const
{
- // not sure this is right, but if it is, it must be inline
return s;
}
+inline NSString *QString::getNSString() const
+{
+ return (NSString *)s;
+}
+
inline bool operator==(const char *chs, const QString &qs)
{
return qs == chs;
@@ -705,6 +676,4 @@ public:
}; // class QConstString =======================================================
-#endif // USING_BORROWED_QSTRING
-
#endif
diff --git a/WebCore/libwebcore.exp b/WebCore/libwebcore.exp
index b8dbfb4..3a8acc9 100644
--- a/WebCore/libwebcore.exp
+++ b/WebCore/libwebcore.exp
@@ -1,8 +1,8 @@
.objc_class_name_WCPluginDatabase
-__Z21WCSetIFPluginMakeFuncPFP11objc_object7_NSRectS0_S0_S0_S0_tE
-__Z25WCSetIFNullPluginMakeFuncPFP11objc_object7_NSRectS0_S0_E
__Z27WCSetIFLoadProgressMakeFuncPFP11objc_objectvE
__Z28WCSetIFWebDataSourceMakeFuncPFP11objc_objectPvE
+__Z31IFSetPluginViewCreationFunctionPFP6NSViewP8NSStringS2_P7NSArrayS2_E
+__Z35IFSetJavaAppletViewCreationFunctionPFP6NSViewP12NSDictionaryE
__ZN11QMouseEventC1EN6QEvent4TypeERK6QPointii
__ZN3DOM12DocumentImpl19updateStyleSelectorEv
__ZN3DOM9DOMStringD1Ev
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index e2cccce..25404a4 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,18 @@
+2002-04-25 Darin Adler <darin at apple.com>
+
+ Rework plugin code to prepare to move more of here from WebCore.
+
+ * Plugins.subproj/IFPluginView.mm:
+ (IFPluginViewCreate): New. Does all the work of creating an NSView
+ for a plug-in, including stuff previously done in WebCore.
+ (IFJavaAppletViewCreate): Same as above, for Java applets.
+ (+[IFPluginView load]): Set up the function pointers using the new
+ improved WebCore API.
+
+ * Plugins.subproj/IFNullPluginView.mm:
+ (-[IFNullPluginView load]): Remove this setup because now there's
+ no separate call to set up a null plug-in.
+
2002-04-25 John Sullivan <sullivan at apple.com>
Fixed 2911915 (Exception in -[IFWebView mouseMoved])
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index e2cccce..25404a4 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,18 @@
+2002-04-25 Darin Adler <darin at apple.com>
+
+ Rework plugin code to prepare to move more of here from WebCore.
+
+ * Plugins.subproj/IFPluginView.mm:
+ (IFPluginViewCreate): New. Does all the work of creating an NSView
+ for a plug-in, including stuff previously done in WebCore.
+ (IFJavaAppletViewCreate): Same as above, for Java applets.
+ (+[IFPluginView load]): Set up the function pointers using the new
+ improved WebCore API.
+
+ * Plugins.subproj/IFNullPluginView.mm:
+ (-[IFNullPluginView load]): Remove this setup because now there's
+ no separate call to set up a null plug-in.
+
2002-04-25 John Sullivan <sullivan at apple.com>
Fixed 2911915 (Exception in -[IFWebView mouseMoved])
diff --git a/WebKit/Plugins.subproj/IFNullPluginView.mm b/WebKit/Plugins.subproj/IFNullPluginView.mm
index 1b63cbd..5252612 100644
--- a/WebKit/Plugins.subproj/IFNullPluginView.mm
+++ b/WebKit/Plugins.subproj/IFNullPluginView.mm
@@ -14,17 +14,8 @@ static NSImage *image = nil;
@implementation IFNullPluginView
-static id IFNullPluginMake(NSRect rect, NSString *mimeType, NSDictionary *arguments)
+- initWithFrame:(NSRect)frame mimeType:(NSString *)mime arguments:(NSDictionary *)arguments
{
- return [[[IFNullPluginView alloc] initWithFrame:rect mimeType:mimeType arguments:arguments] autorelease];
-}
-
-+(void) load
-{
- WCSetIFNullPluginMakeFunc(IFNullPluginMake);
-}
-
-- initWithFrame:(NSRect)frame mimeType:(NSString *)mime arguments:(NSDictionary *)arguments{
NSBundle *bundle;
NSString *imagePath, *pluginPageString;
diff --git a/WebKit/Plugins.subproj/IFPluginView.mm b/WebKit/Plugins.subproj/IFPluginView.mm
index b07a4e4..b750104 100644
--- a/WebKit/Plugins.subproj/IFPluginView.mm
+++ b/WebKit/Plugins.subproj/IFPluginView.mm
@@ -15,6 +15,8 @@
#import <Carbon/Carbon.h>
#import <WCPluginWidget.h>
+#import <WCJavaAppletWidget.h>
+#import <WCPluginDatabase.h>
#import <WebFoundation/IFURLHandle.h>
#import <IFPluginStream.h>
#import <IFWebDataSource.h>
@@ -26,6 +28,7 @@
#import <IFWebView.h>
#import <IFBaseWebController.h>
#import <IFPluginNullEventSender.h>
+#import "IFNullPluginView.h"
extern "C" {
#import <CoreGraphics/CoreGraphics.h>
@@ -719,14 +722,68 @@ newCString(NSString *string)
#pragma mark PREBINDING
-static id IFPluginMake(NSRect rect, WCPlugin *plugin, NSString *url, NSString *mimeType, NSDictionary *arguments, uint16 mode)
+static NSView *IFPluginViewCreate(NSString *pluginURL, NSString *serviceType, NSArray *args, NSString *baseURL)
+{
+ NSMutableDictionary *arguments;
+ NSString *mimeType;
+ NSRange r1, r2, r3;
+ WCPlugin *plugin;
+ uint i;
+
+ arguments = [NSMutableDictionary dictionary];
+ for (i = 0; i < [args count]; i++){
+ NSString *arg = [args objectAtIndex:i];
+ if ([arg rangeOfString:@"__KHTML__"].length == 0) {
+ r1 = [arg rangeOfString:@"="]; // parse out attributes and values
+ r2 = [arg rangeOfString:@"\""];
+ r3.location = r2.location + 1;
+ r3.length = [arg length] - r2.location - 2; // don't include quotes
+ [arguments setObject:[arg substringWithRange:r3] forKey:[arg substringToIndex:r1.location]];
+ }
+ }
+
+ if ([baseURL length]) {
+ [arguments setObject:baseURL forKey:@"WebKitBaseURL"];
+ }
+
+ if ([serviceType length]) {
+ mimeType = serviceType;
+ plugin = [[WCPluginDatabase installedPlugins] getPluginForMimeType:mimeType];
+ } else {
+ plugin = [[WCPluginDatabase installedPlugins] getPluginForExtension:[pluginURL pathExtension]];
+ mimeType = [plugin mimeTypeForURL:pluginURL];
+ }
+
+ if (plugin == nil) {
+ return [[[IFNullPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) mimeType:mimeType arguments:arguments] autorelease];
+ }
+ return [[[IFPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) plugin:plugin url:pluginURL mime:mimeType arguments:arguments mode:NP_EMBED] autorelease];
+}
+
+static NSView *IFJavaAppletViewCreate(NSDictionary *arguments)
{
- return [[[IFPluginView alloc] initWithFrame:rect plugin:plugin url:url mime:mimeType arguments:arguments mode:mode] autorelease];
+ WCPlugin *plugin;
+ NSMutableDictionary *argsCopy;
+
+ plugin = [[WCPluginDatabase installedPlugins] getPluginForFilename:@"Java.plugin"];
+ if (plugin == nil) {
+ return nil;
+ }
+
+ argsCopy = [NSMutableDictionary dictionaryWithDictionary:arguments];
+ [argsCopy setObject:[argsCopy objectForKey:@"baseURL"] forKey:@"DOCBASE"];
+ [argsCopy removeObjectForKey:@"baseURL"];
+
+ if (plugin == nil) {
+ return [[[IFNullPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) mimeType:@"application/x-java-applet" arguments:argsCopy] autorelease];
+ }
+ return [[[IFPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) plugin:plugin url:nil mime:@"application/x-java-applet" arguments:argsCopy mode:NP_EMBED] autorelease];
}
+(void) load
{
- WCSetIFPluginMakeFunc(IFPluginMake);
+ IFSetPluginViewCreationFunction(IFPluginViewCreate);
+ IFSetJavaAppletViewCreationFunction(IFJavaAppletViewCreate);
}
@end
diff --git a/WebKit/Plugins.subproj/WebNullPluginView.m b/WebKit/Plugins.subproj/WebNullPluginView.m
index 1b63cbd..5252612 100644
--- a/WebKit/Plugins.subproj/WebNullPluginView.m
+++ b/WebKit/Plugins.subproj/WebNullPluginView.m
@@ -14,17 +14,8 @@ static NSImage *image = nil;
@implementation IFNullPluginView
-static id IFNullPluginMake(NSRect rect, NSString *mimeType, NSDictionary *arguments)
+- initWithFrame:(NSRect)frame mimeType:(NSString *)mime arguments:(NSDictionary *)arguments
{
- return [[[IFNullPluginView alloc] initWithFrame:rect mimeType:mimeType arguments:arguments] autorelease];
-}
-
-+(void) load
-{
- WCSetIFNullPluginMakeFunc(IFNullPluginMake);
-}
-
-- initWithFrame:(NSRect)frame mimeType:(NSString *)mime arguments:(NSDictionary *)arguments{
NSBundle *bundle;
NSString *imagePath, *pluginPageString;
diff --git a/WebKit/Plugins.subproj/WebPluginView.m b/WebKit/Plugins.subproj/WebPluginView.m
index b07a4e4..b750104 100644
--- a/WebKit/Plugins.subproj/WebPluginView.m
+++ b/WebKit/Plugins.subproj/WebPluginView.m
@@ -15,6 +15,8 @@
#import <Carbon/Carbon.h>
#import <WCPluginWidget.h>
+#import <WCJavaAppletWidget.h>
+#import <WCPluginDatabase.h>
#import <WebFoundation/IFURLHandle.h>
#import <IFPluginStream.h>
#import <IFWebDataSource.h>
@@ -26,6 +28,7 @@
#import <IFWebView.h>
#import <IFBaseWebController.h>
#import <IFPluginNullEventSender.h>
+#import "IFNullPluginView.h"
extern "C" {
#import <CoreGraphics/CoreGraphics.h>
@@ -719,14 +722,68 @@ newCString(NSString *string)
#pragma mark PREBINDING
-static id IFPluginMake(NSRect rect, WCPlugin *plugin, NSString *url, NSString *mimeType, NSDictionary *arguments, uint16 mode)
+static NSView *IFPluginViewCreate(NSString *pluginURL, NSString *serviceType, NSArray *args, NSString *baseURL)
+{
+ NSMutableDictionary *arguments;
+ NSString *mimeType;
+ NSRange r1, r2, r3;
+ WCPlugin *plugin;
+ uint i;
+
+ arguments = [NSMutableDictionary dictionary];
+ for (i = 0; i < [args count]; i++){
+ NSString *arg = [args objectAtIndex:i];
+ if ([arg rangeOfString:@"__KHTML__"].length == 0) {
+ r1 = [arg rangeOfString:@"="]; // parse out attributes and values
+ r2 = [arg rangeOfString:@"\""];
+ r3.location = r2.location + 1;
+ r3.length = [arg length] - r2.location - 2; // don't include quotes
+ [arguments setObject:[arg substringWithRange:r3] forKey:[arg substringToIndex:r1.location]];
+ }
+ }
+
+ if ([baseURL length]) {
+ [arguments setObject:baseURL forKey:@"WebKitBaseURL"];
+ }
+
+ if ([serviceType length]) {
+ mimeType = serviceType;
+ plugin = [[WCPluginDatabase installedPlugins] getPluginForMimeType:mimeType];
+ } else {
+ plugin = [[WCPluginDatabase installedPlugins] getPluginForExtension:[pluginURL pathExtension]];
+ mimeType = [plugin mimeTypeForURL:pluginURL];
+ }
+
+ if (plugin == nil) {
+ return [[[IFNullPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) mimeType:mimeType arguments:arguments] autorelease];
+ }
+ return [[[IFPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) plugin:plugin url:pluginURL mime:mimeType arguments:arguments mode:NP_EMBED] autorelease];
+}
+
+static NSView *IFJavaAppletViewCreate(NSDictionary *arguments)
{
- return [[[IFPluginView alloc] initWithFrame:rect plugin:plugin url:url mime:mimeType arguments:arguments mode:mode] autorelease];
+ WCPlugin *plugin;
+ NSMutableDictionary *argsCopy;
+
+ plugin = [[WCPluginDatabase installedPlugins] getPluginForFilename:@"Java.plugin"];
+ if (plugin == nil) {
+ return nil;
+ }
+
+ argsCopy = [NSMutableDictionary dictionaryWithDictionary:arguments];
+ [argsCopy setObject:[argsCopy objectForKey:@"baseURL"] forKey:@"DOCBASE"];
+ [argsCopy removeObjectForKey:@"baseURL"];
+
+ if (plugin == nil) {
+ return [[[IFNullPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) mimeType:@"application/x-java-applet" arguments:argsCopy] autorelease];
+ }
+ return [[[IFPluginView alloc] initWithFrame:NSMakeRect(0,0,0,0) plugin:plugin url:nil mime:@"application/x-java-applet" arguments:argsCopy mode:NP_EMBED] autorelease];
}
+(void) load
{
- WCSetIFPluginMakeFunc(IFPluginMake);
+ IFSetPluginViewCreationFunction(IFPluginViewCreate);
+ IFSetJavaAppletViewCreationFunction(IFJavaAppletViewCreate);
}
@end
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list