| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 9 * Copyright (C) 2013 Google Inc. All rights reserved. | 9 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // security risk, or platform limitation. | 72 // security risk, or platform limitation. |
| 73 return !document.settings() || document.settings()->fullscreenSupported(); | 73 return !document.settings() || document.settings()->fullscreenSupported(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 bool fullscreenElementReady(const Element& element) | 76 bool fullscreenElementReady(const Element& element) |
| 77 { | 77 { |
| 78 // A fullscreen element ready check for an element |element| returns true if
all of the | 78 // A fullscreen element ready check for an element |element| returns true if
all of the |
| 79 // following are true, and false otherwise: | 79 // following are true, and false otherwise: |
| 80 | 80 |
| 81 // |element| is in a document. | 81 // |element| is in a document. |
| 82 if (!element.inShadowIncludingDocument()) | 82 if (!element.isConnected()) |
| 83 return false; | 83 return false; |
| 84 | 84 |
| 85 // |element|'s node document's fullscreen enabled flag is set. | 85 // |element|'s node document's fullscreen enabled flag is set. |
| 86 if (!fullscreenIsAllowedForAllOwners(element.document())) | 86 if (!fullscreenIsAllowedForAllOwners(element.document())) |
| 87 return false; | 87 return false; |
| 88 | 88 |
| 89 // |element|'s node document's fullscreen element stack is either empty or i
ts top element is an | 89 // |element|'s node document's fullscreen element stack is either empty or i
ts top element is an |
| 90 // inclusive ancestor of |element|. | 90 // inclusive ancestor of |element|. |
| 91 if (const Element* topElement = Fullscreen::fullscreenElementFrom(element.do
cument())) { | 91 if (const Element* topElement = Fullscreen::fullscreenElementFrom(element.do
cument())) { |
| 92 if (!topElement->contains(&element)) | 92 if (!topElement->contains(&element)) |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 Element* newTop = 0; | 409 Element* newTop = 0; |
| 410 while (currentDoc) { | 410 while (currentDoc) { |
| 411 RequestType requestType = from(*currentDoc).m_fullScreenElementStack.las
t().second; | 411 RequestType requestType = from(*currentDoc).m_fullScreenElementStack.las
t().second; |
| 412 | 412 |
| 413 // 1. Pop the top element of doc's fullscreen element stack. | 413 // 1. Pop the top element of doc's fullscreen element stack. |
| 414 from(*currentDoc).popFullscreenElementStack(); | 414 from(*currentDoc).popFullscreenElementStack(); |
| 415 | 415 |
| 416 // If doc's fullscreen element stack is non-empty and the element now
at the top is either | 416 // If doc's fullscreen element stack is non-empty and the element now
at the top is either |
| 417 // not in a document or its node document is not doc, repeat this sub
step. | 417 // not in a document or its node document is not doc, repeat this sub
step. |
| 418 newTop = fullscreenElementFrom(*currentDoc); | 418 newTop = fullscreenElementFrom(*currentDoc); |
| 419 if (newTop && (!newTop->inShadowIncludingDocument() || newTop->document(
) != currentDoc)) | 419 if (newTop && (!newTop->isConnected() || newTop->document() != currentDo
c)) |
| 420 continue; | 420 continue; |
| 421 | 421 |
| 422 // 2. Queue a task to fire an event named fullscreenchange with its bubb
les attribute set to true | 422 // 2. Queue a task to fire an event named fullscreenchange with its bubb
les attribute set to true |
| 423 // on doc. | 423 // on doc. |
| 424 enqueueChangeEvent(*currentDoc, requestType); | 424 enqueueChangeEvent(*currentDoc, requestType); |
| 425 | 425 |
| 426 // 3. If doc's fullscreen element stack is empty and doc's browsing cont
ext has a browsing context | 426 // 3. If doc's fullscreen element stack is empty and doc's browsing cont
ext has a browsing context |
| 427 // container, set doc to that browsing context container's node document
. | 427 // container, set doc to that browsing context container's node document
. |
| 428 // | 428 // |
| 429 // OOPIF: If browsing context container's document is in another | 429 // OOPIF: If browsing context container's document is in another |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 void Fullscreen::eventQueueTimerFired(Timer<Fullscreen>*) | 632 void Fullscreen::eventQueueTimerFired(Timer<Fullscreen>*) |
| 633 { | 633 { |
| 634 HeapDeque<Member<Event>> eventQueue; | 634 HeapDeque<Member<Event>> eventQueue; |
| 635 m_eventQueue.swap(eventQueue); | 635 m_eventQueue.swap(eventQueue); |
| 636 | 636 |
| 637 while (!eventQueue.isEmpty()) { | 637 while (!eventQueue.isEmpty()) { |
| 638 Event* event = eventQueue.takeFirst(); | 638 Event* event = eventQueue.takeFirst(); |
| 639 Node* target = event->target()->toNode(); | 639 Node* target = event->target()->toNode(); |
| 640 | 640 |
| 641 // If the element was removed from our tree, also message the documentEl
ement. | 641 // If the element was removed from our tree, also message the documentEl
ement. |
| 642 if (!target->inShadowIncludingDocument() && document()->documentElement(
)) { | 642 if (!target->isConnected() && document()->documentElement()) { |
| 643 DCHECK(isPrefixed(event->type())); | 643 DCHECK(isPrefixed(event->type())); |
| 644 eventQueue.append(createEvent(event->type(), *document()->documentEl
ement())); | 644 eventQueue.append(createEvent(event->type(), *document()->documentEl
ement())); |
| 645 } | 645 } |
| 646 | 646 |
| 647 target->dispatchEvent(event); | 647 target->dispatchEvent(event); |
| 648 } | 648 } |
| 649 } | 649 } |
| 650 | 650 |
| 651 void Fullscreen::elementRemoved(Element& oldNode) | 651 void Fullscreen::elementRemoved(Element& oldNode) |
| 652 { | 652 { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 DEFINE_TRACE(Fullscreen) | 692 DEFINE_TRACE(Fullscreen) |
| 693 { | 693 { |
| 694 visitor->trace(m_fullScreenElement); | 694 visitor->trace(m_fullScreenElement); |
| 695 visitor->trace(m_fullScreenElementStack); | 695 visitor->trace(m_fullScreenElementStack); |
| 696 visitor->trace(m_eventQueue); | 696 visitor->trace(m_eventQueue); |
| 697 Supplement<Document>::trace(visitor); | 697 Supplement<Document>::trace(visitor); |
| 698 ContextLifecycleObserver::trace(visitor); | 698 ContextLifecycleObserver::trace(visitor); |
| 699 } | 699 } |
| 700 | 700 |
| 701 } // namespace blink | 701 } // namespace blink |
| OLD | NEW |