| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "core/dom/ExecutionContext.h" | 47 #include "core/dom/ExecutionContext.h" |
| 48 #include "core/dom/RequestAnimationFrameCallback.h" | 48 #include "core/dom/RequestAnimationFrameCallback.h" |
| 49 #include "core/editing/Editor.h" | 49 #include "core/editing/Editor.h" |
| 50 #include "core/events/DOMWindowEventQueue.h" | 50 #include "core/events/DOMWindowEventQueue.h" |
| 51 #include "core/events/EventListener.h" | 51 #include "core/events/EventListener.h" |
| 52 #include "core/events/HashChangeEvent.h" | 52 #include "core/events/HashChangeEvent.h" |
| 53 #include "core/events/PageTransitionEvent.h" | 53 #include "core/events/PageTransitionEvent.h" |
| 54 #include "core/events/PopStateEvent.h" | 54 #include "core/events/PopStateEvent.h" |
| 55 #include "core/frame/Console.h" | 55 #include "core/frame/Console.h" |
| 56 #include "core/frame/DOMWindowLifecycleNotifier.h" | 56 #include "core/frame/DOMWindowLifecycleNotifier.h" |
| 57 #include "core/frame/EventHandlerRegistry.h" | |
| 58 #include "core/frame/FrameConsole.h" | 57 #include "core/frame/FrameConsole.h" |
| 59 #include "core/frame/FrameHost.h" | 58 #include "core/frame/FrameHost.h" |
| 60 #include "core/frame/FrameView.h" | 59 #include "core/frame/FrameView.h" |
| 61 #include "core/frame/History.h" | 60 #include "core/frame/History.h" |
| 62 #include "core/frame/LocalFrame.h" | 61 #include "core/frame/LocalFrame.h" |
| 63 #include "core/frame/Location.h" | 62 #include "core/frame/Location.h" |
| 64 #include "core/frame/Screen.h" | 63 #include "core/frame/Screen.h" |
| 65 #include "core/frame/Settings.h" | 64 #include "core/frame/Settings.h" |
| 66 #include "core/html/HTMLDocument.h" | 65 #include "core/html/HTMLDocument.h" |
| 67 #include "core/inspector/ConsoleMessage.h" | 66 #include "core/inspector/ConsoleMessage.h" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 } | 355 } |
| 357 | 356 |
| 358 void LocalDOMWindow::frameDestroyed() | 357 void LocalDOMWindow::frameDestroyed() |
| 359 { | 358 { |
| 360 FrameDestructionObserver::frameDestroyed(); | 359 FrameDestructionObserver::frameDestroyed(); |
| 361 reset(); | 360 reset(); |
| 362 } | 361 } |
| 363 | 362 |
| 364 void LocalDOMWindow::willDetachFrameHost() | 363 void LocalDOMWindow::willDetachFrameHost() |
| 365 { | 364 { |
| 366 m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); | |
| 367 m_frame->console().messageStorage()->frameWindowDiscarded(this); | 365 m_frame->console().messageStorage()->frameWindowDiscarded(this); |
| 368 } | 366 } |
| 369 | 367 |
| 370 void LocalDOMWindow::willDestroyDocumentInFrame() | 368 void LocalDOMWindow::willDestroyDocumentInFrame() |
| 371 { | 369 { |
| 372 // It is necessary to copy m_properties to a separate vector because the DOM
WindowProperties may | 370 // It is necessary to copy m_properties to a separate vector because the DOM
WindowProperties may |
| 373 // unregister themselves from the LocalDOMWindow as a result of the call to
willDestroyGlobalObjectInFrame. | 371 // unregister themselves from the LocalDOMWindow as a result of the call to
willDestroyGlobalObjectInFrame. |
| 374 Vector<DOMWindowProperty*> properties; | 372 Vector<DOMWindowProperty*> properties; |
| 375 copyToVector(m_properties, properties); | 373 copyToVector(m_properties, properties); |
| 376 for (size_t i = 0; i < properties.size(); ++i) | 374 for (size_t i = 0; i < properties.size(); ++i) |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 if (!m_css) | 699 if (!m_css) |
| 702 m_css = DOMWindowCSS::create(); | 700 m_css = DOMWindowCSS::create(); |
| 703 return *m_css; | 701 return *m_css; |
| 704 } | 702 } |
| 705 | 703 |
| 706 bool LocalDOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<
EventListener> listener, bool useCapture) | 704 bool LocalDOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<
EventListener> listener, bool useCapture) |
| 707 { | 705 { |
| 708 if (!EventTarget::addEventListener(eventType, listener, useCapture)) | 706 if (!EventTarget::addEventListener(eventType, listener, useCapture)) |
| 709 return false; | 707 return false; |
| 710 | 708 |
| 711 if (m_frame && m_frame->host()) | |
| 712 m_frame->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT
ype); | |
| 713 | |
| 714 if (Document* document = this->document()) | 709 if (Document* document = this->document()) |
| 715 document->addListenerTypeIfNeeded(eventType); | 710 document->addListenerTypeIfNeeded(eventType); |
| 716 | 711 |
| 717 lifecycleNotifier().notifyAddEventListener(this, eventType); | 712 lifecycleNotifier().notifyAddEventListener(this, eventType); |
| 718 | 713 |
| 719 if (eventType == EventTypeNames::unload) { | 714 if (eventType == EventTypeNames::unload) { |
| 720 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered); | 715 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered); |
| 721 addUnloadEventListener(this); | 716 addUnloadEventListener(this); |
| 722 } | 717 } |
| 723 return true; | 718 return true; |
| 724 } | 719 } |
| 725 | 720 |
| 726 bool LocalDOMWindow::removeEventListener(const AtomicString& eventType, PassRefP
tr<EventListener> listener, bool useCapture) | 721 bool LocalDOMWindow::removeEventListener(const AtomicString& eventType, PassRefP
tr<EventListener> listener, bool useCapture) |
| 727 { | 722 { |
| 728 if (!EventTarget::removeEventListener(eventType, listener, useCapture)) | 723 if (!EventTarget::removeEventListener(eventType, listener, useCapture)) |
| 729 return false; | 724 return false; |
| 730 | 725 |
| 731 if (m_frame && m_frame->host()) | |
| 732 m_frame->host()->eventHandlerRegistry().didRemoveEventHandler(*this, eve
ntType); | |
| 733 | |
| 734 lifecycleNotifier().notifyRemoveEventListener(this, eventType); | 726 lifecycleNotifier().notifyRemoveEventListener(this, eventType); |
| 735 | 727 |
| 736 if (eventType == EventTypeNames::unload) { | 728 if (eventType == EventTypeNames::unload) { |
| 737 removeUnloadEventListener(this); | 729 removeUnloadEventListener(this); |
| 738 } | 730 } |
| 739 | 731 |
| 740 return true; | 732 return true; |
| 741 } | 733 } |
| 742 | 734 |
| 743 void LocalDOMWindow::dispatchLoadEvent() | 735 void LocalDOMWindow::dispatchLoadEvent() |
| (...skipping 21 matching lines...) Expand all Loading... |
| 765 | 757 |
| 766 return result; | 758 return result; |
| 767 } | 759 } |
| 768 | 760 |
| 769 void LocalDOMWindow::removeAllEventListenersInternal(BroadcastListenerRemoval mo
de) | 761 void LocalDOMWindow::removeAllEventListenersInternal(BroadcastListenerRemoval mo
de) |
| 770 { | 762 { |
| 771 EventTarget::removeAllEventListeners(); | 763 EventTarget::removeAllEventListeners(); |
| 772 | 764 |
| 773 lifecycleNotifier().notifyRemoveAllEventListeners(this); | 765 lifecycleNotifier().notifyRemoveAllEventListeners(this); |
| 774 | 766 |
| 775 if (mode == DoBroadcastListenerRemoval) { | |
| 776 if (m_frame && m_frame->host()) | |
| 777 m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*t
his); | |
| 778 } | |
| 779 | |
| 780 removeAllUnloadEventListeners(this); | 767 removeAllUnloadEventListeners(this); |
| 781 } | 768 } |
| 782 | 769 |
| 783 void LocalDOMWindow::removeAllEventListeners() | 770 void LocalDOMWindow::removeAllEventListeners() |
| 784 { | 771 { |
| 785 removeAllEventListenersInternal(DoBroadcastListenerRemoval); | 772 removeAllEventListenersInternal(DoBroadcastListenerRemoval); |
| 786 } | 773 } |
| 787 | 774 |
| 788 void LocalDOMWindow::setLocation(const String& urlString, LocalDOMWindow* callin
gWindow, LocalDOMWindow* enteredWindow, SetLocationLocking locking) | 775 void LocalDOMWindow::setLocation(const String& urlString, LocalDOMWindow* callin
gWindow, LocalDOMWindow* enteredWindow, SetLocationLocking locking) |
| 789 { | 776 { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 809 { | 796 { |
| 810 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<LocalDOMWin
dow>::lifecycleNotifier()); | 797 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<LocalDOMWin
dow>::lifecycleNotifier()); |
| 811 } | 798 } |
| 812 | 799 |
| 813 PassOwnPtr<LifecycleNotifier<LocalDOMWindow> > LocalDOMWindow::createLifecycleNo
tifier() | 800 PassOwnPtr<LifecycleNotifier<LocalDOMWindow> > LocalDOMWindow::createLifecycleNo
tifier() |
| 814 { | 801 { |
| 815 return DOMWindowLifecycleNotifier::create(this); | 802 return DOMWindowLifecycleNotifier::create(this); |
| 816 } | 803 } |
| 817 | 804 |
| 818 } // namespace blink | 805 } // namespace blink |
| OLD | NEW |