Changeset 83460 in webkit


Ignore:
Timestamp:
Apr 11, 2011 11:31:19 AM (13 years ago)
Author:
bweinstein@apple.com
Message:

WebKit2: Windows 7 Gestures Window Bounce shouldn't require a sync message
https://bugs.webkit.org/show_bug.cgi?id=58167
<rdar://problem/9259813>

Reviewed by Adam Roben.

Instead of making GestureDidScroll sync, have WebPageWin call from WebProcess ->
UIProcess when the gesture causes the page to scroll to the beginning or the
end of the document.

  • UIProcess/PageClient.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::gestureDidScroll): Not a sync message anymore.
(WebKit::WebPageProxy::setGestureScrollingLimitReached): Tell the page client that the gesture

scrolling limnit was reached.

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in: Add a new message.
  • UIProcess/win/WebView.cpp:

(WebKit::WebView::WebView): Initialize new variable.
(WebKit::WebView::onGesture): Use the state of the member variable, not the response from

the sync message.

  • UIProcess/win/WebView.h:

(WebKit::WebView::setGestureScrollingLimitReached):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:
  • WebProcess/WebPage/win/WebPageWin.cpp:

(WebKit::scrollbarAtTopOfBottomOrDocument): Returns whether or not the scrollbar is at the

top or bottom of the document.

(WebKit::WebPage::gestureDidScroll): Track whether or not we started at the beginning

or end of the document, and whether or not we ended at the beginning or end of the document,
and send a message if the value changed.

