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

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

Issue 225903009: Migrate touch events to EventHandlerRegistry (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix indendation problems (added by meld?) Created 6 years, 4 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
« no previous file with comments | « Source/core/frame/EventHandlerRegistry.cpp ('k') | Source/core/html/HTMLInputElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 414
415 if (m_frame->page() && m_frame->view()) { 415 if (m_frame->page() && m_frame->view()) {
416 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll ingCoordinator()) { 416 if (ScrollingCoordinator* scrollingCoordinator = m_frame->page()->scroll ingCoordinator()) {
417 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame- >view(), HorizontalScrollbar); 417 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame- >view(), HorizontalScrollbar);
418 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame- >view(), VerticalScrollbar); 418 scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_frame- >view(), VerticalScrollbar);
419 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_frame->vi ew()); 419 scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_frame->vi ew());
420 } 420 }
421 } 421 }
422 422
423 m_frame->selection().updateSecureKeyboardEntryIfActive(); 423 m_frame->selection().updateSecureKeyboardEntryIfActive();
424
425 if (m_frame->isMainFrame()) {
426 if (m_document->hasTouchEventHandlers())
427 m_frame->host()->chrome().client().needTouchEvents(true);
428 }
429 return m_document; 424 return m_document;
430 } 425 }
431 426
432 EventQueue* LocalDOMWindow::eventQueue() const 427 EventQueue* LocalDOMWindow::eventQueue() const
433 { 428 {
434 return m_eventQueue.get(); 429 return m_eventQueue.get();
435 } 430 }
436 431
437 void LocalDOMWindow::enqueueWindowEvent(PassRefPtrWillBeRawPtr<Event> event) 432 void LocalDOMWindow::enqueueWindowEvent(PassRefPtrWillBeRawPtr<Event> event)
438 { 433 {
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 bool LocalDOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr< EventListener> listener, bool useCapture) 1512 bool LocalDOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr< EventListener> listener, bool useCapture)
1518 { 1513 {
1519 if (!EventTarget::addEventListener(eventType, listener, useCapture)) 1514 if (!EventTarget::addEventListener(eventType, listener, useCapture))
1520 return false; 1515 return false;
1521 1516
1522 if (m_frame && m_frame->host()) 1517 if (m_frame && m_frame->host())
1523 m_frame->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT ype); 1518 m_frame->host()->eventHandlerRegistry().didAddEventHandler(*this, eventT ype);
1524 1519
1525 if (Document* document = this->document()) { 1520 if (Document* document = this->document()) {
1526 document->addListenerTypeIfNeeded(eventType); 1521 document->addListenerTypeIfNeeded(eventType);
1527 if (isTouchEventType(eventType)) 1522 if (eventType == EventTypeNames::storage)
1528 document->didAddTouchEventHandler(document);
1529 else if (eventType == EventTypeNames::storage)
1530 didAddStorageEventListener(this); 1523 didAddStorageEventListener(this);
1531 } 1524 }
1532 1525
1533 lifecycleNotifier().notifyAddEventListener(this, eventType); 1526 lifecycleNotifier().notifyAddEventListener(this, eventType);
1534 1527
1535 if (eventType == EventTypeNames::unload) { 1528 if (eventType == EventTypeNames::unload) {
1536 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered); 1529 UseCounter::count(document(), UseCounter::DocumentUnloadRegistered);
1537 addUnloadEventListener(this); 1530 addUnloadEventListener(this);
1538 } else if (eventType == EventTypeNames::beforeunload) { 1531 } else if (eventType == EventTypeNames::beforeunload) {
1539 UseCounter::count(document(), UseCounter::DocumentBeforeUnloadRegistered ); 1532 UseCounter::count(document(), UseCounter::DocumentBeforeUnloadRegistered );
(...skipping 12 matching lines...) Expand all
1552 } 1545 }
1553 1546
1554 bool LocalDOMWindow::removeEventListener(const AtomicString& eventType, PassRefP tr<EventListener> listener, bool useCapture) 1547 bool LocalDOMWindow::removeEventListener(const AtomicString& eventType, PassRefP tr<EventListener> listener, bool useCapture)
1555 { 1548 {
1556 if (!EventTarget::removeEventListener(eventType, listener, useCapture)) 1549 if (!EventTarget::removeEventListener(eventType, listener, useCapture))
1557 return false; 1550 return false;
1558 1551
1559 if (m_frame && m_frame->host()) 1552 if (m_frame && m_frame->host())
1560 m_frame->host()->eventHandlerRegistry().didRemoveEventHandler(*this, eve ntType); 1553 m_frame->host()->eventHandlerRegistry().didRemoveEventHandler(*this, eve ntType);
1561 1554
1562 if (Document* document = this->document()) {
1563 if (isTouchEventType(eventType))
1564 document->didRemoveTouchEventHandler(document);
1565 }
1566
1567 lifecycleNotifier().notifyRemoveEventListener(this, eventType); 1555 lifecycleNotifier().notifyRemoveEventListener(this, eventType);
1568 1556
1569 if (eventType == EventTypeNames::unload) { 1557 if (eventType == EventTypeNames::unload) {
1570 removeUnloadEventListener(this); 1558 removeUnloadEventListener(this);
1571 } else if (eventType == EventTypeNames::beforeunload && allowsBeforeUnloadLi steners(this)) { 1559 } else if (eventType == EventTypeNames::beforeunload && allowsBeforeUnloadLi steners(this)) {
1572 removeBeforeUnloadEventListener(this); 1560 removeBeforeUnloadEventListener(this);
1573 } 1561 }
1574 1562
1575 return true; 1563 return true;
1576 } 1564 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 1613
1626 void LocalDOMWindow::removeAllEventListenersInternal(BroadcastListenerRemoval mo de) 1614 void LocalDOMWindow::removeAllEventListenersInternal(BroadcastListenerRemoval mo de)
1627 { 1615 {
1628 EventTarget::removeAllEventListeners(); 1616 EventTarget::removeAllEventListeners();
1629 1617
1630 lifecycleNotifier().notifyRemoveAllEventListeners(this); 1618 lifecycleNotifier().notifyRemoveAllEventListeners(this);
1631 1619
1632 if (mode == DoBroadcastListenerRemoval) { 1620 if (mode == DoBroadcastListenerRemoval) {
1633 if (m_frame && m_frame->host()) 1621 if (m_frame && m_frame->host())
1634 m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*t his); 1622 m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*t his);
1635
1636 if (Document* document = this->document())
1637 document->didClearTouchEventHandlers(document);
1638 } 1623 }
1639 1624
1640 removeAllUnloadEventListeners(this); 1625 removeAllUnloadEventListeners(this);
1641 removeAllBeforeUnloadEventListeners(this); 1626 removeAllBeforeUnloadEventListeners(this);
1642 } 1627 }
1643 1628
1644 void LocalDOMWindow::removeAllEventListeners() 1629 void LocalDOMWindow::removeAllEventListeners()
1645 { 1630 {
1646 removeAllEventListenersInternal(DoBroadcastListenerRemoval); 1631 removeAllEventListenersInternal(DoBroadcastListenerRemoval);
1647 } 1632 }
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 visitor->trace(m_localStorage); 1913 visitor->trace(m_localStorage);
1929 visitor->trace(m_applicationCache); 1914 visitor->trace(m_applicationCache);
1930 visitor->trace(m_performance); 1915 visitor->trace(m_performance);
1931 visitor->trace(m_css); 1916 visitor->trace(m_css);
1932 visitor->trace(m_eventQueue); 1917 visitor->trace(m_eventQueue);
1933 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor); 1918 WillBeHeapSupplementable<LocalDOMWindow>::trace(visitor);
1934 EventTargetWithInlineData::trace(visitor); 1919 EventTargetWithInlineData::trace(visitor);
1935 } 1920 }
1936 1921
1937 } // namespace blink 1922 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/EventHandlerRegistry.cpp ('k') | Source/core/html/HTMLInputElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698