#pragma once
#include "HTMLAnchorElement.h"
#include "LayoutRect.h"
#include <memory>
namespace WebCore {
class HTMLImageElement;
class HitTestResult;
class Path;
class HTMLAreaElement final : public HTMLAnchorElement {
WTF_MAKE_ISO_ALLOCATED(HTMLAreaElement);
public:
static Ref<HTMLAreaElement> create(const QualifiedName&, Document&);
bool isDefault() const { return m_shape == Default; }
bool mapMouseEvent(LayoutPoint location, const LayoutSize&, HitTestResult&);
WEBCORE_EXPORT LayoutRect computeRect(RenderObject*) const;
Path computePath(RenderObject*) const;
Path computePathForFocusRing(const LayoutSize& elementSize) const;
WEBCORE_EXPORT HTMLImageElement* imageElement() const;
private:
HTMLAreaElement(const QualifiedName&, Document&);
void parseAttribute(const QualifiedName&, const AtomString&) final;
bool supportsFocus() const final;
String target() const final;
bool isKeyboardFocusable(KeyboardEvent*) const final;
bool isMouseFocusable() const final;
bool isFocusable() const final;
RefPtr<Element> focusAppearanceUpdateTarget() final;
void setFocus(bool) final;
enum Shape { Default, Poly, Rect, Circle, Unknown };
Path getRegion(const LayoutSize&) const;
void invalidateCachedRegion();
std::unique_ptr<Path> m_region;
Vector<double> m_coords;
LayoutSize m_lastSize;
Shape m_shape;
};
}