Commit 45f34810 authored by darin's avatar darin

Reviewed by Maciej.

	- fixed 3136391 -- PianoNanny.com screens turn to garbage when resized

	Turns out browsers pass open calls to the window object if they show up at the document
	with parameters. We now emulate that too.

        * khtml/ecma/kjs_html.cpp: (KJS::HTMLDocFunction::tryCall): If we get an open call with
	parameters, pass it on to the window.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3205 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 73bc007f
2002-12-29 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed 3136391 -- PianoNanny.com screens turn to garbage when resized
Turns out browsers pass open calls to the window object if they show up at the document
with parameters. We now emulate that too.
* khtml/ecma/kjs_html.cpp: (KJS::HTMLDocFunction::tryCall): If we get an open call with
parameters, pass it on to the window.
2002-12-29 Darin Adler <darin@apple.com> 2002-12-29 Darin Adler <darin@apple.com>
Reviewed by Ken. Reviewed by Ken.
......
2002-12-29 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fixed 3136391 -- PianoNanny.com screens turn to garbage when resized
Turns out browsers pass open calls to the window object if they show up at the document
with parameters. We now emulate that too.
* khtml/ecma/kjs_html.cpp: (KJS::HTMLDocFunction::tryCall): If we get an open call with
parameters, pass it on to the window.
2002-12-29 Darin Adler <darin@apple.com> 2002-12-29 Darin Adler <darin@apple.com>
Reviewed by Ken. Reviewed by Ken.
......
...@@ -57,16 +57,34 @@ Value KJS::HTMLDocFunction::tryCall(ExecState *exec, Object &thisObj, const List ...@@ -57,16 +57,34 @@ Value KJS::HTMLDocFunction::tryCall(ExecState *exec, Object &thisObj, const List
return err; return err;
} }
DOM::HTMLDocument doc = static_cast<KJS::HTMLDocument *>(thisObj.imp())->toDocument(); DOM::HTMLDocument doc = static_cast<KJS::HTMLDocument *>(thisObj.imp())->toDocument();
String s;
DOM::HTMLElement element;
Value v = args[0];
switch (id) { switch (id) {
case HTMLDocument::Clear: // even IE doesn't support that one... case HTMLDocument::Clear: // even IE doesn't support that one...
//doc.clear(); // TODO //doc.clear(); // TODO
return Undefined(); return Undefined();
case HTMLDocument::Open: case HTMLDocument::Open:
// For compatibility with other browsers, pass open calls with parameters to the window.
if (args.size() != 0) {
KHTMLView *view = static_cast<DOM::DocumentImpl *>(doc.handle())->view();
if (view) {
KHTMLPart *part = view->part();
if (part) {
Window *window = Window::retrieveWindow(part);
if (window) {
Object functionObject = Object::dynamicCast(window->get(exec, "open"));
if (functionObject.isNull() || !functionObject.implementsCall()) {
Object exception = Error::create(exec, TypeError);
exec->setException(exception);
return exception;
}
Object windowObject(window);
return functionObject.call(exec, windowObject, args);
}
}
}
return Undefined();
}
// In the case of no prameters, do a normal document open.
doc.open(); doc.open();
return Undefined(); return Undefined();
case HTMLDocument::Close: case HTMLDocument::Close:
...@@ -87,7 +105,7 @@ Value KJS::HTMLDocFunction::tryCall(ExecState *exec, Object &thisObj, const List ...@@ -87,7 +105,7 @@ Value KJS::HTMLDocFunction::tryCall(ExecState *exec, Object &thisObj, const List
return Undefined(); return Undefined();
} }
case HTMLDocument::GetElementsByName: case HTMLDocument::GetElementsByName:
return getDOMNodeList(exec,doc.getElementsByName(v.toString(exec).string())); return getDOMNodeList(exec,doc.getElementsByName(args[0].toString(exec).string()));
case HTMLDocument::CaptureEvents: case HTMLDocument::CaptureEvents:
case HTMLDocument::ReleaseEvents: case HTMLDocument::ReleaseEvents:
// Do nothing for now. These are NS-specific legacy calls. // Do nothing for now. These are NS-specific legacy calls.
......
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