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 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 document->didAddTouchEventHandler(document); | 1522 document->didAddTouchEventHandler(document); |
1523 else if (eventType == eventNames().storageEvent) | 1523 else if (eventType == eventNames().storageEvent) |
1524 didAddStorageEventListener(this); | 1524 didAddStorageEventListener(this); |
1525 } | 1525 } |
1526 | 1526 |
1527 if (eventType == eventNames().unloadEvent) | 1527 if (eventType == eventNames().unloadEvent) |
1528 addUnloadEventListener(this); | 1528 addUnloadEventListener(this); |
1529 else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadLi
steners(this)) | 1529 else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadLi
steners(this)) |
1530 addBeforeUnloadEventListener(this); | 1530 addBeforeUnloadEventListener(this); |
1531 else if (eventType == eventNames().devicemotionEvent && RuntimeEnabledFeatur
es::deviceMotionEnabled()) { | 1531 else if (eventType == eventNames().devicemotionEvent && RuntimeEnabledFeatur
es::deviceMotionEnabled()) { |
1532 if (DeviceMotionController* controller = DeviceMotionController::from(pa
ge())) | 1532 if (DeviceMotionController* controller = DeviceMotionController::from(do
cument())) |
1533 controller->addDeviceEventListener(this); | 1533 controller->startUpdating(); |
1534 } else if (eventType == eventNames().deviceorientationEvent && RuntimeEnable
dFeatures::deviceOrientationEnabled()) { | 1534 } else if (eventType == eventNames().deviceorientationEvent && RuntimeEnable
dFeatures::deviceOrientationEnabled()) { |
1535 if (DeviceOrientationController* controller = DeviceOrientationControlle
r::from(page())) | 1535 if (DeviceOrientationController* controller = DeviceOrientationControlle
r::from(page())) |
1536 controller->addDeviceEventListener(this); | 1536 controller->addDeviceEventListener(this); |
1537 } | 1537 } |
1538 | 1538 |
1539 return true; | 1539 return true; |
1540 } | 1540 } |
1541 | 1541 |
1542 bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener
* listener, bool useCapture) | 1542 bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener
* listener, bool useCapture) |
1543 { | 1543 { |
1544 if (!EventTarget::removeEventListener(eventType, listener, useCapture)) | 1544 if (!EventTarget::removeEventListener(eventType, listener, useCapture)) |
1545 return false; | 1545 return false; |
1546 | 1546 |
1547 if (Document* document = this->document()) { | 1547 if (Document* document = this->document()) { |
1548 if (eventType == eventNames().mousewheelEvent) | 1548 if (eventType == eventNames().mousewheelEvent) |
1549 document->didRemoveWheelEventHandler(); | 1549 document->didRemoveWheelEventHandler(); |
1550 else if (eventNames().isTouchEventType(eventType)) | 1550 else if (eventNames().isTouchEventType(eventType)) |
1551 document->didRemoveTouchEventHandler(document); | 1551 document->didRemoveTouchEventHandler(document); |
1552 } | 1552 } |
1553 | 1553 |
1554 if (eventType == eventNames().unloadEvent) | 1554 if (eventType == eventNames().unloadEvent) |
1555 removeUnloadEventListener(this); | 1555 removeUnloadEventListener(this); |
1556 else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadLi
steners(this)) | 1556 else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadLi
steners(this)) |
1557 removeBeforeUnloadEventListener(this); | 1557 removeBeforeUnloadEventListener(this); |
1558 else if (eventType == eventNames().devicemotionEvent) { | 1558 else if (eventType == eventNames().devicemotionEvent) { |
1559 if (DeviceMotionController* controller = DeviceMotionController::from(pa
ge())) | 1559 if (DeviceMotionController* controller = DeviceMotionController::from(do
cument())) |
1560 controller->removeDeviceEventListener(this); | 1560 controller->stopUpdating(); |
1561 } else if (eventType == eventNames().deviceorientationEvent) { | 1561 } else if (eventType == eventNames().deviceorientationEvent) { |
1562 if (DeviceOrientationController* controller = DeviceOrientationControlle
r::from(page())) | 1562 if (DeviceOrientationController* controller = DeviceOrientationControlle
r::from(page())) |
1563 controller->removeDeviceEventListener(this); | 1563 controller->removeDeviceEventListener(this); |
1564 } | 1564 } |
1565 | 1565 |
1566 return true; | 1566 return true; |
1567 } | 1567 } |
1568 | 1568 |
1569 void DOMWindow::dispatchLoadEvent() | 1569 void DOMWindow::dispatchLoadEvent() |
1570 { | 1570 { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 | 1605 |
1606 InspectorInstrumentation::didDispatchEventOnWindow(cookie); | 1606 InspectorInstrumentation::didDispatchEventOnWindow(cookie); |
1607 | 1607 |
1608 return result; | 1608 return result; |
1609 } | 1609 } |
1610 | 1610 |
1611 void DOMWindow::removeAllEventListeners() | 1611 void DOMWindow::removeAllEventListeners() |
1612 { | 1612 { |
1613 EventTarget::removeAllEventListeners(); | 1613 EventTarget::removeAllEventListeners(); |
1614 | 1614 |
1615 if (DeviceMotionController* controller = DeviceMotionController::from(page()
)) | 1615 if (DeviceMotionController* controller = DeviceMotionController::from(docume
nt())) |
1616 controller->removeAllDeviceEventListeners(this); | 1616 controller->stopUpdating(); |
1617 if (DeviceOrientationController* controller = DeviceOrientationController::f
rom(page())) | 1617 if (DeviceOrientationController* controller = DeviceOrientationController::f
rom(page())) |
1618 controller->removeAllDeviceEventListeners(this); | 1618 controller->removeDeviceEventListener(this); |
1619 if (Document* document = this->document()) | 1619 if (Document* document = this->document()) |
1620 document->didRemoveEventTargetNode(document); | 1620 document->didRemoveEventTargetNode(document); |
1621 | 1621 |
1622 removeAllUnloadEventListeners(this); | 1622 removeAllUnloadEventListeners(this); |
1623 removeAllBeforeUnloadEventListeners(this); | 1623 removeAllBeforeUnloadEventListeners(this); |
1624 } | 1624 } |
1625 | 1625 |
1626 void DOMWindow::finishedLoading() | 1626 void DOMWindow::finishedLoading() |
1627 { | 1627 { |
1628 if (m_shouldPrintWhenFinishedLoading) { | 1628 if (m_shouldPrintWhenFinishedLoading) { |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 WindowFeatures windowFeatures(dialogFeaturesString, screenAvailableRect(m_fr
ame->view())); | 1862 WindowFeatures windowFeatures(dialogFeaturesString, screenAvailableRect(m_fr
ame->view())); |
1863 Frame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures, | 1863 Frame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures, |
1864 activeWindow, firstFrame, m_frame, function, functionContext); | 1864 activeWindow, firstFrame, m_frame, function, functionContext); |
1865 if (!dialogFrame) | 1865 if (!dialogFrame) |
1866 return; | 1866 return; |
1867 UserGestureIndicatorDisabler disabler; | 1867 UserGestureIndicatorDisabler disabler; |
1868 dialogFrame->page()->chrome()->runModal(); | 1868 dialogFrame->page()->chrome()->runModal(); |
1869 } | 1869 } |
1870 | 1870 |
1871 } // namespace WebCore | 1871 } // namespace WebCore |
OLD | NEW |