Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Side by Side Diff: Source/core/dom/FullscreenElementStack.cpp

Issue 387233002: Introduce FullscreenElementStack::fullyExitFullscreen() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/FullscreenElementStack.h ('k') | Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 m_areKeysEnabledInFullScreen = requestType != PrefixedMozillaRequest && requestType != PrefixedVideoRequest; 261 m_areKeysEnabledInFullScreen = requestType != PrefixedMozillaRequest && requestType != PrefixedVideoRequest;
262 document()->frameHost()->chrome().client().enterFullScreenForElement(&el ement); 262 document()->frameHost()->chrome().client().enterFullScreenForElement(&el ement);
263 263
264 // 7. Optionally, display a message indicating how the user can exit dis playing the context object fullscreen. 264 // 7. Optionally, display a message indicating how the user can exit dis playing the context object fullscreen.
265 return; 265 return;
266 } while (0); 266 } while (0);
267 267
268 enqueueErrorEvent(element); 268 enqueueErrorEvent(element);
269 } 269 }
270 270
271 void FullscreenElementStack::webkitCancelFullScreen() 271 void FullscreenElementStack::fullyExitFullscreen()
272 { 272 {
273 // The Mozilla "cancelFullScreen()" API behaves like the W3C "fully exit ful lscreen" behavior, which
274 // is defined as:
275 // "To fully exit fullscreen act as if the exitFullscreen() method was invok ed on the top-level browsing 273 // "To fully exit fullscreen act as if the exitFullscreen() method was invok ed on the top-level browsing
276 // context's document and subsequently empty that document's fullscreen elem ent stack." 274 // context's document and subsequently empty that document's fullscreen elem ent stack."
277 if (!fullscreenElementFrom(document()->topDocument())) 275 if (!fullscreenElementFrom(document()->topDocument()))
278 return; 276 return;
279 277
280 // To achieve that aim, remove all the elements from the top document's stac k except for the first before 278 // To achieve that aim, remove all the elements from the top document's stac k except for the first before
281 // calling webkitExitFullscreen(): 279 // calling exitFullscreen():
282 WillBeHeapVector<RefPtrWillBeMember<Element> > replacementFullscreenElementS tack; 280 WillBeHeapVector<RefPtrWillBeMember<Element> > replacementFullscreenElementS tack;
283 replacementFullscreenElementStack.append(fullscreenElementFrom(document()->t opDocument())); 281 replacementFullscreenElementStack.append(fullscreenElementFrom(document()->t opDocument()));
284 FullscreenElementStack& topFullscreenElementStack = from(document()->topDocu ment()); 282 FullscreenElementStack& topFullscreenElementStack = from(document()->topDocu ment());
285 topFullscreenElementStack.m_fullScreenElementStack.swap(replacementFullscree nElementStack); 283 topFullscreenElementStack.m_fullScreenElementStack.swap(replacementFullscree nElementStack);
286 topFullscreenElementStack.webkitExitFullscreen(); 284 topFullscreenElementStack.exitFullscreen();
287 } 285 }
288 286
289 void FullscreenElementStack::webkitExitFullscreen() 287 void FullscreenElementStack::exitFullscreen()
290 { 288 {
291 // The exitFullscreen() method must run these steps: 289 // The exitFullscreen() method must run these steps:
292 290
293 // 1. Let doc be the context object. (i.e. "this") 291 // 1. Let doc be the context object. (i.e. "this")
294 Document* currentDoc = document(); 292 Document* currentDoc = document();
295 if (!currentDoc->isActive()) 293 if (!currentDoc->isActive())
296 return; 294 return;
297 295
298 // 2. If doc's fullscreen element stack is empty, terminate these steps. 296 // 2. If doc's fullscreen element stack is empty, terminate these steps.
299 if (m_fullScreenElementStack.isEmpty()) 297 if (m_fullScreenElementStack.isEmpty())
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false); 442 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false);
445 443
446 m_areKeysEnabledInFullScreen = false; 444 m_areKeysEnabledInFullScreen = false;
447 445
448 if (m_fullScreenRenderer) 446 if (m_fullScreenRenderer)
449 m_fullScreenRenderer->unwrapRenderer(); 447 m_fullScreenRenderer->unwrapRenderer();
450 448
451 m_fullScreenElement = nullptr; 449 m_fullScreenElement = nullptr;
452 document()->setNeedsStyleRecalc(SubtreeStyleChange); 450 document()->setNeedsStyleRecalc(SubtreeStyleChange);
453 451
454 // When webkitCancelFullScreen is called, we call webkitExitFullScreen on th e topDocument(). That 452 // When fullyExitFullscreen is called, we call exitFullscreen on the topDocu ment(). That means
455 // means that the events will be queued there. So if we have no events here, start the timer on 453 // that the events will be queued there. So if we have no events here, start the timer on the
456 // the exiting document. 454 // exiting document.
457 Document* exitingDocument = document(); 455 Document* exitingDocument = document();
458 if (m_eventQueue.isEmpty()) 456 if (m_eventQueue.isEmpty())
459 exitingDocument = &document()->topDocument(); 457 exitingDocument = &document()->topDocument();
460 ASSERT(exitingDocument); 458 ASSERT(exitingDocument);
461 from(*exitingDocument).m_eventQueueTimer.startOneShot(0, FROM_HERE); 459 from(*exitingDocument).m_eventQueueTimer.startOneShot(0, FROM_HERE);
462 } 460 }
463 461
464 void FullscreenElementStack::setFullScreenRenderer(RenderFullScreen* renderer) 462 void FullscreenElementStack::setFullScreenRenderer(RenderFullScreen* renderer)
465 { 463 {
466 if (renderer == m_fullScreenRenderer) 464 if (renderer == m_fullScreenRenderer)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 if (!target->inDocument() && document()->documentElement()) 520 if (!target->inDocument() && document()->documentElement())
523 eventQueue.append(createEvent(event->type(), *document()->documentEl ement())); 521 eventQueue.append(createEvent(event->type(), *document()->documentEl ement()));
524 522
525 target->dispatchEvent(event); 523 target->dispatchEvent(event);
526 } 524 }
527 } 525 }
528 526
529 void FullscreenElementStack::fullScreenElementRemoved() 527 void FullscreenElementStack::fullScreenElementRemoved()
530 { 528 {
531 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false); 529 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false);
532 webkitCancelFullScreen(); 530 fullyExitFullscreen();
533 } 531 }
534 532
535 void FullscreenElementStack::removeFullScreenElementOfSubtree(Node* node, bool a mongChildrenOnly) 533 void FullscreenElementStack::removeFullScreenElementOfSubtree(Node* node, bool a mongChildrenOnly)
536 { 534 {
537 if (!m_fullScreenElement) 535 if (!m_fullScreenElement)
538 return; 536 return;
539 537
540 // If the node isn't in a document it can't have a fullscreen'd child. 538 // If the node isn't in a document it can't have a fullscreen'd child.
541 if (!node->inDocument()) 539 if (!node->inDocument())
542 return; 540 return;
(...skipping 28 matching lines...) Expand all
571 569
572 void FullscreenElementStack::trace(Visitor* visitor) 570 void FullscreenElementStack::trace(Visitor* visitor)
573 { 571 {
574 visitor->trace(m_fullScreenElement); 572 visitor->trace(m_fullScreenElement);
575 visitor->trace(m_fullScreenElementStack); 573 visitor->trace(m_fullScreenElementStack);
576 visitor->trace(m_eventQueue); 574 visitor->trace(m_eventQueue);
577 DocumentSupplement::trace(visitor); 575 DocumentSupplement::trace(visitor);
578 } 576 }
579 577
580 } // namespace WebCore 578 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/FullscreenElementStack.h ('k') | Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698