Chromium Code Reviews| 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) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2010 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 result.setInnerNode(defaultArea); | 67 result.setInnerNode(defaultArea); |
| 68 result.setURLElement(defaultArea); | 68 result.setURLElement(defaultArea); |
| 69 } | 69 } |
| 70 return defaultArea; | 70 return defaultArea; |
| 71 } | 71 } |
| 72 | 72 |
| 73 HTMLImageElement* HTMLMapElement::imageElement() | 73 HTMLImageElement* HTMLMapElement::imageElement() |
| 74 { | 74 { |
| 75 RefPtr<HTMLCollection> images = document().images(); | 75 RefPtr<HTMLCollection> images = document().images(); |
| 76 for (unsigned i = 0; Element* curr = images->item(i); i++) { | 76 for (unsigned i = 0; Element* curr = images->item(i); i++) { |
| 77 if (!curr->hasTagName(imgTag)) | 77 ASSERT(isHTMLImageElement(curr)); |
|
adamk
2014/03/13 20:20:36
I take it this is just asserting that Document::im
| |
| 78 continue; | |
| 79 | 78 |
| 80 // The HTMLImageElement's useMap() value includes the '#' symbol at the beginning, | 79 // The HTMLImageElement's useMap() value includes the '#' symbol at the beginning, |
| 81 // which has to be stripped off. | 80 // which has to be stripped off. |
| 82 HTMLImageElement* imageElement = toHTMLImageElement(curr); | 81 HTMLImageElement& imageElement = toHTMLImageElement(*curr); |
| 83 String useMapName = imageElement->getAttribute(usemapAttr).string().subs tring(1); | 82 String useMapName = imageElement.getAttribute(usemapAttr).string().subst ring(1); |
| 84 if (equalIgnoringCase(useMapName, m_name)) | 83 if (equalIgnoringCase(useMapName, m_name)) |
| 85 return imageElement; | 84 return &imageElement; |
| 86 } | 85 } |
| 87 | 86 |
| 88 return 0; | 87 return 0; |
| 89 } | 88 } |
| 90 | 89 |
| 91 void HTMLMapElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value) | 90 void HTMLMapElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value) |
| 92 { | 91 { |
| 93 // FIXME: This logic seems wrong for XML documents. | 92 // FIXME: This logic seems wrong for XML documents. |
| 94 // Either the id or name will be used depending on the order the attributes are parsed. | 93 // Either the id or name will be used depending on the order the attributes are parsed. |
| 95 | 94 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 } | 127 } |
| 129 | 128 |
| 130 void HTMLMapElement::removedFrom(ContainerNode* insertionPoint) | 129 void HTMLMapElement::removedFrom(ContainerNode* insertionPoint) |
| 131 { | 130 { |
| 132 if (insertionPoint->inDocument()) | 131 if (insertionPoint->inDocument()) |
| 133 treeScope().removeImageMap(this); | 132 treeScope().removeImageMap(this); |
| 134 HTMLElement::removedFrom(insertionPoint); | 133 HTMLElement::removedFrom(insertionPoint); |
| 135 } | 134 } |
| 136 | 135 |
| 137 } | 136 } |
| OLD | NEW |