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

Side by Side Diff: Source/core/frame/LocalFrame.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) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Simon Hausmann <hausmann@kde.org> 5 * 2000 Simon Hausmann <hausmann@kde.org>
6 * 2000 Stefan Schimanski <1Stein@gmx.de> 6 * 2000 Stefan Schimanski <1Stein@gmx.de>
7 * 2001 George Staikos <staikos@kde.org> 7 * 2001 George Staikos <staikos@kde.org>
8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 8 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com> 9 * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 15 matching lines...) Expand all
26 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 26 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
27 * Boston, MA 02110-1301, USA. 27 * Boston, MA 02110-1301, USA.
28 */ 28 */
29 29
30 #include "config.h" 30 #include "config.h"
31 #include "core/frame/LocalFrame.h" 31 #include "core/frame/LocalFrame.h"
32 32
33 #include "RuntimeEnabledFeatures.h" 33 #include "RuntimeEnabledFeatures.h"
34 #include "bindings/v8/ScriptController.h" 34 #include "bindings/v8/ScriptController.h"
35 #include "core/dom/DocumentType.h" 35 #include "core/dom/DocumentType.h"
36 #include "core/dom/WheelController.h"
37 #include "core/editing/Editor.h" 36 #include "core/editing/Editor.h"
38 #include "core/editing/FrameSelection.h" 37 #include "core/editing/FrameSelection.h"
39 #include "core/editing/InputMethodController.h" 38 #include "core/editing/InputMethodController.h"
40 #include "core/editing/SpellChecker.h" 39 #include "core/editing/SpellChecker.h"
41 #include "core/editing/htmlediting.h" 40 #include "core/editing/htmlediting.h"
42 #include "core/editing/markup.h" 41 #include "core/editing/markup.h"
43 #include "core/events/Event.h" 42 #include "core/events/Event.h"
44 #include "core/fetch/ResourceFetcher.h" 43 #include "core/fetch/ResourceFetcher.h"
45 #include "core/frame/DOMWindow.h" 44 #include "core/frame/DOMWindow.h"
45 #include "core/frame/EventHandlerRegistry.h"
46 #include "core/frame/FrameConsole.h" 46 #include "core/frame/FrameConsole.h"
47 #include "core/frame/FrameHost.h" 47 #include "core/frame/FrameHost.h"
48 #include "core/frame/FrameView.h" 48 #include "core/frame/FrameView.h"
49 #include "core/frame/Settings.h" 49 #include "core/frame/Settings.h"
50 #include "core/html/HTMLFrameElementBase.h" 50 #include "core/html/HTMLFrameElementBase.h"
51 #include "core/inspector/InspectorInstrumentation.h" 51 #include "core/inspector/InspectorInstrumentation.h"
52 #include "core/loader/FrameLoaderClient.h" 52 #include "core/loader/FrameLoaderClient.h"
53 #include "core/page/Chrome.h" 53 #include "core/page/Chrome.h"
54 #include "core/page/EventHandler.h" 54 #include "core/page/EventHandler.h"
55 #include "core/page/FocusController.h" 55 #include "core/page/FocusController.h"
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 500
501 void LocalFrame::deviceOrPageScaleFactorChanged() 501 void LocalFrame::deviceOrPageScaleFactorChanged()
502 { 502 {
503 document()->mediaQueryAffectingValueChanged(); 503 document()->mediaQueryAffectingValueChanged();
504 for (RefPtr<LocalFrame> child = tree().firstChild(); child; child = child->t ree().nextSibling()) 504 for (RefPtr<LocalFrame> child = tree().firstChild(); child; child = child->t ree().nextSibling())
505 child->deviceOrPageScaleFactorChanged(); 505 child->deviceOrPageScaleFactorChanged();
506 } 506 }
507 507
508 void LocalFrame::notifyChromeClientWheelEventHandlerCountChanged() const 508 void LocalFrame::notifyChromeClientWheelEventHandlerCountChanged() const
509 { 509 {
510 // TODO(skyostil): No-one is using this information, so remove this code.
510 // Ensure that this method is being called on the main frame of the page. 511 // Ensure that this method is being called on the main frame of the page.
511 ASSERT(isMainFrame()); 512 ASSERT(isMainFrame());
512 513
513 unsigned count = 0; 514 EventHandlerRegistry& registry = m_host->eventHandlerRegistry();
514 for (const LocalFrame* frame = this; frame; frame = frame->tree().traverseNe xt()) { 515 unsigned count = registry.externalEventHandlerCount(EventHandlerRegistry::Wh eelEvent);
515 if (frame->document()) 516 const EventTargetSet* targets = registry.eventHandlerTargets(EventHandlerReg istry::WheelEvent);
516 count += WheelController::from(*frame->document())->wheelEventHandle rCount(); 517 if (targets) {
ojan 2014/06/02 21:23:04 There's no official style rule, but we typically d
Sami 2014/06/03 15:57:45 Ah yes, that's a good idea. Done.
518 for (EventTargetSet::const_iterator iter = targets->begin(); iter != tar gets->end(); ++iter)
519 count += iter->value;
517 } 520 }
518 521
519 m_host->chrome().client().numWheelEventHandlersChanged(count); 522 m_host->chrome().client().numWheelEventHandlersChanged(count);
520 } 523 }
521 524
522 bool LocalFrame::isURLAllowed(const KURL& url) const 525 bool LocalFrame::isURLAllowed(const KURL& url) const
523 { 526 {
524 // We allow one level of self-reference because some sites depend on that, 527 // We allow one level of self-reference because some sites depend on that,
525 // but we don't allow more than one. 528 // but we don't allow more than one.
526 if (page()->subframeCount() >= Page::maxNumberOfFrames) 529 if (page()->subframeCount() >= Page::maxNumberOfFrames)
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 LocalFrame* LocalFrame::localFrameRoot() 653 LocalFrame* LocalFrame::localFrameRoot()
651 { 654 {
652 LocalFrame* curFrame = this; 655 LocalFrame* curFrame = this;
653 while (curFrame && curFrame->tree().parent() && curFrame->tree().parent()->i sLocalFrame()) 656 while (curFrame && curFrame->tree().parent() && curFrame->tree().parent()->i sLocalFrame())
654 curFrame = curFrame->tree().parent(); 657 curFrame = curFrame->tree().parent();
655 658
656 return curFrame; 659 return curFrame;
657 } 660 }
658 661
659 } // namespace WebCore 662 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698