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

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: Remove fake handler conditionally. 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) 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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 } 656 }
658 657
659 void ScrollingCoordinator::updateHaveWheelEventHandlers() 658 void ScrollingCoordinator::updateHaveWheelEventHandlers()
660 { 659 {
661 ASSERT(isMainThread()); 660 ASSERT(isMainThread());
662 ASSERT(m_page); 661 ASSERT(m_page);
663 if (!m_page->mainFrame()->view()) 662 if (!m_page->mainFrame()->view())
664 return; 663 return;
665 664
666 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor Scrolling())) { 665 if (WebLayer* scrollLayer = toWebLayer(m_page->mainFrame()->view()->layerFor Scrolling())) {
667 unsigned wheelEventHandlerCount = 0; 666 bool haveHandlers = m_page->frameHost().eventHandlerRegistry().hasEventH andlers(EventHandlerRegistry::WheelEvent);
668 667 scrollLayer->setHaveWheelEventHandlers(haveHandlers);
669 for (LocalFrame* frame = m_page->mainFrame(); frame; frame = frame->tree ().traverseNext()) {
670 wheelEventHandlerCount += WheelController::from(*frame->document())- >wheelEventHandlerCount();
671 }
672
673 scrollLayer->setHaveWheelEventHandlers(wheelEventHandlerCount);
674 } 668 }
675 } 669 }
676 670
677 void ScrollingCoordinator::updateHaveScrollEventHandlers() 671 void ScrollingCoordinator::updateHaveScrollEventHandlers()
678 { 672 {
679 ASSERT(isMainThread()); 673 ASSERT(isMainThread());
680 ASSERT(m_page); 674 ASSERT(m_page);
681 if (!m_page->mainFrame()->view()) 675 if (!m_page->mainFrame()->view())
682 return; 676 return;
683 677
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 bool frameIsScrollable = frameView && frameView->isScrollable(); 971 bool frameIsScrollable = frameView && frameView->isScrollable();
978 if (frameIsScrollable != m_wasFrameScrollable) 972 if (frameIsScrollable != m_wasFrameScrollable)
979 return true; 973 return true;
980 974
981 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : 0) 975 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : 0)
982 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( ); 976 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( );
983 return false; 977 return false;
984 } 978 }
985 979
986 } // namespace WebCore 980 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698