Changeset 54069 in webkit


Ignore:
Timestamp:
Jan 29, 2010 9:56:44 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-01-29 Ben Murdoch <benm@google.com>

Reviewed by Dimitri Glazkov.

[Android] Android needs functionality in the ChromeClient to be informed when touch events are and are not needed by the webpage.
https://bugs.webkit.org/show_bug.cgi?id=34215

Add a function on the ChromeClient that WebCore can use to inform the platform when it needs touch events. This way the platform can optimise by not forwarding the events if they are not required.

No new tests as the only implementation is specific to Android.

  • dom/Document.cpp: (WebCore::Document::detach): Check if this is the top level document and if so, stop forwarding touch events. (WebCore::Document::addListenerTypeIfNeeded): Inform the ChromeClient it should start forwarding touch events and guard touch event code properly.
  • history/CachedFrame.cpp: (WebCore::CachedFrameBase::restore): If the document uses touch events, inform the ChromeClient to start forwarding them. (WebCore::CachedFrame::CachedFrame): If the document uses touch events, inform the ChromeClient to stop forwarding them, as the document is being put into the page cache.
  • loader/EmptyClients.h: (WebCore::EmptyChromeClient::needTouchEvents): Add an empty implementation.
  • page/ChromeClient.h: Add the needTouchEvents() function.

2010-01-29 Ben Murdoch <benm@google.com>

Reviewed by Dimitri Glazkov.

[Android] Android needs functionality in the ChromeClient to be informed when touch events are and are not needed by the webpage.
https://bugs.webkit.org/show_bug.cgi?id=34215

Add needTouchEvents() to the ChromeClient which is called when the page decides it needs or no longer needs to be informed of touch events.

  • WebCoreSupport/ChromeClientQt.h: (WebCore::ChromeClientQt::needTouchEvents): Add an empty implementation.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r54068 r54069  
     12010-01-29  Ben Murdoch  <benm@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        [Android] Android needs functionality in the ChromeClient to be informed when touch events are and are not needed by the webpage.
     6        https://bugs.webkit.org/show_bug.cgi?id=34215
     7
     8        Add a function on the ChromeClient that WebCore can use to inform the platform when it needs touch events. This way the platform can optimise by not forwarding the events if they are not required.
     9
     10        No new tests as the only implementation is specific to Android.
     11
     12        * dom/Document.cpp:
     13        (WebCore::Document::detach): Check if this is the top level document and if so, stop forwarding touch events.
     14        (WebCore::Document::addListenerTypeIfNeeded): Inform the ChromeClient it should start forwarding touch events and guard touch event code properly.
     15        * history/CachedFrame.cpp:
     16        (WebCore::CachedFrameBase::restore): If the document uses touch events, inform the ChromeClient to start forwarding them.
     17        (WebCore::CachedFrame::CachedFrame): If the document uses touch events, inform the ChromeClient to stop forwarding them, as the document is being put into the page cache.
     18        * loader/EmptyClients.h:
     19        (WebCore::EmptyChromeClient::needTouchEvents): Add an empty implementation.
     20        * page/ChromeClient.h: Add the needTouchEvents() function.
     21
    1222010-01-29  Alexander Pavlov  <apavlov@chromium.org>
    223
  • trunk/WebCore/dom/Document.cpp

    r54005 r54069  
    15191519        if (view)
    15201520            view->detachCustomScrollbars();
     1521
     1522#if ENABLE(TOUCH_EVENTS)
     1523        Page* ownerPage = page();
     1524        if (ownerPage && (m_frame == ownerPage->mainFrame())) {
     1525            // Inform the Chrome Client that it no longer needs to
     1526            // foward touch events to WebCore as the document is being
     1527            // destroyed. It may start again if a subsequent page
     1528            // registers a touch event listener.
     1529            ownerPage->chrome()->client()->needTouchEvents(false);
     1530        }
     1531#endif
    15211532    }
    15221533
     
    30703081    else if (eventType == eventNames().beforeloadEvent)
    30713082        addListenerType(BEFORELOAD_LISTENER);
     3083#if ENABLE(TOUCH_EVENTS)
    30723084    else if (eventType == eventNames().touchstartEvent
    30733085             || eventType == eventNames().touchmoveEvent
    30743086             || eventType == eventNames().touchendEvent
    3075              || eventType == eventNames().touchcancelEvent)
     3087             || eventType == eventNames().touchcancelEvent) {
    30763088        addListenerType(TOUCH_LISTENER);
     3089        if (Page* page = this->page())
     3090            page->chrome()->client()->needTouchEvents(true);
     3091    }
     3092#endif
    30773093}
    30783094
  • trunk/WebCore/history/CachedFrame.cpp

    r53274 r54069  
    4343#endif
    4444
     45#if ENABLE(TOUCH_EVENTS)
     46#include "Chrome.h"
     47#include "ChromeClient.h"
     48#include "Page.h"
     49#endif
     50
    4551namespace WebCore {
    4652
     
    101107
    102108    m_document->dispatchWindowEvent(PageTransitionEvent::create(eventNames().pageshowEvent, true), m_document);
     109#if ENABLE(TOUCH_EVENTS)
     110    if (m_document->hasListenerType(Document::TOUCH_LISTENER))
     111        m_document->page()->chrome()->client()->needTouchEvents(true);
     112#endif
    103113}
    104114
     
    146156        LOG(PageCache, "Finished creating CachedFrame for child frame with url '%s' and DocumentLoader %p\n", m_url.string().utf8().data(), m_documentLoader.get());
    147157#endif
     158
     159#if ENABLE(TOUCH_EVENTS)
     160    if (m_document->hasListenerType(Document::TOUCH_LISTENER))
     161        m_document->page()->chrome()->client()->needTouchEvents(false);
     162#endif
    148163}
    149164
  • trunk/WebCore/loader/EmptyClients.h

    r52158 r54069  
    166166    virtual void scheduleCompositingLayerSync() {};
    167167#endif
     168
     169#if ENABLE(TOUCH_EVENTS)
     170    virtual void needTouchEvents(bool) { }
     171#endif
    168172};
    169173
  • trunk/WebCore/page/ChromeClient.h

    r50477 r54069  
    222222#endif
    223223
     224#if ENABLE(TOUCH_EVENTS)
     225        virtual void needTouchEvents(bool) = 0;
     226#endif
     227
    224228    protected:
    225229        virtual ~ChromeClient() { }
  • trunk/WebKit/qt/ChangeLog

    r54064 r54069  
     12010-01-29  Ben Murdoch  <benm@google.com>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        [Android] Android needs functionality in the ChromeClient to be informed when touch events are and are not needed by the webpage.
     6        https://bugs.webkit.org/show_bug.cgi?id=34215
     7
     8        Add needTouchEvents() to the ChromeClient which is called when the page decides it needs or no longer needs to be informed of touch events.
     9
     10        * WebCoreSupport/ChromeClientQt.h:
     11        (WebCore::ChromeClientQt::needTouchEvents): Add an empty implementation.
     12
    1132010-01-29  Kenneth Rohde Christiansen  <kenneth@webkit.org>
    214
  • trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.h

    r53618 r54069  
    133133#endif
    134134
     135#if ENABLE(TOUCH_EVENTS)
     136        virtual void needTouchEvents(bool) { }
     137#endif
     138
    135139        virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
    136140
Note: See TracChangeset for help on using the changeset viewer.