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 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 document->didAddTouchEventHandler(document); | 1523 document->didAddTouchEventHandler(document); |
1524 else if (eventType == eventNames().storageEvent) | 1524 else if (eventType == eventNames().storageEvent) |
1525 didAddStorageEventListener(this); | 1525 didAddStorageEventListener(this); |
1526 } | 1526 } |
1527 | 1527 |
1528 if (eventType == eventNames().unloadEvent) | 1528 if (eventType == eventNames().unloadEvent) |
1529 addUnloadEventListener(this); | 1529 addUnloadEventListener(this); |
1530 else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadLi
steners(this)) | 1530 else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadLi
steners(this)) |
1531 addBeforeUnloadEventListener(this); | 1531 addBeforeUnloadEventListener(this); |
1532 else if (eventType == eventNames().devicemotionEvent && RuntimeEnabledFeatur
es::deviceMotionEnabled()) { | 1532 else if (eventType == eventNames().devicemotionEvent && RuntimeEnabledFeatur
es::deviceMotionEnabled()) { |
1533 if (DeviceMotionController* controller = DeviceMotionController::from(pa
ge())) | 1533 if (DeviceMotionController* controller = DeviceMotionController::from(do
cument())) |
1534 controller->addDeviceEventListener(this); | 1534 controller->startUpdating(); |
1535 } else if (eventType == eventNames().deviceorientationEvent && RuntimeEnable
dFeatures::deviceOrientationEnabled()) { | 1535 } else if (eventType == eventNames().deviceorientationEvent && RuntimeEnable
dFeatures::deviceOrientationEnabled()) { |
1536 if (DeviceOrientationController* controller = DeviceOrientationControlle
r::from(page())) | 1536 if (DeviceOrientationController* controller = DeviceOrientationControlle
r::from(page())) |
1537 controller->addDeviceEventListener(this); | 1537 controller->addDeviceEventListener(this); |
1538 } | 1538 } |
1539 | 1539 |
1540 return true; | 1540 return true; |
1541 } | 1541 } |
1542 | 1542 |
1543 bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener
* listener, bool useCapture) | 1543 bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener
* listener, bool useCapture) |
1544 { | 1544 { |
1545 if (!EventTarget::removeEventListener(eventType, listener, useCapture)) | 1545 if (!EventTarget::removeEventListener(eventType, listener, useCapture)) |
1546 return false; | 1546 return false; |
1547 | 1547 |
1548 if (Document* document = this->document()) { | 1548 if (Document* document = this->document()) { |
1549 if (eventType == eventNames().mousewheelEvent) | 1549 if (eventType == eventNames().mousewheelEvent) |
1550 document->didRemoveWheelEventHandler(); | 1550 document->didRemoveWheelEventHandler(); |
1551 else if (eventNames().isTouchEventType(eventType)) | 1551 else if (eventNames().isTouchEventType(eventType)) |
1552 document->didRemoveTouchEventHandler(document); | 1552 document->didRemoveTouchEventHandler(document); |
1553 } | 1553 } |
1554 | 1554 |
1555 if (eventType == eventNames().unloadEvent) | 1555 if (eventType == eventNames().unloadEvent) |
1556 removeUnloadEventListener(this); | 1556 removeUnloadEventListener(this); |
1557 else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadLi
steners(this)) | 1557 else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadLi
steners(this)) |
1558 removeBeforeUnloadEventListener(this); | 1558 removeBeforeUnloadEventListener(this); |
1559 else if (eventType == eventNames().devicemotionEvent) { | 1559 else if (eventType == eventNames().devicemotionEvent) { |
1560 if (DeviceMotionController* controller = DeviceMotionController::from(pa
ge())) | 1560 if (DeviceMotionController* controller = DeviceMotionController::from(do
cument())) |
1561 controller->removeDeviceEventListener(this); | 1561 controller->stopUpdating(); |
1562 } else if (eventType == eventNames().deviceorientationEvent) { | 1562 } else if (eventType == eventNames().deviceorientationEvent) { |
1563 if (DeviceOrientationController* controller = DeviceOrientationControlle
r::from(page())) | 1563 if (DeviceOrientationController* controller = DeviceOrientationControlle
r::from(page())) |
1564 controller->removeDeviceEventListener(this); | 1564 controller->removeDeviceEventListener(this); |
1565 } | 1565 } |
1566 | 1566 |
1567 return true; | 1567 return true; |
1568 } | 1568 } |
1569 | 1569 |
1570 void DOMWindow::dispatchLoadEvent() | 1570 void DOMWindow::dispatchLoadEvent() |
1571 { | 1571 { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1606 | 1606 |
1607 InspectorInstrumentation::didDispatchEventOnWindow(cookie); | 1607 InspectorInstrumentation::didDispatchEventOnWindow(cookie); |
1608 | 1608 |
1609 return result; | 1609 return result; |
1610 } | 1610 } |
1611 | 1611 |
1612 void DOMWindow::removeAllEventListeners() | 1612 void DOMWindow::removeAllEventListeners() |
1613 { | 1613 { |
1614 EventTarget::removeAllEventListeners(); | 1614 EventTarget::removeAllEventListeners(); |
1615 | 1615 |
1616 if (DeviceMotionController* controller = DeviceMotionController::from(page()
)) | 1616 if (DeviceMotionController* controller = DeviceMotionController::from(docume
nt())) |
1617 controller->removeAllDeviceEventListeners(this); | 1617 controller->stopUpdating(); |
1618 if (DeviceOrientationController* controller = DeviceOrientationController::f
rom(page())) | 1618 if (DeviceOrientationController* controller = DeviceOrientationController::f
rom(page())) |
1619 controller->removeAllDeviceEventListeners(this); | 1619 controller->removeAllDeviceEventListeners(this); |
1620 if (Document* document = this->document()) | 1620 if (Document* document = this->document()) |
1621 document->didRemoveEventTargetNode(document); | 1621 document->didRemoveEventTargetNode(document); |
1622 | 1622 |
1623 removeAllUnloadEventListeners(this); | 1623 removeAllUnloadEventListeners(this); |
1624 removeAllBeforeUnloadEventListeners(this); | 1624 removeAllBeforeUnloadEventListeners(this); |
1625 } | 1625 } |
1626 | 1626 |
1627 void DOMWindow::finishedLoading() | 1627 void DOMWindow::finishedLoading() |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1877 | 1877 |
1878 Frame* child = frame->tree()->scopedChild(index); | 1878 Frame* child = frame->tree()->scopedChild(index); |
1879 if (child) | 1879 if (child) |
1880 return child->document()->domWindow(); | 1880 return child->document()->domWindow(); |
1881 | 1881 |
1882 return 0; | 1882 return 0; |
1883 } | 1883 } |
1884 | 1884 |
1885 | 1885 |
1886 } // namespace WebCore | 1886 } // namespace WebCore |
OLD | NEW |