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

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

Powered by Google App Engine
This is Rietveld 408576698