Changeset 89018 in webkit


Ignore:
Timestamp:
Jun 16, 2011 1:49:12 AM (13 years ago)
Author:
abarth@webkit.org
Message:

2011-06-16 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Remove HTMLVideoElement::processingUserGesture
https://bugs.webkit.org/show_bug.cgi?id=62784

HTMLMediaElement shouldn't have its own notion of the user gesture
state. It should just use the normal user gesture state. Also,
there's no point in having the bindings send the user gesture state in
a boolean parameter.

  • WebCore.exp.in:
  • html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::removedFromDocument): (WebCore::HTMLMediaElement::load): (WebCore::HTMLMediaElement::play): (WebCore::HTMLMediaElement::pause): (WebCore::HTMLMediaElement::beginScrubbing): (WebCore::HTMLMediaElement::resume):
  • html/HTMLMediaElement.h:
  • html/HTMLMediaElement.idl:
  • html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::webkitEnterFullscreen):
  • html/HTMLVideoElement.h: (WebCore::HTMLVideoElement::webkitEnterFullScreen):
  • html/HTMLVideoElement.idl:
  • html/MediaDocument.cpp: (WebCore::MediaDocument::defaultEventHandler):
  • html/shadow/MediaControlElements.cpp: (WebCore::MediaControlSeekButtonElement::defaultEventHandler):

2011-06-16 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Remove HTMLVideoElement::processingUserGesture
https://bugs.webkit.org/show_bug.cgi?id=62784

  • src/WebViewImpl.cpp: (WebKit::WebViewImpl::performMediaPlayerAction):

2011-06-16 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Remove HTMLVideoElement::processingUserGesture
https://bugs.webkit.org/show_bug.cgi?id=62784

  • WebCoreSupport/FullscreenVideoController.cpp: (FullscreenVideoController::play): (FullscreenVideoController::pause):

2011-06-16 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Remove HTMLVideoElement::processingUserGesture
https://bugs.webkit.org/show_bug.cgi?id=62784

  • WebView/WebVideoFullscreenHUDWindowController.mm: (-[WebVideoFullscreenHUDWindowController setPlaying:]):

2011-06-16 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Remove HTMLVideoElement::processingUserGesture
https://bugs.webkit.org/show_bug.cgi?id=62784

  • FullscreenVideoController.cpp: (FullscreenVideoController::play): (FullscreenVideoController::pause):
