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

Side by Side Diff: Source/core/page/scrolling/ScrollingCoordinator.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/core/frame/LocalFrame.cpp ('k') | Source/core/testing/Internals.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) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 13 matching lines...) Expand all
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 27
28 #include "core/page/scrolling/ScrollingCoordinator.h" 28 #include "core/page/scrolling/ScrollingCoordinator.h"
29 29
30 #include "RuntimeEnabledFeatures.h" 30 #include "RuntimeEnabledFeatures.h"
31 #include "core/dom/Document.h" 31 #include "core/dom/Document.h"
32 #include "core/dom/FullscreenElementStack.h" 32 #include "core/dom/FullscreenElementStack.h"
33 #include "core/dom/Node.h" 33 #include "core/dom/Node.h"
34 #include "core/dom/WheelController.h"
35 #include "core/frame/EventHandlerRegistry.h" 34 #include "core/frame/EventHandlerRegistry.h"
36 #include "core/frame/FrameView.h" 35 #include "core/frame/FrameView.h"
37 #include "core/frame/LocalFrame.h" 36 #include "core/frame/LocalFrame.h"
38 #include "core/frame/Settings.h" 37 #include "core/frame/Settings.h"
39 #include "core/html/HTMLElement.h" 38 #include "core/html/HTMLElement.h"
40 #include "core/page/Page.h" 39 #include "core/page/Page.h"
41 #include "core/plugins/PluginView.h" 40 #include "core/plugins/PluginView.h"
42 #include "core/rendering/RenderGeometryMap.h" 41 #include "core/rendering/RenderGeometryMap.h"
43 #include "core/rendering/RenderView.h" 42 #include "core/rendering/RenderView.h"
44 #include "core/rendering/compositing/CompositedLayerMapping.h" 43 #include "core/rendering/compositing/CompositedLayerMapping.h"
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 } 660 }
662 661
663 void ScrollingCoordinator::updateHaveWheelEventHandlers() 662 void ScrollingCoordinator::updateHaveWheelEventHandlers()
664 { 663 {
665 ASSERT(isMainThread()); 664 ASSERT(isMainThread());
666 ASSERT(m_page); 665 ASSERT(m_page);
667 if (!m_page->mainFrame()->view()) 666 if (!m_page->mainFrame()->view())
668 return; 667 return;
669 668
670 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor Scrolling())) { 669 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor Scrolling())) {
671 unsigned wheelEventHandlerCount = 0; 670 bool haveHandlers = m_page->frameHost().eventHandlerRegistry().hasEventH andlers(EventHandlerRegistry::WheelEvent);
672 671 scrollLayer->setHaveWheelEventHandlers(haveHandlers);
673 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().tr averseNext()) {
674 if (frame->isLocalFrame())
675 wheelEventHandlerCount += WheelController::from(*toLocalFrame(fr ame)->document())->wheelEventHandlerCount();
676 }
677
678 scrollLayer->setHaveWheelEventHandlers(wheelEventHandlerCount);
679 } 672 }
680 } 673 }
681 674
682 void ScrollingCoordinator::updateHaveScrollEventHandlers() 675 void ScrollingCoordinator::updateHaveScrollEventHandlers()
683 { 676 {
684 ASSERT(isMainThread()); 677 ASSERT(isMainThread());
685 ASSERT(m_page); 678 ASSERT(m_page);
686 if (!m_page->mainFrame()->view()) 679 if (!m_page->mainFrame()->view())
687 return; 680 return;
688 681
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 bool frameIsScrollable = frameView && frameView->isScrollable(); 977 bool frameIsScrollable = frameView && frameView->isScrollable();
985 if (frameIsScrollable != m_wasFrameScrollable) 978 if (frameIsScrollable != m_wasFrameScrollable)
986 return true; 979 return true;
987 980
988 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : 0) 981 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : 0)
989 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( ); 982 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( );
990 return false; 983 return false;
991 } 984 }
992 985
993 } // namespace WebCore 986 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/LocalFrame.cpp ('k') | Source/core/testing/Internals.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698