<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[56208] trunk/WebKit/qt</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/56208">56208</a></dd>
<dt>Author</dt> <dd>eric@webkit.org</dd>
<dt>Date</dt> <dd>2010-03-18 21:51:35 -0700 (Thu, 18 Mar 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>2010-03-18  Joe Ligman  &lt;joseph.ligman@nokia.com&gt;

        Reviewed by Simon Hausmann.

        [Qt] New API scrollRecursively has several problems.
        https://bugs.webkit.org/show_bug.cgi?id=35873

        Remove scrollRecursively from the Qt 4.7 API
        Update the internal API to accept a hit test position
        for nested scrolling

        * Api/qwebframe.cpp:
        (webframe_scrollOverflow):
        (qtwebkit_webframe_scrollRecursively):
        * Api/qwebframe.h:
        * Api/qwebframe_p.h:
        * tests/qwebframe/tst_qwebframe.cpp:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebKitqtApiqwebframecpp">trunk/WebKit/qt/Api/qwebframe.cpp</a></li>
<li><a href="#trunkWebKitqtApiqwebframeh">trunk/WebKit/qt/Api/qwebframe.h</a></li>
<li><a href="#trunkWebKitqtApiqwebframe_ph">trunk/WebKit/qt/Api/qwebframe_p.h</a></li>
<li><a href="#trunkWebKitqtChangeLog">trunk/WebKit/qt/ChangeLog</a></li>
<li><a href="#trunkWebKitqttestsqwebframetst_qwebframecpp">trunk/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebKitqtApiqwebframecpp"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/qt/Api/qwebframe.cpp (56207 => 56208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/qt/Api/qwebframe.cpp        2010-03-19 03:58:55 UTC (rev 56207)
+++ trunk/WebKit/qt/Api/qwebframe.cpp        2010-03-19 04:51:35 UTC (rev 56208)
</span><span class="lines">@@ -266,6 +266,86 @@
</span><span class="cx">         JSC::JSValue result = frame-&gt;script()-&gt;executeScriptInWorld(mainThreadNormalWorld(), script, true).jsValue();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static bool webframe_scrollOverflow(WebCore::Frame* frame, int dx, int dy, const QPoint&amp; pos)
+{
+    if (!frame || !frame-&gt;document() || !frame-&gt;eventHandler())
+        return false;
+
+    Node* node = frame-&gt;document()-&gt;elementFromPoint(pos.x(), pos.y());
+    if (!node)
+        return false;
+
+    RenderObject* renderer = node-&gt;renderer();
+    if (!renderer)
+        return false;
+
+    if (renderer-&gt;isListBox())
+        return false;
+
+    RenderLayer* renderLayer = renderer-&gt;enclosingLayer();
+    if (!renderLayer)
+        return false;
+
+    bool scrolledHorizontal = false;
+    bool scrolledVertical = false;
+
+    if (dx &gt; 0)
+        scrolledHorizontal = renderLayer-&gt;scroll(ScrollRight, ScrollByPixel, dx);
+    else if (dx &lt; 0)
+        scrolledHorizontal = renderLayer-&gt;scroll(ScrollLeft, ScrollByPixel, qAbs(dx));
+
+    if (dy &gt; 0)
+        scrolledVertical = renderLayer-&gt;scroll(ScrollDown, ScrollByPixel, dy);
+    else if (dy &lt; 0)
+        scrolledVertical = renderLayer-&gt;scroll(ScrollUp, ScrollByPixel, qAbs(dy));
+
+    return (scrolledHorizontal || scrolledVertical);
+}
+
+
+/*!
+  \internal
+  Scrolls nested frames starting at this frame, \a dx pixels to the right 
+  and \a dy pixels downward. Both \a dx and \a dy may be negative. First attempts
+  to scroll elements with CSS overflow at position pos, followed by this frame. If this 
+  frame doesn't scroll, attempts to scroll the parent
+*/
+void QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int dx, int dy, const QPoint&amp; pos)
+{
+    Frame* frame = QWebFramePrivate::core(qFrame);
+
+    if (!frame || !frame-&gt;view())
+        return;
+    
+    if (!webframe_scrollOverflow(frame, dx, dy, pos)) {
+        do {
+            bool scrolledHorizontal = false;
+            bool scrolledVertical = false;
+            
+            IntSize scrollOffset = frame-&gt;view()-&gt;scrollOffset();
+            IntPoint maxScrollOffset = frame-&gt;view()-&gt;maximumScrollPosition();
+
+            if (dx &gt; 0) // scroll right
+                scrolledHorizontal = scrollOffset.width() &lt; maxScrollOffset.x();
+            else if (dx &lt; 0) // scroll left
+                scrolledHorizontal = scrollOffset.width() &gt; 0;
+
+            if (dy &gt; 0) // scroll down
+                scrolledVertical = scrollOffset.height() &lt; maxScrollOffset.y();
+            else if (dy &lt; 0) //scroll up
+                scrolledVertical = scrollOffset.height() &gt; 0;
+
+            if (scrolledHorizontal || scrolledVertical) {
+                frame-&gt;view()-&gt;scrollBy(IntSize(dx, dy));
+                return;
+            }
+            
+            frame = frame-&gt;tree()-&gt;parent(); 
+        } while (frame &amp;&amp; frame-&gt;view());
+    }
+}
+
+
</ins><span class="cx"> QWebFrameData::QWebFrameData(WebCore::Page* parentPage, WebCore::Frame* parentFrame,
</span><span class="cx">                              WebCore::HTMLFrameOwnerElement* ownerFrameElement,
</span><span class="cx">                              const WebCore::String&amp; frameName)
</span><span class="lines">@@ -429,45 +509,6 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool QWebFramePrivate::scrollOverflow(int dx, int dy)
-{
-    if (!frame || !frame-&gt;document() || !frame-&gt;eventHandler())
-        return false;
-
-    Node* node = frame-&gt;document()-&gt;focusedNode();
-    if (!node)
-        node = frame-&gt;document()-&gt;elementFromPoint(frame-&gt;eventHandler()-&gt;currentMousePosition().x(),
-                                                   frame-&gt;eventHandler()-&gt;currentMousePosition().y());
-    if (!node)
-        return false;
-
-    RenderObject* renderer = node-&gt;renderer();
-    if (!renderer)
-        return false;
-
-    if (renderer-&gt;isListBox())
-        return false;
-
-    RenderLayer* renderLayer = renderer-&gt;enclosingLayer();
-    if (!renderLayer)
-        return false;
-
-    bool scrolledHorizontal = false;
-    bool scrolledVertical = false;
-
-    if (dx &gt; 0)
-        scrolledHorizontal = renderLayer-&gt;scroll(ScrollRight, ScrollByPixel, dx);
-    else if (dx &lt; 0)
-        scrolledHorizontal = renderLayer-&gt;scroll(ScrollLeft, ScrollByPixel, qAbs(dx));
-
-    if (dy &gt; 0)
-        scrolledVertical = renderLayer-&gt;scroll(ScrollDown, ScrollByPixel, dy);
-    else if (dy &lt; 0)
-        scrolledVertical = renderLayer-&gt;scroll(ScrollUp, ScrollByPixel, qAbs(dy));
-
-    return (scrolledHorizontal || scrolledVertical);
-}
-
</del><span class="cx"> /*!
</span><span class="cx">     \class QWebFrame
</span><span class="cx">     \since 4.4
</span><span class="lines">@@ -1107,55 +1148,6 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /*!
</span><del>-  \since 4.7
-  Scrolls nested frames starting at this frame, \a dx pixels to the right 
-  and \a dy pixels downward. Both \a dx and \a dy may be negative. First attempts
-  to scroll elements with CSS overflow followed by this frame. If this 
-  frame doesn't scroll, attempts to scroll the parent
-
-  \sa QWebFrame::scroll
-*/
-bool QWebFrame::scrollRecursively(int dx, int dy)
-{
-    bool scrolledHorizontal = false;
-    bool scrolledVertical = false;
-    bool scrolledOverflow = d-&gt;scrollOverflow(dx, dy);
-
-    if (!scrolledOverflow) {
-        Frame* frame = d-&gt;frame;
-        if (!frame || !frame-&gt;view())
-            return false;
-
-        do {
-            IntSize scrollOffset = frame-&gt;view()-&gt;scrollOffset();
-            IntPoint maxScrollOffset = frame-&gt;view()-&gt;maximumScrollPosition();
-
-            if (dx &gt; 0) // scroll right
-                scrolledHorizontal = scrollOffset.width() &lt; maxScrollOffset.x();
-            else if (dx &lt; 0) // scroll left
-                scrolledHorizontal = scrollOffset.width() &gt; 0;
-
-            if (dy &gt; 0) // scroll down
-                scrolledVertical = scrollOffset.height() &lt; maxScrollOffset.y();
-            else if (dy &lt; 0) //scroll up
-                scrolledVertical = scrollOffset.height() &gt; 0;
-
-            if (scrolledHorizontal || scrolledVertical) {
-                frame-&gt;view()-&gt;scrollBy(IntSize(dx, dy));
-                return true;
-            }
-            frame = frame-&gt;tree()-&gt;parent(); 
-        } while (frame &amp;&amp; frame-&gt;view());
-    }
-    return (scrolledHorizontal || scrolledVertical || scrolledOverflow);
-}
-
-bool QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int dx, int dy)
-{
-    return qFrame-&gt;scrollRecursively(dx, dy);
-}
-
-/*!
</del><span class="cx">   \property QWebFrame::scrollPosition
</span><span class="cx">   \since 4.5
</span><span class="cx">   \brief the position the frame is currently scrolled to.
</span></span></pre></div>
<a id="trunkWebKitqtApiqwebframeh"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/qt/Api/qwebframe.h (56207 => 56208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/qt/Api/qwebframe.h        2010-03-19 03:58:55 UTC (rev 56207)
+++ trunk/WebKit/qt/Api/qwebframe.h        2010-03-19 04:51:35 UTC (rev 56208)
</span><span class="lines">@@ -156,7 +156,6 @@
</span><span class="cx">     QRect scrollBarGeometry(Qt::Orientation orientation) const;
</span><span class="cx"> 
</span><span class="cx">     void scroll(int, int);
</span><del>-    bool scrollRecursively(int, int);
</del><span class="cx">     QPoint scrollPosition() const;
</span><span class="cx">     void setScrollPosition(const QPoint &amp;pos);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebKitqtApiqwebframe_ph"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/qt/Api/qwebframe_p.h (56207 => 56208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/qt/Api/qwebframe_p.h        2010-03-19 03:58:55 UTC (rev 56207)
+++ trunk/WebKit/qt/Api/qwebframe_p.h        2010-03-19 04:51:35 UTC (rev 56208)
</span><span class="lines">@@ -88,8 +88,6 @@
</span><span class="cx">     void renderFromTiledBackingStore(WebCore::GraphicsContext*, const QRegion&amp; clip);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    bool scrollOverflow(int dx, int dy);
-
</del><span class="cx">     QWebFrame *q;
</span><span class="cx">     Qt::ScrollBarPolicy horizontalScrollBarPolicy;
</span><span class="cx">     Qt::ScrollBarPolicy verticalScrollBarPolicy;
</span></span></pre></div>
<a id="trunkWebKitqtChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/qt/ChangeLog (56207 => 56208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/qt/ChangeLog        2010-03-19 03:58:55 UTC (rev 56207)
+++ trunk/WebKit/qt/ChangeLog        2010-03-19 04:51:35 UTC (rev 56208)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2010-03-18  Joe Ligman  &lt;joseph.ligman@nokia.com&gt;
+
+        Reviewed by Simon Hausmann.
+
+        [Qt] New API scrollRecursively has several problems.
+        https://bugs.webkit.org/show_bug.cgi?id=35873
+
+        Remove scrollRecursively from the Qt 4.7 API
+        Update the internal API to accept a hit test position 
+        for nested scrolling
+
+        * Api/qwebframe.cpp:
+        (webframe_scrollOverflow):
+        (qtwebkit_webframe_scrollRecursively):
+        * Api/qwebframe.h:
+        * Api/qwebframe_p.h:
+        * tests/qwebframe/tst_qwebframe.cpp:
+
</ins><span class="cx"> 2010-03-18  Antti Koivisto  &lt;koivisto@iki.fi&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Kenneth Rohde Christiansen.
</span></span></pre></div>
<a id="trunkWebKitqttestsqwebframetst_qwebframecpp"></a>
<div class="modfile"><h4>Modified: trunk/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp (56207 => 56208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp        2010-03-19 03:58:55 UTC (rev 56207)
+++ trunk/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp        2010-03-19 04:51:35 UTC (rev 56208)
</span><span class="lines">@@ -587,7 +587,6 @@
</span><span class="cx">     void scrollToAnchor();
</span><span class="cx">     void evaluateWillCauseRepaint();
</span><span class="cx">     void qObjectWrapperWithSameIdentity();
</span><del>-    void scrollRecursively();
</del><span class="cx">     void introspectQtMethods_data();
</span><span class="cx">     void introspectQtMethods();
</span><span class="cx"> 
</span><span class="lines">@@ -2855,70 +2854,6 @@
</span><span class="cx">     QCOMPARE(mainFrame-&gt;toPlainText(), QString(&quot;test2&quot;));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void tst_QWebFrame::scrollRecursively()
-{
-    // The test content is 
-    // a nested frame set
-    // The main frame scrolls
-    // and has two children
-    // an iframe and a div overflow
-    // both scroll
-    QWebView webView;
-    QWebPage* webPage = webView.page();
-    QSignalSpy loadSpy(webPage, SIGNAL(loadFinished(bool)));
-    QUrl url = QUrl(&quot;qrc:///testiframe.html&quot;);
-    webPage-&gt;mainFrame()-&gt;load(url);
-    QTRY_COMPARE(loadSpy.count(), 1);
-
-    QList&lt;QWebFrame*&gt; children =  webPage-&gt;mainFrame()-&gt;childFrames();
-    QVERIFY(children.count() == 1);
-
-    // 1st test
-    // call scrollRecursively over mainframe
-    // verify scrolled
-    // verify scroll postion changed
-    QPoint scrollPosition(webPage-&gt;mainFrame()-&gt;scrollPosition());
-    QVERIFY(webPage-&gt;mainFrame()-&gt;scrollRecursively(10, 10));
-    QVERIFY(scrollPosition != webPage-&gt;mainFrame()-&gt;scrollPosition());
-
-    // 2nd test
-    // call scrollRecursively over child iframe
-    // verify scrolled
-    // verify child scroll position changed
-    // verify parent's scroll position did not change
-    scrollPosition = webPage-&gt;mainFrame()-&gt;scrollPosition();
-    QPoint childScrollPosition = children.at(0)-&gt;scrollPosition();
-    QVERIFY(children.at(0)-&gt;scrollRecursively(10, 10));
-    QVERIFY(scrollPosition == webPage-&gt;mainFrame()-&gt;scrollPosition());
-    QVERIFY(childScrollPosition != children.at(0)-&gt;scrollPosition());
-
-    // 3rd test
-    // call scrollRecursively over div overflow
-    // verify scrolled == true
-    // verify parent and child frame's scroll postion did not change
-    QWebElement div = webPage-&gt;mainFrame()-&gt;documentElement().findFirst(&quot;#content1&quot;);
-    QMouseEvent evpres(QEvent::MouseMove, div.geometry().center(), Qt::NoButton, Qt::NoButton, Qt::NoModifier);
-    webPage-&gt;event(&amp;evpres);
-    scrollPosition = webPage-&gt;mainFrame()-&gt;scrollPosition();
-    childScrollPosition = children.at(0)-&gt;scrollPosition();
-    QVERIFY(webPage-&gt;mainFrame()-&gt;scrollRecursively(5, 5));
-    QVERIFY(childScrollPosition == children.at(0)-&gt;scrollPosition());
-    QVERIFY(scrollPosition == webPage-&gt;mainFrame()-&gt;scrollPosition());
-
-    // 4th test
-    // call scrollRecursively twice over childs iframe
-    // verify scrolled == true first time
-    // verify parent's scroll == true second time
-    // verify parent and childs scroll position changed
-    childScrollPosition = children.at(0)-&gt;scrollPosition();
-    QVERIFY(children.at(0)-&gt;scrollRecursively(-10, -10));
-    QVERIFY(childScrollPosition != children.at(0)-&gt;scrollPosition());
-    scrollPosition = webPage-&gt;mainFrame()-&gt;scrollPosition();
-    QVERIFY(children.at(0)-&gt;scrollRecursively(-10, -10));
-    QVERIFY(scrollPosition != webPage-&gt;mainFrame()-&gt;scrollPosition());
-
-}
-
</del><span class="cx"> void tst_QWebFrame::introspectQtMethods_data()
</span><span class="cx"> {
</span><span class="cx">     QTest::addColumn&lt;QString&gt;(&quot;objectExpression&quot;);
</span></span></pre>
</div>
</div>

</body>
</html>