Location:
trunk/Source
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r89016 r89018  
     12011-06-16  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Remove HTMLVideoElement::processingUserGesture
     6        https://bugs.webkit.org/show_bug.cgi?id=62784
     7
     8        HTMLMediaElement shouldn't have its own notion of the user gesture
     9        state.  It should just use the normal user gesture state.  Also,
     10        there's no point in having the bindings send the user gesture state in
     11        a boolean parameter.
     12
     13        * WebCore.exp.in:
     14        * html/HTMLMediaElement.cpp:
     15        (WebCore::HTMLMediaElement::removedFromDocument):
     16        (WebCore::HTMLMediaElement::load):
     17        (WebCore::HTMLMediaElement::play):
     18        (WebCore::HTMLMediaElement::pause):
     19        (WebCore::HTMLMediaElement::beginScrubbing):
     20        (WebCore::HTMLMediaElement::resume):
     21        * html/HTMLMediaElement.h:
     22        * html/HTMLMediaElement.idl:
     23        * html/HTMLVideoElement.cpp:
     24        (WebCore::HTMLVideoElement::webkitEnterFullscreen):
     25        * html/HTMLVideoElement.h:
     26        (WebCore::HTMLVideoElement::webkitEnterFullScreen):
     27        * html/HTMLVideoElement.idl:
     28        * html/MediaDocument.cpp:
     29        (WebCore::MediaDocument::defaultEventHandler):
     30        * html/shadow/MediaControlElements.cpp:
     31        (WebCore::MediaControlSeekButtonElement::defaultEventHandler):
     32
    1332011-06-16  Sheriff Bot  <webkit.review.bot@gmail.com>
    234
  • trunk/Source/WebCore/WebCore.exp.in

    r89007 r89018  
    18091809__ZN7WebCore16HTMLMediaElement20getSitesInMediaCacheERN3WTF6VectorINS1_6StringELm0EEE
    18101810__ZN7WebCore16HTMLMediaElement22clearMediaCacheForSiteERKN3WTF6StringE
    1811 __ZN7WebCore16HTMLMediaElement4playEb
    1812 __ZN7WebCore16HTMLMediaElement5pauseEb
     1811__ZN7WebCore16HTMLMediaElement4playEv
     1812__ZN7WebCore16HTMLMediaElement5pauseEv
    18131813__ZN7WebCore16HTMLMediaElement6rewindEf
    18141814__ZN7WebCore16HTMLMediaElement8setMutedEb
     
    18161816__ZNK7WebCore16HTMLMediaElement11currentTimeEv
    18171817__ZNK7WebCore16HTMLMediaElement13platformMediaEv
    1818 __ZNK7WebCore16HTMLMediaElement21processingUserGestureEv
    18191818__ZNK7WebCore16HTMLMediaElement5mutedEv
    18201819__ZNK7WebCore16HTMLMediaElement6volumeEv
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r88958 r89018  
    360360    LOG(Media, "HTMLMediaElement::removedFromDocument");
    361361    if (m_networkState > NETWORK_EMPTY)
    362         pause(processingUserGesture());
     362        pause();
    363363    if (m_isFullscreen)
    364364        exitFullscreen();
     
    490490}
    491491
    492 void HTMLMediaElement::load(bool isUserGesture, ExceptionCode& ec)
    493 {
    494     LOG(Media, "HTMLMediaElement::load(isUserGesture : %s)", boolString(isUserGesture));
    495 
    496     if (m_restrictions & RequireUserGestureForLoadRestriction && !isUserGesture)
     492void HTMLMediaElement::load(ExceptionCode& ec)
     493{
     494    LOG(Media, "HTMLMediaElement::load()");
     495
     496    if (m_restrictions & RequireUserGestureForLoadRestriction && !ScriptController::processingUserGesture())
    497497        ec = INVALID_STATE_ERR;
    498498    else {
    499         m_loadInitiatedByUserGesture = isUserGesture;
     499        m_loadInitiatedByUserGesture = ScriptController::processingUserGesture();
    500500        prepareForLoad();
    501501        loadInternal();
     
    14551455}
    14561456
    1457 void HTMLMediaElement::play(bool isUserGesture)
    1458 {
    1459     LOG(Media, "HTMLMediaElement::play(isUserGesture : %s)", boolString(isUserGesture));
    1460 
    1461     if (m_restrictions & RequireUserGestureForRateChangeRestriction && !isUserGesture)
    1462         return;
    1463 
    1464     Document* doc = document();
    1465     Settings* settings = doc->settings();
     1457void HTMLMediaElement::play()
     1458{
     1459    LOG(Media, "HTMLMediaElement::play()");
     1460
     1461    if (m_restrictions & RequireUserGestureForRateChangeRestriction && !ScriptController::processingUserGesture())
     1462        return;
     1463
     1464    Settings* settings = document()->settings();
    14661465    if (settings && settings->needsSiteSpecificQuirks() && m_dispatchingCanPlayEvent && !m_loadInitiatedByUserGesture) {
    14671466        // It should be impossible to be processing the canplay event while handling a user gesture
    14681467        // since it is dispatched asynchronously.
    1469         ASSERT(!isUserGesture);
    1470         String host = doc->baseURL().host();
     1468        ASSERT(!ScriptController::processingUserGesture());
     1469        String host = document()->baseURL().host();
    14711470        if (host.endsWith(".npr.org", false) || equalIgnoringCase(host, "npr.org"))
    14721471            return;
    14731472    }
    1474    
     1473
    14751474    playInternal();
    14761475}
     
    15041503}
    15051504
    1506 void HTMLMediaElement::pause(bool isUserGesture)
    1507 {
    1508     LOG(Media, "HTMLMediaElement::pause(isUserGesture : %s)", boolString(isUserGesture));
    1509 
    1510     if (m_restrictions & RequireUserGestureForRateChangeRestriction && !isUserGesture)
     1505void HTMLMediaElement::pause()
     1506{
     1507    LOG(Media, "HTMLMediaElement::pause()");
     1508
     1509    if (m_restrictions & RequireUserGestureForRateChangeRestriction && !ScriptController::processingUserGesture())
    15111510        return;
    15121511
     
    16361635            // when the slider is dragged from the end to another position unless we pause first. Do
    16371636            // a "hard pause" so an event is generated, since we want to stay paused after scrubbing finishes.
    1638             pause(processingUserGesture());
     1637            pause();
    16391638        } else {
    16401639            // Not at the end but we still want to pause playback so the media engine doesn't try to
     
    23872386        // This behavior is not specified but it seems like a sensible thing to do.
    23882387        ExceptionCode ec;
    2389         load(processingUserGesture(), ec);
     2388        load(ec);
    23902389    }
    23912390
     
    24222421    HTMLElement::defaultEventHandler(event);
    24232422#endif
    2424 }
    2425 
    2426 // FIXME: We should remove this function in favor of just calling ScriptController::processingUserGesture().
    2427 bool HTMLMediaElement::processingUserGesture() const
    2428 {
    2429     // FIXME: We should remove this check, but it seems to be needed to stop
    2430     // some media tests from crashing.
    2431     if (!document()->frame())
    2432         return true;
    2433     return ScriptController::processingUserGesture();
    24342423}
    24352424
  • trunk/Source/WebCore/html/HTMLMediaElement.h

    r88958 r89018  
    9696
    9797    PassRefPtr<TimeRanges> buffered() const;
    98     void load(bool isUserGesture, ExceptionCode&);
     98    void load(ExceptionCode&);
    9999    String canPlayType(const String& mimeType) const;
    100100
     
    123123    bool loop() const;   
    124124    void setLoop(bool b);
    125     void play(bool isUserGesture);
    126     void pause(bool isUserGesture);
     125    void play();
     126    void pause();
    127127
    128128// captions
     
    174174
    175175    MediaControls* mediaControls();
    176 
    177     bool processingUserGesture() const;
    178176
    179177    void sourceWillBeRemoved(HTMLSourceElement*);
  • trunk/Source/WebCore/html/HTMLMediaElement.idl

    r87539 r89018  
    4242
    4343    readonly attribute TimeRanges buffered;
    44     [NeedsUserGestureCheck] void load()
     44    void load()
    4545        raises (DOMException);
    4646    DOMString canPlayType(in DOMString type);
     
    6868    attribute [Reflect] boolean autoplay;
    6969    attribute [Reflect] boolean loop;
    70     [NeedsUserGestureCheck] void play();
    71     [NeedsUserGestureCheck] void pause();
     70    void play();
     71    void pause();
    7272
    7373    // controls
  • trunk/Source/WebCore/html/HTMLVideoElement.cpp

    r87125 r89018  
    4040#include "RenderImage.h"
    4141#include "RenderVideo.h"
     42#include "ScriptController.h"
    4243
    4344namespace WebCore {
     
    231232}
    232233
    233 void HTMLVideoElement::webkitEnterFullscreen(bool isUserGesture, ExceptionCode& ec)
     234void HTMLVideoElement::webkitEnterFullscreen(ExceptionCode& ec)
    234235{
    235236    if (isFullscreen())
     
    238239    // Generate an exception if this isn't called in response to a user gesture, or if the
    239240    // element does not support fullscreen.
    240     if ((requireUserGestureForFullScreen() && !isUserGesture) || !supportsFullscreen()) {
     241    if ((requireUserGestureForFullScreen() && !ScriptController::processingUserGesture()) || !supportsFullscreen()) {
    241242        ec = INVALID_STATE_ERR;
    242243        return;
  • trunk/Source/WebCore/html/HTMLVideoElement.h

    r87125 r89018  
    4646   
    4747    // Fullscreen
    48     void webkitEnterFullscreen(bool isUserGesture, ExceptionCode&);
     48    void webkitEnterFullscreen(ExceptionCode&);
    4949    void webkitExitFullscreen();
    5050    bool webkitSupportsFullscreen();
     
    5353    // FIXME: Maintain "FullScreen" capitalization scheme for backwards compatibility.
    5454    // https://bugs.webkit.org/show_bug.cgi?id=36081
    55     void webkitEnterFullScreen(bool isUserGesture, ExceptionCode& ec) { webkitEnterFullscreen(isUserGesture, ec); }
     55    void webkitEnterFullScreen(ExceptionCode& ec) { webkitEnterFullscreen(ec); }
    5656    void webkitExitFullScreen() { webkitExitFullscreen(); }
    5757
  • trunk/Source/WebCore/html/HTMLVideoElement.idl

    r88619 r89018  
    3838        readonly attribute boolean webkitDisplayingFullscreen;
    3939
    40         [NeedsUserGestureCheck] void webkitEnterFullscreen() raises (DOMException);
     40        void webkitEnterFullscreen() raises (DOMException);
    4141        void webkitExitFullscreen();
    4242
    4343        // Note the different capitalization of the "S" in FullScreen.
    44         [NeedsUserGestureCheck] void webkitEnterFullScreen() raises (DOMException);
     44        void webkitEnterFullScreen() raises (DOMException);
    4545        void webkitExitFullScreen();
    4646
  • trunk/Source/WebCore/html/MediaDocument.cpp

    r89007 r89018  
    166166        if (event->type() == eventNames().clickEvent) {
    167167            if (!video->canPlay()) {
    168                 video->pause(ScriptController::processingUserGesture());
     168                video->pause();
    169169                event->setDefaultHandled();
    170170            }
    171171        } else if (event->type() == eventNames().dblclickEvent) {
    172172            if (video->canPlay()) {
    173                 video->play(ScriptController::processingUserGesture());
     173                video->play();
    174174                event->setDefaultHandled();
    175175            }
     
    186186            if (video->paused()) {
    187187                if (video->canPlay())
    188                     video->play(ScriptController::processingUserGesture());
     188                    video->play();
    189189            } else
    190                 video->pause(ScriptController::processingUserGesture());
     190                video->pause();
    191191            event->setDefaultHandled();
    192192        }
  • trunk/Source/WebCore/html/shadow/MediaControlElements.cpp

    r89007 r89018  
    549549            frame->eventHandler()->setCapturingMouseEventsNode(this);
    550550        }
    551         mediaElement()->pause(ScriptController::processingUserGesture());
     551        mediaElement()->pause();
    552552        m_seekTimer.startRepeating(cSeekRepeatDelay);
    553553        event->setDefaultHandled();
  • trunk/Source/WebKit/chromium/ChangeLog

    r89008 r89018  
     12011-06-16  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Remove HTMLVideoElement::processingUserGesture
     6        https://bugs.webkit.org/show_bug.cgi?id=62784
     7
     8        * src/WebViewImpl.cpp:
     9        (WebKit::WebViewImpl::performMediaPlayerAction):
     10
    1112011-06-15  Mikhail Naganov  <mnaganov@chromium.org>
    212
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r88835 r89018  
    17981798                                           const WebPoint& location)
    17991799{
    1800     HitTestResult result =
    1801         hitTestResultForWindowPos(location);
     1800    HitTestResult result = hitTestResultForWindowPos(location);
    18021801    RefPtr<Node> node = result.innerNonSharedNode();
    18031802    if (!node->hasTagName(HTMLNames::videoTag) && !node->hasTagName(HTMLNames::audioTag))
     
    18091808    case WebMediaPlayerAction::Play:
    18101809        if (action.enable)
    1811             mediaElement->play(mediaElement->processingUserGesture());
     1810            mediaElement->play();
    18121811        else
    1813             mediaElement->pause(mediaElement->processingUserGesture());
     1812            mediaElement->pause();
    18141813        break;
    18151814    case WebMediaPlayerAction::Mute:
  • trunk/Source/WebKit/gtk/ChangeLog

    r88935 r89018  
     12011-06-16  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Remove HTMLVideoElement::processingUserGesture
     6        https://bugs.webkit.org/show_bug.cgi?id=62784
     7
     8        * WebCoreSupport/FullscreenVideoController.cpp:
     9        (FullscreenVideoController::play):
     10        (FullscreenVideoController::pause):
     11
    1122011-06-15  Claudio Saavedra  <csaavedra@igalia.com>
    213
  • trunk/Source/WebKit/gtk/WebCoreSupport/FullscreenVideoController.cpp

    r75605 r89018  
    369369{
    370370    if (m_mediaElement)
    371         m_mediaElement->play(m_mediaElement->processingUserGesture());
     371        m_mediaElement->play();
    372372
    373373    playStateChanged();
     
    378378{
    379379    if (m_mediaElement)
    380         m_mediaElement->pause(m_mediaElement->processingUserGesture());
     380        m_mediaElement->pause();
    381381
    382382    playStateChanged();
  • trunk/Source/WebKit/mac/ChangeLog

    r89001 r89018  
     12011-06-16  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Remove HTMLVideoElement::processingUserGesture
     6        https://bugs.webkit.org/show_bug.cgi?id=62784
     7
     8        * WebView/WebVideoFullscreenHUDWindowController.mm:
     9        (-[WebVideoFullscreenHUDWindowController setPlaying:]):
     10
    1112011-06-15  Adam Barth  <abarth@webkit.org>
    212
  • trunk/Source/WebKit/mac/WebView/WebVideoFullscreenHUDWindowController.mm

    r85036 r89018  
    564564
    565565    if (playing)
    566         mediaElement->play(mediaElement->processingUserGesture());
     566        mediaElement->play();
    567567    else
    568         mediaElement->pause(mediaElement->processingUserGesture());
     568        mediaElement->pause();
    569569}
    570570
  • trunk/Source/WebKit/win/ChangeLog

    r88737 r89018  
     12011-06-16  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Remove HTMLVideoElement::processingUserGesture
     6        https://bugs.webkit.org/show_bug.cgi?id=62784
     7
     8        * FullscreenVideoController.cpp:
     9        (FullscreenVideoController::play):
     10        (FullscreenVideoController::pause):
     11
    1122011-06-13  Kentaro Hara  <haraken@google.com>
    213
  • trunk/Source/WebKit/win/FullscreenVideoController.cpp

    r85699 r89018  
    326326{
    327327    if (m_mediaElement)
    328         m_mediaElement->play(m_mediaElement->processingUserGesture());
     328        m_mediaElement->play();
    329329}
    330330
     
    332332{
    333333    if (m_mediaElement)
    334         m_mediaElement->pause(m_mediaElement->processingUserGesture());
     334        m_mediaElement->pause();
    335335}
    336336
Note: See TracChangeset for help on using the changeset viewer.