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

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

Issue 476433002: Sync fullscreen element removal with the spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 // If the element was removed from our tree, also message the documentEl ement. 553 // If the element was removed from our tree, also message the documentEl ement.
554 if (!target->inDocument() && document()->documentElement()) { 554 if (!target->inDocument() && document()->documentElement()) {
555 ASSERT(isPrefixed(event->type())); 555 ASSERT(isPrefixed(event->type()));
556 eventQueue.append(createEvent(event->type(), *document()->documentEl ement())); 556 eventQueue.append(createEvent(event->type(), *document()->documentEl ement()));
557 } 557 }
558 558
559 target->dispatchEvent(event); 559 target->dispatchEvent(event);
560 } 560 }
561 } 561 }
562 562
563 void FullscreenElementStack::fullScreenElementRemoved() 563 void FullscreenElementStack::elementRemoved(Element& element)
564 { 564 {
565 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false); 565 // If an element element in a fullscreen element stack is removed from a doc ument document, run
falken 2014/08/14 04:12:47 I find these hard to read. How about putting itali
philipj_slow 2014/08/14 08:10:39 I had done this, but then I started worrying about
566 fullyExitFullscreen(); 566 // these steps:
567 }
568 567
569 void FullscreenElementStack::removeFullScreenElementOfSubtree(Node* node, bool a mongChildrenOnly) 568 // 1. If element was at the top of document's fullscreen element stack, act as if the
570 { 569 // exitFullscreen() method was invoked on that document.
571 if (!m_fullScreenElement) 570 if (fullscreenElement() == &element) {
571 exitFullscreen();
572 return; 572 return;
573 }
573 574
574 // If the node isn't in a document it can't have a fullscreen'd child. 575 // 2. Otherwise, remove element from document's fullscreen element stack.
575 if (!node->inDocument()) 576 for (size_t i = 0; i < m_fullScreenElementStack.size(); ++i) {
576 return; 577 if (m_fullScreenElementStack[i].first.get() == &element) {
577 578 m_fullScreenElementStack.remove(i);
578 bool elementInSubtree = false; 579 return;
579 if (amongChildrenOnly) 580 }
580 elementInSubtree = m_fullScreenElement->isDescendantOf(node); 581 }
falken 2014/08/14 04:12:47 Is it worth doing NOTREACHED() here?
philipj_slow 2014/08/14 08:10:39 It's actually reachable, because elementRemoved wi
581 else
582 elementInSubtree = (m_fullScreenElement == node) || m_fullScreenElement- >isDescendantOf(node);
583
584 if (elementInSubtree)
585 fullScreenElementRemoved();
586 } 582 }
587 583
588 void FullscreenElementStack::clearFullscreenElementStack() 584 void FullscreenElementStack::clearFullscreenElementStack()
589 { 585 {
590 m_fullScreenElementStack.clear(); 586 m_fullScreenElementStack.clear();
591 } 587 }
592 588
593 void FullscreenElementStack::popFullscreenElementStack() 589 void FullscreenElementStack::popFullscreenElementStack()
594 { 590 {
595 if (m_fullScreenElementStack.isEmpty()) 591 if (m_fullScreenElementStack.isEmpty())
(...skipping 10 matching lines...) Expand all
606 void FullscreenElementStack::trace(Visitor* visitor) 602 void FullscreenElementStack::trace(Visitor* visitor)
607 { 603 {
608 visitor->trace(m_fullScreenElement); 604 visitor->trace(m_fullScreenElement);
609 visitor->trace(m_fullScreenElementStack); 605 visitor->trace(m_fullScreenElementStack);
610 visitor->trace(m_fullScreenRenderer); 606 visitor->trace(m_fullScreenRenderer);
611 visitor->trace(m_eventQueue); 607 visitor->trace(m_eventQueue);
612 DocumentSupplement::trace(visitor); 608 DocumentSupplement::trace(visitor);
613 } 609 }
614 610
615 } // namespace blink 611 } // namespace blink
OLDNEW
« LayoutTests/fullscreen/model/remove-first.html ('K') | « Source/core/dom/FullscreenElementStack.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698