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

Unified Diff: content/renderer/context_menu_params_builder.cc

Issue 384243004: Make <a ping> work for context menus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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/context_menu_params_builder.cc
diff --git a/content/renderer/context_menu_params_builder.cc b/content/renderer/context_menu_params_builder.cc
index 7cd34beb46476c69e2ae3a4e8203745954f3ae92..9044aa22af802bc09943dd0f8584d456a87034c6 100644
--- a/content/renderer/context_menu_params_builder.cc
+++ b/content/renderer/context_menu_params_builder.cc
@@ -55,14 +55,7 @@ ContextMenuParams ContextMenuParamsBuilder::Build(
}
if (!params.link_url.is_empty()) {
- blink::WebNode selectedNode = data.node;
-
- // If there are other embedded tags (like <a ..>Some <b>text</b></a>)
- // we need to extract the parent <a/> node.
- while (!selectedNode.isLink() && !selectedNode.parentNode().isNull()) {
- selectedNode = selectedNode.parentNode();
- }
-
+ blink::WebNode selectedNode = extractParentAnchorNode(data.node);
blink::WebElement selectedElement = selectedNode.to<blink::WebElement>();
if (selectedNode.isLink() && !selectedElement.isNull()) {
params.link_text = selectedElement.innerText();
@@ -85,4 +78,15 @@ ContextMenuParams ContextMenuParamsBuilder::Build(
return params;
}
+blink::WebNode ContextMenuParamsBuilder::extractParentAnchorNode(
+ const blink::WebNode& node) {
+ blink::WebNode selectedNode = node;
darin (slow to review) 2014/07/22 17:34:39 nit: selectedNode -> selected_node
Nate Chapin 2014/07/22 18:19:55 Done.
+
+ // If there are other embedded tags (like <a ..>Some <b>text</b></a>)
+ // we need to extract the parent <a/> node.
+ while (!selectedNode.isLink() && !selectedNode.parentNode().isNull())
+ selectedNode = selectedNode.parentNode();
+ return selectedNode;
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698