Home | History | Annotate | Download | only in renderer
      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.
      4 
      5 #include "content/renderer/dom_utils.h"
      6 
      7 #include "third_party/WebKit/public/web/WebNode.h"
      8 
      9 namespace content {
     10 
     11 blink::WebNode DomUtils::ExtractParentAnchorNode(
     12     const blink::WebNode& node) {
     13   blink::WebNode selected_node = node;
     14 
     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;
     20 }
     21 
     22 }  // namespace content
     23