Chromium Code Reviews| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 // 1. Let following document be the document after document in docs, or null if there is no | 221 // 1. Let following document be the document after document in docs, or null if there is no |
| 222 // such document. | 222 // such document. |
| 223 Document* currentDoc = *current; | 223 Document* currentDoc = *current; |
| 224 Document* followingDoc = following != docs.end() ? *following : 0; | 224 Document* followingDoc = following != docs.end() ? *following : 0; |
| 225 | 225 |
| 226 // 2. If following document is null, push context object on document 's fullscreen element | 226 // 2. If following document is null, push context object on document 's fullscreen element |
| 227 // stack, and queue a task to fire an event named fullscreenchange w ith its bubbles attribute | 227 // stack, and queue a task to fire an event named fullscreenchange w ith its bubbles attribute |
| 228 // set to true on the document. | 228 // set to true on the document. |
| 229 if (!followingDoc) { | 229 if (!followingDoc) { |
| 230 from(*currentDoc).pushFullscreenElementStack(element); | 230 from(*currentDoc).pushFullscreenElementStack(element); |
| 231 addDocumentToFullScreenChangeEventQueue(*currentDoc); | 231 enqueueChangeEvent(element); |
| 232 continue; | 232 continue; |
| 233 } | 233 } |
| 234 | 234 |
| 235 // 3. Otherwise, if document's fullscreen element stack is either em pty or its top element | 235 // 3. Otherwise, if document's fullscreen element stack is either em pty or its top element |
| 236 // is not following document's browsing context container, | 236 // is not following document's browsing context container, |
| 237 Element* topElement = fullscreenElementFrom(*currentDoc); | 237 Element* topElement = fullscreenElementFrom(*currentDoc); |
| 238 if (!topElement || topElement != followingDoc->ownerElement()) { | 238 if (!topElement || topElement != followingDoc->ownerElement()) { |
| 239 // ...push following document's browsing context container on do cument's fullscreen element | 239 // ...push following document's browsing context container on do cument's fullscreen element |
| 240 // stack, and queue a task to fire an event named fullscreenchan ge with its bubbles attribute | 240 // stack, and queue a task to fire an event named fullscreenchan ge with its bubbles attribute |
| 241 // set to true on document. | 241 // set to true on document. |
| 242 from(*currentDoc).pushFullscreenElementStack(*followingDoc->owne rElement()); | 242 Element& ownerElement = *followingDoc->ownerElement(); |
| 243 addDocumentToFullScreenChangeEventQueue(*currentDoc); | 243 from(*currentDoc).pushFullscreenElementStack(ownerElement); |
| 244 enqueueChangeEvent(ownerElement); | |
| 244 continue; | 245 continue; |
| 245 } | 246 } |
| 246 | 247 |
| 247 // 4. Otherwise, do nothing for this document. It stays the same. | 248 // 4. Otherwise, do nothing for this document. It stays the same. |
| 248 } while (++current != docs.end()); | 249 } while (++current != docs.end()); |
| 249 | 250 |
| 250 // 5. Return, and run the remaining steps asynchronously. | 251 // 5. Return, and run the remaining steps asynchronously. |
| 251 // 6. Optionally, perform some animation. | 252 // 6. Optionally, perform some animation. |
| 252 m_areKeysEnabledInFullScreen = requestType != PrefixedMozillaRequest && requestType != PrefixedVideoRequest; | 253 m_areKeysEnabledInFullScreen = requestType != PrefixedMozillaRequest && requestType != PrefixedVideoRequest; |
| 253 document()->frameHost()->chrome().client().enterFullScreenForElement(&el ement); | 254 document()->frameHost()->chrome().client().enterFullScreenForElement(&el ement); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 ASSERT(toLocalFrame(descendant)->document()); | 302 ASSERT(toLocalFrame(descendant)->document()); |
| 302 if (fullscreenElementFrom(*toLocalFrame(descendant)->document())) | 303 if (fullscreenElementFrom(*toLocalFrame(descendant)->document())) |
| 303 descendants.prepend(toLocalFrame(descendant)->document()); | 304 descendants.prepend(toLocalFrame(descendant)->document()); |
| 304 } | 305 } |
| 305 | 306 |
| 306 // 4. For each descendant in descendants, empty descendant's fullscreen elem ent stack, and queue a | 307 // 4. For each descendant in descendants, empty descendant's fullscreen elem ent stack, and queue a |
| 307 // task to fire an event named fullscreenchange with its bubbles attribute s et to true on descendant. | 308 // task to fire an event named fullscreenchange with its bubbles attribute s et to true on descendant. |
| 308 for (WillBeHeapDeque<RefPtrWillBeMember<Document> >::iterator i = descendant s.begin(); i != descendants.end(); ++i) { | 309 for (WillBeHeapDeque<RefPtrWillBeMember<Document> >::iterator i = descendant s.begin(); i != descendants.end(); ++i) { |
| 309 ASSERT(*i); | 310 ASSERT(*i); |
| 310 from(**i).clearFullscreenElementStack(); | 311 from(**i).clearFullscreenElementStack(); |
| 311 addDocumentToFullScreenChangeEventQueue(**i); | 312 enqueueChangeEvent(**i); |
|
philipj_slow
2014/06/29 01:21:24
Bah, adding some asserts revealed that this change
falken
2014/06/30 02:29:41
I don't really understand this FullscreenElementSt
| |
| 312 } | 313 } |
| 313 | 314 |
| 314 // 5. While doc is not null, run these substeps: | 315 // 5. While doc is not null, run these substeps: |
| 315 Element* newTop = 0; | 316 Element* newTop = 0; |
| 316 while (currentDoc) { | 317 while (currentDoc) { |
| 317 // 1. Pop the top element of doc's fullscreen element stack. | 318 // 1. Pop the top element of doc's fullscreen element stack. |
| 318 from(*currentDoc).popFullscreenElementStack(); | 319 from(*currentDoc).popFullscreenElementStack(); |
| 319 | 320 |
| 320 // If doc's fullscreen element stack is non-empty and the element now at the top is either | 321 // If doc's fullscreen element stack is non-empty and the element now at the top is either |
| 321 // not in a document or its node document is not doc, repeat this sub step. | 322 // not in a document or its node document is not doc, repeat this sub step. |
| 322 newTop = fullscreenElementFrom(*currentDoc); | 323 newTop = fullscreenElementFrom(*currentDoc); |
| 323 if (newTop && (!newTop->inDocument() || newTop->document() != currentDoc )) | 324 if (newTop && (!newTop->inDocument() || newTop->document() != currentDoc )) |
| 324 continue; | 325 continue; |
| 325 | 326 |
| 326 // 2. Queue a task to fire an event named fullscreenchange with its bubb les attribute set to true | 327 // 2. Queue a task to fire an event named fullscreenchange with its bubb les attribute set to true |
| 327 // on doc. | 328 // on doc. |
| 328 addDocumentToFullScreenChangeEventQueue(*currentDoc); | 329 Node* target = newTop; |
| 330 if (!target) | |
| 331 target = currentFullScreenElementFrom(*currentDoc); | |
| 332 if (!target) | |
| 333 target = currentDoc; | |
| 334 enqueueChangeEvent(*target); | |
| 329 | 335 |
| 330 // 3. If doc's fullscreen element stack is empty and doc's browsing cont ext has a browsing context | 336 // 3. If doc's fullscreen element stack is empty and doc's browsing cont ext has a browsing context |
| 331 // container, set doc to that browsing context container's node document . | 337 // container, set doc to that browsing context container's node document . |
| 332 if (!newTop && currentDoc->ownerElement()) { | 338 if (!newTop && currentDoc->ownerElement()) { |
| 333 currentDoc = ¤tDoc->ownerElement()->document(); | 339 currentDoc = ¤tDoc->ownerElement()->document(); |
| 334 continue; | 340 continue; |
| 335 } | 341 } |
| 336 | 342 |
| 337 // 4. Otherwise, set doc to null. | 343 // 4. Otherwise, set doc to null. |
| 338 currentDoc = 0; | 344 currentDoc = 0; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 470 ASSERT(!m_fullScreenRenderer); | 476 ASSERT(!m_fullScreenRenderer); |
| 471 | 477 |
| 472 m_fullScreenRenderer = renderer; | 478 m_fullScreenRenderer = renderer; |
| 473 } | 479 } |
| 474 | 480 |
| 475 void FullscreenElementStack::fullScreenRendererDestroyed() | 481 void FullscreenElementStack::fullScreenRendererDestroyed() |
| 476 { | 482 { |
| 477 m_fullScreenRenderer = 0; | 483 m_fullScreenRenderer = 0; |
| 478 } | 484 } |
| 479 | 485 |
| 486 void FullscreenElementStack::enqueueChangeEvent(Node& node) | |
| 487 { | |
| 488 m_fullScreenChangeEventTargetQueue.append(&node); | |
| 489 } | |
| 490 | |
| 480 void FullscreenElementStack::fullScreenChangeDelayTimerFired(Timer<FullscreenEle mentStack>*) | 491 void FullscreenElementStack::fullScreenChangeDelayTimerFired(Timer<FullscreenEle mentStack>*) |
| 481 { | 492 { |
| 482 // Since we dispatch events in this function, it's possible that the | 493 // Since we dispatch events in this function, it's possible that the |
| 483 // document will be detached and GC'd. We protect it here to make sure we | 494 // document will be detached and GC'd. We protect it here to make sure we |
| 484 // can finish the function successfully. | 495 // can finish the function successfully. |
| 485 RefPtrWillBeRawPtr<Document> protectDocument(document()); | 496 RefPtrWillBeRawPtr<Document> protectDocument(document()); |
| 486 WillBeHeapDeque<RefPtrWillBeMember<Node> > changeQueue; | 497 WillBeHeapDeque<RefPtrWillBeMember<Node> > changeQueue; |
| 487 m_fullScreenChangeEventTargetQueue.swap(changeQueue); | 498 m_fullScreenChangeEventTargetQueue.swap(changeQueue); |
| 488 WillBeHeapDeque<RefPtrWillBeMember<Node> > errorQueue; | 499 WillBeHeapDeque<RefPtrWillBeMember<Node> > errorQueue; |
| 489 m_fullScreenErrorEventTargetQueue.swap(errorQueue); | 500 m_fullScreenErrorEventTargetQueue.swap(errorQueue); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 557 return; | 568 return; |
| 558 | 569 |
| 559 m_fullScreenElementStack.removeLast(); | 570 m_fullScreenElementStack.removeLast(); |
| 560 } | 571 } |
| 561 | 572 |
| 562 void FullscreenElementStack::pushFullscreenElementStack(Element& element) | 573 void FullscreenElementStack::pushFullscreenElementStack(Element& element) |
| 563 { | 574 { |
| 564 m_fullScreenElementStack.append(&element); | 575 m_fullScreenElementStack.append(&element); |
| 565 } | 576 } |
| 566 | 577 |
| 567 void FullscreenElementStack::addDocumentToFullScreenChangeEventQueue(Document& d oc) | |
| 568 { | |
| 569 Node* target = 0; | |
| 570 if (FullscreenElementStack* fullscreen = fromIfExists(doc)) { | |
| 571 target = fullscreen->webkitFullscreenElement(); | |
| 572 if (!target) | |
| 573 target = fullscreen->webkitCurrentFullScreenElement(); | |
| 574 } | |
| 575 | |
| 576 if (!target) | |
| 577 target = &doc; | |
| 578 m_fullScreenChangeEventTargetQueue.append(target); | |
| 579 } | |
| 580 | |
| 581 void FullscreenElementStack::trace(Visitor* visitor) | 578 void FullscreenElementStack::trace(Visitor* visitor) |
| 582 { | 579 { |
| 583 visitor->trace(m_fullScreenElement); | 580 visitor->trace(m_fullScreenElement); |
| 584 visitor->trace(m_fullScreenElementStack); | 581 visitor->trace(m_fullScreenElementStack); |
| 585 visitor->trace(m_fullScreenChangeEventTargetQueue); | 582 visitor->trace(m_fullScreenChangeEventTargetQueue); |
| 586 visitor->trace(m_fullScreenErrorEventTargetQueue); | 583 visitor->trace(m_fullScreenErrorEventTargetQueue); |
| 587 DocumentSupplement::trace(visitor); | 584 DocumentSupplement::trace(visitor); |
| 588 } | 585 } |
| 589 | 586 |
| 590 } // namespace WebCore | 587 } // namespace WebCore |
| OLD | NEW |