summaryrefslogtreecommitdiffstats
path: root/WebCore/html/HTMLMapElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/html/HTMLMapElement.cpp')
-rw-r--r--WebCore/html/HTMLMapElement.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/WebCore/html/HTMLMapElement.cpp b/WebCore/html/HTMLMapElement.cpp
index 90204e0..9617afc 100644
--- a/WebCore/html/HTMLMapElement.cpp
+++ b/WebCore/html/HTMLMapElement.cpp
@@ -25,10 +25,12 @@
#include "Document.h"
#include "HTMLAreaElement.h"
#include "HTMLCollection.h"
+#include "HTMLImageElement.h"
#include "HTMLNames.h"
#include "HitTestResult.h"
#include "IntSize.h"
#include "MappedAttribute.h"
+#include "RenderObject.h"
using namespace std;
@@ -75,12 +77,30 @@ bool HTMLMapElement::mapMouseEvent(int x, int y, const IntSize& size, HitTestRes
return defaultArea;
}
+HTMLImageElement* HTMLMapElement::imageElement() const
+{
+ RefPtr<HTMLCollection> coll = renderer()->document()->images();
+ for (Node* curr = coll->firstItem(); curr; curr = coll->nextItem()) {
+ if (!curr->hasTagName(imgTag))
+ continue;
+
+ // The HTMLImageElement's useMap() value includes the '#' symbol at the beginning,
+ // which has to be stripped off.
+ HTMLImageElement* imageElement = static_cast<HTMLImageElement*>(curr);
+ String useMapName = imageElement->getAttribute(usemapAttr).string().substring(1);
+ if (equalIgnoringCase(useMapName, m_name))
+ return imageElement;
+ }
+
+ return 0;
+}
+
void HTMLMapElement::parseMappedAttribute(MappedAttribute* attr)
{
const QualifiedName& attrName = attr->name();
- if (attrName == idAttr || attrName == nameAttr) {
+ if (attrName == idAttributeName() || attrName == nameAttr) {
Document* doc = document();
- if (attrName == idAttr) {
+ if (attrName == idAttributeName()) {
// Call base class so that hasID bit gets set.
HTMLElement::parseMappedAttribute(attr);
if (doc->isHTMLDocument())