Commit b1961817 authored by darin's avatar darin

WebCore:

	- moved all NSURL and CFURL use out of WebCore

        * kwq/KWQKURL.h: Remove getNSURL() and getNSURLFromString().
        * kwq/KWQKURL.mm: Ditto.

        * kwq/KWQKCookieJar.mm:
        (KWQKCookieJar::cookie): Pass an NSString instead of an NSURL.
        (KWQKCookieJar::setCookie): Ditto.
        * kwq/KWQKHTMLPart.mm:
        (KWQKHTMLPart::openURL): Ditto.
        (KWQKHTMLPart::openURLRequest): Ditto.
        (KWQKHTMLPart::submitForm): Ditto.
        (KWQKHTMLPart::urlSelected): Ditto.
        (KWQKHTMLPart::createPart): Ditto.
        (KWQKHTMLPart::redirectionTimerStartedOrStopped): Ditto.
        (KWQKHTMLPart::userAgent): Ditto.
        (KWQKHTMLPart::requestedURLString): Receive an NSString instead of an NSURL.
        * kwq/KWQKHTMLPartBrowserExtension.mm:
        (KHTMLPartBrowserExtension::createNewWindow): Pass an NSString instead of an NSURL.
        (KHTMLPartBrowserExtension::setIconURL): Ditto.
        (KHTMLPartBrowserExtension::setTypedIconURL): Ditto.
        * kwq/KWQKJavaAppletWidget.h: Remove use of NSURL, just use QString instead.
        * kwq/KWQKJavaAppletWidget.mm:
        (KJavaAppletWidget::KJavaAppletWidget): No need to set the QString to nil.
        (KJavaAppletWidget::~KJavaAppletWidget): No need to release the QString.
        (KJavaAppletWidget::showApplet): Pass an NSString instead of an NSURL.
        * kwq/KWQLoader.mm:
        (KWQServeRequest): Pass an NSString instead of an NSURL.
        (KWQCheckCacheObjectStatus): Ditto.
        * kwq/WebCoreBridge.h: Change all methods to use NSString instead of NSURL.
        * kwq/WebCoreBridge.mm:
        (-[WebCoreBridge openURL:reload:headers:]): Receive an NSString instead of an NSURL.
        (-[WebCoreBridge completeURLForDOMString:]): Return an NSString instead of an NSURL.
        (-[WebCoreBridge elementAtPoint:]): WebCoreElementLinkURL and WebCoreElementImageURL
	are now strings.
        (-[WebCoreBridge URL]): Return an NSString instead of an NSURL.
        * kwq/WebCoreCookieAdapter.h: Change all methods to use NSString instead of NSURL.
        * kwq/WebCoreCookieAdapter.m:
        (-[WebCoreCookieAdapter cookiesForURL:]): Ditto.
        (-[WebCoreCookieAdapter setCookies:forURL:policyBaseURL:]): Ditto.

        * khtml/rendering/render_applet.cpp: (RenderApplet::processArguments):
	Tweaked this file a tiny bit, mainly because header dependencies weren't working
	and we need this file to be recompiled due to inline function changes.

WebKit:

	- update for change to WebCore API so it never uses NSURL

        * WebCoreSupport.subproj/WebBridge.m:
        (-[WebBridge createWindowWithURL:frameName:]): Take NSString instead of NSURL.
        (-[WebBridge startLoadingResource:withURL:]): Ditto.
        (-[WebBridge objectLoadedFromCacheWithURL:response:size:]): Ditto.
        (-[WebBridge reportClientRedirectToURL:delay:fireDate:]): Ditto.
        (-[WebBridge setIconURL:]): Ditto.
        (-[WebBridge setIconURL:withType:]): Ditto.
        (-[WebBridge loadURL:reload:triggeringEvent:isFormSubmission:]): Ditto.
        (-[WebBridge postWithURL:data:contentType:triggeringEvent:]): Ditto.
        (-[WebBridge createChildFrameNamed:withURL:renderPart:allowsScrolling:marginWidth:marginHeight:]): Ditto.
        (-[WebBridge userAgentForURL:]): Ditto.
        (-[WebBridge requestedURL]): Return NSString instead of NSURL.
        (-[WebBridge viewForPluginWithURL:attributes:baseURL:MIMEType:]): Take NSString instead of NSURL.
        (-[WebBridge viewForJavaAppletWithFrame:attributes:baseURL:]): Take NSString instead of NSURL.

        * WebCoreSupport.subproj/WebCookieAdapter.m:
        (-[WebCookieAdapter cookiesForURL:]): Take NSString instead of NSURL.
        (-[WebCookieAdapter setCookies:forURL:policyBaseURL:]): Ditto.

        * WebView.subproj/WebDataSourcePrivate.m:
        (-[WebDataSource _commitIfReady]): Pass NSString instead of NSURL.
        * WebView.subproj/WebFramePrivate.m:
        (-[WebFrame _continueFragmentScrollAfterNavigationPolicy:request:]): Pass NSString instead of NSURL
        (-[WebFrame _loadURL:loadType:triggeringEvent:isFormSubmission:]): Turn bridge URL into NSURL so we
	can call _web_URLByRemovingFragment on it.
        * WebView.subproj/WebHTMLViewPrivate.m:
        (-[WebHTMLView _elementAtPoint:]): Convert NSString to NSURL when making the WebKit element dictionary.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2720 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7d5a4793
