Bug 29583 - [Qt] calling a js function via QWebFrame::evaluateJavaScript doe s not repaint div background
Summary: [Qt] calling a js function via QWebFrame::evaluateJavaScript doe s not repain...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords: Qt
Depends on:
Blocks:
 
Reported: 2009-09-21 08:48 PDT by Tor Arne Vestbø
Modified: 2009-09-25 07:10 PDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tor Arne Vestbø 2009-09-21 08:48:46 PDT
This bug report originated from Nokia internal issue QT-1850


--- Comments ---

Product
Qt

Function
webkit

Version
4.5.0

Platform
Windows XP

Platform details
32bit Windows XP SP2

Compilers
GCC

Compiler details
Native Mingw 3.4.5

Subject
calling a js function via QWebFrame::evaluateJavaScript does not repaint div background

Steps to reproduce / test case
Calling a javascript function, that sets a DIV element's background color:

function testrepaint()
{
document.getElementById("repaintdiv").style.backgroundColor="blue";
}

The js function is called from the GUI thread (via a button press slot), via QWebFrame::evaluateJavaScript(), like this:

webView->page()->mainFrame()->evaluateJavaScript("testrepaint()");

The result:
If the above is triggered when the mouse is not within the area of the QWebView control, the color of the DIV does not change. Subsequently, when moving the mouse cursor over the QWebView control, the DIV gets immediately repainted.

More information
I have tried performing two other operations from the called javascript function which work as expected:
toggling the state of a checkbox, and setting the innerHTML of the DIV. These operations are executed immediately even if hte mouse cursor is not within the QWebView control.

I have also tried an alternative method of calling the javascript function, via using the WebKit API directly. The result is the same, which probably suggest the issue is related to the Qt port of WebKit or to WebKit itself. Here is the code that uses the webkit API to call the js function:

void MyBrowser::CallJSFunctionNameWithParams(WebCore::Frame* frame, const char* jsFuncName, const JSC::ArgList& argList)
{
WebCore::JSDOMWindow *globalObject = toJSDOMWindow(frame);
if (!globalObject)
{
printf ("Warning: couldn't get window object");
return;
}

JSC::ExecState* globalExec = globalObject->globalExec();

JSC::JSLock lock(true);

JSC::Identifier identifier(globalExec, jsFuncName);
JSC::JSValuePtr funcVal = globalObject->get(globalExec, identifier);

if ( !funcVal || !funcVal->isObject())
{
printf("Requested Object could not Be Found!");
return;
}

JSC::JSObject* funcObj = asObject(funcVal);
if (!(funcObj->inherits(&JSC::JSFunction::info)))
{
printf("not a function");
return;
}
JSC::JSFunction* funcImp = static_cast<JSC::JSFunction*>(funcObj);

JSC::JSObject* thisObj = globalObject;
JSC::JSValuePtr result = funcImp->call(globalExec, thisObj, argList);
if (!result)
{
printf( "Nothing returned from JavaScript function");
return;
}
}
Comment 1 Tor Arne Vestbø 2009-09-25 07:10:49 PDT
Fixed in r47963