本文整理汇总了C++中HTMLImageElement::document方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLImageElement::document方法的具体用法?C++ HTMLImageElement::document怎么用?C++ HTMLImageElement::document使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLImageElement
的用法示例。
在下文中一共展示了HTMLImageElement::document方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IntRect
TEST_F(ImageBitmapTest, ImageResourceConsistency)
{
const ImageBitmapOptions defaultOptions;
HTMLImageElement* imageElement = HTMLImageElement::create(*Document::create());
ImageResource* image = ImageResource::create(StaticBitmapImage::create(m_image).get());
imageElement->setImageResource(image);
ImageBitmap* imageBitmapNoCrop = ImageBitmap::create(imageElement,
IntRect(0, 0, m_image->width(), m_image->height()),
&(imageElement->document()), defaultOptions);
ImageBitmap* imageBitmapInteriorCrop = ImageBitmap::create(imageElement,
IntRect(m_image->width() / 2, m_image->height() / 2, m_image->width() / 2, m_image->height() / 2),
&(imageElement->document()), defaultOptions);
ImageBitmap* imageBitmapExteriorCrop = ImageBitmap::create(imageElement,
IntRect(-m_image->width() / 2, -m_image->height() / 2, m_image->width(), m_image->height()),
&(imageElement->document()), defaultOptions);
ImageBitmap* imageBitmapOutsideCrop = ImageBitmap::create(imageElement,
IntRect(-m_image->width(), -m_image->height(), m_image->width(), m_image->height()),
&(imageElement->document()), defaultOptions);
ASSERT_EQ(imageBitmapNoCrop->bitmapImage()->imageForCurrentFrame(), imageElement->cachedImage()->getImage()->imageForCurrentFrame());
ASSERT_NE(imageBitmapInteriorCrop->bitmapImage()->imageForCurrentFrame(), imageElement->cachedImage()->getImage()->imageForCurrentFrame());
ASSERT_NE(imageBitmapExteriorCrop->bitmapImage()->imageForCurrentFrame(), imageElement->cachedImage()->getImage()->imageForCurrentFrame());
StaticBitmapImage* emptyImage = imageBitmapOutsideCrop->bitmapImage();
ASSERT_NE(emptyImage->imageForCurrentFrame(), imageElement->cachedImage()->getImage()->imageForCurrentFrame());
}
示例2: invoke
JSValue invoke(ExecState* exec, QtPixmapInstance* instance)
{
if (!exec->argumentCount())
return jsUndefined();
JSObject* objectArg = exec->argument(0).toObject(exec);
if (!objectArg)
return jsUndefined();
if (!objectArg->inherits(&JSHTMLImageElement::s_info))
return jsUndefined();
// we now know that we have a valid <img> element as the argument, we can attach the pixmap to it.
PassRefPtr<StillImage> stillImage = WebCore::StillImage::create(instance->toPixmap());
HTMLImageElement* imageElement = static_cast<HTMLImageElement*>(static_cast<JSHTMLImageElement*>(objectArg)->impl());
imageElement->setCachedImage(new CachedImage(stillImage.get()));
JSDOMGlobalObject* global = static_cast<JSDOMGlobalObject*>(instance->rootObject()->globalObject());
toJS(exec, global, imageElement->document());
return jsUndefined();
}
示例3: firstNamedItem
static HTMLElement* firstNamedItem(const FormAssociatedElement::List& elementsArray,
const Vector<HTMLImageElement*>* imageElementsArray, const QualifiedName& attrName, const String& name)
{
ASSERT(attrName == idAttr || attrName == nameAttr);
for (unsigned i = 0; i < elementsArray.size(); ++i) {
HTMLElement* element = toHTMLElement(elementsArray[i]);
if (elementsArray[i]->isEnumeratable() && element->fastGetAttribute(attrName) == name)
return element;
}
if (!imageElementsArray)
return 0;
for (unsigned i = 0; i < imageElementsArray->size(); ++i) {
HTMLImageElement* element = (*imageElementsArray)[i];
if (element->fastGetAttribute(attrName) == name) {
UseCounter::count(element->document(), UseCounter::FormNameAccessForImageElement);
return element;
}
}
return 0;
}
示例4: imageMap
HTMLMapElement* RenderImage::imageMap() const
{
HTMLImageElement* i = node() && node()->hasTagName(imgTag) ? static_cast<HTMLImageElement*>(node()) : 0;
return i ? i->document()->getImageMap(i->fastGetAttribute(usemapAttr)) : 0;
}
示例5: imageMap
HTMLMapElement* RenderImage::imageMap()
{
HTMLImageElement* i = element() && element()->hasTagName(imgTag) ? static_cast<HTMLImageElement*>(element()) : 0;
return i ? i->document()->getImageMap(i->useMap()) : 0;
}