本文整理汇总了C++中HTMLMetaElement::content方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLMetaElement::content方法的具体用法?C++ HTMLMetaElement::content怎么用?C++ HTMLMetaElement::content使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLMetaElement
的用法示例。
在下文中一共展示了HTMLMetaElement::content方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: metaData
/*!
\since 4.5
\brief Returns the meta data in this frame as a QMultiMap
The meta data consists of the name and content attributes of the
of the \c{<meta>} tags in the HTML document.
For example:
\code
<html>
<head>
<meta name="description" content="This document is a tutorial about Qt development">
<meta name="keywords" content="Qt, WebKit, Programming">
</head>
...
</html>
\endcode
Given the above HTML code the metaData() function will return a map with two entries:
\table
\header \o Key
\o Value
\row \o "description"
\o "This document is a tutorial about Qt development"
\row \o "keywords"
\o "Qt, WebKit, Programming"
\endtable
This function returns a multi map to support multiple meta tags with the same attribute name.
*/
QMultiMap<QString, QString> QWebFrame::metaData() const
{
if (!d->frame->document())
return QMap<QString, QString>();
QMultiMap<QString, QString> map;
Document* doc = d->frame->document();
RefPtr<NodeList> list = doc->getElementsByTagName("meta");
unsigned len = list->length();
for (unsigned i = 0; i < len; i++) {
HTMLMetaElement* meta = static_cast<HTMLMetaElement*>(list->item(i));
map.insert(meta->name(), meta->content());
}
return map;
}
示例2: getValueProperty
JSValue* JSHTMLMetaElement::getValueProperty(ExecState* exec, int token) const
{
switch (token) {
case ContentAttrNum: {
HTMLMetaElement* imp = static_cast<HTMLMetaElement*>(impl());
return jsString(exec, imp->content());
}
case HttpEquivAttrNum: {
HTMLMetaElement* imp = static_cast<HTMLMetaElement*>(impl());
return jsString(exec, imp->httpEquiv());
}
case NameAttrNum: {
HTMLMetaElement* imp = static_cast<HTMLMetaElement*>(impl());
return jsString(exec, imp->name());
}
case SchemeAttrNum: {
HTMLMetaElement* imp = static_cast<HTMLMetaElement*>(impl());
return jsString(exec, imp->scheme());
}
case ConstructorAttrNum:
return getConstructor(exec);
}
return 0;
}
示例3: dispatchDidFinishLoad
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
}