Index: Source/core/html/HTMLAreaElement.cpp |
diff --git a/Source/core/html/HTMLAreaElement.cpp b/Source/core/html/HTMLAreaElement.cpp |
index f8d4e5c961d955415a7b1061ecf3777c5475ccec..551592b41f305f4db5aeab2193e3982fa55e805b 100644 |
--- a/Source/core/html/HTMLAreaElement.cpp |
+++ b/Source/core/html/HTMLAreaElement.cpp |
@@ -175,14 +175,9 @@ Path HTMLAreaElement::getRegion(const LayoutSize& size) const |
HTMLImageElement* HTMLAreaElement::imageElement() const |
{ |
- Element* mapElement = parentElement(); |
- while (mapElement && !isHTMLMapElement(*mapElement)) |
- mapElement = mapElement->parentElement(); |
- |
- if (!mapElement) |
- return 0; |
- |
- return toHTMLMapElement(*mapElement).imageElement(); |
+ if (HTMLMapElement* mapElement = Traversal<HTMLMapElement>::firstAncestor(*this)) |
+ return mapElement->imageElement(); |
+ return 0; |
} |
bool HTMLAreaElement::isKeyboardFocusable() const |