| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 if (defaultArea) { | 75 if (defaultArea) { |
| 76 result.setInnerNode(defaultArea); | 76 result.setInnerNode(defaultArea); |
| 77 result.setURLElement(defaultArea); | 77 result.setURLElement(defaultArea); |
| 78 } | 78 } |
| 79 return defaultArea; | 79 return defaultArea; |
| 80 } | 80 } |
| 81 | 81 |
| 82 HTMLImageElement* HTMLMapElement::imageElement() | 82 HTMLImageElement* HTMLMapElement::imageElement() |
| 83 { | 83 { |
| 84 RefPtr<HTMLCollection> images = document()->images(); | 84 RefPtr<HTMLCollection> images = document().images(); |
| 85 for (unsigned i = 0; Node* curr = images->item(i); i++) { | 85 for (unsigned i = 0; Node* curr = images->item(i); i++) { |
| 86 if (!curr->hasTagName(imgTag)) | 86 if (!curr->hasTagName(imgTag)) |
| 87 continue; | 87 continue; |
| 88 | 88 |
| 89 // The HTMLImageElement's useMap() value includes the '#' symbol at the
beginning, | 89 // The HTMLImageElement's useMap() value includes the '#' symbol at the
beginning, |
| 90 // which has to be stripped off. | 90 // which has to be stripped off. |
| 91 HTMLImageElement* imageElement = toHTMLImageElement(curr); | 91 HTMLImageElement* imageElement = toHTMLImageElement(curr); |
| 92 String useMapName = imageElement->getAttribute(usemapAttr).string().subs
tring(1); | 92 String useMapName = imageElement->getAttribute(usemapAttr).string().subs
tring(1); |
| 93 if (equalIgnoringCase(useMapName, m_name)) | 93 if (equalIgnoringCase(useMapName, m_name)) |
| 94 return imageElement; | 94 return imageElement; |
| 95 } | 95 } |
| 96 | 96 |
| 97 return 0; | 97 return 0; |
| 98 } | 98 } |
| 99 | 99 |
| 100 void HTMLMapElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 100 void HTMLMapElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
| 101 { | 101 { |
| 102 // FIXME: This logic seems wrong for XML documents. | 102 // FIXME: This logic seems wrong for XML documents. |
| 103 // Either the id or name will be used depending on the order the attributes
are parsed. | 103 // Either the id or name will be used depending on the order the attributes
are parsed. |
| 104 | 104 |
| 105 if (isIdAttributeName(name) || name == nameAttr) { | 105 if (isIdAttributeName(name) || name == nameAttr) { |
| 106 if (isIdAttributeName(name)) { | 106 if (isIdAttributeName(name)) { |
| 107 // Call base class so that hasID bit gets set. | 107 // Call base class so that hasID bit gets set. |
| 108 HTMLElement::parseAttribute(name, value); | 108 HTMLElement::parseAttribute(name, value); |
| 109 if (document()->isHTMLDocument()) | 109 if (document().isHTMLDocument()) |
| 110 return; | 110 return; |
| 111 } | 111 } |
| 112 if (inDocument()) | 112 if (inDocument()) |
| 113 treeScope()->removeImageMap(this); | 113 treeScope()->removeImageMap(this); |
| 114 String mapName = value; | 114 String mapName = value; |
| 115 if (mapName[0] == '#') | 115 if (mapName[0] == '#') |
| 116 mapName = mapName.substring(1); | 116 mapName = mapName.substring(1); |
| 117 m_name = document()->isHTMLDocument() ? mapName.lower() : mapName; | 117 m_name = document().isHTMLDocument() ? mapName.lower() : mapName; |
| 118 if (inDocument()) | 118 if (inDocument()) |
| 119 treeScope()->addImageMap(this); | 119 treeScope()->addImageMap(this); |
| 120 | 120 |
| 121 return; | 121 return; |
| 122 } | 122 } |
| 123 | 123 |
| 124 HTMLElement::parseAttribute(name, value); | 124 HTMLElement::parseAttribute(name, value); |
| 125 } | 125 } |
| 126 | 126 |
| 127 PassRefPtr<HTMLCollection> HTMLMapElement::areas() | 127 PassRefPtr<HTMLCollection> HTMLMapElement::areas() |
| 128 { | 128 { |
| 129 return ensureCachedHTMLCollection(MapAreas); | 129 return ensureCachedHTMLCollection(MapAreas); |
| 130 } | 130 } |
| 131 | 131 |
| 132 Node::InsertionNotificationRequest HTMLMapElement::insertedInto(ContainerNode* i
nsertionPoint) | 132 Node::InsertionNotificationRequest HTMLMapElement::insertedInto(ContainerNode* i
nsertionPoint) |
| 133 { | 133 { |
| 134 if (insertionPoint->inDocument()) | 134 if (insertionPoint->inDocument()) |
| 135 treeScope()->addImageMap(this); | 135 treeScope()->addImageMap(this); |
| 136 return HTMLElement::insertedInto(insertionPoint); | 136 return HTMLElement::insertedInto(insertionPoint); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void HTMLMapElement::removedFrom(ContainerNode* insertionPoint) | 139 void HTMLMapElement::removedFrom(ContainerNode* insertionPoint) |
| 140 { | 140 { |
| 141 if (insertionPoint->inDocument()) | 141 if (insertionPoint->inDocument()) |
| 142 treeScope()->removeImageMap(this); | 142 treeScope()->removeImageMap(this); |
| 143 HTMLElement::removedFrom(insertionPoint); | 143 HTMLElement::removedFrom(insertionPoint); |
| 144 } | 144 } |
| 145 | 145 |
| 146 } | 146 } |
| OLD | NEW |