| 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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 bool Fullscreen::fullscreenEnabled(Document& document) { | 544 bool Fullscreen::fullscreenEnabled(Document& document) { |
| 545 // The fullscreenEnabled attribute's getter must return true if the context | 545 // The fullscreenEnabled attribute's getter must return true if the context |
| 546 // object is allowed to use the feature indicated by attribute name | 546 // object is allowed to use the feature indicated by attribute name |
| 547 // allowfullscreen and fullscreen is supported, and false otherwise. | 547 // allowfullscreen and fullscreen is supported, and false otherwise. |
| 548 return allowedToUseFullscreen(document.frame()) && | 548 return allowedToUseFullscreen(document.frame()) && |
| 549 fullscreenIsSupported(document); | 549 fullscreenIsSupported(document); |
| 550 } | 550 } |
| 551 | 551 |
| 552 void Fullscreen::didEnterFullscreenForElement(Element* element) { | 552 void Fullscreen::didEnterFullscreenForElement(Element* element) { |
| 553 DCHECK(element); | 553 DCHECK(element); |
| 554 if (!document()->isActive()) | 554 if (!document()->isActive() || !document()->frame()) |
| 555 return; |
| 556 |
| 557 if (m_currentFullScreenElement == element) |
| 555 return; | 558 return; |
| 556 | 559 |
| 557 if (m_fullScreenLayoutObject) | 560 if (m_fullScreenLayoutObject) |
| 558 m_fullScreenLayoutObject->unwrapLayoutObject(); | 561 m_fullScreenLayoutObject->unwrapLayoutObject(); |
| 559 | 562 |
| 563 Element* previousElement = m_currentFullScreenElement; |
| 560 m_currentFullScreenElement = element; | 564 m_currentFullScreenElement = element; |
| 561 | 565 |
| 562 // Create a placeholder block for a the full-screen element, to keep the page | 566 // Create a placeholder block for a the full-screen element, to keep the page |
| 563 // from reflowing when the element is removed from the normal flow. Only do | 567 // from reflowing when the element is removed from the normal flow. Only do |
| 564 // this for a LayoutBox, as only a box will have a frameRect. The placeholder | 568 // this for a LayoutBox, as only a box will have a frameRect. The placeholder |
| 565 // will be created in setFullScreenLayoutObject() during layout. | 569 // will be created in setFullScreenLayoutObject() during layout. |
| 566 LayoutObject* layoutObject = m_currentFullScreenElement->layoutObject(); | 570 LayoutObject* layoutObject = m_currentFullScreenElement->layoutObject(); |
| 567 bool shouldCreatePlaceholder = layoutObject && layoutObject->isBox(); | 571 bool shouldCreatePlaceholder = layoutObject && layoutObject->isBox(); |
| 568 if (shouldCreatePlaceholder) { | 572 if (shouldCreatePlaceholder) { |
| 569 m_savedPlaceholderFrameRect = toLayoutBox(layoutObject)->frameRect(); | 573 m_savedPlaceholderFrameRect = toLayoutBox(layoutObject)->frameRect(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 593 | 597 |
| 594 m_currentFullScreenElement | 598 m_currentFullScreenElement |
| 595 ->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true); | 599 ->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true); |
| 596 | 600 |
| 597 document()->styleEngine().ensureUAStyleForFullscreen(); | 601 document()->styleEngine().ensureUAStyleForFullscreen(); |
| 598 m_currentFullScreenElement->pseudoStateChanged(CSSSelector::PseudoFullScreen); | 602 m_currentFullScreenElement->pseudoStateChanged(CSSSelector::PseudoFullScreen); |
| 599 | 603 |
| 600 // FIXME: This should not call updateStyleAndLayoutTree. | 604 // FIXME: This should not call updateStyleAndLayoutTree. |
| 601 document()->updateStyleAndLayoutTree(); | 605 document()->updateStyleAndLayoutTree(); |
| 602 | 606 |
| 603 m_currentFullScreenElement->didBecomeFullscreenElement(); | 607 document()->frame()->eventHandler().scheduleHoverStateUpdate(); |
| 604 | |
| 605 if (document()->frame()) | |
| 606 document()->frame()->eventHandler().scheduleHoverStateUpdate(); | |
| 607 | 608 |
| 608 m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE); | 609 m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE); |
| 610 |
| 611 document()->frame()->chromeClient().fullscreenElementChanged(previousElement, |
| 612 element); |
| 609 } | 613 } |
| 610 | 614 |
| 611 void Fullscreen::didExitFullscreen() { | 615 void Fullscreen::didExitFullscreen() { |
| 616 if (!document()->isActive() || !document()->frame()) |
| 617 return; |
| 618 |
| 612 if (!m_currentFullScreenElement) | 619 if (!m_currentFullScreenElement) |
| 613 return; | 620 return; |
| 614 | 621 |
| 615 if (!document()->isActive()) | |
| 616 return; | |
| 617 | |
| 618 m_currentFullScreenElement->willStopBeingFullscreenElement(); | |
| 619 | |
| 620 if (m_forCrossProcessDescendant) | 622 if (m_forCrossProcessDescendant) |
| 621 m_currentFullScreenElement->setContainsFullScreenElement(false); | 623 m_currentFullScreenElement->setContainsFullScreenElement(false); |
| 622 | 624 |
| 623 m_currentFullScreenElement | 625 m_currentFullScreenElement |
| 624 ->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false); | 626 ->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false); |
| 625 | 627 |
| 626 if (m_fullScreenLayoutObject) | 628 if (m_fullScreenLayoutObject) |
| 627 LayoutFullScreenItem(m_fullScreenLayoutObject).unwrapLayoutObject(); | 629 LayoutFullScreenItem(m_fullScreenLayoutObject).unwrapLayoutObject(); |
| 628 | 630 |
| 629 document()->styleEngine().ensureUAStyleForFullscreen(); | 631 document()->styleEngine().ensureUAStyleForFullscreen(); |
| 630 m_currentFullScreenElement->pseudoStateChanged(CSSSelector::PseudoFullScreen); | 632 m_currentFullScreenElement->pseudoStateChanged(CSSSelector::PseudoFullScreen); |
| 633 Element* previousElement = m_currentFullScreenElement; |
| 631 m_currentFullScreenElement = nullptr; | 634 m_currentFullScreenElement = nullptr; |
| 632 | 635 |
| 633 if (document()->frame()) | 636 document()->frame()->eventHandler().scheduleHoverStateUpdate(); |
| 634 document()->frame()->eventHandler().scheduleHoverStateUpdate(); | |
| 635 | 637 |
| 636 // When fullyExitFullscreen is called, we call exitFullscreen on the | 638 // When fullyExitFullscreen is called, we call exitFullscreen on the |
| 637 // topDocument(). That means that the events will be queued there. So if we | 639 // topDocument(). That means that the events will be queued there. So if we |
| 638 // have no events here, start the timer on the exiting document. | 640 // have no events here, start the timer on the exiting document. |
| 639 Document* exitingDocument = document(); | 641 Document* exitingDocument = document(); |
| 640 if (m_eventQueue.isEmpty()) | 642 if (m_eventQueue.isEmpty()) |
| 641 exitingDocument = &topmostLocalAncestor(*document()); | 643 exitingDocument = &topmostLocalAncestor(*document()); |
| 642 DCHECK(exitingDocument); | 644 DCHECK(exitingDocument); |
| 643 from(*exitingDocument).m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE); | 645 from(*exitingDocument).m_eventQueueTimer.startOneShot(0, BLINK_FROM_HERE); |
| 644 | 646 |
| 645 m_forCrossProcessDescendant = false; | 647 m_forCrossProcessDescendant = false; |
| 648 |
| 649 document()->frame()->chromeClient().fullscreenElementChanged(previousElement, |
| 650 nullptr); |
| 646 } | 651 } |
| 647 | 652 |
| 648 void Fullscreen::setFullScreenLayoutObject(LayoutFullScreen* layoutObject) { | 653 void Fullscreen::setFullScreenLayoutObject(LayoutFullScreen* layoutObject) { |
| 649 if (layoutObject == m_fullScreenLayoutObject) | 654 if (layoutObject == m_fullScreenLayoutObject) |
| 650 return; | 655 return; |
| 651 | 656 |
| 652 if (layoutObject && m_savedPlaceholderComputedStyle) { | 657 if (layoutObject && m_savedPlaceholderComputedStyle) { |
| 653 layoutObject->createPlaceholder(m_savedPlaceholderComputedStyle.release(), | 658 layoutObject->createPlaceholder(m_savedPlaceholderComputedStyle.release(), |
| 654 m_savedPlaceholderFrameRect); | 659 m_savedPlaceholderFrameRect); |
| 655 } else if (layoutObject && m_fullScreenLayoutObject && | 660 } else if (layoutObject && m_fullScreenLayoutObject && |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 | 767 |
| 763 DEFINE_TRACE(Fullscreen) { | 768 DEFINE_TRACE(Fullscreen) { |
| 764 visitor->trace(m_currentFullScreenElement); | 769 visitor->trace(m_currentFullScreenElement); |
| 765 visitor->trace(m_fullscreenElementStack); | 770 visitor->trace(m_fullscreenElementStack); |
| 766 visitor->trace(m_eventQueue); | 771 visitor->trace(m_eventQueue); |
| 767 Supplement<Document>::trace(visitor); | 772 Supplement<Document>::trace(visitor); |
| 768 ContextLifecycleObserver::trace(visitor); | 773 ContextLifecycleObserver::trace(visitor); |
| 769 } | 774 } |
| 770 | 775 |
| 771 } // namespace blink | 776 } // namespace blink |
| OLD | NEW |