本文整理汇总了C++中HTMLImageElement::fastGetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLImageElement::fastGetAttribute方法的具体用法?C++ HTMLImageElement::fastGetAttribute怎么用?C++ HTMLImageElement::fastGetAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLImageElement
的用法示例。
在下文中一共展示了HTMLImageElement::fastGetAttribute方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: imageAreaForImage
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());
}
示例2: serializeFrame
void PageSerializer::serializeFrame(Frame* frame)
{
Document* document = frame->document();
URL url = document->url();
if (!url.isValid() || url.isBlankURL()) {
// For blank frames we generate a fake URL so they can be referenced by their containing frame.
url = urlForBlankFrame(frame);
}
if (m_resourceURLs.contains(url)) {
// FIXME: We could have 2 frame with the same URL but which were dynamically changed and have now
// different content. So we should serialize both and somehow rename the frame src in the containing
// frame. Arg!
return;
}
Vector<Node*> nodes;
SerializerMarkupAccumulator accumulator(*this, *document, &nodes);
TextEncoding textEncoding(document->charset());
CString data;
if (!textEncoding.isValid()) {
// FIXME: iframes used as images trigger this. We should deal with them correctly.
return;
}
String text = accumulator.serializeNodes(*document->documentElement(), 0, IncludeNode);
CString frameHTML = textEncoding.encode(text, EntitiesForUnencodables);
m_resources->append(Resource(url, document->suggestedMIMEType(), SharedBuffer::create(frameHTML.data(), frameHTML.length())));
m_resourceURLs.add(url);
for (Vector<Node*>::iterator iter = nodes.begin(); iter != nodes.end(); ++iter) {
Node* node = *iter;
if (!node->isElementNode())
continue;
Element* element = toElement(node);
// We have to process in-line style as it might contain some resources (typically background images).
if (element->isStyledElement())
retrieveResourcesForProperties(toStyledElement(element)->inlineStyle(), document);
if (isHTMLImageElement(element)) {
HTMLImageElement* imageElement = toHTMLImageElement(element);
URL url = document->completeURL(imageElement->fastGetAttribute(HTMLNames::srcAttr));
CachedImage* cachedImage = imageElement->cachedImage();
addImageToResources(cachedImage, imageElement->renderer(), url);
} else if (element->hasTagName(HTMLNames::linkTag)) {
HTMLLinkElement* linkElement = toHTMLLinkElement(element);
if (CSSStyleSheet* sheet = linkElement->sheet()) {
URL url = document->completeURL(linkElement->getAttribute(HTMLNames::hrefAttr));
serializeCSSStyleSheet(sheet, url);
ASSERT(m_resourceURLs.contains(url));
}
} else if (isHTMLStyleElement(element)) {
if (CSSStyleSheet* sheet = toHTMLStyleElement(element)->sheet())
serializeCSSStyleSheet(sheet, URL());
}
}
for (Frame* childFrame = frame->tree().firstChild(); childFrame; childFrame = childFrame->tree().nextSibling())
serializeFrame(childFrame);
}
示例3: firstNamedItem
static HTMLElement* firstNamedItem(const Vector<FormAssociatedElement*>& 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)
return element;
}
return 0;
}
示例4: firstNamedItem
static HTMLElement* firstNamedItem(const FormAssociatedElement::List& elementsArray,
const WillBeHeapVector<RawPtrWillBeMember<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 nullptr;
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 nullptr;
}
示例5: imageMap
HTMLMapElement* LayoutImage::imageMap() const
{
HTMLImageElement* i = isHTMLImageElement(node()) ? toHTMLImageElement(node()) : 0;
return i ? i->treeScope().getImageMap(i->fastGetAttribute(usemapAttr)) : 0;
}
示例6: imageMap
HTMLMapElement* RenderImage::imageMap() const
{
HTMLImageElement* i = node() && node()->hasTagName(imgTag) ? static_cast<HTMLImageElement*>(node()) : 0;
return i ? i->treeScope()->getImageMap(i->fastGetAttribute(usemapAttr)) : 0;
}
示例7: imageMap
HTMLMapElement* RenderImage::imageMap() const
{
HTMLImageElement* image = is<HTMLImageElement>(element()) ? downcast<HTMLImageElement>(element()) : nullptr;
return image ? image->treeScope().getImageMap(image->fastGetAttribute(usemapAttr)) : nullptr;
}