OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |