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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All |
7 * rights reserved. | 7 * rights reserved. |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 m_currentFullScreenElement->pseudoStateChanged(CSSSelector::PseudoFullScreen); | 563 m_currentFullScreenElement->pseudoStateChanged(CSSSelector::PseudoFullScreen); |
564 | 564 |
565 // FIXME: This should not call updateStyleAndLayoutTree. | 565 // FIXME: This should not call updateStyleAndLayoutTree. |
566 document()->updateStyleAndLayoutTree(); | 566 document()->updateStyleAndLayoutTree(); |
567 | 567 |
568 m_currentFullScreenElement->didBecomeFullscreenElement(); | 568 m_currentFullScreenElement->didBecomeFullscreenElement(); |
569 | 569 |
570 if (document()->frame()) | 570 if (document()->frame()) |
571 document()->frame()->eventHandler().scheduleHoverStateUpdate(); | 571 document()->frame()->eventHandler().scheduleHoverStateUpdate(); |
572 | 572 |
| 573 for (FullscreenObserver* observer : m_observers) |
| 574 observer->onEnteredFullscreen(); |
| 575 |
573 m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE); | 576 m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE); |
574 } | 577 } |
575 | 578 |
576 void Fullscreen::didExitFullscreen() { | 579 void Fullscreen::didExitFullscreen() { |
577 if (!m_currentFullScreenElement) | 580 if (!m_currentFullScreenElement) |
578 return; | 581 return; |
579 | 582 |
580 if (!document()->isActive()) | 583 if (!document()->isActive()) |
581 return; | 584 return; |
582 | 585 |
(...skipping 18 matching lines...) Expand all Loading... |
601 // When fullyExitFullscreen is called, we call exitFullscreen on the | 604 // When fullyExitFullscreen is called, we call exitFullscreen on the |
602 // topDocument(). That means that the events will be queued there. So if we | 605 // topDocument(). That means that the events will be queued there. So if we |
603 // have no events here, start the timer on the exiting document. | 606 // have no events here, start the timer on the exiting document. |
604 Document* exitingDocument = document(); | 607 Document* exitingDocument = document(); |
605 if (m_eventQueue.isEmpty()) | 608 if (m_eventQueue.isEmpty()) |
606 exitingDocument = &topmostLocalAncestor(*document()); | 609 exitingDocument = &topmostLocalAncestor(*document()); |
607 DCHECK(exitingDocument); | 610 DCHECK(exitingDocument); |
608 from(*exitingDocument).m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE); | 611 from(*exitingDocument).m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE); |
609 | 612 |
610 m_forCrossProcessDescendant = false; | 613 m_forCrossProcessDescendant = false; |
| 614 |
| 615 for (FullscreenObserver* observer : m_observers) |
| 616 observer->onExitedFullscreen(); |
611 } | 617 } |
612 | 618 |
613 void Fullscreen::setFullScreenLayoutObject(LayoutFullScreen* layoutObject) { | 619 void Fullscreen::setFullScreenLayoutObject(LayoutFullScreen* layoutObject) { |
614 if (layoutObject == m_fullScreenLayoutObject) | 620 if (layoutObject == m_fullScreenLayoutObject) |
615 return; | 621 return; |
616 | 622 |
617 if (layoutObject && m_savedPlaceholderComputedStyle) { | 623 if (layoutObject && m_savedPlaceholderComputedStyle) { |
618 layoutObject->createPlaceholder(m_savedPlaceholderComputedStyle.release(), | 624 layoutObject->createPlaceholder(m_savedPlaceholderComputedStyle.release(), |
619 m_savedPlaceholderFrameRect); | 625 m_savedPlaceholderFrameRect); |
620 } else if (layoutObject && m_fullScreenLayoutObject && | 626 } else if (layoutObject && m_fullScreenLayoutObject && |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 return; | 724 return; |
719 | 725 |
720 m_fullscreenElementStack.removeLast(); | 726 m_fullscreenElementStack.removeLast(); |
721 } | 727 } |
722 | 728 |
723 void Fullscreen::pushFullscreenElementStack(Element& element, | 729 void Fullscreen::pushFullscreenElementStack(Element& element, |
724 RequestType requestType) { | 730 RequestType requestType) { |
725 m_fullscreenElementStack.append(std::make_pair(&element, requestType)); | 731 m_fullscreenElementStack.append(std::make_pair(&element, requestType)); |
726 } | 732 } |
727 | 733 |
| 734 void Fullscreen::registerObserver(FullscreenObserver* observer) { |
| 735 if (m_observers.find(observer) != m_observers.end()) |
| 736 return; |
| 737 m_observers.insert(observer); |
| 738 } |
| 739 |
| 740 void Fullscreen::removeObserver(FullscreenObserver* observer) { |
| 741 if (m_observers.find(observer) == m_observers.end()) |
| 742 return; |
| 743 m_observers.erase(observer); |
| 744 } |
| 745 |
728 DEFINE_TRACE(Fullscreen) { | 746 DEFINE_TRACE(Fullscreen) { |
729 visitor->trace(m_currentFullScreenElement); | 747 visitor->trace(m_currentFullScreenElement); |
730 visitor->trace(m_fullscreenElementStack); | 748 visitor->trace(m_fullscreenElementStack); |
731 visitor->trace(m_eventQueue); | 749 visitor->trace(m_eventQueue); |
732 Supplement<Document>::trace(visitor); | 750 Supplement<Document>::trace(visitor); |
733 ContextLifecycleObserver::trace(visitor); | 751 ContextLifecycleObserver::trace(visitor); |
734 } | 752 } |
735 | 753 |
736 } // namespace blink | 754 } // namespace blink |
OLD | NEW |