Index: Source/core/html/HTMLMapElement.cpp |
diff --git a/Source/core/html/HTMLMapElement.cpp b/Source/core/html/HTMLMapElement.cpp |
index 00f7032c8087ddc0773a7a9d044e7bbb7bae11fa..02c70e977a7fe086c09bb0e45555cba40f0364e2 100644 |
--- a/Source/core/html/HTMLMapElement.cpp |
+++ b/Source/core/html/HTMLMapElement.cpp |
@@ -54,15 +54,12 @@ HTMLMapElement::~HTMLMapElement() |
bool HTMLMapElement::mapMouseEvent(LayoutPoint location, const LayoutSize& size, HitTestResult& result) |
{ |
HTMLAreaElement* defaultArea = 0; |
- Element* element = this; |
- while ((element = ElementTraversal::next(*element, this))) { |
- if (element->hasTagName(areaTag)) { |
- HTMLAreaElement* areaElt = toHTMLAreaElement(element); |
- if (areaElt->isDefault()) { |
- if (!defaultArea) |
- defaultArea = areaElt; |
- } else if (areaElt->mapMouseEvent(location, size, result)) |
- return true; |
+ for (HTMLAreaElement* area = Traversal<HTMLAreaElement>::firstWithin(*this); area; area = Traversal<HTMLAreaElement>::next(*area, this)) { |
+ if (area->isDefault()) { |
+ if (!defaultArea) |
+ defaultArea = area; |
+ } else if (area->mapMouseEvent(location, size, result)) { |
+ return true; |
} |
} |