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

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: Address darin's comments 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
« no previous file with comments | « content/public/common/context_menu_params.h ('k') | content/renderer/dom_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0d53dac225eefaf56f29cb59b620a63e389a09c6 100644
--- a/content/renderer/context_menu_params_builder.cc
+++ b/content/renderer/context_menu_params_builder.cc
@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "content/common/ssl_status_serialization.h"
#include "content/public/common/context_menu_params.h"
+#include "content/renderer/dom_utils.h"
#include "content/renderer/history_serialization.h"
#include "content/renderer/menu_item_builder.h"
#include "third_party/WebKit/public/web/WebElement.h"
@@ -55,14 +56,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 = DomUtils::ExtractParentAnchorNode(data.node);
blink::WebElement selectedElement = selectedNode.to<blink::WebElement>();
if (selectedNode.isLink() && !selectedElement.isNull()) {
params.link_text = selectedElement.innerText();
« no previous file with comments | « content/public/common/context_menu_params.h ('k') | content/renderer/dom_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698