本文整理汇总了C++中GetCurrentDoc函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCurrentDoc函数的具体用法?C++ GetCurrentDoc怎么用?C++ GetCurrentDoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetCurrentDoc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NS_ENSURE_SUCCESS
nsresult
nsHTMLSharedElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
PRBool aNotify)
{
nsresult rv = nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aPrefix,
aValue, aNotify);
NS_ENSURE_SUCCESS(rv, rv);
// If the href attribute of a <base> tag is changing, we may need to update
// the document's base URI, which will cause all the links on the page to be
// re-resolved given the new base. If the target attribute is changing, we
// similarly need to change the base target.
if (mNodeInfo->Equals(nsGkAtoms::base) &&
aNameSpaceID == kNameSpaceID_None &&
IsInDoc()) {
if (aName == nsGkAtoms::href) {
SetBaseURIUsingFirstBaseWithHref(GetCurrentDoc(), this);
} else if (aName == nsGkAtoms::target) {
SetBaseTargetUsingFirstBaseWithTarget(GetCurrentDoc(), this);
}
}
return NS_OK;
}
示例2: NS_ENSURE_TRUE
NS_IMETHODIMP
nsHTMLMenuElement::SendShowEvent()
{
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_DOM_SECURITY_ERR);
nsCOMPtr<nsIDocument> document = GetCurrentDoc();
if (!document) {
return NS_ERROR_FAILURE;
}
nsEvent event(true, NS_SHOW_EVENT);
event.flags |= NS_EVENT_FLAG_CANT_CANCEL | NS_EVENT_FLAG_CANT_BUBBLE;
nsCOMPtr<nsIPresShell> shell = document->GetShell();
if (!shell) {
return NS_ERROR_FAILURE;
}
nsRefPtr<nsPresContext> presContext = shell->GetPresContext();
nsEventStatus status = nsEventStatus_eIgnore;
nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
&event, nullptr, &status);
return NS_OK;
}
示例3: GetCurrentDoc
void
HTMLLinkElement::UnbindFromTree(bool aDeep, bool aNullParent)
{
// If this link is ever reinserted into a document, it might
// be under a different xml:base, so forget the cached state now.
Link::ResetLinkState(false, Link::ElementHasHref());
// Once we have XPCOMGC we shouldn't need to call UnbindFromTree during Unlink
// and so this messy event dispatch can go away.
nsCOMPtr<nsIDocument> oldDoc = GetCurrentDoc();
// Check for a ShadowRoot because link elements are inert in a
// ShadowRoot.
ShadowRoot* oldShadowRoot = GetBindingParent() ?
GetBindingParent()->GetShadowRoot() : nullptr;
if (oldDoc && !oldShadowRoot) {
oldDoc->UnregisterPendingLinkUpdate(this);
}
CreateAndDispatchEvent(oldDoc, NS_LITERAL_STRING("DOMLinkRemoved"));
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
UpdateStyleSheetInternal(oldDoc, oldShadowRoot);
UpdateImport();
}
示例4: GetCurrentDoc
void
nsXTFElementWrapper::RegUnregAccessKey(PRBool aDoReg)
{
nsIDocument* doc = GetCurrentDoc();
if (!doc)
return;
// Get presentation shell 0
nsIPresShell *presShell = doc->GetShell();
if (!presShell)
return;
nsPresContext *presContext = presShell->GetPresContext();
if (!presContext)
return;
nsEventStateManager *esm = presContext->EventStateManager();
if (!esm)
return;
// Register or unregister as appropriate.
nsCOMPtr<nsIDOMAttr> accesskeyNode;
GetXTFElement()->GetAccesskeyNode(getter_AddRefs(accesskeyNode));
if (!accesskeyNode)
return;
nsAutoString accessKey;
accesskeyNode->GetValue(accessKey);
if (aDoReg && !accessKey.IsEmpty())
esm->RegisterAccessKey(this, (PRUint32)accessKey.First());
else
esm->UnregisterAccessKey(this, (PRUint32)accessKey.First());
}
示例5: GetCurrentDoc
//
/// Calls CreateAnyView(*doc) where doc is the current document.
//
void
TDocManager::ViewCreate()
{
TDocument* doc = GetCurrentDoc();
if (doc)
CreateAnyView(*doc);
}
示例6: UnsetFlags
void
HTMLAnchorElement::UnbindFromTree(bool aDeep, bool aNullParent)
{
// Cancel any DNS prefetches
// Note: Must come before ResetLinkState. If called after, it will recreate
// mCachedURI based on data that is invalid - due to a call to GetHostname.
// If prefetch was deferred, clear flag and move on
if (HasFlag(HTML_ANCHOR_DNS_PREFETCH_DEFERRED))
UnsetFlags(HTML_ANCHOR_DNS_PREFETCH_DEFERRED);
// Else if prefetch was requested, clear flag and send cancellation
else if (HasFlag(HTML_ANCHOR_DNS_PREFETCH_REQUESTED)) {
UnsetFlags(HTML_ANCHOR_DNS_PREFETCH_REQUESTED);
// Possible that hostname could have changed since binding, but since this
// covers common cases, most DNS prefetch requests will be canceled
nsHTMLDNSPrefetch::CancelPrefetchLow(this, NS_ERROR_ABORT);
}
// If this link is ever reinserted into a document, it might
// be under a different xml:base, so forget the cached state now.
Link::ResetLinkState(false, Link::ElementHasHref());
nsIDocument* doc = GetCurrentDoc();
if (doc) {
doc->UnregisterPendingLinkUpdate(this);
}
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
}
示例7: GetFirstLabelableDescendant
nsGenericHTMLElement*
HTMLLabelElement::GetLabeledElement() const
{
nsAutoString elementId;
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::_for, elementId)) {
// No @for, so we are a label for our first form control element.
// Do a depth-first traversal to look for the first form control element.
return GetFirstLabelableDescendant();
}
// We have a @for. The id has to be linked to an element in the same document
// and this element should be a labelable form control.
nsIDocument* doc = GetCurrentDoc();
if (!doc) {
return nullptr;
}
Element* element = doc->GetElementById(elementId);
if (element && element->IsLabelable()) {
return static_cast<nsGenericHTMLElement*>(element);
}
return nullptr;
}
示例8: GetCurrentDoc
void
nsHTMLMetaElement::UnbindFromTree(bool aDeep, bool aNullParent)
{
nsCOMPtr<nsIDocument> oldDoc = GetCurrentDoc();
CreateAndDispatchEvent(oldDoc, NS_LITERAL_STRING("DOMMetaRemoved"));
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
}
示例9: GetCurrentDoc
void
nsHTMLStyleElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
{
nsCOMPtr<nsIDocument> oldDoc = GetCurrentDoc();
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
UpdateStyleSheetInternal(oldDoc);
}
示例10: GetCurrentDoc
void
SVGTitleElement::SendTitleChangeEvent(bool aBound)
{
nsIDocument* doc = GetCurrentDoc();
if (doc) {
doc->NotifyPossibleTitleChange(aBound);
}
}
示例11: GetCurrentDoc
void
HTMLStyleElement::UnbindFromTree(bool aDeep, bool aNullParent)
{
nsCOMPtr<nsIDocument> oldDoc = GetCurrentDoc();
ShadowRoot* oldShadow = GetContainingShadow();
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
UpdateStyleSheetInternal(oldDoc, oldShadow);
}
示例12: GetCurrentDoc
void
nsXMLStylesheetPI::UnbindFromTree(bool aDeep, bool aNullParent)
{
nsCOMPtr<nsIDocument> oldDoc = GetCurrentDoc();
nsXMLProcessingInstruction::UnbindFromTree(aDeep, aNullParent);
UpdateStyleSheetInternal(oldDoc);
}
示例13: GetCurrentDoc
void
nsSVGElement::FlushAnimations()
{
nsIDocument* doc = GetCurrentDoc();
if (doc) {
nsSMILAnimationController* smilController = doc->GetAnimationController();
if (smilController) {
smilController->FlushResampleRequests();
}
}
}
示例14: GetCurrentDoc
void
SVGUseElement::TriggerReclone()
{
nsIDocument *doc = GetCurrentDoc();
if (!doc)
return;
nsIPresShell *presShell = doc->GetShell();
if (!presShell)
return;
presShell->PostRecreateFramesFor(this);
}
示例15: GetCurrentDoc
void CMainFrame::OnSelchangeGroupList ()
{
CFusionDoc *pDoc = GetCurrentDoc ();
int CurSel;
CurSel = m_wndGroupBar.m_comboBox.GetCurSel ();
if (CurSel != LB_ERR)
{
pDoc->mCurrentGroup = m_wndGroupBar.m_comboBox.GetItemData (CurSel);
m_wndTabControls->GrpTab->UpdateTabDisplay (pDoc);
}
}