Changeset 57266 in webkit


Ignore:
Timestamp:
Apr 8, 2010 2:13:50 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-04-08 Joe Ligman <joseph.ligman@nokia.com>

Reviewed by Simon Hausmann.

[Qt] qtwebkit_webframe_scrollRecursively scrolls when body.style.overflow="hidden"
https://bugs.webkit.org/show_bug.cgi?id=36674

The scrolling check was based on the frameview's scrolloffset, and
maximumScrollPosition, which does not acknowledge the overflow properties.

I am now basing the scrolling off the scrollbar position. The scrollbars are
affected by the overflow properties indicating when not to scroll. The scrollbar
positions also continue to work for CSS ::-webkit-scrollbar styles.

  • Api/qwebframe.cpp: (qtwebkit_webframe_scrollRecursively):
Location:
trunk/WebKit/qt
Files:
2 edited

Legend:

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

    r56577 r57266  
    278278static bool webframe_scrollOverflow(WebCore::Frame* frame, int dx, int dy, const QPoint& pos)
    279279{
    280     if (!frame || !frame->document() || !frame->eventHandler())
     280    if (!frame || !frame->document() || !frame->view() || !frame->eventHandler())
    281281        return false;
    282282
    283     Node* node = frame->document()->elementFromPoint(pos.x(), pos.y());
     283    QPoint contentsPos = frame->view()->windowToContents(pos);
     284    Node* node = frame->document()->elementFromPoint(contentsPos.x(), contentsPos.y());
    284285    if (!node)
    285286        return false;
     
    322323void QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int dx, int dy, const QPoint& pos)
    323324{
    324     Frame* frame = QWebFramePrivate::core(qFrame);
    325 
    326     if (!frame || !frame->view())
     325    if (!qFrame)
    327326        return;
    328    
    329     if (!webframe_scrollOverflow(frame, dx, dy, pos)) {
    330         do {
    331             bool scrolledHorizontal = false;
    332             bool scrolledVertical = false;
    333            
    334             IntSize scrollOffset = frame->view()->scrollOffset();
    335             IntPoint maxScrollOffset = frame->view()->maximumScrollPosition();
    336 
    337             if (dx > 0) // scroll right
    338                 scrolledHorizontal = scrollOffset.width() < maxScrollOffset.x();
    339             else if (dx < 0) // scroll left
    340                 scrolledHorizontal = scrollOffset.width() > 0;
    341 
    342             if (dy > 0) // scroll down
    343                 scrolledVertical = scrollOffset.height() < maxScrollOffset.y();
     327
     328    if (webframe_scrollOverflow(QWebFramePrivate::core(qFrame), dx, dy, pos))
     329        return;
     330
     331    bool scrollHorizontal = false;
     332    bool scrollVertical = false;
     333
     334    do {
     335        if (dx > 0)  // scroll right
     336            scrollHorizontal = qFrame->scrollBarValue(Qt::Horizontal) < qFrame->scrollBarMaximum(Qt::Horizontal);
     337        else if (dx < 0)  // scroll left
     338            scrollHorizontal = qFrame->scrollBarValue(Qt::Horizontal) > qFrame->scrollBarMinimum(Qt::Horizontal);
     339
     340        if (dy > 0)  // scroll down
     341            scrollVertical = qFrame->scrollBarValue(Qt::Vertical) < qFrame->scrollBarMaximum(Qt::Vertical);
    344342            else if (dy < 0) //scroll up
    345                 scrolledVertical = scrollOffset.height() > 0;
    346 
    347             if (scrolledHorizontal || scrolledVertical) {
    348                 frame->view()->scrollBy(IntSize(dx, dy));
    349                 return;
    350             }
    351            
    352             frame = frame->tree()->parent();
    353         } while (frame && frame->view());
    354     }
     343            scrollVertical = qFrame->scrollBarValue(Qt::Vertical) > qFrame->scrollBarMinimum(Qt::Vertical);
     344
     345        if (scrollHorizontal || scrollVertical) {
     346            qFrame->scroll(dx, dy);
     347            return;
     348        }
     349
     350        qFrame = qFrame->parentFrame();
     351    } while (qFrame);
    355352}
    356353
  • trunk/WebKit/qt/ChangeLog

    r57210 r57266  
     12010-04-08  Joe Ligman  <joseph.ligman@nokia.com>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        [Qt] qtwebkit_webframe_scrollRecursively scrolls when body.style.overflow="hidden"
     6        https://bugs.webkit.org/show_bug.cgi?id=36674
     7
     8        The scrolling check was based on the frameview's scrolloffset, and
     9        maximumScrollPosition, which does not acknowledge the overflow properties.
     10
     11        I am now basing the scrolling off the scrollbar position. The scrollbars are
     12        affected by the overflow properties indicating when not to scroll. The scrollbar
     13        positions also continue to work for CSS ::-webkit-scrollbar styles.
     14
     15        * Api/qwebframe.cpp:
     16        (qtwebkit_webframe_scrollRecursively):
     17
    1182010-04-07  Andrey Kosyakov  <caseq@chromium.org>
    219
Note: See TracChangeset for help on using the changeset viewer.