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

Side by Side Diff: Source/core/rendering/HitTestResult.cpp

Issue 18888002: Introduce isHTMLAnchorElement and toHTMLAnchorElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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 unified diff | Download patch
« no previous file with comments | « Source/core/page/DragController.cpp ('k') | Source/core/rendering/RenderObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 return static_cast<HTMLMediaElement*>(m_innerNonSharedNode.get()); 318 return static_cast<HTMLMediaElement*>(m_innerNonSharedNode.get());
319 return 0; 319 return 0;
320 } 320 }
321 321
322 KURL HitTestResult::absoluteLinkURL() const 322 KURL HitTestResult::absoluteLinkURL() const
323 { 323 {
324 if (!(m_innerURLElement && m_innerURLElement->document())) 324 if (!(m_innerURLElement && m_innerURLElement->document()))
325 return KURL(); 325 return KURL();
326 326
327 AtomicString urlString; 327 AtomicString urlString;
328 if (m_innerURLElement->hasTagName(aTag) || isHTMLAreaElement(m_innerURLEleme nt.get()) || m_innerURLElement->hasTagName(linkTag)) 328 if (isHTMLAnchorElement(m_innerURLElement.get()) || isHTMLAreaElement(m_inne rURLElement.get()) || m_innerURLElement->hasTagName(linkTag))
329 urlString = m_innerURLElement->getAttribute(hrefAttr); 329 urlString = m_innerURLElement->getAttribute(hrefAttr);
330 else if (m_innerURLElement->hasTagName(SVGNames::aTag)) 330 else if (m_innerURLElement->hasTagName(SVGNames::aTag))
331 urlString = m_innerURLElement->getAttribute(XLinkNames::hrefAttr); 331 urlString = m_innerURLElement->getAttribute(XLinkNames::hrefAttr);
332 else 332 else
333 return KURL(); 333 return KURL();
334 334
335 return m_innerURLElement->document()->completeURL(stripLeadingAndTrailingHTM LSpaces(urlString)); 335 return m_innerURLElement->document()->completeURL(stripLeadingAndTrailingHTM LSpaces(urlString));
336 } 336 }
337 337
338 bool HitTestResult::isLiveLink() const 338 bool HitTestResult::isLiveLink() const
339 { 339 {
340 if (!(m_innerURLElement && m_innerURLElement->document())) 340 if (!(m_innerURLElement && m_innerURLElement->document()))
341 return false; 341 return false;
342 342
343 if (m_innerURLElement->hasTagName(aTag)) 343 if (isHTMLAnchorElement(m_innerURLElement.get()))
344 return static_cast<HTMLAnchorElement*>(m_innerURLElement.get())->isLiveL ink(); 344 return toHTMLAnchorElement(m_innerURLElement.get())->isLiveLink();
345 345
346 if (m_innerURLElement->hasTagName(SVGNames::aTag)) 346 if (m_innerURLElement->hasTagName(SVGNames::aTag))
347 return m_innerURLElement->isLink(); 347 return m_innerURLElement->isLink();
348 348
349 return false; 349 return false;
350 } 350 }
351 351
352 bool HitTestResult::isMisspelled() const 352 bool HitTestResult::isMisspelled() const
353 { 353 {
354 if (!targetNode()) 354 if (!targetNode())
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 { 487 {
488 NodeRenderingTraversal::ParentDetails details; 488 NodeRenderingTraversal::ParentDetails details;
489 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa rent(node, &details)) 489 for (Node* node = m_innerNode.get(); node; node = NodeRenderingTraversal::pa rent(node, &details))
490 if (node->isElementNode()) 490 if (node->isElementNode())
491 return toElement(node); 491 return toElement(node);
492 492
493 return 0; 493 return 0;
494 } 494 }
495 495
496 } // namespace WebCore 496 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/DragController.cpp ('k') | Source/core/rendering/RenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698