当前位置: 首页>>代码示例>>C++>>正文


C++ HTMLImageElement::document方法代码示例

本文整理汇总了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());
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例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();
    }
开发者ID:achellies,项目名称:WinCEWebKit,代码行数:20,代码来源:qt_pixmapruntime.cpp

示例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;
}
开发者ID:coinpayee,项目名称:blink,代码行数:24,代码来源:HTMLFormControlsCollection.cpp

示例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;
}
开发者ID:,项目名称:,代码行数:5,代码来源:

示例5: imageMap

HTMLMapElement* RenderImage::imageMap()
{
    HTMLImageElement* i = element() && element()->hasTagName(imgTag) ? static_cast<HTMLImageElement*>(element()) : 0;
    return i ? i->document()->getImageMap(i->useMap()) : 0;
}
开发者ID:Chingliu,项目名称:EAWebkit,代码行数:5,代码来源:RenderImage.cpp


注:本文中的HTMLImageElement::document方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。