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

Unified Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 1977633003: Remove RenderFrameImpl::GetFocusedElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes the right click + blur + copy case. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.h ('k') | third_party/WebKit/Source/web/WebNode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
index 8bc1e19e2877568a589dd0aa4903769e567f4f79..5d633b5ab2b9b3bdb66b7ed4b2e09d5a25a8d31c 100644
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -259,12 +259,17 @@ WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromFrame(LocalFrame*
return toWebPluginContainerImpl(pluginDocument->pluginWidget());
}
-WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromNode(LocalFrame* frame, const WebNode& node)
+WebPluginContainerImpl* WebLocalFrameImpl::currentPluginContainer(LocalFrame* frame, Node* node)
{
WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame);
if (pluginContainer)
return pluginContainer;
- return toWebPluginContainerImpl(node.pluginContainer());
+
+ if (!node) {
+ DCHECK(frame->document());
+ node = frame->document()->focusedElement();
+ }
+ return toWebPluginContainerImpl(WebNode::pluginContainerFromNode(node));
}
// Simple class to override some of PrintContext behavior. Some of the methods
@@ -1011,7 +1016,7 @@ size_t WebLocalFrameImpl::characterIndexForPoint(const WebPoint& pointInViewport
return PlainTextRange::create(*editable, range).start();
}
-bool WebLocalFrameImpl::executeCommand(const WebString& name, const WebNode& node)
+bool WebLocalFrameImpl::executeCommand(const WebString& name)
{
DCHECK(frame());
@@ -1029,18 +1034,19 @@ bool WebLocalFrameImpl::executeCommand(const WebString& name, const WebNode& nod
if (command[command.length() - 1] == UChar(':'))
command = command.substring(0, command.length() - 1);
- WebPluginContainerImpl* pluginContainer = pluginContainerFromNode(frame(), node);
+ Node* pluginLookupContextNode = m_contextMenuNode && name == "Copy" ? m_contextMenuNode : nullptr;
+ WebPluginContainerImpl* pluginContainer = currentPluginContainer(frame(), pluginLookupContextNode);
if (pluginContainer && pluginContainer->executeEditCommand(name))
return true;
return frame()->editor().executeCommand(command);
}
-bool WebLocalFrameImpl::executeCommand(const WebString& name, const WebString& value, const WebNode& node)
+bool WebLocalFrameImpl::executeCommand(const WebString& name, const WebString& value)
{
DCHECK(frame());
- WebPluginContainerImpl* pluginContainer = pluginContainerFromNode(frame(), node);
+ WebPluginContainerImpl* pluginContainer = currentPluginContainer(frame());
if (pluginContainer && pluginContainer->executeEditCommand(name, value))
return true;
@@ -1224,7 +1230,7 @@ VisiblePosition WebLocalFrameImpl::visiblePositionForViewportPoint(const WebPoin
WebPlugin* WebLocalFrameImpl::focusedPluginIfInputMethodSupported()
{
- WebPluginContainerImpl* container = WebLocalFrameImpl::pluginContainerFromNode(frame(), WebNode(frame()->document()->focusedElement()));
+ WebPluginContainerImpl* container = WebLocalFrameImpl::currentPluginContainer(frame());
if (container && container->supportsInputMethod())
return container->plugin();
return 0;
« no previous file with comments | « third_party/WebKit/Source/web/WebLocalFrameImpl.h ('k') | third_party/WebKit/Source/web/WebNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698