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

Unified Diff: content/renderer/render_frame_impl.cc

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 | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index e8a3eec1b8e87ce7d09fd93de129d72b7c2159eb..8e3682ef034967b80817a10666d6d4e426a4e4dd 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -1695,36 +1695,32 @@ void RenderFrameImpl::OnCustomContextMenuAction(
}
void RenderFrameImpl::OnUndo() {
- frame_->executeCommand(WebString::fromUTF8("Undo"), GetFocusedElement());
+ frame_->executeCommand(WebString::fromUTF8("Undo"));
}
void RenderFrameImpl::OnRedo() {
- frame_->executeCommand(WebString::fromUTF8("Redo"), GetFocusedElement());
+ frame_->executeCommand(WebString::fromUTF8("Redo"));
}
void RenderFrameImpl::OnCut() {
base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
- frame_->executeCommand(WebString::fromUTF8("Cut"), GetFocusedElement());
+ frame_->executeCommand(WebString::fromUTF8("Cut"));
}
void RenderFrameImpl::OnCopy() {
base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
- WebNode current_node = frame_->contextMenuNode();
- frame_->executeCommand(WebString::fromUTF8("Copy"), current_node.isNull()
- ? GetFocusedElement()
- : current_node);
+ frame_->executeCommand(WebString::fromUTF8("Copy"));
}
void RenderFrameImpl::OnPaste() {
base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
base::AutoReset<bool> handling_paste(&is_pasting_, true);
- frame_->executeCommand(WebString::fromUTF8("Paste"), GetFocusedElement());
+ frame_->executeCommand(WebString::fromUTF8("Paste"));
}
void RenderFrameImpl::OnPasteAndMatchStyle() {
base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
- frame_->executeCommand(
- WebString::fromUTF8("PasteAndMatchStyle"), GetFocusedElement());
+ frame_->executeCommand(WebString::fromUTF8("PasteAndMatchStyle"));
}
#if defined(OS_MACOSX)
@@ -1740,12 +1736,12 @@ void RenderFrameImpl::OnCopyToFindPboard() {
#endif
void RenderFrameImpl::OnDelete() {
- frame_->executeCommand(WebString::fromUTF8("Delete"), GetFocusedElement());
+ frame_->executeCommand(WebString::fromUTF8("Delete"));
}
void RenderFrameImpl::OnSelectAll() {
base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
- frame_->executeCommand(WebString::fromUTF8("SelectAll"), GetFocusedElement());
+ frame_->executeCommand(WebString::fromUTF8("SelectAll"));
}
void RenderFrameImpl::OnSelectRange(const gfx::Point& base,
@@ -1784,7 +1780,7 @@ void RenderFrameImpl::OnAdjustSelectionByCharacterOffset(int start_adjust,
void RenderFrameImpl::OnUnselect() {
base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
- frame_->executeCommand(WebString::fromUTF8("Unselect"), GetFocusedElement());
+ frame_->executeCommand(WebString::fromUTF8("Unselect"));
}
void RenderFrameImpl::OnMoveRangeSelectionExtent(const gfx::Point& point) {
@@ -1977,7 +1973,7 @@ void RenderFrameImpl::OnSetCompositionFromExistingText(
}
void RenderFrameImpl::OnExecuteNoValueEditCommand(const std::string& name) {
- frame_->executeCommand(WebString::fromUTF8(name), GetFocusedElement());
+ frame_->executeCommand(WebString::fromUTF8(name));
}
void RenderFrameImpl::OnExtendSelectionAndDelete(int before, int after) {
@@ -2240,14 +2236,6 @@ blink::WebLocalFrame* RenderFrameImpl::GetWebFrame() {
return frame_;
}
-WebElement RenderFrameImpl::GetFocusedElement() const {
- WebDocument doc = frame_->document();
- if (!doc.isNull())
- return doc.focusedElement();
-
- return WebElement();
-}
-
WebPreferences& RenderFrameImpl::GetWebkitPreferences() {
return render_view_->GetWebkitPreferences();
}
@@ -5045,8 +5033,7 @@ void RenderFrameImpl::OnFind(int request_id,
if (!result) {
// Don't leave text selected as you move to the next frame.
- search_frame->executeCommand(WebString::fromUTF8("Unselect"),
- GetFocusedElement());
+ search_frame->executeCommand(WebString::fromUTF8("Unselect"));
// Find the next frame, but skip the invisible ones.
do {
@@ -5059,8 +5046,7 @@ void RenderFrameImpl::OnFind(int request_id,
search_frame != focused_frame);
// Make sure selection doesn't affect the search operation in new frame.
- search_frame->executeCommand(WebString::fromUTF8("Unselect"),
- GetFocusedElement());
+ search_frame->executeCommand(WebString::fromUTF8("Unselect"));
// If we have multiple frames and we have wrapped back around to the
// focused frame, we need to search it once more allowing wrap within
@@ -5139,8 +5125,7 @@ void RenderFrameImpl::OnStopFinding(StopFindAction action) {
bool clear_selection = action == STOP_FIND_ACTION_CLEAR_SELECTION;
if (clear_selection) {
- view->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect"),
- GetFocusedElement());
+ view->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect"));
}
WebLocalFrame* frame = GetWebFrame();
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698