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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLPlugInElement.cpp

Issue 2797943002: Set plugin focus via element dispatch (Closed)
Patch Set: Dispatch to DOM onblur/onfocus first, then call plugin Created 3 years, 8 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
OLDNEW
1 /** 1 /**
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de)
5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 DCHECK(!m_isDelayingLoadEvent); 90 DCHECK(!m_isDelayingLoadEvent);
91 } 91 }
92 92
93 DEFINE_TRACE(HTMLPlugInElement) { 93 DEFINE_TRACE(HTMLPlugInElement) {
94 visitor->trace(m_imageLoader); 94 visitor->trace(m_imageLoader);
95 visitor->trace(m_plugin); 95 visitor->trace(m_plugin);
96 visitor->trace(m_persistedPlugin); 96 visitor->trace(m_persistedPlugin);
97 HTMLFrameOwnerElement::trace(visitor); 97 HTMLFrameOwnerElement::trace(visitor);
98 } 98 }
99 99
100 void HTMLPlugInElement::dispatchBlurEvent(
101 Element* newFocusedElement,
102 WebFocusType type,
103 InputDeviceCapabilities* sourceCapabilities) {
104 Element::dispatchBlurEvent(newFocusedElement, type, sourceCapabilities);
haraken 2017/04/06 06:20:26 Can we add a comment on why we want to call Elemen
joelhockey 2017/04/06 06:28:39 Done. I hope my explanation is reasonable. Feel
dcheng 2017/04/06 06:28:49 Thinking about this more, either ordering makes me
joelhockey 2017/04/07 06:56:05 You are right that it was possible for plugin to e
105 if (m_plugin)
106 m_plugin->setFocused(false, type);
107 }
108
109 void HTMLPlugInElement::dispatchFocusEvent(
110 Element* oldFocusedElement,
111 WebFocusType type,
112 InputDeviceCapabilities* sourceCapabilities) {
113 Element::dispatchFocusEvent(oldFocusedElement, type, sourceCapabilities);
114 if (m_plugin)
115 m_plugin->setFocused(true, type);
116 }
117
100 void HTMLPlugInElement::setPlugin(PluginView* plugin) { 118 void HTMLPlugInElement::setPlugin(PluginView* plugin) {
101 if (plugin == m_plugin) 119 if (plugin == m_plugin)
102 return; 120 return;
103 121
104 // Remove and dispose the old plugin if we had one. 122 // Remove and dispose the old plugin if we had one.
105 if (m_plugin) { 123 if (m_plugin) {
106 document().view()->removePlugin(m_plugin); 124 document().view()->removePlugin(m_plugin);
107 disposeWidgetSoon(m_plugin); 125 disposeWidgetSoon(m_plugin);
108 } 126 }
109 m_plugin = plugin; 127 m_plugin = plugin;
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 707
690 void HTMLPlugInElement::lazyReattachIfNeeded() { 708 void HTMLPlugInElement::lazyReattachIfNeeded() {
691 if (!useFallbackContent() && needsPluginUpdate() && layoutObject() && 709 if (!useFallbackContent() && needsPluginUpdate() && layoutObject() &&
692 !isImageType()) { 710 !isImageType()) {
693 lazyReattachIfAttached(); 711 lazyReattachIfAttached();
694 setPersistedPlugin(nullptr); 712 setPersistedPlugin(nullptr);
695 } 713 }
696 } 714 }
697 715
698 } // namespace blink 716 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLPlugInElement.h ('k') | third_party/WebKit/Source/core/plugins/PluginView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698