本文整理汇总了C++中HTMLLinkElement::GetHrefURI方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLLinkElement::GetHrefURI方法的具体用法?C++ HTMLLinkElement::GetHrefURI怎么用?C++ HTMLLinkElement::GetHrefURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLLinkElement
的用法示例。
在下文中一共展示了HTMLLinkElement::GetHrefURI方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNearestPredecessor
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:
ImportLoader*
ImportManager::Find(nsINode* aLink)
{
HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(aLink);
nsCOMPtr<nsIURI> uri = linkElement->GetHrefURI();
return mImports.GetWeak(uri);
}