| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011, 2012 Apple Inc. All rights
reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2011, 2012 Apple Inc. All rights
reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 if (!previous) | 56 if (!previous) |
| 57 current = ElementTraversal::firstWithin(ownerNode()); | 57 current = ElementTraversal::firstWithin(ownerNode()); |
| 58 else | 58 else |
| 59 current = ElementTraversal::next(*previous, &ownerNode()); | 59 current = ElementTraversal::next(*previous, &ownerNode()); |
| 60 | 60 |
| 61 for (; current; current = ElementTraversal::next(*current, &ownerNode())) { | 61 for (; current; current = ElementTraversal::next(*current, &ownerNode())) { |
| 62 switch (type()) { | 62 switch (type()) { |
| 63 case WindowNamedItems: | 63 case WindowNamedItems: |
| 64 // find only images, forms, applets, embeds and objects by name, | 64 // find only images, forms, applets, embeds and objects by name, |
| 65 // but anything by id | 65 // but anything by id |
| 66 if (current->hasTagName(imgTag) | 66 if (isHTMLImageElement(*current) |
| 67 || current->hasTagName(formTag) | 67 || isHTMLFormElement(*current) |
| 68 || current->hasTagName(appletTag) | 68 || isHTMLAppletElement(*current) |
| 69 || current->hasTagName(embedTag) | 69 || isHTMLEmbedElement(*current) |
| 70 || current->hasTagName(objectTag)) { | 70 || isHTMLObjectElement(*current)) { |
| 71 if (current->getNameAttribute() == m_name) | 71 if (current->getNameAttribute() == m_name) |
| 72 return current; | 72 return current; |
| 73 } | 73 } |
| 74 if (current->getIdAttribute() == m_name) | 74 if (current->getIdAttribute() == m_name) |
| 75 return current; | 75 return current; |
| 76 break; | 76 break; |
| 77 case DocumentNamedItems: | 77 case DocumentNamedItems: |
| 78 // find images, forms, applets, embeds, objects and iframes by name, | 78 // find images, forms, applets, embeds, objects and iframes by name, |
| 79 // applets and object by id, and images by id but only if they have | 79 // applets and object by id, and images by id but only if they have |
| 80 // a name attribute (this very strange rule matches IE) | 80 // a name attribute (this very strange rule matches IE) |
| 81 if (current->hasTagName(formTag) | 81 if (isHTMLFormElement(*current) |
| 82 || current->hasTagName(iframeTag) | 82 || isHTMLIFrameElement(*current) |
| 83 || (current->hasTagName(embedTag) && toHTMLEmbedElement(current)
->isExposed())) { | 83 || (isHTMLEmbedElement(*current) && toHTMLEmbedElement(*current)
.isExposed())) { |
| 84 if (current->getNameAttribute() == m_name) | 84 if (current->getNameAttribute() == m_name) |
| 85 return current; | 85 return current; |
| 86 } else if (current->hasTagName(appletTag) | 86 } else if (isHTMLAppletElement(*current) |
| 87 || (current->hasTagName(objectTag) && toHTMLObjectElement(curren
t)->isExposed())) { | 87 || (isHTMLObjectElement(*current) && toHTMLObjectElement(*curren
t).isExposed())) { |
| 88 if (current->getNameAttribute() == m_name || current->getIdAttri
bute() == m_name) | 88 if (current->getNameAttribute() == m_name || current->getIdAttri
bute() == m_name) |
| 89 return current; | 89 return current; |
| 90 } else if (current->hasTagName(imgTag)) { | 90 } else if (isHTMLImageElement(*current)) { |
| 91 if (current->getNameAttribute() == m_name || (current->getIdAttr
ibute() == m_name && current->hasName())) | 91 if (current->getNameAttribute() == m_name || (current->getIdAttr
ibute() == m_name && current->hasName())) |
| 92 return current; | 92 return current; |
| 93 } | 93 } |
| 94 break; | 94 break; |
| 95 default: | 95 default: |
| 96 ASSERT_NOT_REACHED(); | 96 ASSERT_NOT_REACHED(); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 return 0; | 100 return 0; |
| 101 } | 101 } |
| 102 | 102 |
| 103 } | 103 } |
| OLD | NEW |