Commit 15d67e44 authored by darin's avatar darin
Browse files

WebCore:

	Here's the *real* mistake that killed plugins. I accidentally
	stopped creating objects at all! Duh. Fixed now.

        * kwq/KWQKHTMLPartImpl.mm: (KWQKHTMLPartImpl::createPart):
	Make a part for a plugin if we need one. Not a KHTMLPart, but
	a KWQPluginPart.

WebKit:

	Added assertions, and dealt with some breakage I created while
	trying to fix, here, what I broke in WebCore.

        * Plugins.subproj/WebPluginView.m: (-[WebNetscapePluginView start]):
	Do get the dataSource from our parent when we are being used as an
	object in a view rather than a document view.

        * Plugins.subproj/WebPluginStream.m:
        * WebView.subproj/WebDataSource.m:
        * WebView.subproj/WebFrame.m:
	Leave in the assertions I used to debug.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2064 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 284e61bc
2002-09-13 Darin Adler <darin@apple.com>
Here's the *real* mistake that killed plugins. I accidentally
stopped creating objects at all! Duh. Fixed now.
* kwq/KWQKHTMLPartImpl.mm: (KWQKHTMLPartImpl::createPart):
Make a part for a plugin if we need one. Not a KHTMLPart, but
a KWQPluginPart.
2002-09-13 Darin Adler <darin@apple.com>
* kwq/KWQKHTMLPartImpl.mm: (KWQKHTMLPartImpl::createPart):
Fix plugin-related crashes by making sure each part has a unique
frame name. There may be something fundamentally wrong with how this
is working now.
2002-09-13 Richard Williamson (Home) <rjw@apple.com>
 
Made justified text work correctly in khtml for rendering
......
2002-09-13 Darin Adler <darin@apple.com>
Here's the *real* mistake that killed plugins. I accidentally
stopped creating objects at all! Duh. Fixed now.
* kwq/KWQKHTMLPartImpl.mm: (KWQKHTMLPartImpl::createPart):
Make a part for a plugin if we need one. Not a KHTMLPart, but
a KWQPluginPart.
2002-09-13 Darin Adler <darin@apple.com>
* kwq/KWQKHTMLPartImpl.mm: (KWQKHTMLPartImpl::createPart):
Fix plugin-related crashes by making sure each part has a unique
frame name. There may be something fundamentally wrong with how this
is working now.
2002-09-13 Richard Williamson (Home) <rjw@apple.com>
 
Made justified text work correctly in khtml for rendering
......
2002-09-13 Darin Adler <darin@apple.com>
Here's the *real* mistake that killed plugins. I accidentally
stopped creating objects at all! Duh. Fixed now.
* kwq/KWQKHTMLPartImpl.mm: (KWQKHTMLPartImpl::createPart):
Make a part for a plugin if we need one. Not a KHTMLPart, but
a KWQPluginPart.
2002-09-13 Darin Adler <darin@apple.com>
* kwq/KWQKHTMLPartImpl.mm: (KWQKHTMLPartImpl::createPart):
Fix plugin-related crashes by making sure each part has a unique
frame name. There may be something fundamentally wrong with how this
is working now.
2002-09-13 Richard Williamson (Home) <rjw@apple.com>
 
Made justified text work correctly in khtml for rendering
......
......@@ -194,53 +194,44 @@ void KWQKHTMLPartImpl::urlSelected(const KURL &url, int button, int state, const
[targetBridge loadURL:cocoaURL referrer:referrer(args)];
}
class KWQPluginPart : public ReadOnlyPart
{
virtual bool openURL(const KURL &) { return true; }
virtual bool closeURL() { return true; }
};
ReadOnlyPart *KWQKHTMLPartImpl::createPart(const ChildFrame &child, const KURL &url, const QString &mimeType)
{
LOG(Frames, "name %s", child.m_name.ascii());
NSURL *childURL = url.getNSURL();
if (childURL == nil) {
// FIXME: Do we need to report an error to someone?
return 0;
}
HTMLIFrameElementImpl *o = static_cast<HTMLIFrameElementImpl *>(child.m_frame->element());
WebCoreBridge *childBridge = [_bridge createChildFrameNamed:child.m_name.getNSString()
withURL:childURL referrer:referrer(child.m_args)
renderPart:child.m_frame allowsScrolling:o->scrollingMode() != QScrollView::AlwaysOff
marginWidth:o->getMarginWidth() marginHeight:o->getMarginHeight()];
return [childBridge part];
}
bool KWQKHTMLPartImpl::requestObject(RenderPart *frame, const QString &url, const QString &serviceType, const QStringList &args)
{
if (url.isEmpty()) {
return false;
}
NSURL *cocoaURL = part->completeURL(url).getNSURL();
if (cocoaURL == nil) {
// FIXME: We need to report an error to someone.
return false;
}
if (frame->widget()) {
return true;
}
NSMutableArray *argsArray = [NSMutableArray arrayWithCapacity:args.count()];
for (uint i = 0; i < args.count(); i++) {
[argsArray addObject:args[i].getNSString()];
if (child.m_type == ChildFrame::Object) {
NSMutableArray *paramsArray = [NSMutableArray arrayWithCapacity:child.m_params.count()];
for (uint i = 0; i < child.m_params.count(); i++) {
[paramsArray addObject:child.m_params[i].getNSString()];
}
KWQPluginPart *newPart = new KWQPluginPart;
newPart->setWidget(new QWidget([[WebCoreViewFactory sharedFactory]
viewForPluginWithURL:childURL
serviceType:child.m_args.serviceType.getNSString()
arguments:paramsArray
baseURL:KURL(d->m_doc->baseURL()).getNSURL()]));
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 referrer:referrer(child.m_args)
renderPart:child.m_frame allowsScrolling:o->scrollingMode() != QScrollView::AlwaysOff
marginWidth:o->getMarginWidth() marginHeight:o->getMarginHeight()];
return [childBridge part];
}
QWidget *widget = new QWidget([[WebCoreViewFactory sharedFactory]
viewForPluginWithURL:cocoaURL
serviceType:serviceType.getNSString()
arguments:argsArray
baseURL:KURL(d->m_doc->baseURL()).getNSURL()]);
frame->setWidget(widget);
return true;
}
void KWQKHTMLPartImpl::submitForm(const KURL &u, const URLArgs &args)
{
if (!args.doPost()) {
......
......@@ -194,53 +194,44 @@ void KWQKHTMLPartImpl::urlSelected(const KURL &url, int button, int state, const
[targetBridge loadURL:cocoaURL referrer:referrer(args)];
}
class KWQPluginPart : public ReadOnlyPart
{
virtual bool openURL(const KURL &) { return true; }
virtual bool closeURL() { return true; }
};
ReadOnlyPart *KWQKHTMLPartImpl::createPart(const ChildFrame &child, const KURL &url, const QString &mimeType)
{
LOG(Frames, "name %s", child.m_name.ascii());
NSURL *childURL = url.getNSURL();
if (childURL == nil) {
// FIXME: Do we need to report an error to someone?
return 0;
}
HTMLIFrameElementImpl *o = static_cast<HTMLIFrameElementImpl *>(child.m_frame->element());
WebCoreBridge *childBridge = [_bridge createChildFrameNamed:child.m_name.getNSString()
withURL:childURL referrer:referrer(child.m_args)
renderPart:child.m_frame allowsScrolling:o->scrollingMode() != QScrollView::AlwaysOff
marginWidth:o->getMarginWidth() marginHeight:o->getMarginHeight()];
return [childBridge part];
}
bool KWQKHTMLPartImpl::requestObject(RenderPart *frame, const QString &url, const QString &serviceType, const QStringList &args)
{
if (url.isEmpty()) {
return false;
}
NSURL *cocoaURL = part->completeURL(url).getNSURL();
if (cocoaURL == nil) {
// FIXME: We need to report an error to someone.
return false;
}
if (frame->widget()) {
return true;
}
NSMutableArray *argsArray = [NSMutableArray arrayWithCapacity:args.count()];
for (uint i = 0; i < args.count(); i++) {
[argsArray addObject:args[i].getNSString()];
if (child.m_type == ChildFrame::Object) {
NSMutableArray *paramsArray = [NSMutableArray arrayWithCapacity:child.m_params.count()];
for (uint i = 0; i < child.m_params.count(); i++) {
[paramsArray addObject:child.m_params[i].getNSString()];
}
KWQPluginPart *newPart = new KWQPluginPart;
newPart->setWidget(new QWidget([[WebCoreViewFactory sharedFactory]
viewForPluginWithURL:childURL
serviceType:child.m_args.serviceType.getNSString()
arguments:paramsArray
baseURL:KURL(d->m_doc->baseURL()).getNSURL()]));
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 referrer:referrer(child.m_args)
renderPart:child.m_frame allowsScrolling:o->scrollingMode() != QScrollView::AlwaysOff
marginWidth:o->getMarginWidth() marginHeight:o->getMarginHeight()];
return [childBridge part];
}
QWidget *widget = new QWidget([[WebCoreViewFactory sharedFactory]
viewForPluginWithURL:cocoaURL
serviceType:serviceType.getNSString()
arguments:argsArray
baseURL:KURL(d->m_doc->baseURL()).getNSURL()]);
frame->setWidget(widget);
return true;
}
void KWQKHTMLPartImpl::submitForm(const KURL &u, const URLArgs &args)
{
if (!args.doPost()) {
......
2002-09-13 Darin Adler <darin@apple.com>
Added assertions, and dealt with some breakage I created while
trying to fix, here, what I broke in WebCore.
* Plugins.subproj/WebPluginView.m: (-[WebNetscapePluginView start]):
Do get the dataSource from our parent when we are being used as an
object in a view rather than a document view.
* Plugins.subproj/WebPluginStream.m:
* WebView.subproj/WebDataSource.m:
* WebView.subproj/WebFrame.m:
Leave in the assertions I used to debug.
2002-09-13 Darin Adler <darin@apple.com>
- fixed 3031685 -- The text encoding setting is not propagated to subframes
......
2002-09-13 Darin Adler <darin@apple.com>
Added assertions, and dealt with some breakage I created while
trying to fix, here, what I broke in WebCore.
* Plugins.subproj/WebPluginView.m: (-[WebNetscapePluginView start]):
Do get the dataSource from our parent when we are being used as an
object in a view rather than a document view.
* Plugins.subproj/WebPluginStream.m:
* WebView.subproj/WebDataSource.m:
* WebView.subproj/WebFrame.m:
Leave in the assertions I used to debug.
2002-09-13 Darin Adler <darin@apple.com>
- fixed 3031685 -- The text encoding setting is not propagated to subframes
......
......@@ -34,6 +34,8 @@ @implementation WebNetscapePluginStream
- (void) getFunctionPointersFromPluginView:(WebNetscapePluginView *)pluginView
{
ASSERT(pluginView);
NPP_NewStream = [pluginView NPP_NewStream];
NPP_WriteReady = [pluginView NPP_WriteReady];
NPP_Write = [pluginView NPP_Write];
......@@ -67,6 +69,7 @@ - (void) getFunctionPointersFromPluginView:(WebNetscapePluginView *)pluginView
return nil;
view = [(WebNetscapePluginView *)thePluginPointer->ndata retain];
ASSERT(view);
URL = [theURL retain];
instance = thePluginPointer;
notifyData = theNotifyData;
......@@ -96,7 +99,6 @@ - (void) dealloc
- (void)startLoad
{
ASSERT([view webDataSource]);
WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL];
resource = [[WebResourceHandle alloc] initWithRequest:request client:self];
[resource loadInBackground];
......@@ -235,6 +237,12 @@ - (void)setDataSource:(WebDataSource *)dataSource
- (void)receivedData:(NSData *)data withDataSource:(WebDataSource *)dataSource
{
ASSERT(dataSource);
ASSERT([dataSource webFrame]);
ASSERT([[dataSource webFrame] webView]);
ASSERT([[[dataSource webFrame] webView] documentView]);
ASSERT([(WebNetscapePluginView *)[[[dataSource webFrame] webView] documentView] pluginInstance]);
if(isFirstChunk){
WebFrame *frame = [dataSource webFrame];
WebView *webView = [frame webView];
......
......@@ -577,6 +577,7 @@ -(void)start
WebView *webView = (WebView *)[self _web_superviewOfClass:[WebView class]];
webController = [[webView controller] retain];
webFrame = [[webController frameForView:webView] retain];
webDataSource = [[webFrame dataSource] retain];
if(srcURL){
stream = [[WebNetscapePluginStream alloc] initWithURL:srcURL pluginPointer:instance];
......
......@@ -118,6 +118,10 @@ - (void)addFrame: (WebFrame *)frame
{
if (_private->frames == nil)
_private->frames = [[NSMutableDictionary alloc] init];
// Check to make sure a duplicate frame name didn't creep in.
ASSERT([_private->frames objectForKey:[frame name]] == nil);
[[frame dataSource] _setParent: self];
[_private->frames setObject: frame forKey: [frame name]];
}
......
......@@ -157,6 +157,8 @@ - (BOOL)setProvisionalDataSource: (WebDataSource *)newDataSource
[_private setProvisionalDataSource: newDataSource];
ASSERT([newDataSource webFrame] == self);
// We tell the documentView provisionalDataSourceChanged:
// once it has been created by the controller.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment