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

Unified Diff: content/renderer/render_view_impl.cc

Issue 165233003: Replace WebDocument::focusedNode to focusedElement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nits Created 6 years, 10 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
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index f9dd398f15b929941b03190f17dea2ef921e6a61..6b63b6eb86954cb8e9408686e8a6e0eae3a2de5c 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -1560,7 +1560,7 @@ void RenderViewImpl::OnCopy() {
base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
WebNode current_node = context_menu_node_.isNull() ?
- GetFocusedNode() : context_menu_node_;
+ GetFocusedElement() : context_menu_node_;
webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Copy"),
current_node);
}
@@ -1571,7 +1571,7 @@ void RenderViewImpl::OnCut() {
base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Cut"),
- GetFocusedNode());
+ GetFocusedElement());
}
void RenderViewImpl::OnDelete() {
@@ -1579,7 +1579,7 @@ void RenderViewImpl::OnDelete() {
return;
webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Delete"),
- GetFocusedNode());
+ GetFocusedElement());
}
void RenderViewImpl::OnExecuteEditCommand(const std::string& name,
@@ -1606,7 +1606,7 @@ void RenderViewImpl::OnPaste() {
base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Paste"),
- GetFocusedNode());
+ GetFocusedElement());
}
void RenderViewImpl::OnPasteAndMatchStyle() {
@@ -1615,7 +1615,7 @@ void RenderViewImpl::OnPasteAndMatchStyle() {
base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
webview()->focusedFrame()->executeCommand(
- WebString::fromUTF8("PasteAndMatchStyle"), GetFocusedNode());
+ WebString::fromUTF8("PasteAndMatchStyle"), GetFocusedElement());
}
void RenderViewImpl::OnRedo() {
@@ -1623,7 +1623,7 @@ void RenderViewImpl::OnRedo() {
return;
webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Redo"),
- GetFocusedNode());
+ GetFocusedElement());
}
void RenderViewImpl::OnReplace(const base::string16& text) {
@@ -1650,9 +1650,9 @@ void RenderViewImpl::OnReplaceMisspelling(const base::string16& text) {
void RenderViewImpl::OnScrollFocusedEditableNodeIntoRect(
const gfx::Rect& rect) {
- blink::WebNode node = GetFocusedNode();
- if (!node.isNull()) {
- if (IsEditableNode(node)) {
+ blink::WebElement element = GetFocusedElement();
+ if (!element.isNull()) {
+ if (IsEditableNode(element)) {
webview()->saveScrollAndScaleState();
webview()->scrollFocusedNodeIntoRect(rect);
}
@@ -1665,7 +1665,7 @@ void RenderViewImpl::OnSelectAll() {
base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
webview()->focusedFrame()->executeCommand(
- WebString::fromUTF8("SelectAll"), GetFocusedNode());
+ WebString::fromUTF8("SelectAll"), GetFocusedElement());
}
void RenderViewImpl::OnSelectRange(const gfx::Point& start,
@@ -1689,7 +1689,7 @@ void RenderViewImpl::OnUndo() {
return;
webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Undo"),
- GetFocusedNode());
+ GetFocusedElement());
}
void RenderViewImpl::OnUnselect() {
@@ -1698,7 +1698,7 @@ void RenderViewImpl::OnUnselect() {
base::AutoReset<bool> handling_select_range(&handling_select_range_, true);
webview()->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect"),
- GetFocusedNode());
+ GetFocusedElement());
}
#if defined(OS_MACOSX)
@@ -1788,8 +1788,8 @@ void RenderViewImpl::OnSetInLiveResize(bool in_live_resize) {
#if defined(OS_ANDROID)
void RenderViewImpl::OnUndoScrollFocusedEditableNodeIntoRect() {
- const WebNode node = GetFocusedNode();
- if (!node.isNull() && IsEditableNode(node))
+ const WebElement element = GetFocusedElement();
+ if (!element.isNull() && IsEditableNode(element))
webview()->restoreScrollAndScaleState();
}
@@ -2283,7 +2283,7 @@ bool RenderViewImpl::handleCurrentKeyboardEvent() {
// seems safest to not execute the rest.
if (!frame->executeCommand(WebString::fromUTF8(it->name),
WebString::fromUTF8(it->value),
- GetFocusedNode()))
+ GetFocusedElement()))
break;
did_execute_command = true;
}
@@ -3729,17 +3729,17 @@ blink::WebView* RenderViewImpl::GetWebView() {
return webview();
}
-blink::WebNode RenderViewImpl::GetFocusedNode() const {
+blink::WebElement RenderViewImpl::GetFocusedElement() const {
if (!webview())
- return WebNode();
+ return WebElement();
WebFrame* focused_frame = webview()->focusedFrame();
if (focused_frame) {
WebDocument doc = focused_frame->document();
if (!doc.isNull())
- return doc.focusedNode();
+ return doc.focusedElement();
}
- return WebNode();
+ return WebElement();
}
blink::WebNode RenderViewImpl::GetContextMenuNode() const {
@@ -3973,7 +3973,7 @@ void RenderViewImpl::OnFind(int request_id,
if (!result) {
// don't leave text selected as you move to the next frame.
search_frame->executeCommand(WebString::fromUTF8("Unselect"),
- GetFocusedNode());
+ GetFocusedElement());
// Find the next frame, but skip the invisible ones.
do {
@@ -3987,7 +3987,7 @@ void RenderViewImpl::OnFind(int request_id,
// Make sure selection doesn't affect the search operation in new frame.
search_frame->executeCommand(WebString::fromUTF8("Unselect"),
- GetFocusedNode());
+ GetFocusedElement());
// 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
@@ -4062,7 +4062,7 @@ void RenderViewImpl::OnStopFinding(StopFindAction action) {
bool clear_selection = action == STOP_FIND_ACTION_CLEAR_SELECTION;
if (clear_selection) {
view->focusedFrame()->executeCommand(WebString::fromUTF8("Unselect"),
- GetFocusedNode());
+ GetFocusedElement());
}
WebFrame* frame = view->mainFrame();
@@ -4076,9 +4076,9 @@ void RenderViewImpl::OnStopFinding(StopFindAction action) {
if (focused_frame) {
WebDocument doc = focused_frame->document();
if (!doc.isNull()) {
- WebNode node = doc.focusedNode();
- if (!node.isNull())
- node.simulateClick();
+ WebElement element = doc.focusedElement();
+ if (!element.isNull())
+ element.simulateClick();
}
}
}

Powered by Google App Engine
This is Rietveld 408576698