Back to index

lightning-sunbird  0.9+nobinonly
Functions
nsWebBrowserFind.cpp File Reference
#include "nsWebBrowserFind.h"
#include "nsFind.h"
#include "nsIComponentManager.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptSecurityManager.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIDOMWindow.h"
#include "nsIDOMWindowInternal.h"
#include "nsPIDOMWindow.h"
#include "nsIURI.h"
#include "nsIDocShell.h"
#include "nsIEnumerator.h"
#include "nsIDocShellTreeItem.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsIEventStateManager.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIFocusController.h"
#include "nsISelectionController.h"
#include "nsISelection.h"
#include "nsIFrame.h"
#include "nsITextControlFrame.h"
#include "nsReadableUtils.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIContent.h"
#include "nsContentCID.h"
#include "nsIServiceManager.h"
#include "nsIObserverService.h"
#include "nsISupportsPrimitives.h"
#include "nsITimelineService.h"

Go to the source code of this file.

Functions

static NS_DEFINE_IID (kRangeCID, NS_RANGE_CID)
static void FocusElementButNotDocument (nsIDocument *aDocument, nsIContent *aContent)
static PRBool IsNativeAnonymous (nsIContent *aContent)

Function Documentation

static void FocusElementButNotDocument ( nsIDocument aDocument,
nsIContent aContent 
) [static]

Definition at line 372 of file nsWebBrowserFind.cpp.

{
  nsIFocusController *focusController = nsnull;
  nsCOMPtr<nsPIDOMWindow> ourWindow =
    do_QueryInterface(aDocument->GetScriptGlobalObject());
  if (ourWindow)
    focusController = ourWindow->GetRootFocusController();
  if (!focusController)
    return;

  // Get previous focus
  nsCOMPtr<nsIDOMElement> oldFocusedElement;
  focusController->GetFocusedElement(getter_AddRefs(oldFocusedElement));
  nsCOMPtr<nsIContent> oldFocusedContent =
    do_QueryInterface(oldFocusedElement);

  // Notify focus controller of new focus for this document
  nsCOMPtr<nsIDOMElement> newFocusedElement(do_QueryInterface(aContent));
  focusController->SetFocusedElement(newFocusedElement);

  nsIPresShell* presShell = aDocument->GetShellAt(0);
  nsIEventStateManager* esm = presShell->GetPresContext()->EventStateManager();

  // Temporarily set esm::mCurrentFocus so that esm::GetContentState() tells 
  // layout system to show focus on this element. 
  esm->SetFocusedContent(aContent);  // Reset back to null at the end.
  aDocument->BeginUpdate(UPDATE_CONTENT_STATE);
  aDocument->ContentStatesChanged(oldFocusedContent, aContent, 
                                  NS_EVENT_STATE_FOCUS);
  aDocument->EndUpdate(UPDATE_CONTENT_STATE);

  // Reset esm::mCurrentFocus = nsnull for this doc, so when this document
  // does get focus next time via preHandleEvent() NS_GOTFOCUS,
  // the old document gets blurred
  esm->SetFocusedContent(nsnull);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool IsNativeAnonymous ( nsIContent aContent) [static]

Definition at line 410 of file nsWebBrowserFind.cpp.

{
    while (aContent) {
        nsIContent* bindingParent = aContent->GetBindingParent();
        if (bindingParent == aContent) {
            return PR_TRUE;
        }

        aContent = bindingParent;
    }

    return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_IID ( kRangeCID  ,
NS_RANGE_CID   
) [static]