2002-11-17 Darin Adler <darin@apple.com>
- moved all NSURL and CFURL use out of WebCore
* kwq/KWQKURL.h: Remove getNSURL() and getNSURLFromString().
* kwq/KWQKURL.mm: Ditto.
* kwq/KWQKCookieJar.mm:
(KWQKCookieJar::cookie): Pass an NSString instead of an NSURL.
(KWQKCookieJar::setCookie): Ditto.
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::openURL): Ditto.
(KWQKHTMLPart::openURLRequest): Ditto.
(KWQKHTMLPart::submitForm): Ditto.
(KWQKHTMLPart::urlSelected): Ditto.
(KWQKHTMLPart::createPart): Ditto.
(KWQKHTMLPart::redirectionTimerStartedOrStopped): Ditto.
(KWQKHTMLPart::userAgent): Ditto.
(KWQKHTMLPart::requestedURLString): Receive an NSString instead of an NSURL.
* kwq/KWQKHTMLPartBrowserExtension.mm:
(KHTMLPartBrowserExtension::createNewWindow): Pass an NSString instead of an NSURL.
(KHTMLPartBrowserExtension::setIconURL): Ditto.
(KHTMLPartBrowserExtension::setTypedIconURL): Ditto.
* kwq/KWQKJavaAppletWidget.h: Remove use of NSURL, just use QString instead.
* kwq/KWQKJavaAppletWidget.mm:
(KJavaAppletWidget::KJavaAppletWidget): No need to set the QString to nil.
(KJavaAppletWidget::~KJavaAppletWidget): No need to release the QString.
(KJavaAppletWidget::showApplet): Pass an NSString instead of an NSURL.
* kwq/KWQLoader.mm:
(KWQServeRequest): Pass an NSString instead of an NSURL.
(KWQCheckCacheObjectStatus): Ditto.
* kwq/WebCoreBridge.h: Change all methods to use NSString instead of NSURL.
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge openURL:reload:headers:]): Receive an NSString instead of an NSURL.
(-[WebCoreBridge completeURLForDOMString:]): Return an NSString instead of an NSURL.
(-[WebCoreBridge elementAtPoint:]): WebCoreElementLinkURL and WebCoreElementImageURL
are now strings.
(-[WebCoreBridge URL]): Return an NSString instead of an NSURL.
* kwq/WebCoreCookieAdapter.h: Change all methods to use NSString instead of NSURL.
* kwq/WebCoreCookieAdapter.m:
(-[WebCoreCookieAdapter cookiesForURL:]): Ditto.
(-[WebCoreCookieAdapter setCookies:forURL:policyBaseURL:]): Ditto.
* khtml/rendering/render_applet.cpp: (RenderApplet::processArguments):
Tweaked this file a tiny bit, mainly because header dependencies weren't working
and we need this file to be recompiled due to inline function changes.
2002-11-17 David Hyatt <hyatt@apple.com>
Add support for specifying whether repaint should be immediate or
......
2002-11-17 Darin Adler <darin@apple.com>
- moved all NSURL and CFURL use out of WebCore
* kwq/KWQKURL.h: Remove getNSURL() and getNSURLFromString().
* kwq/KWQKURL.mm: Ditto.
* kwq/KWQKCookieJar.mm:
(KWQKCookieJar::cookie): Pass an NSString instead of an NSURL.
(KWQKCookieJar::setCookie): Ditto.
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::openURL): Ditto.
(KWQKHTMLPart::openURLRequest): Ditto.
(KWQKHTMLPart::submitForm): Ditto.
(KWQKHTMLPart::urlSelected): Ditto.
(KWQKHTMLPart::createPart): Ditto.
(KWQKHTMLPart::redirectionTimerStartedOrStopped): Ditto.
(KWQKHTMLPart::userAgent): Ditto.
(KWQKHTMLPart::requestedURLString): Receive an NSString instead of an NSURL.
* kwq/KWQKHTMLPartBrowserExtension.mm:
(KHTMLPartBrowserExtension::createNewWindow): Pass an NSString instead of an NSURL.
(KHTMLPartBrowserExtension::setIconURL): Ditto.
(KHTMLPartBrowserExtension::setTypedIconURL): Ditto.
* kwq/KWQKJavaAppletWidget.h: Remove use of NSURL, just use QString instead.
* kwq/KWQKJavaAppletWidget.mm:
(KJavaAppletWidget::KJavaAppletWidget): No need to set the QString to nil.
(KJavaAppletWidget::~KJavaAppletWidget): No need to release the QString.
(KJavaAppletWidget::showApplet): Pass an NSString instead of an NSURL.
* kwq/KWQLoader.mm:
(KWQServeRequest): Pass an NSString instead of an NSURL.
(KWQCheckCacheObjectStatus): Ditto.
* kwq/WebCoreBridge.h: Change all methods to use NSString instead of NSURL.
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge openURL:reload:headers:]): Receive an NSString instead of an NSURL.
(-[WebCoreBridge completeURLForDOMString:]): Return an NSString instead of an NSURL.
(-[WebCoreBridge elementAtPoint:]): WebCoreElementLinkURL and WebCoreElementImageURL
are now strings.
(-[WebCoreBridge URL]): Return an NSString instead of an NSURL.
* kwq/WebCoreCookieAdapter.h: Change all methods to use NSString instead of NSURL.
* kwq/WebCoreCookieAdapter.m:
(-[WebCoreCookieAdapter cookiesForURL:]): Ditto.
(-[WebCoreCookieAdapter setCookies:forURL:policyBaseURL:]): Ditto.
* khtml/rendering/render_applet.cpp: (RenderApplet::processArguments):
Tweaked this file a tiny bit, mainly because header dependencies weren't working
and we need this file to be recompiled due to inline function changes.
2002-11-17 David Hyatt <hyatt@apple.com>
Add support for specifying whether repaint should be immediate or
......
2002-11-17 Darin Adler <darin@apple.com>
- moved all NSURL and CFURL use out of WebCore
* kwq/KWQKURL.h: Remove getNSURL() and getNSURLFromString().
* kwq/KWQKURL.mm: Ditto.
* kwq/KWQKCookieJar.mm:
(KWQKCookieJar::cookie): Pass an NSString instead of an NSURL.
(KWQKCookieJar::setCookie): Ditto.
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::openURL): Ditto.
(KWQKHTMLPart::openURLRequest): Ditto.
(KWQKHTMLPart::submitForm): Ditto.
(KWQKHTMLPart::urlSelected): Ditto.
(KWQKHTMLPart::createPart): Ditto.
(KWQKHTMLPart::redirectionTimerStartedOrStopped): Ditto.
(KWQKHTMLPart::userAgent): Ditto.
(KWQKHTMLPart::requestedURLString): Receive an NSString instead of an NSURL.
* kwq/KWQKHTMLPartBrowserExtension.mm:
(KHTMLPartBrowserExtension::createNewWindow): Pass an NSString instead of an NSURL.
(KHTMLPartBrowserExtension::setIconURL): Ditto.
(KHTMLPartBrowserExtension::setTypedIconURL): Ditto.
* kwq/KWQKJavaAppletWidget.h: Remove use of NSURL, just use QString instead.
* kwq/KWQKJavaAppletWidget.mm:
(KJavaAppletWidget::KJavaAppletWidget): No need to set the QString to nil.
(KJavaAppletWidget::~KJavaAppletWidget): No need to release the QString.
(KJavaAppletWidget::showApplet): Pass an NSString instead of an NSURL.
* kwq/KWQLoader.mm:
(KWQServeRequest): Pass an NSString instead of an NSURL.
(KWQCheckCacheObjectStatus): Ditto.
* kwq/WebCoreBridge.h: Change all methods to use NSString instead of NSURL.
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge openURL:reload:headers:]): Receive an NSString instead of an NSURL.
(-[WebCoreBridge completeURLForDOMString:]): Return an NSString instead of an NSURL.
(-[WebCoreBridge elementAtPoint:]): WebCoreElementLinkURL and WebCoreElementImageURL
are now strings.
(-[WebCoreBridge URL]): Return an NSString instead of an NSURL.
* kwq/WebCoreCookieAdapter.h: Change all methods to use NSString instead of NSURL.
* kwq/WebCoreCookieAdapter.m:
(-[WebCoreCookieAdapter cookiesForURL:]): Ditto.
(-[WebCoreCookieAdapter setCookies:forURL:policyBaseURL:]): Ditto.
* khtml/rendering/render_applet.cpp: (RenderApplet::processArguments):
Tweaked this file a tiny bit, mainly because header dependencies weren't working
and we need this file to be recompiled due to inline function changes.
2002-11-17 David Hyatt <hyatt@apple.com>
Add support for specifying whether repaint should be immediate or
......
......@@ -120,11 +120,12 @@ void RenderApplet::layout()
void RenderApplet::processArguments(const QMap<QString, QString> &args)
{
KJavaAppletWidget *w = static_cast<KJavaAppletWidget*>(m_widget);
KJavaApplet* applet = w ? w->applet() : 0;
#if APPLE_CHANGES
if (w)
w->processArguments(args);
#endif
KJavaApplet* applet = w ? w->applet() : 0;
if ( applet ) {
applet->setBaseURL( args[QString::fromLatin1("baseURL") ] );
......
......@@ -24,12 +24,13 @@
*/
#import "KWQKCookieJar.h"
#import "WebCoreCookieAdapter.h"
#import "KWQKURL.h"
QString KWQKCookieJar::cookie(const KURL &url)
{
NSString *result = [[WebCoreCookieAdapter sharedAdapter] cookiesForURL:url.getNSURL()];
NSString *result = [[WebCoreCookieAdapter sharedAdapter] cookiesForURL:url.url().getNSString()];
if (result != nil) {
return QString::fromNSString(result);
} else {
......@@ -39,7 +40,8 @@ QString KWQKCookieJar::cookie(const KURL &url)
void KWQKCookieJar::setCookie(const KURL &url, const KURL &policyBaseURL, const QString &cookie)
{
[[WebCoreCookieAdapter sharedAdapter] setCookies:cookie.getNSString() forURL:url.getNSURL() policyBaseURL:policyBaseURL.getNSURL()];
[[WebCoreCookieAdapter sharedAdapter] setCookies:cookie.getNSString()
forURL:url.url().getNSString() policyBaseURL:policyBaseURL.url().getNSString()];
}
bool KWQKCookieJar::cookieEnabled()
......
......@@ -137,43 +137,25 @@ QString KWQKHTMLPart::generateFrameName()
void KWQKHTMLPart::openURL(const KURL &url)
{
NSURL *cocoaURL = url.getNSURL();
if (cocoaURL == nil) {
// FIXME: Do we need to report an error to someone?
return;
}
// FIXME: The lack of args here to get the reload flag from
// indicates a problem in how we use KHTMLPart::processObjectRequest,
// where we are opening the URL before the args are set up.
[_bridge loadURL:cocoaURL reload:NO triggeringEvent:nil isFormSubmission:NO];
[_bridge loadURL:url.url().getNSString() reload:NO triggeringEvent:nil isFormSubmission:NO];
}
void KWQKHTMLPart::openURLRequest(const KURL &url, const URLArgs &args)
{
NSURL *cocoaURL = url.getNSURL();
if (cocoaURL == nil) {
// FIXME: Do we need to report an error to someone?
return;
}
[bridgeForFrameName(args.frameName) loadURL:cocoaURL reload:args.reload triggeringEvent:nil isFormSubmission:NO];
[bridgeForFrameName(args.frameName) loadURL:url.url().getNSString() reload:args.reload triggeringEvent:nil isFormSubmission:NO];
}
void KWQKHTMLPart::submitForm(const KURL &url, const URLArgs &args)
{
NSURL *cocoaURL = url.getNSURL();
if (cocoaURL == nil) {
// FIXME: Do we need to report an error to someone?
return;
}
if (!args.doPost()) {
[bridgeForFrameName(args.frameName) loadURL:cocoaURL reload:args.reload triggeringEvent:_currentEvent isFormSubmission:YES];
[bridgeForFrameName(args.frameName) loadURL:url.url().getNSString() reload:args.reload triggeringEvent:_currentEvent isFormSubmission:YES];
} else {
QString contentType = args.contentType();
ASSERT(contentType.startsWith("Content-Type: "));
[bridgeForFrameName(args.frameName) postWithURL:cocoaURL
[bridgeForFrameName(args.frameName) postWithURL:url.url().getNSString()
data:[NSData dataWithBytes:args.postData.data() length:args.postData.size()]
contentType:contentType.mid(14).getNSString() triggeringEvent:_currentEvent];
}
......@@ -199,13 +181,7 @@ void KWQKHTMLPart::slotData(NSString *encoding, bool forceEncoding, const char *
void KWQKHTMLPart::urlSelected(const KURL &url, int button, int state, const URLArgs &args)
{
NSURL *cocoaURL = url.getNSURL();
if (cocoaURL == nil) {
// FIXME: Do we need to report an error to someone?
return;
}
[bridgeForFrameName(args.frameName) loadURL:cocoaURL reload:args.reload triggeringEvent:_currentEvent isFormSubmission:NO];
[bridgeForFrameName(args.frameName) loadURL:url.url().getNSString() reload:args.reload triggeringEvent:_currentEvent isFormSubmission:NO];
}
class KWQPluginPart : public ReadOnlyPart
......@@ -216,12 +192,6 @@ class KWQPluginPart : public ReadOnlyPart
ReadOnlyPart *KWQKHTMLPart::createPart(const ChildFrame &child, const KURL &url, const QString &mimeType)
{
NSURL *childURL = url.getNSURL();
if (childURL == nil) {
// FIXME: Do we need to report an error to someone?
return 0;
}
if (child.m_type == ChildFrame::Object) {
NSMutableArray *attributesArray = [NSMutableArray arrayWithCapacity:child.m_params.count()];
for (uint i = 0; i < child.m_params.count(); i++) {
......@@ -229,17 +199,20 @@ ReadOnlyPart *KWQKHTMLPart::createPart(const ChildFrame &child, const KURL &url,
}
KWQPluginPart *newPart = new KWQPluginPart;
newPart->setWidget(new QWidget([_bridge viewForPluginWithURL:childURL
newPart->setWidget(new QWidget([_bridge viewForPluginWithURL:url.url().getNSString()
attributes:attributesArray
baseURL:KURL(d->m_doc->baseURL()).getNSURL()
baseURL:d->m_doc->baseURL().getNSString()
MIMEType:child.m_args.serviceType.getNSString()]));
return newPart;
} else {
LOG(Frames, "name %s", child.m_name.ascii());
HTMLIFrameElementImpl *o = static_cast<HTMLIFrameElementImpl *>(child.m_frame->element());
WebCoreBridge *childBridge = [_bridge createChildFrameNamed:child.m_name.getNSString() withURL:childURL
renderPart:child.m_frame allowsScrolling:o->scrollingMode() != QScrollView::AlwaysOff
marginWidth:o->getMarginWidth() marginHeight:o->getMarginHeight()];
WebCoreBridge *childBridge = [_bridge createChildFrameNamed:child.m_name.getNSString()
withURL:url.url().getNSString()
renderPart:child.m_frame
allowsScrolling:o->scrollingMode() != QScrollView::AlwaysOff
marginWidth:o->getMarginWidth()
marginHeight:o->getMarginHeight()];
return [childBridge part];
}
}
......@@ -298,9 +271,9 @@ void KWQKHTMLPart::jumpToSelection()
void KWQKHTMLPart::redirectionTimerStartedOrStopped()
{
if (d->m_redirectionTimer.isActive()) {
[_bridge reportClientRedirectTo:KURL(d->m_redirectURL).getNSURL()
delay:d->m_delayRedirect
fireDate:[d->m_redirectionTimer.getNSTimer() fireDate]];
[_bridge reportClientRedirectToURL:d->m_redirectURL.getNSString()
delay:d->m_delayRedirect
fireDate:[d->m_redirectionTimer.getNSTimer() fireDate]];
} else {
[_bridge reportClientRedirectCancelled];
}
......@@ -357,7 +330,7 @@ RenderObject *KWQKHTMLPart::renderer()
QString KWQKHTMLPart::userAgent() const
{
return QString::fromNSString([_bridge userAgentForURL:part->m_url.getNSURL()]);
return QString::fromNSString([_bridge userAgentForURL:part->m_url.url().getNSString()]);
}
NSView *KWQKHTMLPart::nextKeyViewInFrame(NodeImpl *node, KWQSelectionDirection direction)
......@@ -507,7 +480,7 @@ void KWQKHTMLPart::setPolicyBaseURL(const DOM::DOMString &s)
QString KWQKHTMLPart::requestedURLString() const
{
return QString::fromNSString([[_bridge requestedURL] absoluteString]);
return QString::fromNSString([_bridge requestedURL]);
}
void KWQKHTMLPart::forceLayout()
......
......@@ -69,15 +69,14 @@ void KHTMLPartBrowserExtension::createNewWindow(const KURL &url,
bridge = [m_part->kwq->bridge() findFramedNamed:frameName];
if (bridge != nil) {
if (!url.isEmpty()) {
[bridge loadURL:url.getNSURL() reload:urlArgs.reload triggeringEvent:nil isFormSubmission:NO];
[bridge loadURL:url.url().getNSString() reload:urlArgs.reload triggeringEvent:nil isFormSubmission:NO];
}
*partResult = [bridge part];
return;
}
}
NSURL *cocoaURL = url.isEmpty() ? nil : url.getNSURL();
bridge = [m_part->kwq->bridge() createWindowWithURL:cocoaURL frameName:frameName];
bridge = [m_part->kwq->bridge() createWindowWithURL:url.url().getNSString() frameName:frameName];
if (!winArgs.toolBarsVisible) {
[bridge setToolbarsVisible:NO];
......@@ -129,10 +128,10 @@ void KHTMLPartBrowserExtension::createNewWindow(const KURL &url,
void KHTMLPartBrowserExtension::setIconURL(const KURL &url)
{
[m_part->kwq->bridge() setIconURL:url.getNSURL()];
[m_part->kwq->bridge() setIconURL:url.url().getNSString()];
}
void KHTMLPartBrowserExtension::setTypedIconURL(const KURL &url, const QString &type)
{
[m_part->kwq->bridge() setIconURL:url.getNSURL() withType:type.getNSString()];
[m_part->kwq->bridge() setIconURL:url.url().getNSString() withType:type.getNSString()];
}
......@@ -31,10 +31,8 @@ class KJavaAppletContext;
class KJavaAppletWidget;
#ifdef __OBJC__
@class NSURL;
@class NSMutableDictionary;
#else
class NSURL;
class NSMutableDictionary;
#endif
......@@ -63,18 +61,18 @@ public:
void processArguments(const QMap<QString, QString>&);
KJavaApplet *applet() { return &m_applet; }
KJavaApplet *applet() { return &_applet; }
void setBaseURL(const QString &);
void setBaseURL(const QString &baseURL) { _baseURL = baseURL; }
void setParameter(const QString &, const QString &);
void showApplet();
private:
KJavaApplet m_applet;
KJavaAppletContext *m_context;
NSURL *m_baseURL;
NSMutableDictionary *m_parameters;
KJavaApplet _applet;
KJavaAppletContext *_context;
QString _baseURL;
NSMutableDictionary *_parameters;
};
inline void KJavaApplet::setBaseURL(const QString &URL) { m_widget.setBaseURL(URL); }
......
......@@ -31,23 +31,15 @@
#import "WebCoreBridge.h"
KJavaAppletWidget::KJavaAppletWidget(KJavaAppletContext *c, QWidget *)
: m_applet(*this)
, m_baseURL(nil)
, m_parameters([[NSMutableDictionary alloc] init])
: _applet(*this)
, _context(c)
, _parameters([[NSMutableDictionary alloc] init])
{
m_context = c;
}
KJavaAppletWidget::~KJavaAppletWidget()
{
[m_baseURL release];
[m_parameters release];
}
void KJavaAppletWidget::setBaseURL(const QString &baseURL)
{
[m_baseURL release];
m_baseURL = [KURL(baseURL).getNSURL() retain];
[_parameters release];
}
void KJavaAppletWidget::setParameter(const QString &name, const QString &value)
......@@ -55,7 +47,7 @@ void KJavaAppletWidget::setParameter(const QString &name, const QString &value)
// When putting strings into dictionaries, we should use an immutable copy.
// That's not necessary for keys, because they are copied.
NSString *immutableString = [value.getNSString() copy];
[m_parameters setObject:immutableString forKey:name.getNSString()];
[_parameters setObject:immutableString forKey:name.getNSString()];
[immutableString release];
}
......@@ -68,8 +60,8 @@ void KJavaAppletWidget::processArguments(const QMap<QString, QString> &arguments
void KJavaAppletWidget::showApplet()
{
setView([m_context->part()->kwq->bridge()
viewForJavaAppletWithFrame:NSMakeRect(pos().x(), pos().y(), size().width(), size().height())
attributes:m_parameters
baseURL:m_baseURL]);
setView([_context->part()->kwq->bridge()
viewForJavaAppletWithFrame:NSMakeRect(pos().x(), pos().y(), size().width(), size().height())
attributes:_parameters
baseURL:_baseURL.getNSString()]);
}
......@@ -30,12 +30,6 @@
#include "KWQValueList.h"
#include "KWQRefPtr.h"
#ifdef __OBJC__
@class NSURL;
#else
class NSURL;
#endif
class KURL {
public:
KURL();
......@@ -71,11 +65,8 @@ public:
QString prettyURL(int trailing=0) const;
NSURL *getNSURL() const;
static QString decode_string(const QString &);
static QString encode_string(const QString &);
static NSURL *getNSURLFromString(const QString &);
friend bool operator==(const KURL &, const KURL &);
......
......@@ -1055,11 +1055,6 @@ void KURL::parse(const char *url, const QString *originalString)
}
}
NSURL *KURL::getNSURL() const
{
return KURL::getNSURLFromString(urlString);
}
QString KURL::encodedHtmlRef() const
{
return ref();
......@@ -1113,31 +1108,3 @@ QString KURL::encode_string(const QString& notEncodedString)
return result;
}
NSURL *KURL::getNSURLFromString(const QString &urlString)
{
NSString *string = urlString.getNSString();
// Had to re-add this hack to work around CFURL bug 2908969, and to prevent the symptoms
// described in bug 3032058.
if ([string hasPrefix:@"file:/"] && ![string hasPrefix:@"file://"]) {
string = [NSString stringWithFormat:@"file://%@", [string substringFromIndex:5]];
}
NSURL *URL = [NSURL URLWithString:string];
if (!URL) {
// Try to create URL again, but this time do some more string escaping first.
// Eventually, we would prefer not to have to take this extra step, as the extra
// escaping causes bugs like 3064743.
// Note the set of unescaped characters contains the square brackets.
// This is a bit of license we take with CFURL and its code to detect characters
// it considers illegal. See 3102332 for more information.
CFStringRef stricterString = CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)string, CFSTR("[]%"), NULL, kCFStringEncodingUTF8);
if (stricterString) {
URL = [NSURL URLWithString:(NSString *)stricterString];
CFRelease(stricterString);
}
}
return URL;
}
......@@ -47,15 +47,8 @@ bool KWQServeRequest(Loader *loader, Request *request, TransferJob *job)
WebCoreBridge *bridge = ((KHTMLPart *)request->m_docLoader->part())->kwq->bridge();
NSURL *URL = job->url().getNSURL();
if (URL == nil) {
[bridge reportBadURL:job->url().url().getNSString()];
delete job;
return false;
}
KWQResourceLoader *resourceLoader = [[KWQResourceLoader alloc] initWithLoader:loader job:job];
id <WebCoreResourceHandle> handle = [bridge startLoadingResource:resourceLoader withURL:URL];
id <WebCoreResourceHandle> handle = [bridge startLoadingResource:resourceLoader withURL:job->url().url().getNSString()];
[resourceLoader setHandle:handle];
[resourceLoader release];
......@@ -88,10 +81,10 @@ void KWQCheckCacheObjectStatus(DocLoader *loader, CachedObject *cachedObject)
// Notify the caller that we "loaded".
WebCoreBridge *bridge = ((KHTMLPart *)loader->part())->kwq->bridge();
NSURL *URL = KURL::getNSURLFromString(cachedObject->url().string());
ASSERT(URL);
CachedImage *cachedImage = dynamic_cast<CachedImage *>(cachedObject);
[bridge objectLoadedFromCache:URL response:(id)cachedObject->response() size:cachedImage ? cachedImage->dataSize() : cachedObject->size()];
[bridge objectLoadedFromCacheWithURL:cachedObject->url().string().getNSString()
response:(id)cachedObject->response()
size:cachedImage ? cachedImage->dataSize() : cachedObject->size()];
}
void KWQRetainResponse(void *response)
......
......@@ -94,7 +94,7 @@ enum FrameBorderStyle {
- (void)setParent:(WebCoreBridge *)parent;
- (void)openURL:(NSURL *)URL reload:(BOOL)reload headers:(NSDictionary *)headers;
- (void)openURL:(NSString *)URL reload:(BOOL)reload headers:(NSDictionary *)headers;
- (void)addData:(NSData *)data withEncoding:(NSString *)encoding;
- (void)addData:(NSData *)data withOverrideEncoding:(NSString *)encoding;
- (void)closeURL;
......@@ -102,7 +102,7 @@ enum FrameBorderStyle {
- (void)restoreDocumentState;
- (void)end;
- (NSURL *)URL;
- (NSString *)URL;
- (NSString *)referrer;
- (void)installInFrame:(NSView *)view;
......@@ -179,21 +179,21 @@ enum FrameBorderStyle {
/* Creates a name for an frame unnamed in the HTML. It should produce repeatable results for loads of the same frameset. */
- (NSString *)generateFrameName;
- (void)loadURL:(NSURL *)URL reload:(BOOL)reload triggeringEvent:(NSEvent *)event isFormSubmission:(BOOL)isFormSubmission;
- (void)postWithURL:(NSURL *)URL data:(NSData *)data contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event;
- (void)loadURL:(NSString *)URL reload:(BOOL)reload triggeringEvent:(NSEvent *)event isFormSubmission:(BOOL)isFormSubmission;
- (void)postWithURL:(NSString *)URL data:(NSData *)data contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event;
- (WebCoreBridge *)createWindowWithURL:(NSURL *)URL frameName:(NSString *)name;
- (WebCoreBridge *)createWindowWithURL:(NSString *)URL frameName:(NSString *)name;
- (void)showWindow;
- (NSString *)userAgentForURL:(NSURL *)URL;
- (NSString *)userAgentForURL:(NSString *)URL;
- (void)setTitle:(NSString *)title;
- (void)setStatusText:(NSString *)status;
- (void)setIconURL:(NSURL *)URL;
- (void)setIconURL:(NSURL *)URL withType:(NSString *)string;
- (void)setIconURL:(NSString *)URL;
- (void)setIconURL:(NSString *)URL withType:(NSString *)string;
- (WebCoreBridge *)createChildFrameNamed:(NSString *)frameName withURL:(NSURL *)URL
- (WebCoreBridge *)createChildFrameNamed:(NSString *)frameName withURL:(NSString *)URL
renderPart:(KHTMLRenderPart *)renderPart
allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height;
......@@ -206,12 +206,11 @@ enum FrameBorderStyle {
- (NSWindow *)window;
- (void)setWindowFrame:(NSRect)frame;
- (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withURL:(NSURL *)URL;
- (void)reportBadURL:(NSString *)badURL;
- (void)objectLoadedFromCache:(NSURL *)URL response:(id)response size:(unsigned)bytes;
- (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withURL:(NSString *)URL;
- (void)objectLoadedFromCacheWithURL:(NSString *)URL response:(id)response size:(unsigned)bytes;
- (BOOL)isReloading;
- (void)reportClientRedirectTo:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date;
- (void)reportClientRedirectToURL:(NSString *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date;
- (void)reportClientRedirectCancelled;
- (void)unfocusWindow;
......@@ -227,10 +226,10 @@ enum FrameBorderStyle {
- (void)setNeedsReapplyStyles;
- (void)setNeedsLayout;
- (NSURL *)requestedURL;
- (NSString *)requestedURL;
- (NSView *)viewForPluginWithURL:(NSURL *)URL attributes:(NSArray *)attributesArray baseURL:(NSURL *)baseURL MIMEType:(NSString *)MIMEType;
- (NSView *)viewForJavaAppletWithFrame:(NSRect)frame attributes:(NSDictionary *)attributes baseURL:(NSURL *)baseURL;
- (NSView *)viewForPluginWithURL:(NSString *)URL attributes:(NSArray *)attributesArray baseURL:(NSString *)baseURL MIMEType:(NSString *)MIMEType;
- (NSView *)viewForJavaAppletWithFrame:(NSRect)frame attributes:(NSDictionary *)attributes baseURL:(NSString *)baseURL;
@end
......
......@@ -110,7 +110,7 @@ using khtml::RenderPart;