Changeset 126043 in webkit


Ignore:
Timestamp:
Aug 20, 2012 11:11:22 AM (12 years ago)
Author:
bbudge@chromium.org
Message:

webkitfullscreenchange not fired properly in iframe.
https://bugs.webkit.org/show_bug.cgi?id=93525

Reviewed by Adam Barth.

webkitCancelFullScreen exits fullscreen by invoking webkitExitFullScreen on topDocument.
However, if webkitDidExitFullScreenForElement is invoked on a descendant document, no events
get dispatched. This change starts the event dispatch delay timer on the document where
webkitCancelFullScreen was called, so that the events get dispatched. In addition, when events
are dispatched, the check whether a node has been removed is changed to also check that the
node isn't in another document, as can happen with frames. Finally, webkitExitFullscreen
is fixed to remove unnecessary code and conform to the spec.

No new tests (the existing fullscreen/exit-full-screen-iframe.html test now passes).

  • dom/Document.cpp:

(WebCore::Document::webkitExitFullscreen):
(WebCore::Document::webkitDidExitFullScreenForElement):
(WebCore::Document::fullScreenChangeDelayTimerFired):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r126042 r126043  
     12012-08-20  Bill Budge  <bbudge@chromium.org>
     2
     3        webkitfullscreenchange not fired properly in iframe.
     4        https://bugs.webkit.org/show_bug.cgi?id=93525
     5
     6        Reviewed by Adam Barth.
     7
     8        webkitCancelFullScreen exits fullscreen by invoking webkitExitFullScreen on topDocument.
     9        However, if webkitDidExitFullScreenForElement is invoked on a descendant document, no events
     10        get dispatched. This change starts the event dispatch delay timer on the document where
     11        webkitCancelFullScreen was called, so that the events get dispatched. In addition, when events
     12        are dispatched, the check whether a node has been removed is changed to also check that the
     13        node isn't in another document, as can happen with frames. Finally, webkitExitFullscreen
     14        is fixed to remove unnecessary code and conform to the spec.
     15
     16        No new tests (the existing fullscreen/exit-full-screen-iframe.html test now passes).
     17
     18        * dom/Document.cpp:
     19        (WebCore::Document::webkitExitFullscreen):
     20        (WebCore::Document::webkitDidExitFullScreenForElement):
     21        (WebCore::Document::fullScreenChangeDelayTimerFired):
     22
    1232012-08-20  Yuzhu Shen  <yzshen@chromium.com>
    224
  • trunk/Source/WebCore/dom/Document.cpp

    r125988 r126043  
    66 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All rights reserved.
    77 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
    8  * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved.
     8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
    99 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
    1010 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
     
    55555555        // 2. Queue a task to fire an event named fullscreenchange with its bubbles attribute set to true
    55565556        // on doc.
    5557         Node* target = currentDoc->m_fullScreenElement.get();
    5558         if (!target)
    5559             target = currentDoc;
    55605557        addDocumentToFullScreenChangeEventQueue(currentDoc);
    55615558
    55625559        // 3. If doc's fullscreen element stack is empty and doc's browsing context has a browsing context
    55635560        // container, set doc to that browsing context container's node document.
    5564         if (!newTop && currentDoc->ownerElement())
     5561        if (!newTop && currentDoc->ownerElement()) {
    55655562            currentDoc = currentDoc->ownerElement()->document();
     5563            continue;
     5564        }
    55665565
    55675566        // 4. Otherwise, set doc to null.
     
    56765675    scheduleForcedStyleRecalc();
    56775676   
    5678     m_fullScreenChangeDelayTimer.startOneShot(0);
     5677    // When webkitCancelFullScreen is called, we call webkitExitFullScreen on the topDocument(). That
     5678    // means that the events will be queued there. So if we have no events here, start the timer on
     5679    // the exiting document.
     5680    Document* exitingDocument = this;
     5681    if (m_fullScreenChangeEventTargetQueue.isEmpty() && m_fullScreenErrorEventTargetQueue.isEmpty())
     5682        exitingDocument = topDocument();
     5683    exitingDocument->m_fullScreenChangeDelayTimer.startOneShot(0);
    56795684}
    56805685   
     
    57475752            node = documentElement();
    57485753
    5749         // If the element was removed from our tree, also message the documentElement.
    5750         if (!contains(node.get()))
     5754        // If the element was removed from our tree, also message the documentElement. Since we may
     5755        // have a document hierarchy, check that node isn't in another document.
     5756        if (!contains(node.get()) && !node->inDocument())
    57515757            changeQueue.append(documentElement());
    57525758       
     
    57625768            node = documentElement();
    57635769       
    5764         // If the node was removed from our tree, also message the documentElement.
    5765         if (!contains(node.get()))
     5770        // If the element was removed from our tree, also message the documentElement. Since we may
     5771        // have a document hierarchy, check that node isn't in another document.
     5772        if (!contains(node.get()) && !node->inDocument())
    57665773            errorQueue.append(documentElement());
    57675774       
Note: See TracChangeset for help on using the changeset viewer.