| 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, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 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) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
| (...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1360 } | 1360 } |
| 1361 | 1361 |
| 1362 PageVisibilityState Document::pageVisibilityState() const | 1362 PageVisibilityState Document::pageVisibilityState() const |
| 1363 { | 1363 { |
| 1364 // The visibility of the document is inherited from the visibility of the | 1364 // The visibility of the document is inherited from the visibility of the |
| 1365 // page. If there is no page associated with the document, we will assume | 1365 // page. If there is no page associated with the document, we will assume |
| 1366 // that the page is hidden, as specified by the spec: | 1366 // that the page is hidden, as specified by the spec: |
| 1367 // http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.
html#dom-document-hidden | 1367 // http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.
html#dom-document-hidden |
| 1368 if (!m_frame || !m_frame->page()) | 1368 if (!m_frame || !m_frame->page()) |
| 1369 return PageVisibilityStateHidden; | 1369 return PageVisibilityStateHidden; |
| 1370 // While visibilitychange is being dispatched during unloading it is |
| 1371 // expected that the visibility is hidden regardless of the page's |
| 1372 // visibility. |
| 1373 if (m_loadEventProgress == UnloadVisibilityChangeInProgress) |
| 1374 return PageVisibilityStateHidden; |
| 1370 return m_frame->page()->visibilityState(); | 1375 return m_frame->page()->visibilityState(); |
| 1371 } | 1376 } |
| 1372 | 1377 |
| 1373 String Document::visibilityState() const | 1378 String Document::visibilityState() const |
| 1374 { | 1379 { |
| 1375 return pageVisibilityStateString(pageVisibilityState()); | 1380 return pageVisibilityStateString(pageVisibilityState()); |
| 1376 } | 1381 } |
| 1377 | 1382 |
| 1378 bool Document::hidden() const | 1383 bool Document::hidden() const |
| 1379 { | 1384 { |
| (...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2756 Element* currentFocusedElement = focusedElement(); | 2761 Element* currentFocusedElement = focusedElement(); |
| 2757 if (isHTMLInputElement(currentFocusedElement)) | 2762 if (isHTMLInputElement(currentFocusedElement)) |
| 2758 toHTMLInputElement(*currentFocusedElement).endEditing(); | 2763 toHTMLInputElement(*currentFocusedElement).endEditing(); |
| 2759 if (m_loadEventProgress < PageHideInProgress) { | 2764 if (m_loadEventProgress < PageHideInProgress) { |
| 2760 m_loadEventProgress = PageHideInProgress; | 2765 m_loadEventProgress = PageHideInProgress; |
| 2761 if (LocalDOMWindow* window = domWindow()) | 2766 if (LocalDOMWindow* window = domWindow()) |
| 2762 window->dispatchEvent(PageTransitionEvent::create(EventTypeNames
::pagehide, false), this); | 2767 window->dispatchEvent(PageTransitionEvent::create(EventTypeNames
::pagehide, false), this); |
| 2763 if (!m_frame) | 2768 if (!m_frame) |
| 2764 return; | 2769 return; |
| 2765 | 2770 |
| 2771 PageVisibilityState visibilityState = pageVisibilityState(); |
| 2772 m_loadEventProgress = UnloadVisibilityChangeInProgress; |
| 2773 if (visibilityState != PageVisibilityStateHidden && RuntimeEnabledFe
atures::visibilityChangeOnUnloadEnabled()) { |
| 2774 // Dispatch visibilitychange event, but don't bother doing |
| 2775 // other notifications as we're about to be unloaded. |
| 2776 dispatchEvent(Event::createBubble(EventTypeNames::visibilitychan
ge)); |
| 2777 dispatchEvent(Event::createBubble(EventTypeNames::webkitvisibili
tychange)); |
| 2778 } |
| 2779 if (!m_frame) |
| 2780 return; |
| 2781 |
| 2766 // The DocumentLoader (and thus its DocumentLoadTiming) might get de
stroyed | 2782 // The DocumentLoader (and thus its DocumentLoadTiming) might get de
stroyed |
| 2767 // while dispatching the event, so protect it to prevent writing the
end | 2783 // while dispatching the event, so protect it to prevent writing the
end |
| 2768 // time into freed memory. | 2784 // time into freed memory. |
| 2769 RefPtrWillBeRawPtr<DocumentLoader> documentLoader = m_frame->loader(
).provisionalDocumentLoader(); | 2785 RefPtrWillBeRawPtr<DocumentLoader> documentLoader = m_frame->loader(
).provisionalDocumentLoader(); |
| 2770 m_loadEventProgress = UnloadEventInProgress; | 2786 m_loadEventProgress = UnloadEventInProgress; |
| 2771 RefPtrWillBeRawPtr<Event> unloadEvent(Event::create(EventTypeNames::
unload)); | 2787 RefPtrWillBeRawPtr<Event> unloadEvent(Event::create(EventTypeNames::
unload)); |
| 2772 if (documentLoader && !documentLoader->timing().unloadEventStart() &
& !documentLoader->timing().unloadEventEnd()) { | 2788 if (documentLoader && !documentLoader->timing().unloadEventStart() &
& !documentLoader->timing().unloadEventEnd()) { |
| 2773 DocumentLoadTiming& timing = documentLoader->timing(); | 2789 DocumentLoadTiming& timing = documentLoader->timing(); |
| 2774 ASSERT(timing.navigationStart()); | 2790 ASSERT(timing.navigationStart()); |
| 2775 timing.markUnloadEventStart(); | 2791 timing.markUnloadEventStart(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2791 if (!keepEventListeners) | 2807 if (!keepEventListeners) |
| 2792 removeAllEventListenersRecursively(); | 2808 removeAllEventListenersRecursively(); |
| 2793 } | 2809 } |
| 2794 | 2810 |
| 2795 Document::PageDismissalType Document::pageDismissalEventBeingDispatched() const | 2811 Document::PageDismissalType Document::pageDismissalEventBeingDispatched() const |
| 2796 { | 2812 { |
| 2797 if (m_loadEventProgress == BeforeUnloadEventInProgress) | 2813 if (m_loadEventProgress == BeforeUnloadEventInProgress) |
| 2798 return BeforeUnloadDismissal; | 2814 return BeforeUnloadDismissal; |
| 2799 if (m_loadEventProgress == PageHideInProgress) | 2815 if (m_loadEventProgress == PageHideInProgress) |
| 2800 return PageHideDismissal; | 2816 return PageHideDismissal; |
| 2817 if (m_loadEventProgress == UnloadVisibilityChangeInProgress) |
| 2818 return UnloadVisibilityChangeDismissal; |
| 2801 if (m_loadEventProgress == UnloadEventInProgress) | 2819 if (m_loadEventProgress == UnloadEventInProgress) |
| 2802 return UnloadDismissal; | 2820 return UnloadDismissal; |
| 2803 return NoDismissal; | 2821 return NoDismissal; |
| 2804 } | 2822 } |
| 2805 | 2823 |
| 2806 void Document::setParsingState(ParsingState parsingState) | 2824 void Document::setParsingState(ParsingState parsingState) |
| 2807 { | 2825 { |
| 2808 m_parsingState = parsingState; | 2826 m_parsingState = parsingState; |
| 2809 | 2827 |
| 2810 if (parsing() && !m_elementDataCache) | 2828 if (parsing() && !m_elementDataCache) |
| (...skipping 3168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5979 #ifndef NDEBUG | 5997 #ifndef NDEBUG |
| 5980 using namespace blink; | 5998 using namespace blink; |
| 5981 void showLiveDocumentInstances() | 5999 void showLiveDocumentInstances() |
| 5982 { | 6000 { |
| 5983 Document::WeakDocumentSet& set = Document::liveDocumentSet(); | 6001 Document::WeakDocumentSet& set = Document::liveDocumentSet(); |
| 5984 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); | 6002 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); |
| 5985 for (Document* document : set) | 6003 for (Document* document : set) |
| 5986 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); | 6004 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().get
String().utf8().data()); |
| 5987 } | 6005 } |
| 5988 #endif | 6006 #endif |
| OLD | NEW |