This source file includes following definitions.
- m_mapElement
- detachFromParent
- create
- parentObject
- roleValue
- actionElement
- anchorElement
- url
- accessibilityDescription
- title
- elementRect
#include "config.h"
#include "core/accessibility/AXImageMapLink.h"
#include "core/accessibility/AXObjectCache.h"
#include "core/accessibility/AXRenderObject.h"
namespace WebCore {
using namespace HTMLNames;
AXImageMapLink::AXImageMapLink()
: m_areaElement(nullptr)
, m_mapElement(nullptr)
{
}
AXImageMapLink::~AXImageMapLink()
{
}
void AXImageMapLink::detachFromParent()
{
AXMockObject::detachFromParent();
m_areaElement = nullptr;
m_mapElement = nullptr;
}
PassRefPtr<AXImageMapLink> AXImageMapLink::create()
{
return adoptRef(new AXImageMapLink());
}
AXObject* AXImageMapLink::parentObject() const
{
if (m_parent)
return m_parent;
if (!m_mapElement.get() || !m_mapElement->renderer())
return 0;
return m_mapElement->document().axObjectCache()->getOrCreate(m_mapElement->renderer());
}
AccessibilityRole AXImageMapLink::roleValue() const
{
if (!m_areaElement)
return LinkRole;
const AtomicString& ariaRole = getAttribute(roleAttr);
if (!ariaRole.isEmpty())
return AXObject::ariaRoleToWebCoreRole(ariaRole);
return LinkRole;
}
Element* AXImageMapLink::actionElement() const
{
return anchorElement();
}
Element* AXImageMapLink::anchorElement() const
{
return m_areaElement.get();
}
KURL AXImageMapLink::url() const
{
if (!m_areaElement.get())
return KURL();
return m_areaElement->href();
}
String AXImageMapLink::accessibilityDescription() const
{
const AtomicString& ariaLabel = getAttribute(aria_labelAttr);
if (!ariaLabel.isEmpty())
return ariaLabel;
const AtomicString& alt = getAttribute(altAttr);
if (!alt.isEmpty())
return alt;
return String();
}
String AXImageMapLink::title() const
{
const AtomicString& title = getAttribute(titleAttr);
if (!title.isEmpty())
return title;
const AtomicString& summary = getAttribute(summaryAttr);
if (!summary.isEmpty())
return summary;
return String();
}
LayoutRect AXImageMapLink::elementRect() const
{
if (!m_mapElement.get() || !m_areaElement.get())
return LayoutRect();
RenderObject* renderer;
if (m_parent && m_parent->isAXRenderObject())
renderer = toAXRenderObject(m_parent)->renderer();
else
renderer = m_mapElement->renderer();
if (!renderer)
return LayoutRect();
return m_areaElement->computeRect(renderer);
}
}