Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / html / HTMLAreaElement.cpp
index ac8d97c..e87eb89 100644 (file)
@@ -22,7 +22,7 @@
 #include "config.h"
 #include "core/html/HTMLAreaElement.h"
 
-#include "HTMLNames.h"
+#include "core/HTMLNames.h"
 #include "core/html/HTMLImageElement.h"
 #include "core/html/HTMLMapElement.h"
 #include "core/rendering/HitTestResult.h"
@@ -32,9 +32,7 @@
 #include "platform/graphics/Path.h"
 #include "platform/transforms/AffineTransform.h"
 
-using namespace std;
-
-namespace WebCore {
+namespace blink {
 
 using namespace HTMLNames;
 
@@ -43,13 +41,9 @@ inline HTMLAreaElement::HTMLAreaElement(Document& document)
     , m_lastSize(-1, -1)
     , m_shape(Unknown)
 {
-    ScriptWrappable::init(this);
 }
 
-PassRefPtrWillBeRawPtr<HTMLAreaElement> HTMLAreaElement::create(Document& document)
-{
-    return adoptRefWillBeRefCountedGarbageCollected(new HTMLAreaElement(document));
-}
+DEFINE_NODE_FACTORY(HTMLAreaElement)
 
 void HTMLAreaElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
@@ -155,7 +149,7 @@ Path HTMLAreaElement::getRegion(const LayoutSize& size) const
         case Circle:
             if (m_coords.size() >= 3) {
                 Length radius = m_coords[2];
-                float r = min(minimumValueForLength(radius, width).toFloat(), minimumValueForLength(radius, height).toFloat());
+                float r = std::min(minimumValueForLength(radius, width).toFloat(), minimumValueForLength(radius, height).toFloat());
                 path.addEllipse(FloatRect(minimumValueForLength(m_coords[0], width).toFloat() - r, minimumValueForLength(m_coords[1], height).toFloat() - r, 2 * r, 2 * r));
             }
             break;
@@ -180,14 +174,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 nullptr;
 }
 
 bool HTMLAreaElement::isKeyboardFocusable() const