Changeset 85510 in webkit


Ignore:
Timestamp:
May 2, 2011 1:19:12 PM (13 years ago)
Author:
Dimitri Glazkov
Message:

2011-05-02 Dimitri Glazkov <Dimitri Glazkov>

Reviewed by Eric Carlson.

REGRESSIONS (r71934): In standalone media documents, (double-)clicking the media element doesn’t play/pause
https://bugs.webkit.org/show_bug.cgi?id=59917

Since default event handlers are not retargeted, we should always attempt ancestor
traversal to find out whether the event.

  • html/MediaDocument.cpp: (WebCore::ancestorVideoElement): Added ancestor-traversing helper. (WebCore::MediaDocument::defaultEventHandler): Changed to use ancestorVideoElement.
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r85507 r85510  
     12011-05-02  Dimitri Glazkov  <dglazkov@chromium.org>
     2
     3        Reviewed by Eric Carlson.
     4
     5        REGRESSIONS (r71934): In standalone media documents, (double-)clicking the media element doesn’t play/pause
     6        https://bugs.webkit.org/show_bug.cgi?id=59917
     7
     8        Since default event handlers are not retargeted, we should always attempt ancestor
     9        traversal to find out whether the event.
     10
     11        * html/MediaDocument.cpp:
     12        (WebCore::ancestorVideoElement): Added ancestor-traversing helper.
     13        (WebCore::MediaDocument::defaultEventHandler): Changed to use ancestorVideoElement.
     14
    1152011-05-02  Sam Weinig  <sam@webkit.org>
    216
  • trunk/Source/WebCore/html/MediaDocument.cpp

    r85458 r85510  
    147147}
    148148
     149static inline HTMLVideoElement* ancestorVideoElement(Node* node)
     150{
     151    while (node && !node->hasTagName(videoTag))
     152        node = node->parentOrHostNode();
     153
     154    return static_cast<HTMLVideoElement*>(node);
     155}
     156
    149157void MediaDocument::defaultEventHandler(Event* event)
    150158{
     
    155163        return;
    156164
    157     if (targetNode->hasTagName(videoTag)) {
    158         HTMLVideoElement* video = static_cast<HTMLVideoElement*>(targetNode);
     165    if (HTMLVideoElement* video = ancestorVideoElement(targetNode)) {
    159166        if (event->type() == eventNames().clickEvent) {
    160167            if (!video->canPlay()) {
Note: See TracChangeset for help on using the changeset viewer.