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