diff options
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp')
-rw-r--r-- | src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp index 44cc3b5..721aaa6 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp @@ -275,8 +275,9 @@ void QWEBKIT_EXPORT qt_drt_evaluateScriptInIsolatedWorld(QWebFrame* qFrame, int JSC::JSValue result = frame->script()->executeScriptInWorld(mainThreadNormalWorld(), script, true).jsValue(); } -static bool webframe_scrollOverflow(WebCore::Frame* frame, int dx, int dy, const QPoint& pos) +bool QWEBKIT_EXPORT qtwebkit_webframe_scrollOverflow(QWebFrame* qFrame, int dx, int dy, const QPoint& pos) { + WebCore::Frame* frame = QWebFramePrivate::core(qFrame); if (!frame || !frame->document() || !frame->view() || !frame->eventHandler()) return false; @@ -299,17 +300,24 @@ static bool webframe_scrollOverflow(WebCore::Frame* frame, int dx, int dy, const bool scrolledHorizontal = false; bool scrolledVertical = false; - if (dx > 0) - scrolledHorizontal = renderLayer->scroll(ScrollRight, ScrollByPixel, dx); - else if (dx < 0) - scrolledHorizontal = renderLayer->scroll(ScrollLeft, ScrollByPixel, qAbs(dx)); + do { + if (dx > 0) + scrolledHorizontal = renderLayer->scroll(ScrollRight, ScrollByPixel, dx); + else if (dx < 0) + scrolledHorizontal = renderLayer->scroll(ScrollLeft, ScrollByPixel, qAbs(dx)); + + if (dy > 0) + scrolledVertical = renderLayer->scroll(ScrollDown, ScrollByPixel, dy); + else if (dy < 0) + scrolledVertical = renderLayer->scroll(ScrollUp, ScrollByPixel, qAbs(dy)); - if (dy > 0) - scrolledVertical = renderLayer->scroll(ScrollDown, ScrollByPixel, dy); - else if (dy < 0) - scrolledVertical = renderLayer->scroll(ScrollUp, ScrollByPixel, qAbs(dy)); + if (scrolledHorizontal || scrolledVertical) + return true; - return (scrolledHorizontal || scrolledVertical); + renderLayer = renderLayer->parent(); + } while (renderLayer); + + return false; } @@ -325,7 +333,7 @@ void QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int d if (!qFrame) return; - if (webframe_scrollOverflow(QWebFramePrivate::core(qFrame), dx, dy, pos)) + if (qtwebkit_webframe_scrollOverflow(qFrame, dx, dy, pos)) return; bool scrollHorizontal = false; @@ -339,7 +347,7 @@ void QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int d if (dy > 0) // scroll down scrollVertical = qFrame->scrollBarValue(Qt::Vertical) < qFrame->scrollBarMaximum(Qt::Vertical); - else if (dy < 0) //scroll up + else if (dy < 0) //scroll up scrollVertical = qFrame->scrollBarValue(Qt::Vertical) > qFrame->scrollBarMinimum(Qt::Vertical); if (scrollHorizontal || scrollVertical) { |