本文整理汇总了C++中HTMLLinkElement类的典型用法代码示例。如果您正苦于以下问题:C++ HTMLLinkElement类的具体用法?C++ HTMLLinkElement怎么用?C++ HTMLLinkElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTMLLinkElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MOZ_ASSERT
ImportLoader* ImportManager::GetNearestPredecessor(nsINode* aNode)
{
// Return the previous link if there is any in the same document.
nsIDocument* doc = aNode->OwnerDoc();
int32_t idx = doc->IndexOfSubImportLink(aNode);
MOZ_ASSERT(idx != -1, "aNode must be a sub import link of its owner document");
for (; idx > 0; idx--) {
HTMLLinkElement* link =
static_cast<HTMLLinkElement*>(doc->GetSubImportLink(idx - 1));
nsCOMPtr<nsIURI> uri = link->GetHrefURI();
RefPtr<ImportLoader> ret;
mImports.Get(uri, getter_AddRefs(ret));
// Only main referrer links are interesting.
if (ret->GetMainReferrer() == link) {
return ret;
}
}
if (idx == 0) {
if (doc->IsMasterDocument()) {
// If there is no previous one, and it was the master document, then
// there is no predecessor.
return nullptr;
}
// Else we find the main referrer of the import parent of the link's document.
// And do a recursion.
ImportLoader* owner = Find(doc);
MOZ_ASSERT(owner);
nsCOMPtr<nsINode> mainReferrer = owner->GetMainReferrer();
return GetNearestPredecessor(mainReferrer);
}
return nullptr;
}
示例2: manifestURL
WebURL WebDocument::manifestURL() const {
const Document* document = constUnwrap<Document>();
HTMLLinkElement* linkElement = document->linkManifest();
if (!linkElement)
return WebURL();
return linkElement->href();
}
示例3:
ImportLoader*
ImportManager::Find(nsINode* aLink)
{
HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(aLink);
nsCOMPtr<nsIURI> uri = linkElement->GetHrefURI();
return mImports.GetWeak(uri);
}
示例4: manifestUseCredentials
bool WebDocument::manifestUseCredentials() const
{
const Document* document = constUnwrap<Document>();
HTMLLinkElement* linkElement = document->linkManifest();
if (!linkElement)
return false;
return equalIgnoringCase(linkElement->fastGetAttribute(HTMLNames::crossoriginAttr), "use-credentials");
}
示例5: jsHTMLLinkElementTarget
JSValue jsHTMLLinkElementTarget(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSHTMLLinkElement* castedThis = static_cast<JSHTMLLinkElement*>(asObject(slotBase));
UNUSED_PARAM(exec);
HTMLLinkElement* imp = static_cast<HTMLLinkElement*>(castedThis->impl());
JSValue result = jsString(exec, imp->target());
return result;
}
示例6: jsHTMLLinkElementSheet
JSValue jsHTMLLinkElementSheet(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSHTMLLinkElement* castedThis = static_cast<JSHTMLLinkElement*>(asObject(slotBase));
UNUSED_PARAM(exec);
HTMLLinkElement* imp = static_cast<HTMLLinkElement*>(castedThis->impl());
JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->sheet()));
return result;
}
示例7: jsHTMLLinkElementDisabled
JSValue jsHTMLLinkElementDisabled(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSHTMLLinkElement* castedThis = static_cast<JSHTMLLinkElement*>(asObject(slotBase));
UNUSED_PARAM(exec);
HTMLLinkElement* imp = static_cast<HTMLLinkElement*>(castedThis->impl());
JSValue result = jsBoolean(imp->disabled());
return result;
}
示例8: jsHTMLLinkElementType
JSValue jsHTMLLinkElementType(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSHTMLLinkElement* castedThis = static_cast<JSHTMLLinkElement*>(asObject(slotBase));
UNUSED_PARAM(exec);
HTMLLinkElement* imp = static_cast<HTMLLinkElement*>(castedThis->impl());
JSValue result = jsString(exec, imp->getAttribute(WebCore::HTMLNames::typeAttr));
return result;
}
示例9: TEST
TEST(HTMLLinkElementSizesAttributeTest,
setSizesAttribute_updatesSizesPropertyValue) {
Document* document = Document::create();
HTMLLinkElement* link =
HTMLLinkElement::create(*document, /* createdByParser: */ false);
DOMTokenList* sizes = link->sizes();
EXPECT_EQ(nullAtom, sizes->value());
link->setAttribute(HTMLNames::sizesAttr, "y x ");
EXPECT_EQ("y x ", sizes->value());
}
示例10: parseIconLink
PassRefPtr<IconFetcher> IconFetcher::create(Frame* frame, IconFetcherClient* client)
{
Document* document = frame->document();
HTMLHeadElement* head = document->head();
if (!head)
return 0;
Vector<IconLinkEntry> entries;
for (Node* n = head; n; n = n->traverseNextNode()) {
if (!n->hasTagName(linkTag))
continue;
HTMLLinkElement* link = static_cast<HTMLLinkElement*>(n);
if (!link->isIcon())
continue;
parseIconLink(link, entries);
}
if (entries.isEmpty())
return 0;
// Check if any of the entries have the same type as the native icon type.
// FIXME: This should be way more sophisticated, and handle conversion
// of multisize formats for example.
for (unsigned i = 0; i < entries.size(); i++) {
const IconLinkEntry& entry = entries[i];
if (entry.type() == NativeIconType) {
RefPtr<IconFetcher> iconFetcher = adoptRef(new IconFetcher(frame, client));
iconFetcher->m_entries.append(entry);
iconFetcher->loadEntry();
return iconFetcher.release();
}
}
return 0;
}
示例11: TEST_F
TEST_F(WebDocumentTest, ManifestUseCredentials)
{
loadURL(std::string(kDefaultOrigin) + kManifestDummyFilePath);
WebDocument webDoc = topWebDocument();
Document* document = topDocument();
HTMLLinkElement* linkManifest = document->linkManifest();
// No crossorigin attribute was set so credentials shouldn't be used.
ASSERT_FALSE(linkManifest->fastHasAttribute(HTMLNames::crossoriginAttr));
ASSERT_FALSE(webDoc.manifestUseCredentials());
// Crossorigin set to a random string shouldn't trigger using credentials.
linkManifest->setAttribute(HTMLNames::crossoriginAttr, "foobar");
ASSERT_FALSE(webDoc.manifestUseCredentials());
// Crossorigin set to 'anonymous' shouldn't trigger using credentials.
linkManifest->setAttribute(HTMLNames::crossoriginAttr, "anonymous");
ASSERT_FALSE(webDoc.manifestUseCredentials());
// Crossorigin set to 'use-credentials' should trigger using credentials.
linkManifest->setAttribute(HTMLNames::crossoriginAttr, "use-credentials");
ASSERT_TRUE(webDoc.manifestUseCredentials());
}
示例12:
v8::Handle<v8::Value> V8HTMLLinkElement::sizesAttrGetterCustom(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
HTMLLinkElement* imp = V8HTMLLinkElement::toNative(info.Holder());
return toV8Fast(imp->sizes(), info, imp);
}
示例13: ENABLE
void DocumentStyleSheetCollection::collectActiveStyleSheets(Vector<RefPtr<StyleSheet> >& sheets)
{
if (m_document->settings() && !m_document->settings()->authorAndUserStylesEnabled())
return;
StyleSheetCandidateListHashSet::iterator begin = m_styleSheetCandidateNodes.begin();
StyleSheetCandidateListHashSet::iterator end = m_styleSheetCandidateNodes.end();
for (StyleSheetCandidateListHashSet::iterator it = begin; it != end; ++it) {
Node* n = *it;
StyleSheet* sheet = 0;
if (n->nodeType() == Node::PROCESSING_INSTRUCTION_NODE) {
// Processing instruction (XML documents only).
// We don't support linking to embedded CSS stylesheets, see <https://bugs.webkit.org/show_bug.cgi?id=49281> for discussion.
ProcessingInstruction* pi = static_cast<ProcessingInstruction*>(n);
sheet = pi->sheet();
#if ENABLE(XSLT)
// Don't apply XSL transforms to already transformed documents -- <rdar://problem/4132806>
if (pi->isXSL() && !m_document->transformSourceDocument()) {
// Don't apply XSL transforms until loading is finished.
if (!m_document->parsing())
m_document->applyXSLTransform(pi);
return;
}
#endif
} else if ((n->isHTMLElement() && (n->hasTagName(linkTag) || n->hasTagName(styleTag)))
#if ENABLE(SVG)
|| (n->isSVGElement() && n->hasTagName(SVGNames::styleTag))
#endif
) {
Element* e = toElement(n);
AtomicString title = e->getAttribute(titleAttr);
bool enabledViaScript = false;
if (e->hasTagName(linkTag)) {
// <LINK> element
HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(n);
if (linkElement->isDisabled())
continue;
enabledViaScript = linkElement->isEnabledViaScript();
if (linkElement->styleSheetIsLoading()) {
// it is loading but we should still decide which style sheet set to use
if (!enabledViaScript && !title.isEmpty() && m_preferredStylesheetSetName.isEmpty()) {
const AtomicString& rel = e->getAttribute(relAttr);
if (!rel.contains("alternate")) {
m_preferredStylesheetSetName = title;
m_selectedStylesheetSetName = title;
}
}
continue;
}
if (!linkElement->sheet())
title = nullAtom;
}
// Get the current preferred styleset. This is the
// set of sheets that will be enabled.
#if ENABLE(SVG)
if (e->hasTagName(SVGNames::styleTag))
sheet = static_cast<SVGStyleElement*>(n)->sheet();
else
#endif
{
if (e->hasTagName(linkTag))
sheet = static_cast<HTMLLinkElement*>(n)->sheet();
else
// <STYLE> element
sheet = toHTMLStyleElement(e)->sheet();
}
// Check to see if this sheet belongs to a styleset
// (thus making it PREFERRED or ALTERNATE rather than
// PERSISTENT).
AtomicString rel = e->getAttribute(relAttr);
if (!enabledViaScript && !title.isEmpty()) {
// Yes, we have a title.
if (m_preferredStylesheetSetName.isEmpty()) {
// No preferred set has been established. If
// we are NOT an alternate sheet, then establish
// us as the preferred set. Otherwise, just ignore
// this sheet.
if (e->hasTagName(styleTag) || !rel.contains("alternate"))
m_preferredStylesheetSetName = m_selectedStylesheetSetName = title;
}
if (title != m_preferredStylesheetSetName)
sheet = 0;
}
if (rel.contains("alternate") && title.isEmpty())
sheet = 0;
}
if (sheet)
sheets.append(sheet);
}
}
示例14: INC_STATS
v8::Handle<v8::Value> V8HTMLLinkElement::sizesAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLLinkElement.sizes._get");
HTMLLinkElement* imp = V8HTMLLinkElement::toNative(info.Holder());
return toV8(imp->sizes());
}
示例15: didFinishOrFailLoading
void FrameLoaderClientBlackBerry::dispatchDidFinishLoad()
{
didFinishOrFailLoading(ResourceError());
if (m_webPagePrivate->m_dumpRenderTree)
m_webPagePrivate->m_dumpRenderTree->didFinishLoadForFrame(m_frame);
if (!isMainFrame() || m_webPagePrivate->m_webSettings->isEmailMode()
|| !m_frame->document() || !m_frame->document()->head())
return;
HTMLHeadElement* headElement = m_frame->document()->head();
// FIXME: Handle NOSCRIPT special case?
// Process document metadata.
RefPtr<NodeList> nodeList = headElement->getElementsByTagName(HTMLNames::metaTag.localName());
unsigned int size = nodeList->length();
ScopeArray<WebString> headers;
// This may allocate more space than needed since not all meta elements will be http-equiv.
headers.reset(new WebString[2 * size]);
unsigned headersLength = 0;
for (unsigned i = 0; i < size; ++i) {
HTMLMetaElement* metaElement = static_cast<HTMLMetaElement*>(nodeList->item(i));
if (WTF::equalIgnoringCase(metaElement->name(), "apple-mobile-web-app-capable")
&& WTF::equalIgnoringCase(metaElement->content().stripWhiteSpace(), "yes"))
m_webPagePrivate->m_client->setWebAppCapable();
else {
String httpEquiv = metaElement->httpEquiv().stripWhiteSpace();
String content = metaElement->content().stripWhiteSpace();
if (!httpEquiv.isNull() && !content.isNull()) {
headers[headersLength++] = httpEquiv;
headers[headersLength++] = content;
}
}
}
if (headersLength > 0)
m_webPagePrivate->m_client->setMetaHeaders(headers, headersLength);
nodeList = headElement->getElementsByTagName(HTMLNames::linkTag.localName());
size = nodeList->length();
for (unsigned i = 0; i < size; ++i) {
HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(nodeList->item(i));
String href = linkElement->href().string();
if (!href.isEmpty()) {
String title = linkElement->title();
if (WTF::equalIgnoringCase(linkElement->rel(), "apple-touch-icon"))
m_webPagePrivate->m_client->setLargeIcon(href.latin1().data());
else if (WTF::equalIgnoringCase(linkElement->rel(), "search")) {
if (WTF::equalIgnoringCase(linkElement->type(), "application/opensearchdescription+xml"))
m_webPagePrivate->m_client->setSearchProviderDetails(title.utf8().data(), href.utf8().data());
} else if (WTF::equalIgnoringCase(linkElement->rel(), "alternate")
&& (WTF::equalIgnoringCase(linkElement->type(), "application/rss+xml")
|| WTF::equalIgnoringCase(linkElement->type(), "application/atom+xml")))
m_webPagePrivate->m_client->setAlternateFeedDetails(title.utf8().data(), href.utf8().data());
}
}
#if ENABLE(BLACKBERRY_CREDENTIAL_PERSIST)
if (!m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled())
credentialManager().autofillPasswordForms(m_frame->document()->forms());
#endif
}