| 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 26 matching lines...) Expand all Loading... |
| 37 #include "bindings/v8/ScriptCallStackFactory.h" | 37 #include "bindings/v8/ScriptCallStackFactory.h" |
| 38 #include "bindings/v8/ScriptController.h" | 38 #include "bindings/v8/ScriptController.h" |
| 39 #include "bindings/v8/SerializedScriptValue.h" | 39 #include "bindings/v8/SerializedScriptValue.h" |
| 40 #include "core/css/CSSComputedStyleDeclaration.h" | 40 #include "core/css/CSSComputedStyleDeclaration.h" |
| 41 #include "core/css/CSSRuleList.h" | 41 #include "core/css/CSSRuleList.h" |
| 42 #include "core/css/DOMWindowCSS.h" | 42 #include "core/css/DOMWindowCSS.h" |
| 43 #include "core/css/MediaQueryList.h" | 43 #include "core/css/MediaQueryList.h" |
| 44 #include "core/css/MediaQueryMatcher.h" | 44 #include "core/css/MediaQueryMatcher.h" |
| 45 #include "core/css/StyleMedia.h" | 45 #include "core/css/StyleMedia.h" |
| 46 #include "core/css/resolver/StyleResolver.h" | 46 #include "core/css/resolver/StyleResolver.h" |
| 47 #include "core/dom/DeviceOrientationController.h" | |
| 48 #include "core/dom/Document.h" | 47 #include "core/dom/Document.h" |
| 49 #include "core/dom/Element.h" | 48 #include "core/dom/Element.h" |
| 50 #include "core/events/EventListener.h" | 49 #include "core/events/EventListener.h" |
| 51 #include "core/events/EventNames.h" | 50 #include "core/events/EventNames.h" |
| 52 #include "core/dom/ExceptionCode.h" | 51 #include "core/dom/ExceptionCode.h" |
| 53 #include "core/events/MessageEvent.h" | 52 #include "core/events/MessageEvent.h" |
| 54 #include "core/events/PageTransitionEvent.h" | 53 #include "core/events/PageTransitionEvent.h" |
| 55 #include "core/dom/RequestAnimationFrameCallback.h" | 54 #include "core/dom/RequestAnimationFrameCallback.h" |
| 56 #include "core/dom/ScriptExecutionContext.h" | 55 #include "core/dom/ScriptExecutionContext.h" |
| 57 #include "core/dom/UserGestureIndicator.h" | 56 #include "core/dom/UserGestureIndicator.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 88 #include "core/page/WindowFeatures.h" | 87 #include "core/page/WindowFeatures.h" |
| 89 #include "core/page/WindowFocusAllowedIndicator.h" | 88 #include "core/page/WindowFocusAllowedIndicator.h" |
| 90 #include "core/page/scrolling/ScrollingCoordinator.h" | 89 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 91 #include "core/platform/PlatformScreen.h" | 90 #include "core/platform/PlatformScreen.h" |
| 92 #include "core/platform/SuddenTermination.h" | 91 #include "core/platform/SuddenTermination.h" |
| 93 #include "core/platform/graphics/FloatRect.h" | 92 #include "core/platform/graphics/FloatRect.h" |
| 94 #include "core/platform/graphics/MediaPlayer.h" | 93 #include "core/platform/graphics/MediaPlayer.h" |
| 95 #include "core/storage/Storage.h" | 94 #include "core/storage/Storage.h" |
| 96 #include "core/storage/StorageArea.h" | 95 #include "core/storage/StorageArea.h" |
| 97 #include "core/storage/StorageNamespace.h" | 96 #include "core/storage/StorageNamespace.h" |
| 97 #include "modules/device_orientation/NewDeviceOrientationController.h" |
| 98 #include "weborigin/KURL.h" | 98 #include "weborigin/KURL.h" |
| 99 #include "weborigin/SecurityOrigin.h" | 99 #include "weborigin/SecurityOrigin.h" |
| 100 #include "weborigin/SecurityPolicy.h" | 100 #include "weborigin/SecurityPolicy.h" |
| 101 | 101 |
| 102 using std::min; | 102 using std::min; |
| 103 using std::max; | 103 using std::max; |
| 104 | 104 |
| 105 namespace WebCore { | 105 namespace WebCore { |
| 106 | 106 |
| 107 class PostMessageTimer : public TimerBase { | 107 class PostMessageTimer : public TimerBase { |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 { | 427 { |
| 428 FrameDestructionObserver::frameDestroyed(); | 428 FrameDestructionObserver::frameDestroyed(); |
| 429 reset(); | 429 reset(); |
| 430 } | 430 } |
| 431 | 431 |
| 432 void DOMWindow::willDetachPage() | 432 void DOMWindow::willDetachPage() |
| 433 { | 433 { |
| 434 InspectorInstrumentation::frameWindowDiscarded(m_frame, this); | 434 InspectorInstrumentation::frameWindowDiscarded(m_frame, this); |
| 435 // FIXME: Once DeviceOrientationController is a ScriptExecutionContext | 435 // FIXME: Once DeviceOrientationController is a ScriptExecutionContext |
| 436 // Supplement, this will no longer be needed. | 436 // Supplement, this will no longer be needed. |
| 437 if (DeviceOrientationController* controller = DeviceOrientationController::f
rom(page())) | 437 if (NewDeviceOrientationController* controller = NewDeviceOrientationControl
ler::from(document())) |
| 438 controller->removeAllDeviceEventListeners(this); | 438 controller->stopUpdating(); |
| 439 } | 439 } |
| 440 | 440 |
| 441 void DOMWindow::willDestroyDocumentInFrame() | 441 void DOMWindow::willDestroyDocumentInFrame() |
| 442 { | 442 { |
| 443 // It is necessary to copy m_properties to a separate vector because the DOM
WindowProperties may | 443 // It is necessary to copy m_properties to a separate vector because the DOM
WindowProperties may |
| 444 // unregister themselves from the DOMWindow as a result of the call to willD
estroyGlobalObjectInFrame. | 444 // unregister themselves from the DOMWindow as a result of the call to willD
estroyGlobalObjectInFrame. |
| 445 Vector<DOMWindowProperty*> properties; | 445 Vector<DOMWindowProperty*> properties; |
| 446 copyToVector(m_properties, properties); | 446 copyToVector(m_properties, properties); |
| 447 for (size_t i = 0; i < properties.size(); ++i) | 447 for (size_t i = 0; i < properties.size(); ++i) |
| 448 properties[i]->willDestroyGlobalObjectInFrame(); | 448 properties[i]->willDestroyGlobalObjectInFrame(); |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1425 if (allowsBeforeUnloadListeners(this)) { | 1425 if (allowsBeforeUnloadListeners(this)) { |
| 1426 // This is confusingly named. It doesn't actually add the listener.
It just increments a count | 1426 // This is confusingly named. It doesn't actually add the listener.
It just increments a count |
| 1427 // so that we know we have listeners registered for the purposes of
determining if we can | 1427 // so that we know we have listeners registered for the purposes of
determining if we can |
| 1428 // fast terminate the renderer process. | 1428 // fast terminate the renderer process. |
| 1429 addBeforeUnloadEventListener(this); | 1429 addBeforeUnloadEventListener(this); |
| 1430 } else { | 1430 } else { |
| 1431 // Subframes return false from allowsBeforeUnloadListeners. | 1431 // Subframes return false from allowsBeforeUnloadListeners. |
| 1432 UseCounter::count(this, UseCounter::SubFrameBeforeUnloadRegistered); | 1432 UseCounter::count(this, UseCounter::SubFrameBeforeUnloadRegistered); |
| 1433 } | 1433 } |
| 1434 } else if (eventType == eventNames().deviceorientationEvent && RuntimeEnable
dFeatures::deviceOrientationEnabled()) { | 1434 } else if (eventType == eventNames().deviceorientationEvent && RuntimeEnable
dFeatures::deviceOrientationEnabled()) { |
| 1435 if (DeviceOrientationController* controller = DeviceOrientationControlle
r::from(page())) | 1435 if (NewDeviceOrientationController* controller = NewDeviceOrientationCon
troller::from(document())) |
| 1436 controller->addDeviceEventListener(this); | 1436 controller->startUpdating(); |
| 1437 } | 1437 } |
| 1438 | 1438 |
| 1439 return true; | 1439 return true; |
| 1440 } | 1440 } |
| 1441 | 1441 |
| 1442 bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener
* listener, bool useCapture) | 1442 bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener
* listener, bool useCapture) |
| 1443 { | 1443 { |
| 1444 if (!EventTarget::removeEventListener(eventType, listener, useCapture)) | 1444 if (!EventTarget::removeEventListener(eventType, listener, useCapture)) |
| 1445 return false; | 1445 return false; |
| 1446 | 1446 |
| 1447 if (Document* document = this->document()) { | 1447 if (Document* document = this->document()) { |
| 1448 if (eventNames().isTouchEventType(eventType)) | 1448 if (eventNames().isTouchEventType(eventType)) |
| 1449 document->didRemoveTouchEventHandler(document); | 1449 document->didRemoveTouchEventHandler(document); |
| 1450 } | 1450 } |
| 1451 | 1451 |
| 1452 lifecycleNotifier()->notifyRemoveEventListener(this, eventType); | 1452 lifecycleNotifier()->notifyRemoveEventListener(this, eventType); |
| 1453 | 1453 |
| 1454 if (eventType == eventNames().unloadEvent) { | 1454 if (eventType == eventNames().unloadEvent) { |
| 1455 removeUnloadEventListener(this); | 1455 removeUnloadEventListener(this); |
| 1456 } else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnload
Listeners(this)) { | 1456 } else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnload
Listeners(this)) { |
| 1457 removeBeforeUnloadEventListener(this); | 1457 removeBeforeUnloadEventListener(this); |
| 1458 } else if (eventType == eventNames().deviceorientationEvent) { | 1458 } else if (eventType == eventNames().deviceorientationEvent) { |
| 1459 if (DeviceOrientationController* controller = DeviceOrientationControlle
r::from(page())) | 1459 if (NewDeviceOrientationController* controller = NewDeviceOrientationCon
troller::from(document())) |
| 1460 controller->removeDeviceEventListener(this); | 1460 controller->stopUpdating(); |
| 1461 } | 1461 } |
| 1462 | 1462 |
| 1463 return true; | 1463 return true; |
| 1464 } | 1464 } |
| 1465 | 1465 |
| 1466 void DOMWindow::dispatchLoadEvent() | 1466 void DOMWindow::dispatchLoadEvent() |
| 1467 { | 1467 { |
| 1468 RefPtr<Event> loadEvent(Event::create(eventNames().loadEvent)); | 1468 RefPtr<Event> loadEvent(Event::create(eventNames().loadEvent)); |
| 1469 if (m_frame && m_frame->loader()->documentLoader() && !m_frame->loader()->do
cumentLoader()->timing()->loadEventStart()) { | 1469 if (m_frame && m_frame->loader()->documentLoader() && !m_frame->loader()->do
cumentLoader()->timing()->loadEventStart()) { |
| 1470 // The DocumentLoader (and thus its DocumentLoadTiming) might get destro
yed while dispatching | 1470 // The DocumentLoader (and thus its DocumentLoadTiming) might get destro
yed while dispatching |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1504 | 1504 |
| 1505 return result; | 1505 return result; |
| 1506 } | 1506 } |
| 1507 | 1507 |
| 1508 void DOMWindow::removeAllEventListeners() | 1508 void DOMWindow::removeAllEventListeners() |
| 1509 { | 1509 { |
| 1510 EventTarget::removeAllEventListeners(); | 1510 EventTarget::removeAllEventListeners(); |
| 1511 | 1511 |
| 1512 lifecycleNotifier()->notifyRemoveAllEventListeners(this); | 1512 lifecycleNotifier()->notifyRemoveAllEventListeners(this); |
| 1513 | 1513 |
| 1514 if (DeviceOrientationController* controller = DeviceOrientationController::f
rom(page())) | 1514 if (NewDeviceOrientationController* controller = NewDeviceOrientationControl
ler::from(document())) |
| 1515 controller->removeAllDeviceEventListeners(this); | 1515 controller->stopUpdating(); |
| 1516 if (Document* document = this->document()) | 1516 if (Document* document = this->document()) |
| 1517 document->didRemoveEventTargetNode(document); | 1517 document->didRemoveEventTargetNode(document); |
| 1518 | 1518 |
| 1519 removeAllUnloadEventListeners(this); | 1519 removeAllUnloadEventListeners(this); |
| 1520 removeAllBeforeUnloadEventListeners(this); | 1520 removeAllBeforeUnloadEventListeners(this); |
| 1521 } | 1521 } |
| 1522 | 1522 |
| 1523 void DOMWindow::finishedLoading() | 1523 void DOMWindow::finishedLoading() |
| 1524 { | 1524 { |
| 1525 if (m_shouldPrintWhenFinishedLoading) { | 1525 if (m_shouldPrintWhenFinishedLoading) { |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1761 return static_cast<DOMWindowLifecycleNotifier*>(LifecycleContext::lifecycleN
otifier()); | 1761 return static_cast<DOMWindowLifecycleNotifier*>(LifecycleContext::lifecycleN
otifier()); |
| 1762 } | 1762 } |
| 1763 | 1763 |
| 1764 PassOwnPtr<LifecycleNotifier> DOMWindow::createLifecycleNotifier() | 1764 PassOwnPtr<LifecycleNotifier> DOMWindow::createLifecycleNotifier() |
| 1765 { | 1765 { |
| 1766 return DOMWindowLifecycleNotifier::create(this); | 1766 return DOMWindowLifecycleNotifier::create(this); |
| 1767 } | 1767 } |
| 1768 | 1768 |
| 1769 | 1769 |
| 1770 } // namespace WebCore | 1770 } // namespace WebCore |
| OLD | NEW |