您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ toHTMLElement函数代码示例

51自学网 2021-06-03 08:52:56
  C++
这篇教程C++ toHTMLElement函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中toHTMLElement函数的典型用法代码示例。如果您正苦于以下问题:C++ toHTMLElement函数的具体用法?C++ toHTMLElement怎么用?C++ toHTMLElement使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了toHTMLElement函数的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: appendOpenTag

void StyledMarkupAccumulator::appendElement(StringBuilder& out, Element& element, bool addDisplayInline){    const bool documentIsHTML = element.document().isHTMLDocument();    appendOpenTag(out, element, 0);    const bool shouldAnnotateOrForceInline = element.isHTMLElement() && (shouldAnnotate() || addDisplayInline);    const bool shouldOverrideStyleAttr = shouldAnnotateOrForceInline || shouldApplyWrappingStyle(element);    AttributeCollection attributes = element.attributes();    AttributeCollection::iterator end = attributes.end();    for (AttributeCollection::iterator it = attributes.begin(); it != end; ++it) {        // We'll handle the style attribute separately, below.        if (it->name() == HTMLNames::styleAttr && shouldOverrideStyleAttr)            continue;        appendAttribute(out, element, *it, 0);    }    if (shouldOverrideStyleAttr) {        RefPtr<EditingStyle> newInlineStyle = nullptr;        if (shouldApplyWrappingStyle(element)) {            newInlineStyle = m_wrappingStyle->copy();            newInlineStyle->removePropertiesInElementDefaultStyle(&element);            newInlineStyle->removeStyleConflictingWithStyleOfElement(&element);        } else            newInlineStyle = EditingStyle::create();        if (element.isStyledElement() && element.inlineStyle())            newInlineStyle->overrideWithStyle(element.inlineStyle());        if (shouldAnnotateOrForceInline) {            if (shouldAnnotate())                newInlineStyle->mergeStyleFromRulesForSerialization(&toHTMLElement(element));            if (&element == m_highestNodeToBeSerialized && m_shouldAnnotate == AnnotateForNavigationTransition)                newInlineStyle->addAbsolutePositioningFromElement(element);            if (addDisplayInline)                newInlineStyle->forceInline();        }        if (!newInlineStyle->isEmpty()) {            out.appendLiteral(" style=/"");            appendAttributeValue(out, newInlineStyle->style()->asText(), documentIsHTML);            out.append('/"');        }    }    appendCloseTag(out, element);}
开发者ID:domenic,项目名称:mojo,代码行数:50,


示例2: updateDistribution

void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(const ChildrenChange& change){    if (!selfOrAncestorHasDirAutoAttribute())        return;    updateDistribution();    for (Element* elementToAdjust = this; elementToAdjust; elementToAdjust = ComposedTreeTraversal::parentElement(*elementToAdjust)) {        if (elementAffectsDirectionality(elementToAdjust)) {            toHTMLElement(elementToAdjust)->calculateAndAdjustDirectionality();            return;        }    }}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:14,


示例3: toHTMLElement

bool HTMLElement::translate() const{    for (const Node* n = this; n; n = n->parentNode()) {        if (n->isHTMLElement()) {            TranslateAttributeMode mode = toHTMLElement(n)->translateAttributeMode();            if (mode != TranslateAttributeInherit) {                ASSERT(mode == TranslateAttributeYes || mode == TranslateAttributeNo);                return mode == TranslateAttributeYes;            }        }    }    // Default on the root element is translate=yes.    return true;}
开发者ID:Igalia,项目名称:blink,代码行数:15,


示例4: element

void BaseChooserOnlyDateAndTimeInputType::updateView(){    Node* node = element().userAgentShadowRoot()->firstChild();    if (!node || !node->isHTMLElement())        return;    String displayValue;    if (!element().suggestedValue().isNull())        displayValue = element().suggestedValue();    else        displayValue = visibleValue();    if (displayValue.isEmpty()) {        // Need to put something to keep text baseline.        displayValue = " ";    }    toHTMLElement(node)->setInnerText(displayValue, ASSERT_NO_EXCEPTION);}
开发者ID:kjthegod,项目名称:WebKit,代码行数:16,


示例5: createV8HTMLDirectWrapper

v8::Handle<v8::Object> CustomElementHelpers::createUpgradeCandidateWrapper(PassRefPtr<Element> element, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate, const CreateWrapperFunction& createTypeExtensionUpgradeCandidateWrapper){    if (CustomElementRegistry::isCustomTagName(element->localName())) {        if (element->isHTMLElement())            return createV8HTMLDirectWrapper(toHTMLElement(element.get()), creationContext, isolate);        else if (element->isSVGElement())            return createV8SVGDirectWrapper(toSVGElement(element.get()), creationContext, isolate);        else {            ASSERT(0);            return v8::Handle<v8::Object>();        }    } else {        // It's a type extension        return createTypeExtensionUpgradeCandidateWrapper.invoke(element.get(), creationContext, isolate);    }}
开发者ID:windyuuy,项目名称:opera,代码行数:16,


示例6: highestAncestorToWrapMarkup

static HTMLElement* highestAncestorToWrapMarkup(const Range* range, EAnnotateForInterchange shouldAnnotate, Node* constrainingAncestor){    Node* commonAncestor = range->commonAncestorContainer();    ASSERT(commonAncestor);    HTMLElement* specialCommonAncestor = 0;    Node* checkAncestor = specialCommonAncestor ? specialCommonAncestor : commonAncestor;    if (checkAncestor->renderer()) {        HTMLElement* newSpecialCommonAncestor = toHTMLElement(highestEnclosingNodeOfType(firstPositionInNode(checkAncestor), &isPresentationalHTMLElement, CanCrossEditingBoundary, constrainingAncestor));        if (newSpecialCommonAncestor)            specialCommonAncestor = newSpecialCommonAncestor;    }    if (HTMLAnchorElement* enclosingAnchor = toHTMLAnchorElement(enclosingElementWithTag(firstPositionInNode(specialCommonAncestor ? specialCommonAncestor : commonAncestor), HTMLNames::aTag)))        specialCommonAncestor = enclosingAnchor;    return specialCommonAncestor;}
开发者ID:domenic,项目名称:mojo,代码行数:17,


示例7: DCHECK

HTMLElement* CustomElement::createUndefinedElement(Document& document, const QualifiedName& tagName){    DCHECK(shouldCreateCustomElement(document, tagName));    HTMLElement* element;    if (V0CustomElement::isValidName(tagName.localName()) && document.registrationContext()) {        Element* v0element = document.registrationContext()->createCustomTagElement(document, tagName);        SECURITY_DCHECK(v0element->isHTMLElement());        element = toHTMLElement(v0element);    } else {        element = HTMLElement::create(tagName, document);    }    element->setCustomElementState(CustomElementState::Undefined);    return element;}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:17,


示例8: isCharsetSpecifyingNode

static bool isCharsetSpecifyingNode(Node* node){    if (!node->isHTMLElement())        return false;    HTMLElement* element = toHTMLElement(node);    if (!element->hasTagName(HTMLNames::metaTag))        return false;    HTMLMetaCharsetParser::AttributeList attributes;    const NamedNodeMap* attributesMap = element->attributes(true);    for (unsigned i = 0; i < attributesMap->length(); ++i) {        Attribute* item = attributesMap->attributeItem(i);        // FIXME: We should deal appropriately with the attribute if they have a namespace.        attributes.append(make_pair(item->name().toString(), item->value().string()));    }    TextEncoding textEncoding = HTMLMetaCharsetParser::encodingFromMetaAttributes(attributes);    return textEncoding.isValid();}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:18,


示例9: isCharsetSpecifyingNode

static bool isCharsetSpecifyingNode(Node* node){    if (!node->isHTMLElement())        return false;    HTMLElement* element = toHTMLElement(node);    if (!element->hasTagName(HTMLNames::metaTag))        return false;    HTMLMetaCharsetParser::AttributeList attributes;    if (element->hasAttributes()) {        for (unsigned i = 0; i < element->attributeCount(); ++i) {            const Attribute* attribute = element->attributeItem(i);            // FIXME: We should deal appropriately with the attribute if they have a namespace.            attributes.append(std::make_pair(attribute->name().toString(), attribute->value().string()));        }    }    WTF::TextEncoding textEncoding = HTMLMetaCharsetParser::encodingFromMetaAttributes(attributes);    return textEncoding.isValid();}
开发者ID:chunywang,项目名称:blink-crosswalk,代码行数:19,


示例10: toHTMLElement

bool HTMLCollection::checkForNameMatch(Element* element, bool checkName, const AtomicString& name) const{    if (!element->isHTMLElement())        return false;        HTMLElement* e = toHTMLElement(element);    if (!checkName)        return e->getIdAttribute() == name;    // document.all returns only images, forms, applets, objects and embeds    // by name (though everything by id)    if (m_type == DocAll &&         !(e->hasLocalName(imgTag) || e->hasLocalName(formTag) ||          e->hasLocalName(appletTag) || e->hasLocalName(objectTag) ||          e->hasLocalName(embedTag) || e->hasLocalName(inputTag) ||          e->hasLocalName(selectTag)))        return false;    return e->getAttribute(nameAttr) == name && e->getIdAttribute() != name;}
开发者ID:DreamOnTheGo,项目名称:src,代码行数:20,


示例11: toHTMLElement

void FormAssociatedElement::resetFormOwner(){    m_formWasSetByParser = false;    HTMLElement* element = toHTMLElement(this);    const AtomicString& formId(element->fastGetAttribute(formAttr));    HTMLFormElement* nearestForm = element->findFormAncestor();    // 1. If the element's form owner is not null, and either the element is not    // reassociateable or its form content attribute is not present, and the    // element's form owner is its nearest form element ancestor after the    // change to the ancestor chain, then do nothing, and abort these steps.    if (m_form && formId.isNull() && m_form.get() == nearestForm)        return;    HTMLFormElement* originalForm = m_form.get();    setForm(findAssociatedForm(element));    // FIXME: Move didAssociateFormControl call to didChangeForm or    // HTMLFormElement::associate.    if (m_form && m_form.get() != originalForm && m_form->inDocument())        element->document().didAssociateFormControl(element);}
开发者ID:jeremyroman,项目名称:blink,代码行数:20,


示例12: wrap

// These functions are custom to prevent a wrapper lookup of the return value which is always// part of the arguments.v8::Handle<v8::Object> wrap(Node* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate){    ASSERT(impl);    switch (impl->nodeType()) {    case Node::ELEMENT_NODE:        // For performance reasons, this is inlined from V8Element::wrap and must remain in sync.        if (impl->isHTMLElement())            return wrap(toHTMLElement(impl), creationContext, isolate);        return V8Element::createWrapper(toElement(impl), creationContext, isolate);    case Node::TEXT_NODE:        return wrap(toText(impl), creationContext, isolate);    case Node::DOCUMENT_NODE:        return wrap(toDocument(impl), creationContext, isolate);    case Node::DOCUMENT_FRAGMENT_NODE:        if (impl->isShadowRoot())            return wrap(toShadowRoot(impl), creationContext, isolate);        return wrap(toDocumentFragment(impl), creationContext, isolate);    }    ASSERT_NOT_REACHED();    return V8Node::createWrapper(impl, creationContext, isolate);}
开发者ID:davemichael,项目名称:mojo,代码行数:23,


示例13: wrap

v8::Handle<v8::Object> wrap(Node* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate){    ASSERT(impl);    switch (impl->nodeType()) {    case Node::ELEMENT_NODE:        // For performance reasons, this is inlined from V8Element::wrap and must remain in sync.        if (impl->isHTMLElement())            return wrap(toHTMLElement(impl), creationContext, isolate);#if ENABLE(SVG)        if (impl->isSVGElement())            return wrap(toSVGElement(impl), creationContext, isolate);#endif        return V8Element::createWrapper(toElement(impl), creationContext, isolate);    case Node::ATTRIBUTE_NODE:        return wrap(static_cast<Attr*>(impl), creationContext, isolate);    case Node::TEXT_NODE:        return wrap(toText(impl), creationContext, isolate);    case Node::CDATA_SECTION_NODE:        return wrap(static_cast<CDATASection*>(impl), creationContext, isolate);    case Node::ENTITY_REFERENCE_NODE:        return wrap(static_cast<EntityReference*>(impl), creationContext, isolate);    case Node::ENTITY_NODE:        return wrap(static_cast<Entity*>(impl), creationContext, isolate);    case Node::PROCESSING_INSTRUCTION_NODE:        return wrap(static_cast<ProcessingInstruction*>(impl), creationContext, isolate);    case Node::COMMENT_NODE:        return wrap(static_cast<Comment*>(impl), creationContext, isolate);    case Node::DOCUMENT_NODE:        return wrap(toDocument(impl), creationContext, isolate);    case Node::DOCUMENT_TYPE_NODE:        return wrap(static_cast<DocumentType*>(impl), creationContext, isolate);    case Node::DOCUMENT_FRAGMENT_NODE:        return wrap(static_cast<DocumentFragment*>(impl), creationContext, isolate);    case Node::NOTATION_NODE:        return wrap(static_cast<Notation*>(impl), creationContext, isolate);    default:        break; // XPATH_NAMESPACE_NODE    }    return V8Node::createWrapper(impl, creationContext, isolate);}
开发者ID:Channely,项目名称:know-your-chrome,代码行数:40,


示例14: ASSERT

v8::Handle<v8::Object> V8CustomElement::createWrapper(PassRefPtr<Element> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate){    ASSERT(impl);    RefPtr<CustomElementConstructor> constructor = CustomElementRegistry::constructorOf(impl.get());    if (!constructor) {        v8::Handle<v8::Value> wrapperValue = WebCore::toV8(toHTMLUnknownElement(toHTMLElement(impl.get())), creationContext, isolate);        if (!wrapperValue.IsEmpty() && wrapperValue->IsObject())            return v8::Handle<v8::Object>::Cast(wrapperValue);        return v8::Handle<v8::Object>();    }    // The constructor and registered lifecycle callbacks should be visible only from main world.    // FIXME: This shouldn't be needed once each custom element has its own FunctionTemplate    // https://bugs.webkit.org/show_bug.cgi?id=108138    if (!CustomElementHelpers::isFeatureAllowed(creationContext->CreationContext())) {        v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &V8HTMLElement::info, impl.get(), isolate);        if (!wrapper.IsEmpty())            V8DOMWrapper::associateObjectWithWrapper(impl, &V8HTMLElement::info, wrapper, isolate, WrapperConfiguration::Dependent);        return wrapper;    }    v8::Handle<v8::Value> constructorValue = WebCore::toV8(constructor.get(), creationContext, isolate);    if (constructorValue.IsEmpty() || !constructorValue->IsObject())        return v8::Handle<v8::Object>();    v8::Handle<v8::Object> constructorWapper = v8::Handle<v8::Object>::Cast(constructorValue);    v8::Handle<v8::Object> prototype = v8::Handle<v8::Object>::Cast(constructorWapper->Get(v8::String::NewSymbol("prototype")));    WrapperTypeInfo* typeInfo = findWrapperTypeOf(prototype);    if (!typeInfo)        return v8::Handle<v8::Object>();    v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, typeInfo, impl.get(), isolate);    if (wrapper.IsEmpty())        return v8::Handle<v8::Object>();    wrapper->SetPrototype(prototype);    V8DOMWrapper::associateObjectWithWrapper(impl, typeInfo, wrapper, isolate, WrapperConfiguration::Dependent);    return wrapper;}
开发者ID:jbat100,项目名称:webkit,代码行数:39,


示例15: parentNode

void HTMLElement::setOuterHTML(const String& html, ExceptionState& es){    Node* p = parentNode();    if (!p || !p->isHTMLElement()) {        es.throwDOMException(NoModificationAllowedError);        return;    }    RefPtr<HTMLElement> parent = toHTMLElement(p);    RefPtr<Node> prev = previousSibling();    RefPtr<Node> next = nextSibling();    RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, parent.get(), AllowScriptingContent, es);    if (es.hadException())        return;    parent->replaceChild(fragment.release(), this, es);    RefPtr<Node> node = next ? next->previousSibling() : 0;    if (!es.hadException() && node && node->isTextNode())        mergeWithNextTextNode(node.release(), es);    if (!es.hadException() && prev && prev->isTextNode())        mergeWithNextTextNode(prev.release(), es);}
开发者ID:halton,项目名称:blink-crosswalk,代码行数:23,


示例16: endTagToString

// Serialize end tag of an specified element.void WebFrameSerializerImpl::endTagToString(    Element* element,    SerializeDomParam* param){    bool needSkip;    StringBuilder result;    // Do pre action for end tag.    result.append(preActionBeforeSerializeEndTag(element, param, &needSkip));    if (needSkip)        return;    // Write end tag when element has child/children.    if (element->hasChildren() || param->haveAddedContentsBeforeEnd) {        result.appendLiteral("</");        result.append(element->nodeName().lower());        result.append('>');    } else {        // Check whether we have to write end tag for empty element.        if (param->isHTMLDocument) {            result.append('>');            // FIXME: This code is horribly wrong.  WebFrameSerializerImpl must die.            if (!element->isHTMLElement() || !toHTMLElement(element)->ieForbidsInsertHTML()) {                // We need to write end tag when it is required.                result.appendLiteral("</");                result.append(element->nodeName().lower());                result.append('>');            }        } else {            // For xml base document.            result.appendLiteral(" />");        }    }    // Do post action for end tag.    result.append(postActionAfterSerializeEndTag(element, param));    // Save the result to data buffer.    saveHTMLContentToBuffer(result.toString(), param);}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:37,


示例17: DCHECK

HTMLElement* ScriptCustomElementDefinition::createElementSync(    Document& document,    const QualifiedName& tagName,    ExceptionState& exceptionState) {  DCHECK(ScriptState::current(m_scriptState->isolate()) == m_scriptState);  // Create an element  // https://dom.spec.whatwg.org/#concept-create-element  // 6. If definition is non-null  // 6.1. If the synchronous custom elements flag is set:  // 6.1.2. Set result to Construct(C). Rethrow any exceptions.  // Create an element and push to the construction stack.  // V8HTMLElement::constructorCustom() can only refer to  // window.document(), but it is different from the document here  // when it is an import document.  This is not exactly what the  // spec defines, but the public behavior matches to the spec.  Element* element = createElementForConstructor(document);  {    ConstructionStackScope constructionStackScope(this, element);    v8::TryCatch tryCatch(m_scriptState->isolate());    element = runConstructor();    if (tryCatch.HasCaught()) {      exceptionState.rethrowV8Exception(tryCatch.Exception());      return nullptr;    }  }  // 6.1.3. through 6.1.9.  checkConstructorResult(element, document, tagName, exceptionState);  if (exceptionState.hadException())    return nullptr;  DCHECK_EQ(element->getCustomElementState(), CustomElementState::Custom);  return toHTMLElement(element);}
开发者ID:ollie314,项目名称:chromium,代码行数:36,


示例18: shadow

HTMLElement* HTMLTextAreaElement::innerTextElement() const{    Node* node = shadow()->oldestShadowRoot()->firstChild();    ASSERT(!node || node->hasTagName(divTag));    return toHTMLElement(node);}
开发者ID:Spencerx,项目名称:webkit,代码行数:6,


示例19: IdTargetObserver

FormAttributeTargetObserver::FormAttributeTargetObserver(const AtomicString& id, FormAssociatedElement* element)    : IdTargetObserver(toHTMLElement(element)->treeScope().idTargetObserverRegistry(), id)    , m_element(element){}
开发者ID:chunywang,项目名称:blink-crosswalk,代码行数:5,


示例20: toHTMLElement

HTMLElement* toHTMLElement(FormAssociatedElement* associatedElement){    return const_cast<HTMLElement*>(toHTMLElement(static_cast<const FormAssociatedElement*>(associatedElement)));}
开发者ID:chunywang,项目名称:blink-crosswalk,代码行数:4,


示例21: ASSERT

void FormAssociatedElement::resetFormAttributeTargetObserver(){    ASSERT(toHTMLElement(this)->inDocument());    m_formAttributeTargetObserver = FormAttributeTargetObserver::create(toHTMLElement(this)->fastGetAttribute(formAttr), this);}
开发者ID:chunywang,项目名称:blink-crosswalk,代码行数:5,



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


C++ toHex函数代码示例
C++ toFrameView函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。