當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetCurrentDoc函數代碼示例

本文整理匯總了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;
}
開發者ID:LittleForker,項目名稱:mozilla-central,代碼行數:25,代碼來源:nsHTMLSharedElement.cpp

示例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;
}
開發者ID:bebef1987,項目名稱:mozilla-central,代碼行數:25,代碼來源:nsHTMLMenuElement.cpp

示例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();
}
開發者ID:Balakrishnan-Vivek,項目名稱:gecko-dev,代碼行數:25,代碼來源:HTMLLinkElement.cpp

示例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());
}
開發者ID:nikhilm,項目名稱:v8monkey,代碼行數:34,代碼來源:nsXTFElementWrapper.cpp

示例5: GetCurrentDoc

//
/// Calls CreateAnyView(*doc) where doc is the current document.
//
void
TDocManager::ViewCreate()
{
  TDocument* doc = GetCurrentDoc();
  if (doc)
    CreateAnyView(*doc);
}
開發者ID:Meridian59,項目名稱:Meridian59,代碼行數:10,代碼來源:docmanag.cpp

示例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);
}
開發者ID:L2-D2,項目名稱:gecko-dev,代碼行數:29,代碼來源:HTMLAnchorElement.cpp

示例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;
}
開發者ID:lofter2011,項目名稱:Icefox,代碼行數:25,代碼來源:HTMLLabelElement.cpp

示例8: GetCurrentDoc

void
nsHTMLMetaElement::UnbindFromTree(bool aDeep, bool aNullParent)
{
  nsCOMPtr<nsIDocument> oldDoc = GetCurrentDoc();
  CreateAndDispatchEvent(oldDoc, NS_LITERAL_STRING("DOMMetaRemoved"));
  nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
}
開發者ID:almet,項目名稱:mozilla-central,代碼行數:7,代碼來源:nsHTMLMetaElement.cpp

示例9: GetCurrentDoc

void
nsHTMLStyleElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
{
  nsCOMPtr<nsIDocument> oldDoc = GetCurrentDoc();

  nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
  UpdateStyleSheetInternal(oldDoc);
}
開發者ID:SecareLupus,項目名稱:Drood,代碼行數:8,代碼來源:nsHTMLStyleElement.cpp

示例10: GetCurrentDoc

void
SVGTitleElement::SendTitleChangeEvent(bool aBound)
{
  nsIDocument* doc = GetCurrentDoc();
  if (doc) {
    doc->NotifyPossibleTitleChange(aBound);
  }
}
開發者ID:CodeSpeaker,項目名稱:gecko-dev,代碼行數:8,代碼來源:SVGTitleElement.cpp

示例11: GetCurrentDoc

void
HTMLStyleElement::UnbindFromTree(bool aDeep, bool aNullParent)
{
  nsCOMPtr<nsIDocument> oldDoc = GetCurrentDoc();
  ShadowRoot* oldShadow = GetContainingShadow();
  nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
  UpdateStyleSheetInternal(oldDoc, oldShadow);
}
開發者ID:PatMart,項目名稱:gecko-dev,代碼行數:8,代碼來源:HTMLStyleElement.cpp

示例12: GetCurrentDoc

void
nsXMLStylesheetPI::UnbindFromTree(bool aDeep, bool aNullParent)
{
  nsCOMPtr<nsIDocument> oldDoc = GetCurrentDoc();

  nsXMLProcessingInstruction::UnbindFromTree(aDeep, aNullParent);
  UpdateStyleSheetInternal(oldDoc);
}
開發者ID:AntonSilviu,項目名稱:v8monkey,代碼行數:8,代碼來源:nsXMLStylesheetPI.cpp

示例13: GetCurrentDoc

void
nsSVGElement::FlushAnimations()
{
  nsIDocument* doc = GetCurrentDoc();
  if (doc) {
    nsSMILAnimationController* smilController = doc->GetAnimationController();
    if (smilController) {
      smilController->FlushResampleRequests();
    }
  }
}
開發者ID:AllenDou,項目名稱:firefox,代碼行數:11,代碼來源:nsSVGElement.cpp

示例14: GetCurrentDoc

void
SVGUseElement::TriggerReclone()
{
  nsIDocument *doc = GetCurrentDoc();
  if (!doc)
    return;
  nsIPresShell *presShell = doc->GetShell();
  if (!presShell)
    return;
  presShell->PostRecreateFramesFor(this);
}
開發者ID:JSilver99,項目名稱:mozilla-central,代碼行數:11,代碼來源:SVGUseElement.cpp

示例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);
	}
}
開發者ID:RealityFactory,項目名稱:Genesis3D-Tools,代碼行數:12,代碼來源:MainFrm.cpp


注:本文中的GetCurrentDoc函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。