Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: Source/core/frame/DOMWindow.cpp

Issue 225903009: Migrate touch events to EventHandlerRegistry (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 407
408 if (m_frame->page() && m_frame->view()) { 408 if (m_frame->page() && m_frame->view()) {
409 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll ingCoordinator()) { 409 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll ingCoordinator()) {
410 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame- >view(), HorizontalScrollbar); 410 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame- >view(), HorizontalScrollbar);
411 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame- >view(), VerticalScrollbar); 411 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame- >view(), VerticalScrollbar);
412 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_frame->vi ew()); 412 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_frame->vi ew());
413 } 413 }
414 } 414 }
415 415
416 m_frame->selection().updateSecureKeyboardEntryIfActive(); 416 m_frame->selection().updateSecureKeyboardEntryIfActive();
417
418 if (m_frame->isMainFrame()) {
419 if (m_document->hasTouchEventHandlers())
420 m_frame->host()->chrome().client().needTouchEvents(true);
421 }
422
423 // FIXME: Oilpan: Remove .get() when m_document becomes Member<>. 417 // FIXME: Oilpan: Remove .get() when m_document becomes Member<>.
424 return m_document.get(); 418 return m_document.get();
425 } 419 }
426 420
427 EventQueue* DOMWindow::eventQueue() const 421 EventQueue* DOMWindow::eventQueue() const
428 { 422 {
429 return m_eventQueue.get(); 423 return m_eventQueue.get();
430 } 424 }
431 425
432 void DOMWindow::enqueueWindowEvent(PassRefPtrWillBeRawPtr<Event> event) 426 void DOMWindow::enqueueWindowEvent(PassRefPtrWillBeRawPtr<Event> event)
(...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1536 bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<Event Listener> listener, bool useCapture) 1530 bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<Event Listener> listener, bool useCapture)
1537 { 1531 {
1538 if (!EventTarget::addEventListener(eventType, listener, useCapture)) 1532 if (!EventTarget::addEventListener(eventType, listener, useCapture))
1539 return false; 1533 return false;
1540 1534
1541 if (m_frame && m_frame->host()) 1535 if (m_frame && m_frame->host())
1542 m_frame->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT ype); 1536 m_frame->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT ype);
1543 1537
1544 if (Document* document = this->document()) { 1538 if (Document* document = this->document()) {
1545 document->addListenerTypeIfNeeded(eventType); 1539 document->addListenerTypeIfNeeded(eventType);
1546 if (isTouchEventType(eventType)) 1540 if (eventType == EventTypeNames::storage)
1547 document->didAddTouchEventHandler(document);
1548 else if (eventType == EventTypeNames::storage)
1549 didAddStorageEventListener(this); 1541 didAddStorageEventListener(this);
1550 } 1542 }
1551 1543
1552 lifecycleNotifier().notifyAddEventListener(this, eventType); 1544 lifecycleNotifier().notifyAddEventListener(this, eventType);
1553 1545
1554 if (eventType == EventTypeNames::unload) { 1546 if (eventType == EventTypeNames::unload) {
1555 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered); 1547 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered);
1556 addUnloadEventListener(this); 1548 addUnloadEventListener(this);
1557 } else if (eventType == EventTypeNames::beforeunload) { 1549 } else if (eventType == EventTypeNames::beforeunload) {
1558 UseCounter::count(document(), UseCounter::DocumentBeforeUnloadRegistered ); 1550 UseCounter::count(document(), UseCounter::DocumentBeforeUnloadRegistered );
(...skipping 12 matching lines...) Expand all
1571 } 1563 }
1572 1564
1573 bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener * listener, bool useCapture) 1565 bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener * listener, bool useCapture)
1574 { 1566 {
1575 if (!EventTarget::removeEventListener(eventType, listener, useCapture)) 1567 if (!EventTarget::removeEventListener(eventType, listener, useCapture))
1576 return false; 1568 return false;
1577 1569
1578 if (m_frame && m_frame->host()) 1570 if (m_frame && m_frame->host())
1579 m_frame->host()->eventHandlerRegistry().didRemoveEventHandler(*this, eve ntType); 1571 m_frame->host()->eventHandlerRegistry().didRemoveEventHandler(*this, eve ntType);
1580 1572
1581 if (Document* document = this->document()) {
1582 if (isTouchEventType(eventType))
1583 document->didRemoveTouchEventHandler(document);
1584 }
1585
1586 lifecycleNotifier().notifyRemoveEventListener(this, eventType); 1573 lifecycleNotifier().notifyRemoveEventListener(this, eventType);
1587 1574
1588 if (eventType == EventTypeNames::unload) { 1575 if (eventType == EventTypeNames::unload) {
1589 removeUnloadEventListener(this); 1576 removeUnloadEventListener(this);
1590 } else if (eventType == EventTypeNames::beforeunload && allowsBeforeUnloadLi steners(this)) { 1577 } else if (eventType == EventTypeNames::beforeunload && allowsBeforeUnloadLi steners(this)) {
1591 removeBeforeUnloadEventListener(this); 1578 removeBeforeUnloadEventListener(this);
1592 } 1579 }
1593 1580
1594 return true; 1581 return true;
1595 } 1582 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 1631
1645 void DOMWindow::removeAllEventListenersInternal(BroadcastListenerRemoval mode) 1632 void DOMWindow::removeAllEventListenersInternal(BroadcastListenerRemoval mode)
1646 { 1633 {
1647 EventTarget::removeAllEventListeners(); 1634 EventTarget::removeAllEventListeners();
1648 1635
1649 lifecycleNotifier().notifyRemoveAllEventListeners(this); 1636 lifecycleNotifier().notifyRemoveAllEventListeners(this);
1650 1637
1651 if (mode == DoBroadcastListenerRemoval) { 1638 if (mode == DoBroadcastListenerRemoval) {
1652 if (m_frame && m_frame->host()) 1639 if (m_frame && m_frame->host())
1653 m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*t his); 1640 m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*t his);
1654
1655 if (Document* document = this->document())
1656 document->didClearTouchEventHandlers(document);
1657 } 1641 }
1658 1642
1659 removeAllUnloadEventListeners(this); 1643 removeAllUnloadEventListeners(this);
1660 removeAllBeforeUnloadEventListeners(this); 1644 removeAllBeforeUnloadEventListeners(this);
1661 } 1645 }
1662 1646
1663 void DOMWindow::removeAllEventListeners() 1647 void DOMWindow::removeAllEventListeners()
1664 { 1648 {
1665 removeAllEventListenersInternal(DoBroadcastListenerRemoval); 1649 removeAllEventListenersInternal(DoBroadcastListenerRemoval);
1666 } 1650 }
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1930 visitor->trace(m_localStorage); 1914 visitor->trace(m_localStorage);
1931 visitor->trace(m_applicationCache); 1915 visitor->trace(m_applicationCache);
1932 visitor->trace(m_performance); 1916 visitor->trace(m_performance);
1933 visitor->trace(m_css); 1917 visitor->trace(m_css);
1934 visitor->trace(m_eventQueue); 1918 visitor->trace(m_eventQueue);
1935 WillBeHeapSupplementable<DOMWindow>::trace(visitor); 1919 WillBeHeapSupplementable<DOMWindow>::trace(visitor);
1936 EventTargetWithInlineData::trace(visitor); 1920 EventTargetWithInlineData::trace(visitor);
1937 } 1921 }
1938 1922
1939 } // namespace WebCore 1923 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698