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

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 225823007: Migrate wheel 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
« no previous file with comments | « Source/web/FrameLoaderClientImpl.cpp ('k') | no next file » | 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 21 matching lines...) Expand all
32 #include "web/WebViewImpl.h" 32 #include "web/WebViewImpl.h"
33 33
34 #include "CSSValueKeywords.h" 34 #include "CSSValueKeywords.h"
35 #include "HTMLNames.h" 35 #include "HTMLNames.h"
36 #include "RuntimeEnabledFeatures.h" 36 #include "RuntimeEnabledFeatures.h"
37 #include "core/accessibility/AXObjectCache.h" 37 #include "core/accessibility/AXObjectCache.h"
38 #include "core/clipboard/DataObject.h" 38 #include "core/clipboard/DataObject.h"
39 #include "core/dom/Document.h" 39 #include "core/dom/Document.h"
40 #include "core/dom/DocumentMarkerController.h" 40 #include "core/dom/DocumentMarkerController.h"
41 #include "core/dom/Text.h" 41 #include "core/dom/Text.h"
42 #include "core/dom/WheelController.h"
43 #include "core/editing/Editor.h" 42 #include "core/editing/Editor.h"
44 #include "core/editing/FrameSelection.h" 43 #include "core/editing/FrameSelection.h"
45 #include "core/editing/InputMethodController.h" 44 #include "core/editing/InputMethodController.h"
46 #include "core/editing/TextIterator.h" 45 #include "core/editing/TextIterator.h"
47 #include "core/events/KeyboardEvent.h" 46 #include "core/events/KeyboardEvent.h"
48 #include "core/events/WheelEvent.h" 47 #include "core/events/WheelEvent.h"
48 #include "core/frame/EventHandlerRegistry.h"
49 #include "core/frame/FrameHost.h" 49 #include "core/frame/FrameHost.h"
50 #include "core/frame/FrameView.h" 50 #include "core/frame/FrameView.h"
51 #include "core/frame/LocalFrame.h" 51 #include "core/frame/LocalFrame.h"
52 #include "core/frame/PinchViewport.h" 52 #include "core/frame/PinchViewport.h"
53 #include "core/frame/Settings.h" 53 #include "core/frame/Settings.h"
54 #include "core/frame/SmartClip.h" 54 #include "core/frame/SmartClip.h"
55 #include "core/html/HTMLInputElement.h" 55 #include "core/html/HTMLInputElement.h"
56 #include "core/html/HTMLMediaElement.h" 56 #include "core/html/HTMLMediaElement.h"
57 #include "core/html/HTMLPlugInElement.h" 57 #include "core/html/HTMLPlugInElement.h"
58 #include "core/html/HTMLTextAreaElement.h" 58 #include "core/html/HTMLTextAreaElement.h"
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 1475
1476 return frame->eventHandler().bubblingScroll(scrollDirection, scrollGranulari ty); 1476 return frame->eventHandler().bubblingScroll(scrollDirection, scrollGranulari ty);
1477 } 1477 }
1478 1478
1479 void WebViewImpl::popupOpened(PopupContainer* popupContainer) 1479 void WebViewImpl::popupOpened(PopupContainer* popupContainer)
1480 { 1480 {
1481 ASSERT(!m_selectPopup); 1481 ASSERT(!m_selectPopup);
1482 m_selectPopup = popupContainer; 1482 m_selectPopup = popupContainer;
1483 ASSERT(mainFrameImpl()->frame()->document()); 1483 ASSERT(mainFrameImpl()->frame()->document());
1484 Document& document = *mainFrameImpl()->frame()->document(); 1484 Document& document = *mainFrameImpl()->frame()->document();
1485 WheelController::from(document)->didAddWheelEventHandler(document); 1485 page()->frameHost().eventHandlerRegistry().didAddEventHandler(document, Even tHandlerRegistry::WheelEvent);
1486 } 1486 }
1487 1487
1488 void WebViewImpl::popupClosed(PopupContainer* popupContainer) 1488 void WebViewImpl::popupClosed(PopupContainer* popupContainer)
1489 { 1489 {
1490 ASSERT(m_selectPopup); 1490 ASSERT(m_selectPopup);
1491 m_selectPopup = nullptr; 1491 m_selectPopup = nullptr;
1492 ASSERT(mainFrameImpl()->frame()->document()); 1492 ASSERT(mainFrameImpl()->frame()->document());
1493 Document& document = *mainFrameImpl()->frame()->document(); 1493 Document& document = *mainFrameImpl()->frame()->document();
1494 WheelController::from(document)->didRemoveWheelEventHandler(document); 1494 // Remove the handler we added in |popupOpened| conditionally, because the
1495 // Document may have already removed it, for instance, due to a navigation.
1496 EventHandlerRegistry* registry = &document.frameHost()->eventHandlerRegistry ();
1497 if (registry->eventHandlerTargets(EventHandlerRegistry::WheelEvent)->contain s(&document))
1498 registry->didRemoveEventHandler(document, EventHandlerRegistry::WheelEve nt);
1495 } 1499 }
1496 1500
1497 PagePopup* WebViewImpl::openPagePopup(PagePopupClient* client, const IntRect& or iginBoundsInRootView) 1501 PagePopup* WebViewImpl::openPagePopup(PagePopupClient* client, const IntRect& or iginBoundsInRootView)
1498 { 1502 {
1499 ASSERT(client); 1503 ASSERT(client);
1500 if (hasOpenedPopup()) 1504 if (hasOpenedPopup())
1501 hidePopups(); 1505 hidePopups();
1502 ASSERT(!m_pagePopup); 1506 ASSERT(!m_pagePopup);
1503 1507
1504 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypePage); 1508 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypePage);
(...skipping 2546 matching lines...) Expand 10 before | Expand all | Expand 10 after
4051 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints(); 4055 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi nedConstraints();
4052 4056
4053 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 4057 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4054 return false; 4058 return false;
4055 4059
4056 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4060 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4057 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4061 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4058 } 4062 }
4059 4063
4060 } // namespace blink 4064 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/FrameLoaderClientImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698