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

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

Issue 2797943002: Set plugin focus via element dispatch (Closed)
Patch Set: Remove testing var. 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 DCHECK(!m_pluginWrapper); // cleared in detachLayoutTree() 89 DCHECK(!m_pluginWrapper); // cleared in detachLayoutTree()
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_persistedPlugin); 95 visitor->trace(m_persistedPlugin);
96 HTMLFrameOwnerElement::trace(visitor); 96 HTMLFrameOwnerElement::trace(visitor);
97 } 97 }
98 98
99 void HTMLPlugInElement::dispatchBlurEvent(
100 Element* newFocusedElement,
101 WebFocusType type,
102 InputDeviceCapabilities* sourceCapabilities) {
103 if (PluginView* plugin = ownedPlugin())
104 plugin->setFocused(false, type);
dcheng 2017/04/05 07:48:08 One potential subtlety that I'm not sure if we nee
haraken 2017/04/05 11:59:00 Would it be crazy to call Element::dispatchBlurEve
dcheng 2017/04/05 21:14:44 Either way, I think we may need to do a focus chec
joelhockey 2017/04/05 23:59:11 I think this change will fix any potential bugs re
dcheng 2017/04/06 03:01:33 I guess my concern mostly regards the short-circui
joelhockey 2017/04/06 06:11:00 I have updated to call the dom onblur/onfocus firs
105 Element::dispatchBlurEvent(newFocusedElement, type, sourceCapabilities);
106 }
107
108 void HTMLPlugInElement::dispatchFocusEvent(
109 Element* oldFocusedElement,
110 WebFocusType type,
111 InputDeviceCapabilities* sourceCapabilities) {
112 if (PluginView* plugin = ownedPlugin())
113 plugin->setFocused(true, type);
114 Element::dispatchFocusEvent(oldFocusedElement, type, sourceCapabilities);
115 }
116
99 // TODO(joelhockey): Move implementation of HTMLFrameOwnerElement 117 // TODO(joelhockey): Move implementation of HTMLFrameOwnerElement
100 // setWidget/releaseWidget/ownedWidget that relates to plugins to here and 118 // setWidget/releaseWidget/ownedWidget that relates to plugins to here and
101 // remove inheritance from PluginView to FrameViewBase. 119 // remove inheritance from PluginView to FrameViewBase.
102 void HTMLPlugInElement::setPlugin(PluginView* pluginView) { 120 void HTMLPlugInElement::setPlugin(PluginView* pluginView) {
103 setWidget(pluginView); 121 setWidget(pluginView);
104 } 122 }
105 123
106 PluginView* HTMLPlugInElement::releasePlugin() { 124 PluginView* HTMLPlugInElement::releasePlugin() {
107 FrameViewBase* plugin = releaseWidget(); 125 FrameViewBase* plugin = releaseWidget();
108 return plugin && plugin->isPluginView() ? toPluginView(plugin) : nullptr; 126 return plugin && plugin->isPluginView() ? toPluginView(plugin) : nullptr;
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 676
659 void HTMLPlugInElement::lazyReattachIfNeeded() { 677 void HTMLPlugInElement::lazyReattachIfNeeded() {
660 if (!useFallbackContent() && needsPluginUpdate() && layoutObject() && 678 if (!useFallbackContent() && needsPluginUpdate() && layoutObject() &&
661 !isImageType()) { 679 !isImageType()) {
662 lazyReattachIfAttached(); 680 lazyReattachIfAttached();
663 setPersistedPlugin(nullptr); 681 setPersistedPlugin(nullptr);
664 } 682 }
665 } 683 }
666 684
667 } // namespace blink 685 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698