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

Side by Side Diff: Source/core/dom/TreeScope.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/dom/Document.cpp ('k') | Source/core/dom/VisitedLinkState.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) 2011 Google Inc. All Rights Reserved. 2 * Copyright (C) 2011 Google Inc. All Rights Reserved.
3 * Copyright (C) 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 return m_selection.get(); 295 return m_selection.get();
296 } 296 }
297 297
298 Element* TreeScope::findAnchor(const String& name) 298 Element* TreeScope::findAnchor(const String& name)
299 { 299 {
300 if (name.isEmpty()) 300 if (name.isEmpty())
301 return 0; 301 return 0;
302 if (Element* element = getElementById(name)) 302 if (Element* element = getElementById(name))
303 return element; 303 return element;
304 for (Element* element = ElementTraversal::firstWithin(rootNode()); element; element = ElementTraversal::next(element)) { 304 for (Element* element = ElementTraversal::firstWithin(rootNode()); element; element = ElementTraversal::next(element)) {
305 if (element->hasTagName(aTag)) { 305 if (isHTMLAnchorElement(element)) {
306 HTMLAnchorElement* anchor = static_cast<HTMLAnchorElement*>(element) ; 306 HTMLAnchorElement* anchor = toHTMLAnchorElement(element);
307 if (rootNode()->document()->inQuirksMode()) { 307 if (rootNode()->document()->inQuirksMode()) {
308 // Quirks mode, case insensitive comparison of names. 308 // Quirks mode, case insensitive comparison of names.
309 if (equalIgnoringCase(anchor->name(), name)) 309 if (equalIgnoringCase(anchor->name(), name))
310 return anchor; 310 return anchor;
311 } else { 311 } else {
312 // Strict mode, names need to match exactly. 312 // Strict mode, names need to match exactly.
313 if (anchor->name() == name) 313 if (anchor->name() == name)
314 return anchor; 314 return anchor;
315 } 315 }
316 } 316 }
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 result = element; 506 result = element;
507 for (ShadowRoot* shadowRoot = element->youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) { 507 for (ShadowRoot* shadowRoot = element->youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) {
508 if (Element* shadowResult = shadowRoot->getElementByAccessKey(key)) 508 if (Element* shadowResult = shadowRoot->getElementByAccessKey(key))
509 result = shadowResult; 509 result = shadowResult;
510 } 510 }
511 } 511 }
512 return result; 512 return result;
513 } 513 }
514 514
515 } // namespace WebCore 515 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/VisitedLinkState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698