Ejemplo n.º 1
0
static ImageResourceContent* getImageResourceContent(Element* element) {
  // Attempt to pull ImageResourceContent from element
  ASSERT(element);
  LayoutObject* layoutObject = element->layoutObject();
  if (!layoutObject || !layoutObject->isImage())
    return 0;

  LayoutImage* image = toLayoutImage(layoutObject);
  if (image->cachedImage() && !image->cachedImage()->errorOccurred())
    return image->cachedImage();

  return 0;
}
Ejemplo n.º 2
0
Image* HitTestResult::image() const
{
    Node* innerNodeOrImageMapImage = this->innerNodeOrImageMapImage();
    if (!innerNodeOrImageMapImage)
        return nullptr;

    LayoutObject* layoutObject = innerNodeOrImageMapImage->layoutObject();
    if (layoutObject && layoutObject->isImage()) {
        LayoutImage* image = toLayoutImage(layoutObject);
        if (image->cachedImage() && !image->cachedImage()->errorOccurred())
            return image->cachedImage()->image();
    }

    return nullptr;
}