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

Unified Diff: content/renderer/dom_utils.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/renderer/dom_utils.h ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/dom_utils.cc
diff --git a/content/renderer/dom_utils.cc b/content/renderer/dom_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6878c891e3c42b8b4cff83f4667497d42ae5d4dd
--- /dev/null
+++ b/content/renderer/dom_utils.cc
@@ -0,0 +1,22 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/renderer/dom_utils.h"
+
+#include "third_party/WebKit/public/web/WebNode.h"
+
+namespace content {
+
+blink::WebNode DomUtils::ExtractParentAnchorNode(
+ const blink::WebNode& node) {
+ blink::WebNode selected_node = node;
+
+ // If there are other embedded tags (like <a ..>Some <b>text</b></a>)
+ // we need to extract the parent <a/> node.
+ while (!selected_node.isLink() && !selected_node.parentNode().isNull())
+ selected_node = selected_node.parentNode();
+ return selected_node.isLink() ? selected_node : blink::WebNode();
+}
+
+} // namespace content
« no previous file with comments | « content/renderer/dom_utils.h ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698