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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 400 |
401 if (m_frame->page() && m_frame->view()) { | 401 if (m_frame->page() && m_frame->view()) { |
402 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll
ingCoordinator()) { | 402 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll
ingCoordinator()) { |
403 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame-
>view(), HorizontalScrollbar); | 403 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame-
>view(), HorizontalScrollbar); |
404 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame-
>view(), VerticalScrollbar); | 404 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame-
>view(), VerticalScrollbar); |
405 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_frame->vi
ew()); | 405 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_frame->vi
ew()); |
406 } | 406 } |
407 } | 407 } |
408 | 408 |
409 m_frame->selection().updateSecureKeyboardEntryIfActive(); | 409 m_frame->selection().updateSecureKeyboardEntryIfActive(); |
410 | |
411 if (m_frame->isMainFrame()) { | |
412 m_frame->notifyChromeClientWheelEventHandlerCountChanged(); | |
413 if (m_document->hasTouchEventHandlers()) | |
414 m_frame->host()->chrome().client().needTouchEvents(true); | |
415 } | |
416 | |
417 return m_document; | 410 return m_document; |
418 } | 411 } |
419 | 412 |
420 EventQueue* DOMWindow::eventQueue() const | 413 EventQueue* DOMWindow::eventQueue() const |
421 { | 414 { |
422 return m_eventQueue.get(); | 415 return m_eventQueue.get(); |
423 } | 416 } |
424 | 417 |
425 void DOMWindow::enqueueWindowEvent(PassRefPtr<Event> event) | 418 void DOMWindow::enqueueWindowEvent(PassRefPtr<Event> event) |
426 { | 419 { |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 window->sessionStorage(IGNORE_EXCEPTION); | 1507 window->sessionStorage(IGNORE_EXCEPTION); |
1515 } | 1508 } |
1516 | 1509 |
1517 bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<Event
Listener> listener, bool useCapture) | 1510 bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<Event
Listener> listener, bool useCapture) |
1518 { | 1511 { |
1519 if (!EventTarget::addEventListener(eventType, listener, useCapture)) | 1512 if (!EventTarget::addEventListener(eventType, listener, useCapture)) |
1520 return false; | 1513 return false; |
1521 | 1514 |
1522 if (Document* document = this->document()) { | 1515 if (Document* document = this->document()) { |
1523 document->addListenerTypeIfNeeded(eventType); | 1516 document->addListenerTypeIfNeeded(eventType); |
1524 if (isTouchEventType(eventType)) | 1517 if (eventType == EventTypeNames::storage) |
1525 document->didAddTouchEventHandler(document); | |
1526 else if (eventType == EventTypeNames::storage) | |
1527 didAddStorageEventListener(this); | 1518 didAddStorageEventListener(this); |
1528 } | 1519 } |
1529 | 1520 |
1530 lifecycleNotifier().notifyAddEventListener(this, eventType); | 1521 lifecycleNotifier().notifyAddEventListener(this, eventType); |
1531 | 1522 |
1532 if (eventType == EventTypeNames::unload) { | 1523 if (eventType == EventTypeNames::unload) { |
1533 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered); | 1524 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered); |
1534 addUnloadEventListener(this); | 1525 addUnloadEventListener(this); |
1535 } else if (eventType == EventTypeNames::beforeunload) { | 1526 } else if (eventType == EventTypeNames::beforeunload) { |
1536 UseCounter::count(document(), UseCounter::DocumentBeforeUnloadRegistered
); | 1527 UseCounter::count(document(), UseCounter::DocumentBeforeUnloadRegistered
); |
1537 if (allowsBeforeUnloadListeners(this)) { | 1528 if (allowsBeforeUnloadListeners(this)) { |
1538 // This is confusingly named. It doesn't actually add the listener.
It just increments a count | 1529 // This is confusingly named. It doesn't actually add the listener.
It just increments a count |
1539 // so that we know we have listeners registered for the purposes of
determining if we can | 1530 // so that we know we have listeners registered for the purposes of
determining if we can |
1540 // fast terminate the renderer process. | 1531 // fast terminate the renderer process. |
1541 addBeforeUnloadEventListener(this); | 1532 addBeforeUnloadEventListener(this); |
1542 } else { | 1533 } else { |
1543 // Subframes return false from allowsBeforeUnloadListeners. | 1534 // Subframes return false from allowsBeforeUnloadListeners. |
1544 UseCounter::count(document(), UseCounter::SubFrameBeforeUnloadRegist
ered); | 1535 UseCounter::count(document(), UseCounter::SubFrameBeforeUnloadRegist
ered); |
1545 } | 1536 } |
1546 } | 1537 } |
1547 | 1538 |
1548 return true; | 1539 return true; |
1549 } | 1540 } |
1550 | 1541 |
1551 bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener
* listener, bool useCapture) | 1542 bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener
* listener, bool useCapture) |
1552 { | 1543 { |
1553 if (!EventTarget::removeEventListener(eventType, listener, useCapture)) | 1544 if (!EventTarget::removeEventListener(eventType, listener, useCapture)) |
1554 return false; | 1545 return false; |
1555 | 1546 |
1556 if (Document* document = this->document()) { | |
1557 if (isTouchEventType(eventType)) | |
1558 document->didRemoveTouchEventHandler(document); | |
1559 } | |
1560 | |
1561 lifecycleNotifier().notifyRemoveEventListener(this, eventType); | 1547 lifecycleNotifier().notifyRemoveEventListener(this, eventType); |
1562 | 1548 |
1563 if (eventType == EventTypeNames::unload) { | 1549 if (eventType == EventTypeNames::unload) { |
1564 removeUnloadEventListener(this); | 1550 removeUnloadEventListener(this); |
1565 } else if (eventType == EventTypeNames::beforeunload && allowsBeforeUnloadLi
steners(this)) { | 1551 } else if (eventType == EventTypeNames::beforeunload && allowsBeforeUnloadLi
steners(this)) { |
1566 removeBeforeUnloadEventListener(this); | 1552 removeBeforeUnloadEventListener(this); |
1567 } | 1553 } |
1568 | 1554 |
1569 return true; | 1555 return true; |
1570 } | 1556 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1612 | 1598 |
1613 return result; | 1599 return result; |
1614 } | 1600 } |
1615 | 1601 |
1616 void DOMWindow::removeAllEventListeners() | 1602 void DOMWindow::removeAllEventListeners() |
1617 { | 1603 { |
1618 EventTarget::removeAllEventListeners(); | 1604 EventTarget::removeAllEventListeners(); |
1619 | 1605 |
1620 lifecycleNotifier().notifyRemoveAllEventListeners(this); | 1606 lifecycleNotifier().notifyRemoveAllEventListeners(this); |
1621 | 1607 |
1622 if (Document* document = this->document()) | |
1623 document->didClearTouchEventHandlers(document); | |
1624 | |
1625 removeAllUnloadEventListeners(this); | 1608 removeAllUnloadEventListeners(this); |
1626 removeAllBeforeUnloadEventListeners(this); | 1609 removeAllBeforeUnloadEventListeners(this); |
1627 } | 1610 } |
1628 | 1611 |
1629 void DOMWindow::finishedLoading() | 1612 void DOMWindow::finishedLoading() |
1630 { | 1613 { |
1631 if (m_shouldPrintWhenFinishedLoading) { | 1614 if (m_shouldPrintWhenFinishedLoading) { |
1632 m_shouldPrintWhenFinishedLoading = false; | 1615 m_shouldPrintWhenFinishedLoading = false; |
1633 print(); | 1616 print(); |
1634 } | 1617 } |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1888 visitor->trace(m_localStorage); | 1871 visitor->trace(m_localStorage); |
1889 visitor->trace(m_applicationCache); | 1872 visitor->trace(m_applicationCache); |
1890 visitor->trace(m_performance); | 1873 visitor->trace(m_performance); |
1891 visitor->trace(m_css); | 1874 visitor->trace(m_css); |
1892 #if ENABLE(OILPAN) | 1875 #if ENABLE(OILPAN) |
1893 HeapSupplementable<DOMWindow>::trace(visitor); | 1876 HeapSupplementable<DOMWindow>::trace(visitor); |
1894 #endif | 1877 #endif |
1895 } | 1878 } |
1896 | 1879 |
1897 } // namespace WebCore | 1880 } // namespace WebCore |
OLD | NEW |