HTMLAreaElement* HitTestResult::imageAreaForImage() const { ASSERT(m_innerNode); HTMLImageElement* imageElement = nullptr; if (isHTMLImageElement(m_innerNode)) { imageElement = toHTMLImageElement(m_innerNode); } else if (m_innerNode->isInShadowTree()) { if (m_innerNode->containingShadowRoot()->type() == ShadowRootType::UserAgent) { if (isHTMLImageElement(m_innerNode->shadowHost())) imageElement = toHTMLImageElement(m_innerNode->shadowHost()); } } if (!imageElement || !imageElement->layoutObject() || !imageElement->layoutObject()->isBox()) return nullptr; HTMLMapElement* map = imageElement->treeScope().getImageMap(imageElement->fastGetAttribute(usemapAttr)); if (!map) return nullptr; LayoutBox* box = toLayoutBox(imageElement->layoutObject()); LayoutRect contentBox = box->contentBoxRect(); float scaleFactor = 1 / box->style()->effectiveZoom(); LayoutPoint location = localPoint(); location.scale(scaleFactor, scaleFactor); return map->areaForPoint(location, contentBox.size()); }
HTMLMapElement* LayoutImage::imageMap() const { HTMLImageElement* i = isHTMLImageElement(node()) ? toHTMLImageElement(node()) : 0; return i ? i->treeScope().getImageMap(i->fastGetAttribute(usemapAttr)) : 0; }
HTMLMapElement* RenderImage::imageMap() const { HTMLImageElement* i = node() && node()->hasTagName(imgTag) ? static_cast<HTMLImageElement*>(node()) : 0; return i ? i->treeScope()->getImageMap(i->fastGetAttribute(usemapAttr)) : 0; }
HTMLMapElement* RenderImage::imageMap() const { HTMLImageElement* i = hostImageElement(); return i ? i->treeScope()->getImageMap(i->fastGetAttribute(usemapAttr)) : 0; }
HTMLMapElement* RenderImage::imageMap() const { HTMLImageElement* image = is<HTMLImageElement>(element()) ? downcast<HTMLImageElement>(element()) : nullptr; return image ? image->treeScope().getImageMap(image->fastGetAttribute(usemapAttr)) : nullptr; }