Support for process-wide incidents in the safe browsing incident reporting service.
[chromium-blink-merge.git] / content / renderer / dom_utils.cc
blobecf77b82881bfb3ce3a94aa62d212691da87bd43
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/renderer/dom_utils.h"
7 #include "third_party/WebKit/public/web/WebNode.h"
9 namespace content {
11 blink::WebNode DomUtils::ExtractParentAnchorNode(
12 const blink::WebNode& node) {
13 blink::WebNode selected_node = node;
15 // If there are other embedded tags (like <a ..>Some <b>text</b></a>)
16 // we need to extract the parent <a/> node.
17 while (!selected_node.isNull() && !selected_node.isLink())
18 selected_node = selected_node.parentNode();
19 return selected_node;
22 } // namespace content