Location:
trunk/Source/WebKit2
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r83454 r83460  
     12011-04-11  Brian Weinstein  <bweinstein@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        WebKit2: Windows 7 Gestures Window Bounce shouldn't require a sync message
     6        https://bugs.webkit.org/show_bug.cgi?id=58167
     7        <rdar://problem/9259813>
     8       
     9        Instead of making GestureDidScroll sync, have WebPageWin call from WebProcess ->
     10        UIProcess when the gesture causes the page to scroll to the beginning or the
     11        end of the document.
     12
     13        * UIProcess/PageClient.h:
     14        * UIProcess/WebPageProxy.cpp:
     15        (WebKit::WebPageProxy::gestureDidScroll): Not a sync message anymore.
     16        (WebKit::WebPageProxy::setGestureScrollingLimitReached): Tell the page client that the gesture
     17            scrolling limnit was reached.
     18        * UIProcess/WebPageProxy.h:
     19        * UIProcess/WebPageProxy.messages.in: Add a new message.
     20        * UIProcess/win/WebView.cpp:
     21        (WebKit::WebView::WebView): Initialize new variable.
     22        (WebKit::WebView::onGesture): Use the state of the member variable, not the response from
     23            the sync message.
     24        * UIProcess/win/WebView.h:
     25        (WebKit::WebView::setGestureScrollingLimitReached):
     26        * WebProcess/WebPage/WebPage.h:
     27        * WebProcess/WebPage/WebPage.messages.in:
     28        * WebProcess/WebPage/win/WebPageWin.cpp:
     29        (WebKit::scrollbarAtTopOfBottomOrDocument): Returns whether or not the scrollbar is at the
     30            top or bottom of the document.
     31        (WebKit::WebPage::gestureDidScroll): Track whether or not we started at the beginning
     32            or end of the document, and whether or not we ended at the beginning or end of the document,
     33            and send a message if the value changed.
     34
    1352011-04-04  Jer Noble  <jer.noble@apple.com>
    236
  • trunk/Source/WebKit2/UIProcess/PageClient.h

    r83454 r83460  
    131131#if PLATFORM(WIN)
    132132    virtual HWND nativeWindow() = 0;
     133    virtual void setGestureReachedScrollingLimit(bool) = 0;
    133134#endif
    134135
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r83454 r83460  
    676676}
    677677
    678 bool WebPageProxy::gestureDidScroll(const IntSize& size)
    679 {
    680     bool atBeginningOrEndOfScrollableDocument = false;
    681     process()->sendSync(Messages::WebPage::GestureDidScroll(size), Messages::WebPage::GestureDidScroll::Reply(atBeginningOrEndOfScrollableDocument), m_pageID);
    682     return atBeginningOrEndOfScrollableDocument;
     678void WebPageProxy::gestureDidScroll(const IntSize& size)
     679{
     680    process()->send(Messages::WebPage::GestureDidScroll(size), m_pageID);
    683681}
    684682
     
    686684{
    687685    process()->send(Messages::WebPage::GestureDidEnd(), m_pageID);
     686}
     687
     688void WebPageProxy::setGestureReachedScrollingLimit(bool limitReached)
     689{
     690    m_pageClient->setGestureReachedScrollingLimit(limitReached);
    688691}
    689692#endif
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r83454 r83460  
    277277
    278278    bool gestureWillBegin(const WebCore::IntPoint&);
    279     bool gestureDidScroll(const WebCore::IntSize&);
     279    void gestureDidScroll(const WebCore::IntSize&);
    280280    void gestureDidEnd();
     281
     282    void setGestureReachedScrollingLimit(bool);
    281283#endif
    282284#if ENABLE(TILED_BACKING_STORE)
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in

    r83369 r83460  
    234234    RecordAutocorrectionResponse(int32_t responseType, String replacedString, String replacementString);
    235235#endif
     236
     237#if PLATFORM(WIN)
     238    # Windows 7 Gesture Messages
     239    SetGestureReachedScrollingLimit(bool limitReached)
     240#endif
    236241}
  • trunk/Source/WebKit2/UIProcess/win/WebView.cpp

    r83454 r83460  
    276276    , m_lastPanY(0)
    277277    , m_overPanY(0)
     278    , m_gestureReachedScrollingLimit(false)
    278279{
    279280    registerWebViewWindowClass();
     
    570571        m_overPanY -= deltaY;
    571572
    572         bool shouldBounceWindow = m_page->gestureDidScroll(IntSize(deltaX, deltaY));
     573        if (deltaX || deltaY)
     574            m_page->gestureDidScroll(IntSize(deltaX, deltaY));
    573575
    574576        if (gi.dwFlags & GF_BEGIN) {
    575577            BeginPanningFeedbackPtr()(m_window);
     578            m_gestureReachedScrollingLimit = false;
    576579            m_overPanY = 0;
    577580        } else if (gi.dwFlags & GF_END) {
     
    583586        // FIXME: Window Bounce doesn't undo until user releases their finger - <http://webkit.org/b/58069>.
    584587
    585         if (shouldBounceWindow)
     588        if (m_gestureReachedScrollingLimit)
    586589            UpdatePanningFeedbackPtr()(m_window, 0, m_overPanY, gi.dwFlags & GF_INERTIA);
    587590
  • trunk/Source/WebKit2/UIProcess/win/WebView.h

    r83454 r83460  
    192192    virtual HWND nativeWindow();
    193193
     194    virtual void setGestureReachedScrollingLimit(bool limitReached) { m_gestureReachedScrollingLimit = limitReached; }
     195
    194196    // WebCore::WindowMessageListener
    195197    virtual void windowReceivedMessage(HWND, UINT message, WPARAM, LPARAM);
     
    232234
    233235    int m_overPanY;
     236
     237    bool m_gestureReachedScrollingLimit;
    234238};
    235239
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r83368 r83460  
    170170    , m_cachedMainFrameIsPinnedToLeftSide(false)
    171171    , m_cachedMainFrameIsPinnedToRightSide(false)
     172#if PLATFORM(WIN)
     173    , m_gestureReachedScrollingLimit(false)
     174#endif
    172175{
    173176    ASSERT(m_pageID);
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r83372 r83460  
    332332
    333333    void gestureWillBegin(const WebCore::IntPoint&, bool& canBeginPanning);
    334     void gestureDidScroll(const WebCore::IntSize&, bool& atBeginningOrEndOfDocument);
     334    void gestureDidScroll(const WebCore::IntSize&);
    335335    void gestureDidEnd();
    336336#endif
     
    633633    bool m_cachedMainFrameIsPinnedToLeftSide;
    634634    bool m_cachedMainFrameIsPinnedToRightSide;
     635
     636#if PLATFORM(WIN)
     637    bool m_gestureReachedScrollingLimit;
     638#endif
    635639};
    636640
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

    r83362 r83460  
    205205
    206206    GestureWillBegin(WebCore::IntPoint point) -> (bool canBeginPanning)
    207     GestureDidScroll(WebCore::IntSize size) -> (bool atBeginningOrEndOfScrollableDocument)
     207    GestureDidScroll(WebCore::IntSize size)
    208208    GestureDidEnd()
    209209#endif
  • trunk/Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp

    r83197 r83460  
    2929#include "FontSmoothingLevel.h"
    3030#include "WebEvent.h"
     31#include "WebPageProxyMessages.h"
    3132#include "WebPreferencesStore.h"
    3233#include <WebCore/FocusController.h>
     
    358359void WebPage::gestureWillBegin(const WebCore::IntPoint& point, bool& canBeginPanning)
    359360{
     361    m_gestureReachedScrollingLimit = false;
     362
    360363    bool hitScrollbar = false;
    361364
     
    402405}
    403406
    404 void WebPage::gestureDidScroll(const IntSize& size, bool& atBeginningOrEndOfScrollableDocument)
    405 {
    406     atBeginningOrEndOfScrollableDocument = false;
     407static bool scrollbarAtTopOrBottomOfDocument(Scrollbar* scrollbar)
     408{
     409    ASSERT_ARG(scrollbar, scrollbar);
     410    return !scrollbar->currentPos() || scrollbar->currentPos() >= scrollbar->maximum();
     411}
     412
     413void WebPage::gestureDidScroll(const IntSize& size)
     414{
     415    ASSERT_ARG(size, !size.isZero());
    407416
    408417    if (!m_gestureTargetNode || !m_gestureTargetNode->renderer() || !m_gestureTargetNode->renderer()->enclosingLayer())
    409418        return;
    410419
     420    Scrollbar* verticalScrollbar = 0;
     421    if (Frame* frame = m_page->mainFrame()) {
     422        if (ScrollView* view = frame->view())
     423            verticalScrollbar = view->verticalScrollbar();
     424    }
     425
    411426    m_gestureTargetNode->renderer()->enclosingLayer()->scrollByRecursively(size.width(), size.height());
    412 
    413     Frame* frame = m_page->mainFrame();
    414     if (!frame)
    415         return;
    416 
    417     ScrollView* view = frame->view();
    418     if (!view)
    419         return;
    420 
    421     Scrollbar* verticalScrollbar = view->verticalScrollbar();
    422     if (!verticalScrollbar)
    423         return;
    424 
    425     atBeginningOrEndOfScrollableDocument = !verticalScrollbar->currentPos() || verticalScrollbar->currentPos() >= verticalScrollbar->maximum();
     427    bool gestureReachedScrollingLimit = verticalScrollbar && scrollbarAtTopOrBottomOfDocument(verticalScrollbar);
     428
     429    // FIXME: We really only want to update this state if the state was updated via scrolling the main frame,
     430    // not scrolling something in a main frame when the main frame had already reached its scrolling limit.
     431
     432    if (gestureReachedScrollingLimit == m_gestureReachedScrollingLimit)
     433        return;
     434
     435    send(Messages::WebPageProxy::SetGestureReachedScrollingLimit(gestureReachedScrollingLimit));
     436    m_gestureReachedScrollingLimit = gestureReachedScrollingLimit;
    426437}
    427438
Note: See TracChangeset for help on using the changeset viewer.