RESOLVED FIXED Bug 28235
Using QWebFrame::evaluateJavaScript does not relayout
https://bugs.webkit.org/show_bug.cgi?id=28235
Summary Using QWebFrame::evaluateJavaScript does not relayout
Richard Moore
Reported 2009-08-12 15:31:17 PDT
Created attachment 34700 [details] Patch to fix the bug It seems that executing javascript code using evaluateJavaScript that changes the visibility of some divs in a page does not cause an immediate relayout of the page. The page instead remains unchanged until the user moves the mouse over it. The problem was found by using js like this: function toggleVisibility(id) { el = document.getElementById(id); if (el.style.display == 'none') { el.style.display = ''; window.silk.GM_log('showing'); } else { el.style.display = 'none'; window.silk.GM_log('hiding'); } } toggleVisibility('sidebar'); toggleVisibility('header'); toggleVisibility('footer'); Executed against a gitorious repository. The same code executed in the inspector functions as expected. I've included what I think should be a patch to fix this issue in master, though since my code has kde dependencies against 4.5 I have been unable to test it so far.
Attachments
Patch to fix the bug (696 bytes, patch)
2009-08-12 15:31 PDT, Richard Moore
hausmann: review-
A patch that changes how evaluateJavaScript works (2.51 KB, patch)
2009-08-13 14:11 PDT, Richard Moore
no flags
Patch against 4.5.1 to fix the issue (3.11 KB, patch)
2009-08-15 09:00 PDT, Richard Moore
no flags
Patch against master for the same issue (3.13 KB, patch)
2009-08-15 09:01 PDT, Richard Moore
no flags
Patch against Qt git repo (3.10 KB, patch)
2009-08-28 07:40 PDT, Richard Moore
no flags
Patch against Qt git repo including changelog (2.98 KB, patch)
2009-08-28 07:46 PDT, Richard Moore
no flags
Patch against qtwebkit git repo including changelog no tabs (402.18 KB, patch)
2009-08-28 07:54 PDT, Richard Moore
no flags
Patch against qtwebkit git repo including changelog no tabs (2.85 KB, patch)
2009-08-28 07:58 PDT, Richard Moore
vestbo: review+
vestbo: commit-queue-
Simon Hausmann
Comment 1 2009-08-13 02:02:05 PDT
Comment on attachment 34700 [details] Patch to fix the bug This patch is missing a ChangeLog. I'm not convinced it's the correct fix though. Why do the other ports appear not to need this? For example the Mac API has stringByEvaluatingJavaScriptFromString, which can be called to evaluate javascript and the view will be updated afterwards. (A quick google search suggests that it works). However I notice one important difference: We are calling evaluate() on the ScriptController directly, whereas the mac port calls FrameLoader::executeScript, which calls Document::updateStyleForAllDocuments() after evaluation. I think the correct fix involves calling executeScript instead of evaluate on the ScriptController.
Richard Moore
Comment 2 2009-08-13 14:10:19 PDT
Ok, another patch that is closer to what Simon suggested.
Richard Moore
Comment 3 2009-08-13 14:11:42 PDT
Created attachment 34786 [details] A patch that changes how evaluateJavaScript works
Richard Moore
Comment 4 2009-08-15 09:00:16 PDT
Created attachment 34897 [details] Patch against 4.5.1 to fix the issue This patch changes the way evaluateJavaScript works in QWebFrame to use the FrameProxy. This fixes the bug. It also adds a test case for this issue.
Richard Moore
Comment 5 2009-08-15 09:01:52 PDT
Created attachment 34898 [details] Patch against master for the same issue This patch makes the same change as the other one, but is for qt/master. The bug does not currently occur there, but using the frameproxy seems safer anyway. Either way the test case should be included to prevent the issue being reintroduced.
Richard Moore
Comment 6 2009-08-15 09:02:53 PDT
I think the two patches I've attached are now suitable for inclusion to 4.5 branch of qt and master respectively.
Richard Moore
Comment 7 2009-08-28 07:40:44 PDT
Created attachment 38735 [details] Patch against Qt git repo
Richard Moore
Comment 8 2009-08-28 07:46:55 PDT
Created attachment 38737 [details] Patch against Qt git repo including changelog
Richard Moore
Comment 9 2009-08-28 07:54:54 PDT
Created attachment 38738 [details] Patch against qtwebkit git repo including changelog no tabs
Richard Moore
Comment 10 2009-08-28 07:58:33 PDT
Created attachment 38739 [details] Patch against qtwebkit git repo including changelog no tabs
Tor Arne Vestbø
Comment 11 2009-09-02 04:58:40 PDT
Comment on attachment 34898 [details] Patch against master for the same issue Marking as obsolete, as patches should be made against webkit trunk (like the last one)
Tor Arne Vestbø
Comment 12 2009-09-02 05:40:24 PDT
Landed in r47963
Note You need to log in before you can comment on or make changes to this bug.