Changeset 47963 in webkit


Ignore:
Timestamp:
Sep 2, 2009 5:40:18 AM (15 years ago)
Author:
vestbo@webkit.org
Message:

[Qt] Make sure we relayout the page after evaluating JS

Patch by Richard Moore <rich@kde.org> on 2009-09-02
Reviewed by Tor Arne Vestbø.

https://bugs.webkit.org/show_bug.cgi?id=28235

QtWebKit does not always seem to reflow the page when evaluating
javascript. This patch changes the way evaluateJavaScript works to
use the frameloader which ensures that this is done properly.

  • Api/qwebframe.cpp:

(QWebFrame::evaluateJavaScript):

  • tests/qwebframe/tst_qwebframe.cpp:
Location:
trunk/WebKit/qt
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/qt/Api/qwebframe.cpp

    r47746 r47963  
    12471247    QVariant rc;
    12481248    if (proxy) {
    1249         JSC::JSValue v = proxy->evaluate(ScriptSourceCode(scriptSource)).jsValue();
     1249        JSC::JSValue v = d->frame->loader()->executeScript(ScriptSourceCode(scriptSource)).jsValue();
    12501250        int distance = 0;
    12511251        rc = JSC::Bindings::convertValueToQVariant(proxy->globalObject()->globalExec(), v, QMetaType::Void, &distance);
  • trunk/WebKit/qt/ChangeLog

    r47866 r47963  
     12009-09-02  Richard Moore  <rich@kde.org>
     2
     3        Reviewed by Tor Arne Vestbø.
     4
     5        [Qt] Make sure we relayout the page after evaluating JS
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=28235
     8
     9        QtWebKit does not always seem to reflow the page when evaluating
     10        javascript. This patch changes the way evaluateJavaScript works to
     11        use the frameloader which ensures that this is done properly.
     12
     13        * Api/qwebframe.cpp:
     14        (QWebFrame::evaluateJavaScript):
     15        * tests/qwebframe/tst_qwebframe.cpp:
     16
    1172009-08-28  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
    218
  • trunk/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp

    r46767 r47963  
    593593    void render();
    594594    void scrollPosition();
     595    void evaluateWillCauseRepaint();
    595596
    596597private:
     
    26702671}
    26712672
     2673void tst_QWebFrame::evaluateWillCauseRepaint()
     2674{
     2675    QWebView view;
     2676    QString html("<html><body>top<div id=\"junk\" style=\"display: block;\">"
     2677                    "junk</div>bottom</body></html>");
     2678    view.setHtml(html);
     2679    view.show();
     2680
     2681    QTest::qWait(200);
     2682
     2683    view.page()->mainFrame()->evaluateJavaScript(
     2684        "document.getElementById('junk').style.display = 'none';");
     2685
     2686    ::waitForSignal(view.page(), SIGNAL(repaintRequested( const QRect &)));
     2687
     2688    QTest::qWait(2000);
     2689}
     2690
     2691
    26722692QTEST_MAIN(tst_QWebFrame)
    26732693#include "tst_qwebframe.moc"
Note: See TracChangeset for help on using the changeset viewer.