diff options
Diffstat (limited to 'Source/WebKit/qt/Api/qwebframe.cpp')
-rw-r--r-- | Source/WebKit/qt/Api/qwebframe.cpp | 88 |
1 files changed, 2 insertions, 86 deletions
diff --git a/Source/WebKit/qt/Api/qwebframe.cpp b/Source/WebKit/qt/Api/qwebframe.cpp index adbfa1ccd..0accd3362 100644 --- a/Source/WebKit/qt/Api/qwebframe.cpp +++ b/Source/WebKit/qt/Api/qwebframe.cpp @@ -106,90 +106,6 @@ QT_BEGIN_NAMESPACE extern Q_GUI_EXPORT int qt_defaultDpi(); QT_END_NAMESPACE -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; - - QPoint contentsPos = frame->view()->windowToContents(pos); - Node* node = frame->document()->elementFromPoint(contentsPos.x(), contentsPos.y()); - if (!node) - return false; - - RenderObject* renderer = node->renderer(); - if (!renderer) - return false; - - if (renderer->isListBox()) - return false; - - RenderLayer* renderLayer = renderer->enclosingLayer(); - if (!renderLayer) - return false; - - bool scrolledHorizontal = false; - bool scrolledVertical = false; - - 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 (scrolledHorizontal || scrolledVertical) - return true; - - renderLayer = renderLayer->parent(); - } while (renderLayer); - - return false; -} - - -/*! - \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& pos) -{ - if (!qFrame) - return; - - if (qtwebkit_webframe_scrollOverflow(qFrame, dx, dy, pos)) - return; - - bool scrollHorizontal = false; - bool scrollVertical = false; - - do { - if (dx > 0) // scroll right - scrollHorizontal = qFrame->scrollBarValue(Qt::Horizontal) < qFrame->scrollBarMaximum(Qt::Horizontal); - else if (dx < 0) // scroll left - scrollHorizontal = qFrame->scrollBarValue(Qt::Horizontal) > qFrame->scrollBarMinimum(Qt::Horizontal); - - if (dy > 0) // scroll down - scrollVertical = qFrame->scrollBarValue(Qt::Vertical) < qFrame->scrollBarMaximum(Qt::Vertical); - else if (dy < 0) //scroll up - scrollVertical = qFrame->scrollBarValue(Qt::Vertical) > qFrame->scrollBarMinimum(Qt::Vertical); - - if (scrollHorizontal || scrollVertical) { - qFrame->scroll(dx, dy); - return; - } - - qFrame = qFrame->parentFrame(); - } while (qFrame); -} - static inline ResourceRequestCachePolicy cacheLoadControlToCachePolicy(uint cacheLoadControl) { switch (cacheLoadControl) { @@ -1695,9 +1611,9 @@ QWebHitTestResultPrivate::QWebHitTestResultPrivate(const WebCore::HitTestResult boundingRect = innerNonSharedNode ? innerNonSharedNode->renderer()->absoluteBoundingBoxRect() : IntRect(); WebCore::Image *img = hitTest.image(); if (img) { - QImage *pix = img->nativeImageForCurrentFrame(); + QPixmap *pix = img->nativeImageForCurrentFrame(); if (pix) - pixmap = QPixmap::fromImage(*pix); + pixmap = *pix; } WebCore::Frame *wframe = hitTest.targetFrame(); if (wframe) |