Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes
nsWebShellWindow Class Reference

#include <nsWebShellWindow.h>

Inheritance diagram for nsWebShellWindow:
Inheritance graph
[legend]
Collaboration diagram for nsWebShellWindow:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsWebShellWindow ()
NS_DECL_ISUPPORTS_INHERITED
nsresult 
Initialize (nsIXULWindow *aParent, nsIAppShell *aShell, nsIURI *aUrl, PRInt32 aInitialWidth, PRInt32 aInitialHeight, PRBool aIsHiddenWindow, nsWidgetInitData &widgetInitData)
nsresult Toolbar ()
NS_DECL_NSIWEBPROGRESSLISTENER
NS_IMETHOD 
Destroy ()
NS_DECL_ISUPPORTS
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIXULWINDOW
NS_DECL_NSIBASEWINDOW void 
LockUntilChromeLoad ()
PRBool IsLocked () const
void initWindow (in nativeWindow parentNativeWindow, in nsIWidget parentWidget, in long x, in long y, in long cx, in long cy)
void create ()
void destroy ()
void setPosition (in long x, in long y)
void getPosition (out long x, out long y)
void setSize (in long cx, in long cy, in boolean fRepaint)
void getSize (out long cx, out long cy)
void setPositionAndSize (in long x, in long y, in long cx, in long cy, in boolean fRepaint)
void getPositionAndSize (out long x, out long y, out long cx, out long cy)
void repaint (in boolean force)
 Tell the window to repaint itself.
void setFocus ()
 Give the window focus.
void getInterface (in nsIIDRef uuid,[iid_is(uuid), retval] out nsQIResult result)
 Retrieves the specified interface pointer.
nsIDocShellTreeItem getContentShellById (in wstring ID)
 The content shell specified by the supplied id.
void addChildWindow (in nsIXULWindow aChild)
 Tell this window that it has picked up a child XUL window.
void removeChildWindow (in nsIXULWindow aChild)
 Tell this window that it has lost a child XUL window.
void center (in nsIXULWindow aRelative, in boolean aScreen, in boolean aAlert)
 Move the window to a centered position.
void showModal ()
 Shows the window as a modal window.
nsIXULWindow createNewWindow (in PRInt32 aChromeFlags, in nsIAppShell aAppShell)
 Create a new window.
void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus)
 Notification indicating the state has changed for one of the requests associated with aWebProgress.
void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress)
 Notification that the progress has changed for one of the requests associated with aWebProgress.
void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI aLocation)
 Called when the location of the window being watched changes.
void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage)
 Notification that the status of a request has changed.
void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aState)
 Notification called for security progress.

Public Attributes

attribute nsIWidget parentWidget
attribute nativeWindow parentNativeWindow
attribute boolean visibility
attribute boolean enabled
attribute boolean blurSuppression
 set blurSuppression to true to suppress handling of blur events.
readonly attribute nsIWidget mainWidget
attribute wstring title
readonly attribute nsIDocShell docShell
 The docshell owning the XUL for this window.
attribute boolean intrinsicallySized
 Indicates if this window is instrinsically sized.
readonly attribute
nsIDocShellTreeItem 
primaryContentShell
 The primary content shell.
const unsigned long lowestZ = 0
const unsigned long loweredZ = 4
const unsigned long normalZ = 5
const unsigned long raisedZ = 6
const unsigned long highestZ = 9
attribute unsigned long zLevel
attribute PRUint32 contextFlags
 contextFlags are from nsIWindowCreator2
attribute PRUint32 chromeFlags
attribute nsIXULBrowserWindow XULBrowserWindow
const unsigned long STATE_START = 0x00000001
 State Transition Flags.
const unsigned long STATE_REDIRECTING = 0x00000002
const unsigned long STATE_TRANSFERRING = 0x00000004
const unsigned long STATE_NEGOTIATING = 0x00000008
const unsigned long STATE_STOP = 0x00000010
const unsigned long STATE_IS_REQUEST = 0x00010000
 State Type Flags.
const unsigned long STATE_IS_DOCUMENT = 0x00020000
const unsigned long STATE_IS_NETWORK = 0x00040000
const unsigned long STATE_IS_WINDOW = 0x00080000
const unsigned long STATE_RESTORING = 0x01000000
 State Modifier Flags.
const unsigned long STATE_IS_INSECURE = 0x00000004
 State Security Flags.
const unsigned long STATE_IS_BROKEN = 0x00000001
const unsigned long STATE_IS_SECURE = 0x00000002
const unsigned long STATE_SECURE_HIGH = 0x00040000
 Security Strength Flags.
const unsigned long STATE_SECURE_MED = 0x00010000
const unsigned long STATE_SECURE_LOW = 0x00020000

Protected Types

enum  persistentAttributes { PAD_MISC = 0x1, PAD_POSITION = 0x2, PAD_SIZE = 0x4 }

Protected Member Functions

virtual ~nsWebShellWindow ()
nsCOMPtr< nsIDOMDocumentGetNamedDOMDoc (const nsAString &aWebShellName)
void LoadNativeMenus (nsIDOMDocument *aDOMDoc, nsIWidget *aParentWindow)
void LoadContentAreas ()
PRBool ExecuteCloseHandler ()
 ExecuteCloseHandler - Run the close handler, if any.
void SetPersistenceTimer (PRUint32 aDirtyFlags)
NS_IMETHOD EnsureChromeTreeOwner ()
NS_IMETHOD EnsureContentTreeOwner ()
NS_IMETHOD EnsurePrimaryContentTreeOwner ()
NS_IMETHOD EnsurePrompter ()
NS_IMETHOD EnsureAuthPrompter ()
void OnChromeLoaded ()
void StaggerPosition (PRInt32 &aRequestedX, PRInt32 &aRequestedY, PRInt32 aSpecWidth, PRInt32 aSpecHeight)
PRBool LoadPositionFromXUL ()
PRBool LoadSizeFromXUL ()
PRBool LoadMiscPersistentAttributesFromXUL ()
nsresult LoadChromeHidingFromXUL ()
NS_IMETHOD LoadWindowClassFromXUL ()
NS_IMETHOD LoadIconFromXUL ()
NS_IMETHOD SavePersistentAttributes ()
NS_IMETHOD GetWindowDOMWindow (nsIDOMWindowInternal **aDOMWindow)
NS_IMETHOD GetWindowDOMElement (nsIDOMElement **aDOMElement)
NS_IMETHOD GetDOMElementById (char *aID, nsIDOMElement **aDOMElement)
 NS_HIDDEN_ (nsresult) ContentShellAdded(nsIDocShellTreeItem *aContentShell
 NS_HIDDEN_ (nsresult) ContentShellRemoved(nsIDocShellTreeItem *aContentShell)
NS_IMETHOD SizeShellTo (nsIDocShellTreeItem *aShellItem, PRInt32 aCX, PRInt32 aCY)
NS_IMETHOD ExitModalLoop (nsresult aStatus)
NS_IMETHOD CreateNewChromeWindow (PRInt32 aChromeFlags, nsIAppShell *aAppShell, nsIXULWindow **_retval)
NS_IMETHOD CreateNewContentWindow (PRInt32 aChromeFlags, nsIAppShell *aAppShell, nsIXULWindow **_retval)
void EnableParent (PRBool aEnable)
PRBool ConstrainToZLevel (PRBool aImmediate, nsWindowZ *aPlacement, nsIWidget *aReqBelow, nsIWidget **aActualBelow)
void PlaceWindowLayersBehind (PRUint32 aLowLevel, PRUint32 aHighLevel, nsIXULWindow *aBehind)
void SetContentScrollbarVisibility (PRBool aVisible)
PRBool GetContentScrollbarVisibility ()
void PersistentAttributesDirty (PRUint32 aDirtyFlags)
nsresult ApplyChromeFlags ()

Static Protected Member Functions

static nsEventStatus PR_CALLBACK HandleEvent (nsGUIEvent *aEvent)
static void FirePersistenceTimer (nsITimer *aTimer, void *aClosure)

Protected Attributes

nsCOMPtr< nsITimermSPTimer
PRLockmSPTimerLock
PRBool aPrimary
PRBool PRBool aTargetable
PRBool PRBool const nsAString & aID
nsChromeTreeOwnermChromeTreeOwner
nsContentTreeOwnermContentTreeOwner
nsContentTreeOwnermPrimaryContentTreeOwner
nsCOMPtr< nsIWidgetmWindow
nsCOMPtr< nsIDocShellmDocShell
nsCOMPtr< nsIDOMWindowInternalmDOMWindow
nsCOMPtr< nsIWeakReferencemParentWindow
nsCOMPtr< nsIPromptmPrompter
nsCOMPtr< nsIAuthPromptmAuthPrompter
nsCOMPtr< nsIXULBrowserWindowmXULBrowserWindow
nsCOMPtr< nsIDocShellTreeItemmPrimaryContentShell
nsVoidArray mContentShells
nsresult mModalStatus
PRPackedBool mContinueModalLoop
PRPackedBool mDebuting
PRPackedBool mChromeLoaded
PRPackedBool mShowAfterLoad
PRPackedBool mIntrinsicallySized
PRPackedBool mCenterAfterLoad
PRPackedBool mIsHiddenWindow
PRPackedBool mLockedUntilChromeLoad
PRUint32 mContextFlags
PRUint32 mBlurSuppressionLevel
PRUint32 mPersistentAttributesDirty
PRUint32 mPersistentAttributesMask
PRUint32 mChromeFlags
nsString mTitle
nsCOMArray< nsIWeakReferencemTargetableShells

Detailed Description

Definition at line 55 of file nsWebShellWindow.h.


Member Enumeration Documentation

enum nsXULWindow::persistentAttributes [protected, inherited]
Enumerator:
PAD_MISC 
PAD_POSITION 
PAD_SIZE 

Definition at line 101 of file nsXULWindow.h.

                             {
     PAD_MISC =         0x1,
     PAD_POSITION =     0x2,
     PAD_SIZE =         0x4
   };

Constructor & Destructor Documentation

Definition at line 149 of file nsWebShellWindow.cpp.

Here is the call graph for this function:

nsWebShellWindow::~nsWebShellWindow ( ) [protected, virtual]

Definition at line 155 of file nsWebShellWindow.cpp.

{
  if (mWindow)
    mWindow->SetClientData(0);
  mWindow = nsnull; // Force release here.

  if (mSPTimerLock) {
    PR_Lock(mSPTimerLock);
    if (mSPTimer)
      mSPTimer->Cancel();
    PR_Unlock(mSPTimerLock);
    PR_DestroyLock(mSPTimerLock);
  }
}

Here is the call graph for this function:


Member Function Documentation

Tell this window that it has picked up a child XUL window.

Parameters:
aChildthe child window being added
nsresult nsXULWindow::ApplyChromeFlags ( ) [protected, inherited]

Definition at line 2060 of file nsXULWindow.cpp.

{
  nsCOMPtr<nsIDOMElement> window;
  GetWindowDOMElement(getter_AddRefs(window));
  NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);

  // menubar has its own special treatment
  mWindow->ShowMenuBar(mChromeFlags & nsIWebBrowserChrome::CHROME_MENUBAR ? 
                       PR_TRUE : PR_FALSE);

  // Scrollbars have their own special treatment.
  SetContentScrollbarVisibility(mChromeFlags &
                                  nsIWebBrowserChrome::CHROME_SCROLLBARS ?
                                PR_TRUE : PR_FALSE);

  /* the other flags are handled together. we have style rules
     in navigator.css that trigger visibility based on
     the 'chromehidden' attribute of the <window> tag. */
  nsAutoString newvalue;

  if (! (mChromeFlags & nsIWebBrowserChrome::CHROME_MENUBAR))
    newvalue.AppendLiteral("menubar ");

  if (! (mChromeFlags & nsIWebBrowserChrome::CHROME_TOOLBAR))
    newvalue.AppendLiteral("toolbar ");

  if (! (mChromeFlags & nsIWebBrowserChrome::CHROME_LOCATIONBAR))
    newvalue.AppendLiteral("location ");

  if (! (mChromeFlags & nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR))
    newvalue.AppendLiteral("directories ");

  if (! (mChromeFlags & nsIWebBrowserChrome::CHROME_STATUSBAR))
    newvalue.AppendLiteral("status ");

  if (! (mChromeFlags & nsIWebBrowserChrome::CHROME_EXTRA))
    newvalue.AppendLiteral("extrachrome ");


  // Get the old value, to avoid useless style reflows if we're just
  // setting stuff to the exact same thing.
  nsAutoString oldvalue;
  window->GetAttribute(NS_LITERAL_STRING("chromehidden"), oldvalue);

  if (oldvalue != newvalue)
    window->SetAttribute(NS_LITERAL_STRING("chromehidden"), newvalue);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIXULWindow::center ( in nsIXULWindow  aRelative,
in boolean  aScreen,
in boolean  aAlert 
) [inherited]

Move the window to a centered position.

Parameters:
aRelativethe window relative to which the window is moved. See screen parameter for details. if null, the window is centered relative to the main screen.
aScreenPR_TRUE to center the window relative to the screen containing aRelative. PR_FALSE to center it relative to aRelative itself.
aAlertPR_TRUE to move the window to an alert position, generally centered horizontally and 1/3 down from the top.
PRBool nsXULWindow::ConstrainToZLevel ( PRBool  aImmediate,
nsWindowZ aPlacement,
nsIWidget aReqBelow,
nsIWidget **  aActualBelow 
) [protected, inherited]

Definition at line 1881 of file nsXULWindow.cpp.

                                                {

#if 0
  /* Do we have a parent window? This means our z-order is already constrained,
     since we're a dependent window. Our window list isn't hierarchical,
     so we can't properly calculate placement for such a window.
     Should we just abort? */
  nsCOMPtr<nsIBaseWindow> parentWindow = do_QueryReferent(mParentWindow);
  if (parentWindow)
    return PR_FALSE;
#endif

  nsCOMPtr<nsIWindowMediator> mediator(do_GetService(kWindowMediatorCID));
  if(!mediator)
    return PR_FALSE;

  PRBool         altered;
  PRUint32       position,
                 newPosition,
                 zLevel;
  nsIXULWindow  *us = this;

  altered = PR_FALSE;
  mediator->GetZLevel(this, &zLevel);

  // translate from nsGUIEvent to nsIWindowMediator constants
  position = nsIWindowMediator::zLevelTop;
  if (*aPlacement == nsWindowZBottom || zLevel == nsIXULWindow::lowestZ)
    position = nsIWindowMediator::zLevelBottom;
  else if (*aPlacement == nsWindowZRelative)
    position = nsIWindowMediator::zLevelBelow;

  if (NS_SUCCEEDED(mediator->CalculateZPosition(us, position, aReqBelow,
                               &newPosition, aActualBelow, &altered))) {

    /* If we were asked to move to the top but constrained to remain
       below one of our other windows, first move all windows in that
       window's layer and above to the top. This allows the user to
       click a window which can't be topmost and still bring mozilla
       to the foreground. */
    if (altered &&
        (position == nsIWindowMediator::zLevelTop ||
         position == nsIWindowMediator::zLevelBelow && aReqBelow == 0))

      PlaceWindowLayersBehind(zLevel+1, nsIXULWindow::highestZ, 0);

    if (*aPlacement != nsWindowZBottom &&
        position == nsIWindowMediator::zLevelBottom)
      altered = PR_TRUE;
    if (altered || aImmediate) {
      if (newPosition == nsIWindowMediator::zLevelTop)
        *aPlacement = nsWindowZTop;
      else if (newPosition == nsIWindowMediator::zLevelBottom)
        *aPlacement = nsWindowZBottom;
      else
        *aPlacement = nsWindowZRelative;

      if (aImmediate) {
        nsCOMPtr<nsIBaseWindow> ourBase = do_QueryInterface(NS_STATIC_CAST(nsIXULWindow *,this));
        if (ourBase) {
          nsCOMPtr<nsIWidget> ourWidget;
          ourBase->GetMainWidget(getter_AddRefs(ourWidget));
          ourWidget->PlaceBehind(*aPlacement == nsWindowZBottom ?
                                   eZPlacementBottom : eZPlacementBelow,
                                 *aActualBelow, PR_FALSE);
        }
      }
    }

    /* (CalculateZPosition can tell us to be below nothing, because it tries
       not to change something it doesn't recognize. A request to verify
       being below an unrecognized window, then, is treated as a request
       to come to the top (below null) */
    nsCOMPtr<nsIXULWindow> windowAbove;
    if (newPosition == nsIWindowMediator::zLevelBelow && *aActualBelow) {
      void *data;
      (*aActualBelow)->GetClientData(data);
      if (data) {
        windowAbove = NS_REINTERPRET_CAST(nsWebShellWindow*, data);
      }
    }

    mediator->SetZPosition(us, newPosition, windowAbove);
  }

  return altered;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIBaseWindow::create ( ) [inherited]
NS_IMETHODIMP nsXULWindow::CreateNewChromeWindow ( PRInt32  aChromeFlags,
nsIAppShell aAppShell,
nsIXULWindow **  _retval 
) [protected, inherited]

Definition at line 1742 of file nsXULWindow.cpp.

{
   NS_TIMELINE_ENTER("nsXULWindow::CreateNewChromeWindow");
   nsCOMPtr<nsIAppShellService> appShell(do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
   NS_ENSURE_TRUE(appShell, NS_ERROR_FAILURE);
   
   // Just do a normal create of a window and return.
   //XXXTAB remove this when appshell talks in terms of nsIXULWindow
   nsCOMPtr<nsIXULWindow> parent;
   if(aChromeFlags & nsIWebBrowserChrome::CHROME_DEPENDENT)
      parent = this;

   nsCOMPtr<nsIXULWindow> newWindow;
   appShell->CreateTopLevelWindow(parent, nsnull, aChromeFlags,
                                  nsIAppShellService::SIZE_TO_CONTENT,
                                  nsIAppShellService::SIZE_TO_CONTENT,
                                  aAppShell, getter_AddRefs(newWindow));

   NS_ENSURE_TRUE(newWindow, NS_ERROR_FAILURE);

   newWindow->SetChromeFlags(aChromeFlags);

   *_retval = newWindow;
   NS_ADDREF(*_retval);
   
   NS_TIMELINE_LEAVE("nsXULWindow::CreateNewChromeWindow done");
   return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsXULWindow::CreateNewContentWindow ( PRInt32  aChromeFlags,
nsIAppShell aAppShell,
nsIXULWindow **  _retval 
) [protected, inherited]

Definition at line 1772 of file nsXULWindow.cpp.

{
   NS_TIMELINE_ENTER("nsXULWindow::CreateNewContentWindow");
   nsCOMPtr<nsIAppShellService> appShell(do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
   NS_ENSURE_TRUE(appShell, NS_ERROR_FAILURE);

   nsCOMPtr<nsIXULWindow> parent;
   if(aChromeFlags & nsIWebBrowserChrome::CHROME_DEPENDENT)
      parent = this;

   // We need to create a new top level window and then enter a nested
   // loop. Eventually the new window will be told that it has loaded,
   // at which time we know it is safe to spin out of the nested loop
   // and allow the opening code to proceed.

   // First push a nested event queue for event processing from netlib
   // onto our UI thread queue stack.
   nsEventQueueStack queuePusher;
   NS_ENSURE_SUCCESS(queuePusher.Success(), NS_ERROR_FAILURE);

   nsCOMPtr<nsIURI> uri;

   nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));
   if (prefs) {
     char *urlStr;
     PRBool strAllocated = PR_TRUE;
     nsresult prefres;
     prefres = prefs->CopyCharPref("browser.chromeURL", &urlStr);
     if (NS_SUCCEEDED(prefres) && urlStr[0] == '\0') {
       PL_strfree(urlStr);
       prefres = NS_ERROR_FAILURE;
     }
     if (NS_FAILED(prefres)) {
       urlStr = "chrome://navigator/content/navigator.xul";
       strAllocated = PR_FALSE;
     }

     nsCOMPtr<nsIIOService> service(do_GetService(kIOServiceCID));
     if (service)
       service->NewURI(nsDependentCString(urlStr), nsnull, nsnull, getter_AddRefs(uri));
     if (strAllocated)
       PL_strfree(urlStr);
   }
   NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);

   nsCOMPtr<nsIXULWindow> newWindow;
   appShell->CreateTopLevelWindow(parent, uri,
                                  aChromeFlags, 615, 480, aAppShell,
                                  getter_AddRefs(newWindow));

   NS_ENSURE_TRUE(newWindow, NS_ERROR_FAILURE);

   newWindow->SetChromeFlags(aChromeFlags);

   nsCOMPtr<nsIAppShell> subShell(do_CreateInstance(kAppShellCID));
   NS_ENSURE_TRUE(subShell, NS_ERROR_FAILURE);

   subShell->Create(0, nsnull);
   subShell->Spinup();

   // Specify that we want the window to remain locked until the chrome has loaded.
   nsXULWindow *xulWin = NS_STATIC_CAST(nsXULWindow*,
                                        NS_STATIC_CAST(nsIXULWindow*,
                                                       newWindow));

   xulWin->LockUntilChromeLoad();

   // Push nsnull onto the JSContext stack before we dispatch a native event.
   nsCOMPtr<nsIJSContextStack> stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1"));
   if(stack && NS_SUCCEEDED(stack->Push(nsnull)))
      {
      nsresult looprv = NS_OK;
      while(NS_SUCCEEDED(looprv) && xulWin->IsLocked())
         {
         void      *data;
         PRBool    isRealEvent;
    
         looprv = subShell->GetNativeEvent(isRealEvent, data);
         subShell->DispatchNativeEvent(isRealEvent, data);
         }

      JSContext *cx;
      stack->Pop(&cx);
      NS_ASSERTION(cx == nsnull, "JSContextStack mismatch");
      }

   subShell->Spindown();

   *_retval = newWindow;
   NS_ADDREF(*_retval);

   NS_TIMELINE_LEAVE("nsXULWindow::CreateNewContentWindow");
   return NS_OK;
}

Here is the call graph for this function:

nsIXULWindow nsIXULWindow::createNewWindow ( in PRInt32  aChromeFlags,
in nsIAppShell  aAppShell 
) [inherited]

Create a new window.

Parameters:
aChromeFlagssee nsIWebBrowserChrome
Returns:
the newly minted window

Definition at line 829 of file nsWebShellWindow.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIWebProgress> webProgress(do_GetInterface(mDocShell, &rv));
  if (webProgress) {
    webProgress->RemoveProgressListener(this);
  }

  nsCOMPtr<nsIXULWindow> kungFuDeathGrip(this);
  if (mSPTimerLock) {
  PR_Lock(mSPTimerLock);
  if (mSPTimer) {
    mSPTimer->Cancel();
    SavePersistentAttributes();
    mSPTimer = nsnull;
    NS_RELEASE_THIS(); // the timer held a reference to us
  }
  PR_Unlock(mSPTimerLock);
  PR_DestroyLock(mSPTimerLock);
  mSPTimerLock = nsnull;
  }
  return nsXULWindow::Destroy();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIBaseWindow::destroy ( ) [inherited]
void nsXULWindow::EnableParent ( PRBool  aEnable) [protected, inherited]

Definition at line 1868 of file nsXULWindow.cpp.

{
  nsCOMPtr<nsIBaseWindow> parentWindow;
  nsCOMPtr<nsIWidget>     parentWidget;

  parentWindow = do_QueryReferent(mParentWindow);
  if (parentWindow)
    parentWindow->GetMainWidget(getter_AddRefs(parentWidget));
  if (parentWidget)
    parentWidget->Enable(aEnable);
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsXULWindow::EnsureAuthPrompter ( ) [protected, inherited]

Definition at line 938 of file nsXULWindow.cpp.

Here is the call graph for this function:

Definition at line 881 of file nsXULWindow.cpp.

Here is the call graph for this function:

Definition at line 895 of file nsXULWindow.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsXULWindow::EnsurePrompter ( ) [protected, inherited]

Definition at line 923 of file nsXULWindow.cpp.

Here is the call graph for this function:

ExecuteCloseHandler - Run the close handler, if any.

Returns:
PR_TRUE iff we found a close handler to run.

Definition at line 793 of file nsWebShellWindow.cpp.

{
  /* If the event handler closes this window -- a likely scenario --
     things get deleted out of order without this death grip.
     (The problem may be the death grip in nsWindow::windowProc,
     which forces this window's widget to remain alive longer
     than it otherwise would.) */
  nsCOMPtr<nsIXULWindow> kungFuDeathGrip(this);

  nsCOMPtr<nsIScriptGlobalObject> globalObject(do_GetInterface(mDocShell));

  if (globalObject) {
    nsCOMPtr<nsIContentViewer> contentViewer;
    mDocShell->GetContentViewer(getter_AddRefs(contentViewer));
    nsCOMPtr<nsIDocumentViewer> docViewer(do_QueryInterface(contentViewer));

    if (docViewer) {
      nsCOMPtr<nsPresContext> presContext;
      docViewer->GetPresContext(getter_AddRefs(presContext));

      nsEventStatus status = nsEventStatus_eIgnore;
      nsMouseEvent event(PR_TRUE, NS_XUL_CLOSE, nsnull,
                         nsMouseEvent::eReal);

      nsresult rv = globalObject->HandleDOMEvent(presContext, &event, nsnull,
                                                 NS_EVENT_FLAG_INIT, &status);
      if (NS_SUCCEEDED(rv) && status == nsEventStatus_eConsumeNoDefault)
        return PR_TRUE;
      // else fall through and return PR_FALSE
    }
  }

  return PR_FALSE;
} // ExecuteCloseHandler

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsXULWindow::ExitModalLoop ( nsresult  aStatus) [protected, inherited]

Definition at line 1722 of file nsXULWindow.cpp.

Here is the call graph for this function:

void nsWebShellWindow::FirePersistenceTimer ( nsITimer aTimer,
void aClosure 
) [static, protected]

Definition at line 575 of file nsWebShellWindow.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2040 of file nsXULWindow.cpp.

                                                  {

  PRBool visible = PR_TRUE;

  nsCOMPtr<nsIDOMWindow> contentWin(do_GetInterface(mPrimaryContentShell));
  if (contentWin) {
    nsCOMPtr<nsIDOMBarProp> scrollbars;
    contentWin->GetScrollbars(getter_AddRefs(scrollbars));
    if (scrollbars)
      scrollbars->GetVisible(&visible);
  }
  return visible;
}

Here is the call graph for this function:

The content shell specified by the supplied id.

Note that this is a docshell tree item and therefore can not be assured of what object it is. It could be an editor, a docshell, or a browser object. Or down the road any other object that supports being a DocShellTreeItem Query accordingly to determine the capabilities.

NS_IMETHODIMP nsXULWindow::GetDOMElementById ( char *  aID,
nsIDOMElement **  aDOMElement 
) [protected, inherited]

Definition at line 1580 of file nsXULWindow.cpp.

{
   NS_ENSURE_STATE(mDocShell);
   NS_ENSURE_ARG_POINTER(aDOMElement);

   *aDOMElement = nsnull;

   nsCOMPtr<nsIContentViewer> cv;
   
   mDocShell->GetContentViewer(getter_AddRefs(cv));
   if(!cv)
      return NS_ERROR_FAILURE;

   nsCOMPtr<nsIDocumentViewer> docv(do_QueryInterface(cv));
   if(!docv)   
      return NS_ERROR_FAILURE;

   nsCOMPtr<nsIDocument> doc;
   docv->GetDocument(getter_AddRefs(doc));
   nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(doc));
   if(!domdoc) 
      return NS_ERROR_FAILURE;
   
   NS_ENSURE_SUCCESS(domdoc->GetElementById(NS_ConvertASCIItoUCS2(aID), aDOMElement), NS_ERROR_FAILURE);

   return NS_OK;
}

Here is the call graph for this function:

void nsIInterfaceRequestor::getInterface ( in nsIIDRef  uuid,
[iid_is(uuid), retval] out nsQIResult  result 
) [inherited]

Retrieves the specified interface pointer.

Parameters:
uuidThe IID of the interface being requested.
result[out] The interface pointer to be filled in if the interface is accessible.
Returns:
NS_OK - interface was successfully returned. NS_NOINTERFACE - interface not accessible. NS_ERROR* - method failure.
nsCOMPtr< nsIDOMDocument > nsWebShellWindow::GetNamedDOMDoc ( const nsAString &  aWebShellName) [protected]

Definition at line 677 of file nsWebShellWindow.cpp.

{
  nsCOMPtr<nsIDOMDocument> domDoc; // result == nsnull;

  // first get the toolbar child docShell
  nsCOMPtr<nsIDocShell> childDocShell;
  if (aDocShellName.EqualsLiteral("this")) { // XXX small kludge for code reused
    childDocShell = mDocShell;
  } else {
    nsCOMPtr<nsIDocShellTreeItem> docShellAsItem;
    nsCOMPtr<nsIDocShellTreeNode> docShellAsNode(do_QueryInterface(mDocShell));
    docShellAsNode->FindChildWithName(PromiseFlatString(aDocShellName).get(), 
      PR_TRUE, PR_FALSE, nsnull, nsnull, getter_AddRefs(docShellAsItem));
    childDocShell = do_QueryInterface(docShellAsItem);
    if (!childDocShell)
      return domDoc;
  }
  
  nsCOMPtr<nsIContentViewer> cv;
  childDocShell->GetContentViewer(getter_AddRefs(cv));
  if (!cv)
    return domDoc;
   
  nsCOMPtr<nsIDocumentViewer> docv(do_QueryInterface(cv));
  if (!docv)
    return domDoc;

  nsCOMPtr<nsIDocument> doc;
  docv->GetDocument(getter_AddRefs(doc));
  if (doc)
    return nsCOMPtr<nsIDOMDocument>(do_QueryInterface(doc));

  return domDoc;
} // nsWebShellWindow::GetNamedDOMDoc

Here is the call graph for this function:

void nsIBaseWindow::getPosition ( out long  x,
out long  y 
) [inherited]
void nsIBaseWindow::getPositionAndSize ( out long  x,
out long  y,
out long  cx,
out long  cy 
) [inherited]
void nsIBaseWindow::getSize ( out long  cx,
out long  cy 
) [inherited]
NS_IMETHODIMP nsXULWindow::GetWindowDOMElement ( nsIDOMElement **  aDOMElement) [protected, inherited]

Definition at line 1554 of file nsXULWindow.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsXULWindow::GetWindowDOMWindow ( nsIDOMWindowInternal **  aDOMWindow) [protected, inherited]

Definition at line 1541 of file nsXULWindow.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 310 of file nsWebShellWindow.cpp.

{
  nsEventStatus result = nsEventStatus_eIgnore;
  nsIDocShell* docShell = nsnull;
  nsWebShellWindow *eventWindow = nsnull;

  // Get the WebShell instance...
  if (nsnull != aEvent->widget) {
    void* data;

    aEvent->widget->GetClientData(data);
    if (data != nsnull) {
      eventWindow = NS_REINTERPRET_CAST(nsWebShellWindow *, data);
      docShell = eventWindow->mDocShell;
    }
  }

  if (docShell) {
    switch(aEvent->message) {
      /*
       * For size events, the DocShell must be resized to fill the entire
       * client area of the window...
       */
      case NS_MOVE: {
        // persist position, but not immediately, in case this OS is firing
        // repeated move events as the user drags the window
        eventWindow->SetPersistenceTimer(PAD_POSITION);
        break;
      }
      case NS_SIZE: {
        nsSizeEvent* sizeEvent = (nsSizeEvent*)aEvent;
        nsCOMPtr<nsIBaseWindow> shellAsWin(do_QueryInterface(docShell));
        shellAsWin->SetPositionAndSize(0, 0, sizeEvent->windowSize->width, 
          sizeEvent->windowSize->height, PR_FALSE);  
        // persist size, but not immediately, in case this OS is firing
        // repeated size events as the user drags the sizing handle
        if (!eventWindow->IsLocked())
          eventWindow->SetPersistenceTimer(PAD_SIZE | PAD_MISC);
        result = nsEventStatus_eConsumeNoDefault;
        break;
      }
      case NS_SIZEMODE: {
        nsSizeModeEvent* modeEvent = (nsSizeModeEvent*)aEvent;

        // an alwaysRaised (or higher) window will hide any newly opened
        // normal browser windows. here we just drop a raised window
        // to the normal zlevel if it's maximized. we make no provision
        // for automatically re-raising it when restored.
        if (modeEvent->mSizeMode == nsSizeMode_Maximized) {
          PRUint32 zLevel;
          eventWindow->GetZLevel(&zLevel);
          if (zLevel > nsIXULWindow::normalZ)
            eventWindow->SetZLevel(nsIXULWindow::normalZ);
        }

        aEvent->widget->SetSizeMode(modeEvent->mSizeMode);

        // persist mode, but not immediately, because in many (all?)
        // cases this will merge with the similar call in NS_SIZE and
        // write the attribute values only once.
        eventWindow->SetPersistenceTimer(PAD_MISC);
        result = nsEventStatus_eConsumeDoDefault;

        // Note the current implementation of SetSizeMode just stores
        // the new state; it doesn't actually resize. So here we store
        // the state and pass the event on to the OS. The day is coming
        // when we'll handle the event here, and the return result will
        // then need to be different.
#ifdef XP_WIN
        // This is a nasty hack to get around the fact that win32 sends the kill focus
        // event in a different sequence than the deactivate depending on if you're
        // minimizing the window vs. just clicking in a different window to cause
        // the deactivation. Bug #82534
        if(modeEvent->mSizeMode == nsSizeMode_Minimized) {
          nsCOMPtr<nsPIDOMWindow> privateDOMWindow = do_GetInterface(docShell);
          if(privateDOMWindow) {
            nsIFocusController *focusController =
              privateDOMWindow->GetRootFocusController();
            if (focusController)
              focusController->RewindFocusState();
          }
        }
#endif
        break;
      }
      case NS_OS_TOOLBAR: {
        nsCOMPtr<nsIXULWindow> kungFuDeathGrip(eventWindow);
        eventWindow->Toolbar();
        break;
      }
      case NS_XUL_CLOSE: {
        // Calling ExecuteCloseHandler may actually close the window
        // (it probably shouldn't, but you never know what the users JS 
        // code will do).  Therefore we add a death-grip to the window
        // for the duration of the close handler.
        nsCOMPtr<nsIXULWindow> kungFuDeathGrip(eventWindow);
        if (!eventWindow->ExecuteCloseHandler())
          eventWindow->Destroy();
        break;
      }
      /*
       * Notify the ApplicationShellService that the window is being closed...
       */
      case NS_DESTROY: {
        eventWindow->Destroy();
        break;
      }

      case NS_SETZLEVEL: {
        nsZLevelEvent *zEvent = (nsZLevelEvent *) aEvent;

        zEvent->mAdjusted = eventWindow->ConstrainToZLevel(zEvent->mImmediate,
                              &zEvent->mPlacement,
                              zEvent->mReqBelow, &zEvent->mActualBelow);
        break;
      }

      case NS_MOUSE_ACTIVATE:{
        break;
      }
      
      case NS_ACTIVATE: {
#ifdef DEBUG_saari
        printf("nsWebShellWindow::NS_ACTIVATE\n");
#endif
        nsCOMPtr<nsPIDOMWindow> privateDOMWindow = do_GetInterface(docShell);
        if (privateDOMWindow)
          privateDOMWindow->Activate();

        break;
      }

      case NS_DEACTIVATE: {
#ifdef DEBUG_saari
        printf("nsWebShellWindow::NS_DEACTIVATE\n");
#endif

        nsCOMPtr<nsPIDOMWindow> privateDOMWindow = do_GetInterface(docShell);
        if (privateDOMWindow) {
          nsIFocusController *focusController =
            privateDOMWindow->GetRootFocusController();
          if (focusController)
            focusController->SetActive(PR_FALSE);

          privateDOMWindow->Deactivate();
        }
        break;
      }
      
      case NS_GOTFOCUS: {
#ifdef DEBUG_saari
        printf("nsWebShellWindow::GOTFOCUS\n");
#endif
        nsCOMPtr<nsIDOMDocument> domDocument;
        nsCOMPtr<nsPIDOMWindow> piWin = do_GetInterface(docShell);
        if (!piWin) {
          break;
        }
        nsIFocusController *focusController = piWin->GetRootFocusController();
        if (focusController) {
          // This is essentially the first stage of activation (NS_GOTFOCUS is
          // followed by the DOM window getting activated (which is direct on Win32
          // and done through web shell window via an NS_ACTIVATE message on the
          // other platforms).
          //
          // Go ahead and mark the focus controller as being active.  We have
          // to do this even before the activate message comes in, since focus
          // memory kicks in prior to the activate being processed.
          focusController->SetActive(PR_TRUE);

          nsCOMPtr<nsIDOMWindowInternal> focusedWindow;
          focusController->GetFocusedWindow(getter_AddRefs(focusedWindow));
          if (focusedWindow) {
            // It's possible for focusing the window to cause it to close.
            // To avoid holding a pointer to deleted memory, keep a reference
            // on eventWindow. -bryner
            nsCOMPtr<nsIXULWindow> kungFuDeathGrip(eventWindow);

            nsCOMPtr<nsIDOMWindowInternal> domWindow = 
              do_QueryInterface(piWin);

            focusController->SetSuppressFocus(PR_TRUE, "Activation Suppression");

            NS_ASSERTION(domWindow,
                         "windows must support nsIDOMWindowInternal");

            domWindow->Focus(); // This sets focus, but we'll ignore it.  
                                // A subsequent activate will cause us to stop suppressing.

            // since the window has been activated, replace persistent size data
            // with the newly activated window's
            if (eventWindow->mChromeLoaded) {
              eventWindow->PersistentAttributesDirty(
                             PAD_POSITION | PAD_SIZE | PAD_MISC);
              eventWindow->SavePersistentAttributes();
            }

            break;
          }
        }
        break;
      }
      default:
        break;

    }
  }
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsWebShellWindow::Initialize ( nsIXULWindow aParent,
nsIAppShell aShell,
nsIURI aUrl,
PRInt32  aInitialWidth,
PRInt32  aInitialHeight,
PRBool  aIsHiddenWindow,
nsWidgetInitData widgetInitData 
)

Definition at line 177 of file nsWebShellWindow.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIWidget> parentWidget;

  mIsHiddenWindow = aIsHiddenWindow;
  
  // XXX: need to get the default window size from prefs...
  // Doesn't come from prefs... will come from CSS/XUL/RDF
  nsRect r(0, 0, aInitialWidth, aInitialHeight);
  
  // Create top level window
  mWindow = do_CreateInstance(kWindowCID, &rv);
  if (NS_OK != rv) {
    return rv;
  }

  /* This next bit is troublesome. We carry two different versions of a pointer
     to our parent window. One is the parent window's widget, which is passed
     to our own widget. The other is a weak reference we keep here to our
     parent WebShellWindow. The former is useful to the widget, and we can't
     trust its treatment of the parent reference because they're platform-
     specific. The latter is useful to this class.
       A better implementation would be one in which the parent keeps strong
     references to its children and closes them before it allows itself
     to be closed. This would mimic the behaviour of OSes that support
     top-level child windows in OSes that do not. Later.
  */
  nsCOMPtr<nsIBaseWindow> parentAsWin(do_QueryInterface(aParent));
  if (parentAsWin) {
    parentAsWin->GetMainWidget(getter_AddRefs(parentWidget));
    mParentWindow = do_GetWeakReference(aParent);
  }

  mWindow->SetClientData(this);
  mWindow->Create((nsIWidget *)parentWidget,          // Parent nsIWidget
                  r,                                  // Widget dimensions
                  nsWebShellWindow::HandleEvent,      // Event handler function
                  nsnull,                             // Device context
                  aShell,                             // Application shell
                  nsnull,                             // nsIToolkit
                  &widgetInitData);                   // Widget initialization data
  mWindow->GetClientBounds(r);
  mWindow->SetBackgroundColor(NS_RGB(192,192,192));

  // Create web shell
  mDocShell = do_CreateInstance("@mozilla.org/webshell;1");
  NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE);

  // Make sure to set the item type on the docshell _before_ calling
  // Create() so it knows what type it is.
  nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mDocShell));
  NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
  NS_ENSURE_SUCCESS(EnsureChromeTreeOwner(), NS_ERROR_FAILURE);

  docShellAsItem->SetTreeOwner(mChromeTreeOwner);
  docShellAsItem->SetItemType(nsIDocShellTreeItem::typeChrome);

  r.x = r.y = 0;
  nsCOMPtr<nsIBaseWindow> docShellAsWin(do_QueryInterface(mDocShell));
  NS_ENSURE_SUCCESS(docShellAsWin->InitWindow(nsnull, mWindow, 
   r.x, r.y, r.width, r.height), NS_ERROR_FAILURE);
  NS_ENSURE_SUCCESS(docShellAsWin->Create(), NS_ERROR_FAILURE);

  // Attach a WebProgress listener.during initialization...
  nsCOMPtr<nsIWebProgress> webProgress(do_GetInterface(mDocShell, &rv));
  if (webProgress) {
    webProgress->AddProgressListener(this, nsIWebProgress::NOTIFY_STATE_NETWORK);
  }

  if (nsnull != aUrl)  {
    nsCAutoString tmpStr;

    rv = aUrl->GetSpec(tmpStr);
    if (NS_FAILED(rv)) return rv;

    NS_ConvertUTF8toUCS2 urlString(tmpStr);
    nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
    NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
    rv = webNav->LoadURI(urlString.get(),
                         nsIWebNavigation::LOAD_FLAGS_NONE,
                         nsnull,
                         nsnull,
                         nsnull);
    NS_ENSURE_SUCCESS(rv, rv);
  }
                     
  return rv;
}

Here is the call graph for this function:

void nsIBaseWindow::initWindow ( in nativeWindow  parentNativeWindow,
in nsIWidget  parentWidget,
in long  x,
in long  y,
in long  cx,
in long  cy 
) [inherited]
PRBool nsXULWindow::IsLocked ( ) const [inline, inherited]

Definition at line 98 of file nsXULWindow.h.

Here is the caller graph for this function:

nsresult nsXULWindow::LoadChromeHidingFromXUL ( ) [protected, inherited]

Definition at line 998 of file nsXULWindow.cpp.

{
  NS_ENSURE_STATE(mWindow);

  // Get <window> element.
  nsCOMPtr<nsIDOMElement> windowElement;
  GetWindowDOMElement(getter_AddRefs(windowElement));
  NS_ENSURE_TRUE(windowElement, NS_ERROR_FAILURE);

  nsAutoString attr;
  nsresult rv = windowElement->GetAttribute(NS_LITERAL_STRING("hidechrome"), attr);

  if (NS_SUCCEEDED(rv) && attr.LowerCaseEqualsLiteral("true")) {
    mWindow->HideWindowChrome(PR_TRUE);
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 715 of file nsWebShellWindow.cpp.

                                        {

  nsAutoString searchSpec;

  // fetch the chrome document URL
  nsCOMPtr<nsIContentViewer> contentViewer;
  // yes, it's possible for the docshell to be null even this early
  // see bug 57514.
  if (mDocShell)
    mDocShell->GetContentViewer(getter_AddRefs(contentViewer));
  if (contentViewer) {
    nsCOMPtr<nsIDocumentViewer> docViewer = do_QueryInterface(contentViewer);
    if (docViewer) {
      nsCOMPtr<nsIDocument> doc;
      docViewer->GetDocument(getter_AddRefs(doc));
      nsIURI *mainURL = doc->GetDocumentURI();

      nsCOMPtr<nsIURL> url = do_QueryInterface(mainURL);
      if (url) {
        nsCAutoString search;
        url->GetQuery(search);

        AppendUTF8toUTF16(search, searchSpec);
      }
    }
  }

  // content URLs are specified in the search part of the URL
  // as <contentareaID>=<escapedURL>[;(repeat)]
  if (!searchSpec.IsEmpty()) {
    PRInt32     begPos,
                eqPos,
                endPos;
    nsString    contentAreaID,
                contentURL;
    char        *urlChar;
    nsresult rv;
    for (endPos = 0; endPos < (PRInt32)searchSpec.Length(); ) {
      // extract contentAreaID and URL substrings
      begPos = endPos;
      eqPos = searchSpec.FindChar('=', begPos);
      if (eqPos < 0)
        break;

      endPos = searchSpec.FindChar(';', eqPos);
      if (endPos < 0)
        endPos = searchSpec.Length();
      searchSpec.Mid(contentAreaID, begPos, eqPos-begPos);
      searchSpec.Mid(contentURL, eqPos+1, endPos-eqPos-1);
      endPos++;

      // see if we have a docshell with a matching contentAreaID
      nsCOMPtr<nsIDocShellTreeItem> content;
      rv = GetContentShellById(contentAreaID.get(), getter_AddRefs(content));
      if (NS_SUCCEEDED(rv) && content) {
        nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(content));
        if (webNav) {
          urlChar = ToNewCString(contentURL);
          if (urlChar) {
            nsUnescape(urlChar);
            contentURL.AssignWithConversion(urlChar);
            webNav->LoadURI(contentURL.get(),
                          nsIWebNavigation::LOAD_FLAGS_NONE,
                          nsnull,
                          nsnull,
                          nsnull);
            nsMemory::Free(urlChar);
          }
        }
      }
    }
  }
}

Here is the call graph for this function:

NS_IMETHODIMP nsXULWindow::LoadIconFromXUL ( ) [protected, inherited]

Definition at line 1366 of file nsXULWindow.cpp.

{
    NS_ENSURE_STATE(mWindow);

    // Get <window> element.
    nsCOMPtr<nsIDOMElement> windowElement;
    GetWindowDOMElement(getter_AddRefs(windowElement));
    NS_ENSURE_TRUE(windowElement, NS_ERROR_FAILURE);

    // XXX The following code is being #if 0'd out since it
    // basically does nothing until bug 70974 is fixed.
    // After bug 70974 is fixed, we will also need to implement
    // computed style for that property before this will
    // be of any use.  And even then, it will *still* 
    // do nothing on platforms which don't implement 
    // nsWindow::SetIcon(). See bug 76211 for that.
    // Also see bug 57576 and its dependency tree.
#if 0
    // Get document in which this <window> is contained.
    nsCOMPtr<nsIDOMDocument> document;
    windowElement->GetOwnerDocument(getter_AddRefs(document));
    NS_ENSURE_TRUE(document, NS_ERROR_FAILURE);

    // Get document view.
    nsCOMPtr<nsIDOMDocumentView> docView(do_QueryInterface(document));
    NS_ENSURE_TRUE(docView, NS_ERROR_FAILURE);

    // Get default/abstract view.
    nsCOMPtr<nsIDOMAbstractView> abstractView;
    docView->GetDefaultView(getter_AddRefs(abstractView));
    NS_ENSURE_TRUE(abstractView, NS_ERROR_FAILURE);

    // Get "view CSS."
    nsCOMPtr<nsIDOMViewCSS> viewCSS(do_QueryInterface(abstractView));
    NS_ENSURE_TRUE(viewCSS, NS_ERROR_FAILURE);

    // Next, get CSS style declaration.
    nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl;
    viewCSS->GetComputedStyle(windowElement, EmptyString(),
                              getter_AddRefs(cssDecl));
    NS_ENSURE_TRUE(cssDecl, NS_ERROR_FAILURE);

    // Whew.  Now get "list-style-image" property value.
    nsAutoString windowIcon;
    windowIcon.AssignLiteral("-moz-window-icon");
    nsAutoString icon;
    cssDecl->GetPropertyValue(windowIcon, icon);
#endif

    nsAutoString id;
    windowElement->GetAttribute(NS_LITERAL_STRING("id"), id);

    if (id.IsEmpty()) {
        id.AssignLiteral("default");
    }

    mWindow->SetIcon(id);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1159 of file nsXULWindow.cpp.

{
  nsresult rv;
  PRBool   gotState = PR_FALSE;
  
  /* There are no misc attributes of interest to the hidden window.
     It's especially important not to try to validate that window's
     size or position, because some platforms (Mac OS X) need to
     make it visible and offscreen. */
  if (mIsHiddenWindow)
    return PR_FALSE;

  nsCOMPtr<nsIDOMElement> windowElement;
  GetWindowDOMElement(getter_AddRefs(windowElement));
  NS_ASSERTION(windowElement, "no xul:window");
  if (!windowElement)
    return PR_FALSE;

  nsAutoString stateString;

  // sizemode
  rv = windowElement->GetAttribute(NS_LITERAL_STRING("sizemode"), stateString);
  if (NS_SUCCEEDED(rv)) {
    PRInt32 sizeMode = nsSizeMode_Normal;
    /* ignore request to minimize, to not confuse novices
    if (stateString.Equals(SIZEMODE_MINIMIZED))
      sizeMode = nsSizeMode_Minimized;
    */
    if (stateString.Equals(SIZEMODE_MAXIMIZED)) {
      /* Honor request to maximize only if the window is sizable.
         An unsizable, unmaximizable, yet maximized window confuses
         Windows OS and is something of a travesty, anyway. */
      if (mChromeFlags & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) {
        mIntrinsicallySized = PR_FALSE;
        sizeMode = nsSizeMode_Maximized;
      }
    }
    // the widget had better be able to deal with not becoming visible yet
    mWindow->SetSizeMode(sizeMode);
    gotState = PR_TRUE;
  }

  // zlevel
  rv = windowElement->GetAttribute(NS_LITERAL_STRING("zlevel"), stateString);
  if (NS_SUCCEEDED(rv) && stateString.Length() > 0) {
    PRInt32  errorCode;
    PRUint32 zLevel = stateString.ToInteger(&errorCode);
    if (NS_SUCCEEDED(errorCode) && zLevel >= lowestZ && zLevel <= highestZ)
      SetZLevel(zLevel);
  }

  return gotState;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsWebShellWindow::LoadNativeMenus ( nsIDOMDocument aDOMDoc,
nsIWidget aParentWindow 
) [protected]

Definition at line 521 of file nsWebShellWindow.cpp.

{
  // Find the menubar tag (if there is more than one, we ignore all but
  // the first).
  nsCOMPtr<nsIDOMNodeList> menubarElements;
  aDOMDoc->GetElementsByTagNameNS(NS_LITERAL_STRING("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"),
                                  NS_LITERAL_STRING("menubar"),
                                  getter_AddRefs(menubarElements));

  
  nsCOMPtr<nsIDOMNode> menubarNode;
  if (menubarElements)
    menubarElements->Item(0, getter_AddRefs(menubarNode));

  if (!menubarNode)
    return;

  nsCOMPtr<nsIMenuBar> pnsMenuBar = do_CreateInstance(kMenuBarCID);
  if (!pnsMenuBar)
    return;

  // set pnsMenuBar as a nsMenuListener on aParentWindow
  nsCOMPtr<nsIMenuListener> menuListener = do_QueryInterface(pnsMenuBar);

  // fake event
  nsMenuEvent fake(PR_TRUE, 0, nsnull);
  menuListener->MenuConstruct(fake, aParentWindow, menubarNode, mDocShell);
}

Here is the call graph for this function:

PRBool nsXULWindow::LoadPositionFromXUL ( ) [protected, inherited]

Definition at line 1017 of file nsXULWindow.cpp.

{
  nsresult rv;
  PRBool   gotPosition = PR_FALSE;
  
  // if we're the hidden window, don't try to validate our size/position. We're
  // special.
  if (mIsHiddenWindow)
    return PR_FALSE;

  nsCOMPtr<nsIDOMElement> windowElement;
  GetWindowDOMElement(getter_AddRefs(windowElement));
  NS_ASSERTION(windowElement, "no xul:window");
  if (!windowElement)
    return PR_FALSE;

  PRInt32 currX = 0;
  PRInt32 currY = 0;
  PRInt32 currWidth = 0;
  PRInt32 currHeight = 0;
  PRInt32 errorCode;
  PRInt32 temp;

  GetPositionAndSize(&currX, &currY, &currWidth, &currHeight);

  // Obtain the position information from the <xul:window> element.
  PRInt32 specX = currX;
  PRInt32 specY = currY;
  nsAutoString posString;

  rv = windowElement->GetAttribute(NS_LITERAL_STRING("screenX"), posString);
  if (NS_SUCCEEDED(rv)) {
    temp = posString.ToInteger(&errorCode);
    if (NS_SUCCEEDED(errorCode)) {
      specX = temp;
      gotPosition = PR_TRUE;
    }
  }
  rv = windowElement->GetAttribute(NS_LITERAL_STRING("screenY"), posString);
  if (NS_SUCCEEDED(rv)) {
    temp = posString.ToInteger(&errorCode);
    if (NS_SUCCEEDED(errorCode)) {
      specY = temp;
      gotPosition = PR_TRUE;
    }
  }
    
  if (gotPosition) {
    // our position will be relative to our parent, if any
    nsCOMPtr<nsIBaseWindow> parent(do_QueryReferent(mParentWindow));
    if (parent) {
      PRInt32 parentX, parentY;
      if (NS_SUCCEEDED(parent->GetPosition(&parentX, &parentY))) {
        specX += parentX;
        specY += parentY;
      }
    } else
      StaggerPosition(specX, specY, currWidth, currHeight);
  }
  mWindow->ConstrainPosition(PR_FALSE, &specX, &specY);
  if (specX != currX || specY != currY)
    SetPosition(specX, specY);

  return gotPosition;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsXULWindow::LoadSizeFromXUL ( ) [protected, inherited]

Definition at line 1083 of file nsXULWindow.cpp.

{
  nsresult rv;
  PRBool   gotSize = PR_FALSE;
  
  // if we're the hidden window, don't try to validate our size/position. We're
  // special.
  if (mIsHiddenWindow)
    return PR_FALSE;

  nsCOMPtr<nsIDOMElement> windowElement;
  GetWindowDOMElement(getter_AddRefs(windowElement));
  NS_ASSERTION(windowElement, "no xul:window");
  if (!windowElement)
    return PR_FALSE;

  PRInt32 currWidth = 0;
  PRInt32 currHeight = 0;
  PRInt32 errorCode;
  PRInt32 temp;

  GetSize(&currWidth, &currHeight);

  // Obtain the position and sizing information from the <xul:window> element.
  PRInt32 specWidth = currWidth;
  PRInt32 specHeight = currHeight;
  nsAutoString sizeString;

  rv = windowElement->GetAttribute(NS_LITERAL_STRING("width"), sizeString);
  if (NS_SUCCEEDED(rv)) {
    temp = sizeString.ToInteger(&errorCode);
    if (NS_SUCCEEDED(errorCode) && temp > 0) {
      specWidth = temp > 100 ? temp : 100;
      gotSize = PR_TRUE;
    }
  }
  rv = windowElement->GetAttribute(NS_LITERAL_STRING("height"), sizeString);
  if (NS_SUCCEEDED(rv)) {
    temp = sizeString.ToInteger(&errorCode);
    if (NS_SUCCEEDED(errorCode) && temp > 0) {
      specHeight = temp > 100 ? temp : 100;
      gotSize = PR_TRUE;
    }
  }

  if (gotSize) {
    // constrain to screen size
    nsCOMPtr<nsIDOMWindowInternal> domWindow;
    GetWindowDOMWindow(getter_AddRefs(domWindow));
    if (domWindow) {
      nsCOMPtr<nsIDOMScreen> screen;
      domWindow->GetScreen(getter_AddRefs(screen));
      if (screen) {
        PRInt32 screenWidth;
        PRInt32 screenHeight;
        screen->GetAvailWidth(&screenWidth);
        screen->GetAvailHeight(&screenHeight);
        if (specWidth > screenWidth)
          specWidth = screenWidth;
        if (specHeight > screenHeight)
          specHeight = screenHeight;
      }
    }

    mIntrinsicallySized = PR_FALSE;
    if (specWidth != currWidth || specHeight != currHeight)
      SetSize(specWidth, specHeight, PR_FALSE);
  }

  return gotSize;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1332 of file nsXULWindow.cpp.

{
  if (mWindow->GetWindowClass(nsnull)==NS_ERROR_NOT_IMPLEMENTED)
    return NS_OK;

  nsCOMPtr<nsIDOMElement> docShellElement;
  GetWindowDOMElement(getter_AddRefs(docShellElement));
  NS_ENSURE_TRUE(docShellElement, NS_ERROR_FAILURE);

  nsAutoString windowClass;

  docShellElement->GetAttribute(NS_LITERAL_STRING("windowtype"),
                                windowClass);

  if (!windowClass.IsEmpty())
  {
    PRBool persistPosition;
    PRBool persistSize;
    PRBool persistSizeMode;

    if (NS_SUCCEEDED(
         mContentTreeOwner->
           GetPersistence(&persistPosition, &persistSize, &persistSizeMode)
        ) && !persistPosition && !persistSize && !persistSizeMode)
      windowClass.AppendLiteral("-jsSpamPopupCrap");

    char *windowClass_cstr = ToNewCString(windowClass);
    mWindow->SetWindowClass(windowClass_cstr);
    nsMemory::Free(windowClass_cstr);
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_DECL_ISUPPORTS NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSIXULWINDOW NS_DECL_NSIBASEWINDOW void nsXULWindow::LockUntilChromeLoad ( ) [inline, inherited]

Definition at line 97 of file nsXULWindow.h.

Here is the caller graph for this function:

nsXULWindow::NS_HIDDEN_ ( nsresult  ) [protected, inherited]
nsXULWindow::NS_HIDDEN_ ( nsresult  ) [protected, inherited]
void nsXULWindow::OnChromeLoaded ( ) [protected, inherited]

Definition at line 953 of file nsXULWindow.cpp.

{
  nsresult rv = EnsureContentTreeOwner();

  if (NS_SUCCEEDED(rv)) {
    mChromeLoaded = PR_TRUE;
    ApplyChromeFlags();

    LoadChromeHidingFromXUL();
    LoadWindowClassFromXUL();
    LoadIconFromXUL();
    LoadSizeFromXUL();
    if(mIntrinsicallySized) {
      // (if LoadSizeFromXUL set the size, mIntrinsicallySized will be false)
      nsCOMPtr<nsIContentViewer> cv;
      mDocShell->GetContentViewer(getter_AddRefs(cv));
      nsCOMPtr<nsIMarkupDocumentViewer> markupViewer(do_QueryInterface(cv));
      if(markupViewer)
        markupViewer->SizeToContent();
    }

    PRBool positionSet = PR_TRUE;
    nsCOMPtr<nsIXULWindow> parentWindow(do_QueryReferent(mParentWindow));
#if defined(XP_UNIX) && !defined(XP_MACOSX)
    // don't override WM placement on unix for independent, top-level windows
    // (however, we think the benefits of intelligent dependent window placement
    // trump that override.)
    if (!parentWindow)
      positionSet = PR_FALSE;
#endif
    if (positionSet)
      positionSet = LoadPositionFromXUL();
    LoadMiscPersistentAttributesFromXUL();

    //LoadContentAreas();

    if (mCenterAfterLoad && !positionSet)
      Center(parentWindow, parentWindow ? PR_FALSE : PR_TRUE, PR_FALSE);

    if(mShowAfterLoad)
      SetVisibility(PR_TRUE);
  }
  mPersistentAttributesMask |= PAD_POSITION | PAD_SIZE | PAD_MISC;
}

Here is the call graph for this function:

void nsIWebProgressListener::onLocationChange ( in nsIWebProgress  aWebProgress,
in nsIRequest  aRequest,
in nsIURI  aLocation 
) [inherited]

Called when the location of the window being watched changes.

This is not when a load is requested, but rather once it is verified that the load is going to occur in the given window. For instance, a load that starts in a window might send progress and status messages for the new site, but it will not send the onLocationChange until we are sure that we are loading this new page here.

Parameters:
aWebProgressThe nsIWebProgress instance that fired the notification.
aRequestThe associated nsIRequest. This may be null in some cases.
aLocationThe URI of the location that is being loaded.
void nsIWebProgressListener::onProgressChange ( in nsIWebProgress  aWebProgress,
in nsIRequest  aRequest,
in long  aCurSelfProgress,
in long  aMaxSelfProgress,
in long  aCurTotalProgress,
in long  aMaxTotalProgress 
) [inherited]

Notification that the progress has changed for one of the requests associated with aWebProgress.

Progress totals are reset to zero when all requests in aWebProgress complete (corresponding to onStateChange being called with aStateFlags including the STATE_STOP and STATE_IS_WINDOW flags).

Parameters:
aWebProgressThe nsIWebProgress instance that fired the notification.
aRequestThe nsIRequest that has new progress.
aCurSelfProgressThe current progress for aRequest.
aMaxSelfProgressThe maximum progress for aRequest.
aCurTotalProgressThe current progress for all requests associated with aWebProgress.
aMaxTotalProgressThe total progress for all requests associated with aWebProgress.

NOTE: If any progress value is unknown, or if its value would exceed the maximum value of type long, then its value is replaced with -1.

NOTE: If the object also implements nsIWebProgressListener2 and the caller knows about that interface, this function will not be called. Instead, nsIWebProgressListener2::onProgressChange64 will be called.

void nsIWebProgressListener::onSecurityChange ( in nsIWebProgress  aWebProgress,
in nsIRequest  aRequest,
in unsigned long  aState 
) [inherited]

Notification called for security progress.

This method will be called on security transitions (eg HTTP -> HTTPS, HTTPS -> HTTP, FOO -> HTTPS) and after document load completion. It might also be called if an error occurs during network loading.

Parameters:
aWebProgressThe nsIWebProgress instance that fired the notification.
aRequestThe nsIRequest that has new security state.
aStateA value composed of the Security State Flags and the Security Strength Flags listed above. Any undefined bits are reserved for future use.

NOTE: These notifications will only occur if a security package is installed.

void nsIWebProgressListener::onStateChange ( in nsIWebProgress  aWebProgress,
in nsIRequest  aRequest,
in unsigned long  aStateFlags,
in nsresult  aStatus 
) [inherited]

Notification indicating the state has changed for one of the requests associated with aWebProgress.

Parameters:
aWebProgressThe nsIWebProgress instance that fired the notification
aRequestThe nsIRequest that has changed state.
aStateFlagsFlags indicating the new state. This value is a combination of one of the State Transition Flags and one or more of the State Type Flags defined above. Any undefined bits are reserved for future use.
aStatusError status code associated with the state change. This parameter should be ignored unless aStateFlags includes the STATE_STOP bit. The status code indicates success or failure of the request associated with the state change. NOTE: aStatus may be a success code even for server generated errors, such as the HTTP 404 error. In such cases, the request itself should be queried for extended error information (e.g., for HTTP requests see nsIHttpChannel).
void nsIWebProgressListener::onStatusChange ( in nsIWebProgress  aWebProgress,
in nsIRequest  aRequest,
in nsresult  aStatus,
in wstring  aMessage 
) [inherited]

Notification that the status of a request has changed.

The status message is intended to be displayed to the user (e.g., in the status bar of the browser).

Parameters:
aWebProgressThe nsIWebProgress instance that fired the notification.
aRequestThe nsIRequest that has new status.
aStatusThis value is not an error code. Instead, it is a numeric value that indicates the current status of the request. This interface does not define the set of possible status codes. NOTE: Some status values are defined by nsITransport and nsISocketTransport.
aMessageLocalized text corresponding to aStatus.
void nsXULWindow::PersistentAttributesDirty ( PRUint32  aDirtyFlags) [protected, inherited]

Definition at line 2055 of file nsXULWindow.cpp.

Here is the caller graph for this function:

void nsXULWindow::PlaceWindowLayersBehind ( PRUint32  aLowLevel,
PRUint32  aHighLevel,
nsIXULWindow aBehind 
) [protected, inherited]

Definition at line 1981 of file nsXULWindow.cpp.

                                                                 {

  // step through windows in z-order from top to bottommost window

  nsCOMPtr<nsIWindowMediator> mediator(do_GetService(kWindowMediatorCID));
  if(!mediator)
    return;

  nsCOMPtr<nsISimpleEnumerator> windowEnumerator;
  mediator->GetZOrderXULWindowEnumerator(0, PR_TRUE,
              getter_AddRefs(windowEnumerator));
  if (!windowEnumerator)
    return;

  // each window will be moved behind previousHighWidget, itself
  // a moving target. initialize it.
  nsCOMPtr<nsIWidget> previousHighWidget;
  if (aBehind) {
    nsCOMPtr<nsIBaseWindow> highBase(do_QueryInterface(aBehind));
    if (highBase)
      highBase->GetMainWidget(getter_AddRefs(previousHighWidget));
  }

  // get next lower window
  PRBool more;
  while (windowEnumerator->HasMoreElements(&more), more) {
    PRUint32 nextZ; // z-level of nextWindow
    nsCOMPtr<nsISupports> nextWindow;
    windowEnumerator->GetNext(getter_AddRefs(nextWindow));
    nsCOMPtr<nsIXULWindow> nextXULWindow(do_QueryInterface(nextWindow));
    nextXULWindow->GetZLevel(&nextZ);
    if (nextZ < aLowLevel)
      break; // we've processed all windows through aLowLevel
    
    // move it just below its next higher window
    nsCOMPtr<nsIBaseWindow> nextBase(do_QueryInterface(nextXULWindow));
    if (nextBase) {
      nsCOMPtr<nsIWidget> nextWidget;
      nextBase->GetMainWidget(getter_AddRefs(nextWidget));
      if (nextZ <= aHighLevel)
        nextWidget->PlaceBehind(eZPlacementBelow, previousHighWidget, PR_FALSE);
      previousHighWidget = nextWidget;
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Tell this window that it has lost a child XUL window.

Parameters:
aChildthe child window being removed
void nsIBaseWindow::repaint ( in boolean  force) [inherited]

Tell the window to repaint itself.

Parameters:
aForce- if true, repaint immediately if false, the window may defer repainting as it sees fit.

Definition at line 1426 of file nsXULWindow.cpp.

{
  // can happen when the persistence timer fires at an inopportune time
  // during window shutdown
  if (!mDocShell)
    return NS_ERROR_FAILURE;

  nsCOMPtr<nsIDOMElement> docShellElement;
  GetWindowDOMElement(getter_AddRefs(docShellElement));
  if(!docShellElement)
    return NS_ERROR_FAILURE;

  nsAutoString   persistString;
  docShellElement->GetAttribute(PERSIST_ATTRIBUTE, persistString);
  if (persistString.IsEmpty()) { // quick check which sometimes helps
    mPersistentAttributesDirty = 0;
    return NS_OK;
  }

  PRInt32 x, y, cx, cy;
  PRInt32 sizeMode;

  // get our size, position and mode to persist
  NS_ENSURE_SUCCESS(GetPositionAndSize(&x, &y, &cx, &cy), NS_ERROR_FAILURE);
  mWindow->GetSizeMode(&sizeMode);

  // make our position relative to our parent, if any
  nsCOMPtr<nsIBaseWindow> parent(do_QueryReferent(mParentWindow));
  if (parent) {
    PRInt32 parentX, parentY;
    if (NS_SUCCEEDED(parent->GetPosition(&parentX, &parentY))) {
      x -= parentX;
      y -= parentY;
    }
  }

  char                        sizeBuf[10];
  nsAutoString                sizeString;
  nsAutoString                windowElementId;
  nsCOMPtr<nsIDOMXULDocument> ownerXULDoc;

  { // fetch docShellElement's ID and XUL owner document
    nsCOMPtr<nsIDOMDocument> ownerDoc;
    docShellElement->GetOwnerDocument(getter_AddRefs(ownerDoc));
    ownerXULDoc = do_QueryInterface(ownerDoc);
    nsCOMPtr<nsIDOMXULElement> XULElement(do_QueryInterface(docShellElement));
    if (XULElement)
      XULElement->GetId(windowElementId);
  }

  // (only for size elements which are persisted)
  if ((mPersistentAttributesDirty & PAD_POSITION) &&
      sizeMode == nsSizeMode_Normal) {
    if(persistString.Find("screenX") >= 0) {
      PR_snprintf(sizeBuf, sizeof(sizeBuf), "%ld", (long)x);
      sizeString.AssignWithConversion(sizeBuf);
      docShellElement->SetAttribute(SCREENX_ATTRIBUTE, sizeString);
      if (ownerXULDoc) // force persistence in case the value didn't change
        ownerXULDoc->Persist(windowElementId, SCREENX_ATTRIBUTE);
    }
    if(persistString.Find("screenY") >= 0) {
      PR_snprintf(sizeBuf, sizeof(sizeBuf), "%ld", (long)y);
      sizeString.AssignWithConversion(sizeBuf);
      docShellElement->SetAttribute(SCREENY_ATTRIBUTE, sizeString);
      if (ownerXULDoc)
        ownerXULDoc->Persist(windowElementId, SCREENY_ATTRIBUTE);
    }
  }

  if ((mPersistentAttributesDirty & PAD_SIZE) &&
      sizeMode == nsSizeMode_Normal) {
    if(persistString.Find("width") >= 0) {
      PR_snprintf(sizeBuf, sizeof(sizeBuf), "%ld", (long)cx);
      sizeString.AssignWithConversion(sizeBuf);
      docShellElement->SetAttribute(WIDTH_ATTRIBUTE, sizeString);
      if (ownerXULDoc)
        ownerXULDoc->Persist(windowElementId, WIDTH_ATTRIBUTE);
    }
    if(persistString.Find("height") >= 0) {
      PR_snprintf(sizeBuf, sizeof(sizeBuf), "%ld", (long)cy);
      sizeString.AssignWithConversion(sizeBuf);
      docShellElement->SetAttribute(HEIGHT_ATTRIBUTE, sizeString);
      if (ownerXULDoc)
        ownerXULDoc->Persist(windowElementId, HEIGHT_ATTRIBUTE);
    }
  }

  if (mPersistentAttributesDirty & PAD_MISC) {
    if (sizeMode != nsSizeMode_Minimized &&
        persistString.Find("sizemode") >= 0) {
      if (sizeMode == nsSizeMode_Maximized)
        sizeString.Assign(SIZEMODE_MAXIMIZED);
      else
        sizeString.Assign(SIZEMODE_NORMAL);
      docShellElement->SetAttribute(MODE_ATTRIBUTE, sizeString);
      if (ownerXULDoc)
        ownerXULDoc->Persist(windowElementId, MODE_ATTRIBUTE);
    }
    if (persistString.Find("zlevel") >= 0) {
      PRUint32 zLevel;
      nsCOMPtr<nsIWindowMediator> mediator(do_GetService(kWindowMediatorCID));
      if (mediator) {
        mediator->GetZLevel(this, &zLevel);
        PR_snprintf(sizeBuf, sizeof(sizeBuf), "%lu", (unsigned long)zLevel);
        sizeString.AssignWithConversion(sizeBuf);
        docShellElement->SetAttribute(ZLEVEL_ATTRIBUTE, sizeString);
        ownerXULDoc->Persist(windowElementId, ZLEVEL_ATTRIBUTE);
      }
    }
  }

  mPersistentAttributesDirty = 0;
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsXULWindow::SetContentScrollbarVisibility ( PRBool  aVisible) [protected, inherited]

Definition at line 2029 of file nsXULWindow.cpp.

                                                               {

  nsCOMPtr<nsIDOMWindow> contentWin(do_GetInterface(mPrimaryContentShell));
  if (contentWin) {
    nsCOMPtr<nsIDOMBarProp> scrollbars;
    contentWin->GetScrollbars(getter_AddRefs(scrollbars));
    if (scrollbars)
      scrollbars->SetVisible(aVisible);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIBaseWindow::setFocus ( ) [inherited]

Give the window focus.

void nsWebShellWindow::SetPersistenceTimer ( PRUint32  aDirtyFlags) [protected]

Definition at line 552 of file nsWebShellWindow.cpp.

{
  if (!mSPTimerLock)
    return;

  PR_Lock(mSPTimerLock);
  if (mSPTimer) {
    mSPTimer->SetDelay(SIZE_PERSISTENCE_TIMEOUT);
    PersistentAttributesDirty(aDirtyFlags);
  } else {
    nsresult rv;
    mSPTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
    if (NS_SUCCEEDED(rv)) {
      NS_ADDREF_THIS(); // for the timer, which holds a reference to this window
      mSPTimer->InitWithFuncCallback(FirePersistenceTimer, this,
                                     SIZE_PERSISTENCE_TIMEOUT, nsITimer::TYPE_ONE_SHOT);
      PersistentAttributesDirty(aDirtyFlags);
    }
  }
  PR_Unlock(mSPTimerLock);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIBaseWindow::setPosition ( in long  x,
in long  y 
) [inherited]
void nsIBaseWindow::setPositionAndSize ( in long  x,
in long  y,
in long  cx,
in long  cy,
in boolean  fRepaint 
) [inherited]
void nsIBaseWindow::setSize ( in long  cx,
in long  cy,
in boolean  fRepaint 
) [inherited]
void nsIXULWindow::showModal ( ) [inherited]

Shows the window as a modal window.

That is, ensures that it is visible and runs a local event loop, exiting only once the window has been closed.

NS_IMETHODIMP nsXULWindow::SizeShellTo ( nsIDocShellTreeItem aShellItem,
PRInt32  aCX,
PRInt32  aCY 
) [protected, inherited]

Definition at line 1692 of file nsXULWindow.cpp.

{
   // XXXTAB This is wrong, we should actually reflow based on the passed in'
   // shell.  For now we are hacking and doing delta sizing.  This is bad
   // because it assumes all size we add will go to the shell which probably
   // won't happen.

   nsCOMPtr<nsIBaseWindow> shellAsWin(do_QueryInterface(aShellItem));
   NS_ENSURE_TRUE(shellAsWin, NS_ERROR_FAILURE);

   PRInt32 width = 0;
   PRInt32 height = 0;
   shellAsWin->GetSize(&width, &height);

   PRInt32 widthDelta = aCX - width;
   PRInt32 heightDelta = aCY - height;

   if(widthDelta || heightDelta)
      {
      PRInt32 winCX = 0;
      PRInt32 winCY = 0;

      GetSize(&winCX, &winCY);
      SetSize(winCX + widthDelta, winCY + heightDelta, PR_TRUE);
      }

   return NS_OK;
}

Here is the call graph for this function:

void nsXULWindow::StaggerPosition ( PRInt32 aRequestedX,
PRInt32 aRequestedY,
PRInt32  aSpecWidth,
PRInt32  aSpecHeight 
) [protected, inherited]

Definition at line 1218 of file nsXULWindow.cpp.

{
  const PRInt32 kOffset = 22;
  const PRInt32 kSlop = 4;
  nsresult rv;
  PRBool   keepTrying;
  int      bouncedX = 0, // bounced off vertical edge of screen
           bouncedY = 0; // bounced off horizontal edge

  // look for any other windows of this type
  nsCOMPtr<nsIWindowMediator> wm(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
  if (!wm)
    return;

  nsCOMPtr<nsIDOMElement> windowElement;
  GetWindowDOMElement(getter_AddRefs(windowElement));
  nsCOMPtr<nsIXULWindow> ourXULWindow(this);

  nsAutoString windowType;
  rv = windowElement->GetAttribute(WINDOWTYPE_ATTRIBUTE, windowType);
  if (NS_FAILED(rv))
    return;

  PRInt32 screenTop = 0,    // it's pointless to initialize these ...
          screenRight = 0,  // ... but to prevent oversalubrious and ...
          screenBottom = 0, // ... underbright compilers from ...
          screenLeft = 0;   // ... issuing warnings.
  PRBool  gotScreen = PR_FALSE;

  { // fetch screen coordinates
    nsCOMPtr<nsIScreenManager> screenMgr(do_GetService(
                                         "@mozilla.org/gfx/screenmanager;1"));
    if (screenMgr) {
      nsCOMPtr<nsIScreen> ourScreen;
      screenMgr->ScreenForRect(aRequestedX, aRequestedY,
                               aSpecWidth, aSpecHeight,
                               getter_AddRefs(ourScreen));
      if (ourScreen) {
        PRInt32 screenWidth, screenHeight;
        ourScreen->GetAvailRect(&screenLeft, &screenTop,
                                &screenWidth, &screenHeight);
        screenBottom = screenTop + screenHeight;
        screenRight = screenLeft + screenWidth;
        gotScreen = PR_TRUE;
      }
    }
  }

  // one full pass through all windows of this type. repeat until
  // no collisions.
  do {
    keepTrying = PR_FALSE;
    nsCOMPtr<nsISimpleEnumerator> windowList;
    wm->GetXULWindowEnumerator(windowType.get(), getter_AddRefs(windowList));

    if (!windowList)
      break;

    // one full pass through all windows of this type. offset and stop
    // on collision.
    do {
      PRBool more;
      PRInt32 listX, listY;
      windowList->HasMoreElements(&more);
      if (!more)
        break;

      nsCOMPtr<nsISupports> supportsWindow;
      windowList->GetNext(getter_AddRefs(supportsWindow));

      nsCOMPtr<nsIXULWindow> listXULWindow(do_QueryInterface(supportsWindow));
      nsCOMPtr<nsIBaseWindow> listBaseWindow(do_QueryInterface(supportsWindow));

      if (listXULWindow != ourXULWindow) {
        listBaseWindow->GetPosition(&listX, &listY);

        if (PR_ABS(listX-aRequestedX) <= kSlop &&
            PR_ABS(listY-aRequestedY) <= kSlop) {
          // collision! offset and start over
          if (bouncedX & 0x1)
            aRequestedX -= kOffset;
          else
            aRequestedX += kOffset;
          aRequestedY += kOffset;

          if (gotScreen) {
            // bounce off left and right edges
            if (!(bouncedX & 0x1) && aRequestedX + aSpecWidth > screenRight) {
              aRequestedX = screenRight - aSpecWidth;
              ++bouncedX;
            }
            if ((bouncedX & 0x1) && aRequestedX < screenLeft) {
              aRequestedX = screenLeft;
              ++bouncedX;
            }
            // hit the bottom and start again at the top
            if (aRequestedY + aSpecHeight > screenBottom) {
              aRequestedY = screenTop;
              ++bouncedY;
            }
          }

          /* loop around again,
             but it's time to give up once we've covered the screen.
             there's a potential infinite loop with lots of windows. */
          keepTrying = bouncedX < 2 || bouncedY == 0;
          break;
        }
      }
    } while(1);
  } while (keepTrying);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 277 of file nsWebShellWindow.cpp.

{
    nsCOMPtr<nsIXULWindow> kungFuDeathGrip(this);
    nsCOMPtr<nsIWebBrowserChrome> wbc(do_GetInterface(kungFuDeathGrip));
    if (!wbc)
      return NS_ERROR_UNEXPECTED;

    // rjc: don't use "nsIWebBrowserChrome::CHROME_EXTRA"
    //      due to components with multiple sidebar components
    //      (such as Mail/News, Addressbook, etc)... and frankly,
    //      Mac IE, OmniWeb, and other Mac OS X apps all work this way

    PRUint32    chromeMask = (nsIWebBrowserChrome::CHROME_TOOLBAR |
                              nsIWebBrowserChrome::CHROME_LOCATIONBAR |
                              nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR);

    PRUint32    chromeFlags, newChromeFlags = 0;
    wbc->GetChromeFlags(&chromeFlags);
    newChromeFlags = chromeFlags & chromeMask;
    if (!newChromeFlags)    chromeFlags |= chromeMask;
    else                    chromeFlags &= (~newChromeFlags);
    wbc->SetChromeFlags(chromeFlags);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

PRBool PRBool const nsAString& nsXULWindow::aID [protected, inherited]

Definition at line 133 of file nsXULWindow.h.

PRBool nsXULWindow::aPrimary [protected, inherited]

Definition at line 133 of file nsXULWindow.h.

PRBool PRBool nsXULWindow::aTargetable [protected, inherited]

Definition at line 133 of file nsXULWindow.h.

set blurSuppression to true to suppress handling of blur events.

set it false to re-enable them. query it to determine whether blur events are suppressed. The implementation should allow for blur events to be suppressed multiple times.

Definition at line 205 of file nsIBaseWindow.idl.

Definition at line 131 of file nsIXULWindow.idl.

contextFlags are from nsIWindowCreator2

Definition at line 129 of file nsIXULWindow.idl.

The docshell owning the XUL for this window.

Definition at line 60 of file nsIXULWindow.idl.

Definition at line 198 of file nsIBaseWindow.idl.

const unsigned long nsIXULWindow::highestZ = 9 [inherited]

Definition at line 122 of file nsIXULWindow.idl.

Indicates if this window is instrinsically sized.

Definition at line 65 of file nsIXULWindow.idl.

const unsigned long nsIXULWindow::loweredZ = 4 [inherited]

Definition at line 119 of file nsIXULWindow.idl.

const unsigned long nsIXULWindow::lowestZ = 0 [inherited]

Definition at line 118 of file nsIXULWindow.idl.

Definition at line 212 of file nsIBaseWindow.idl.

Definition at line 162 of file nsXULWindow.h.

Definition at line 176 of file nsXULWindow.h.

Definition at line 172 of file nsXULWindow.h.

PRUint32 nsXULWindow::mChromeFlags [protected, inherited]

Definition at line 179 of file nsXULWindow.h.

PRPackedBool nsXULWindow::mChromeLoaded [protected, inherited]

Definition at line 169 of file nsXULWindow.h.

Definition at line 154 of file nsXULWindow.h.

nsVoidArray nsXULWindow::mContentShells [protected, inherited]

Definition at line 165 of file nsXULWindow.h.

Definition at line 155 of file nsXULWindow.h.

PRUint32 nsXULWindow::mContextFlags [protected, inherited]

Definition at line 175 of file nsXULWindow.h.

Definition at line 167 of file nsXULWindow.h.

PRPackedBool nsXULWindow::mDebuting [protected, inherited]

Definition at line 168 of file nsXULWindow.h.

nsCOMPtr<nsIDocShell> nsXULWindow::mDocShell [protected, inherited]

Definition at line 158 of file nsXULWindow.h.

Definition at line 159 of file nsXULWindow.h.

Definition at line 171 of file nsXULWindow.h.

Definition at line 173 of file nsXULWindow.h.

Definition at line 174 of file nsXULWindow.h.

nsresult nsXULWindow::mModalStatus [protected, inherited]

Definition at line 166 of file nsXULWindow.h.

Definition at line 160 of file nsXULWindow.h.

Definition at line 177 of file nsXULWindow.h.

Definition at line 178 of file nsXULWindow.h.

Definition at line 164 of file nsXULWindow.h.

Definition at line 156 of file nsXULWindow.h.

nsCOMPtr<nsIPrompt> nsXULWindow::mPrompter [protected, inherited]

Definition at line 161 of file nsXULWindow.h.

PRPackedBool nsXULWindow::mShowAfterLoad [protected, inherited]

Definition at line 170 of file nsXULWindow.h.

Definition at line 91 of file nsWebShellWindow.h.

Definition at line 92 of file nsWebShellWindow.h.

Definition at line 182 of file nsXULWindow.h.

nsString nsXULWindow::mTitle [protected, inherited]

Definition at line 180 of file nsXULWindow.h.

nsCOMPtr<nsIWidget> nsXULWindow::mWindow [protected, inherited]

Definition at line 157 of file nsXULWindow.h.

Definition at line 163 of file nsXULWindow.h.

const unsigned long nsIXULWindow::normalZ = 5 [inherited]

Definition at line 120 of file nsIXULWindow.idl.

Definition at line 185 of file nsIBaseWindow.idl.

Definition at line 174 of file nsIBaseWindow.idl.

The primary content shell.

Note that this is a docshell tree item and therefore can not be assured of what object it is. It could be an editor, a docshell, or a browser object. Or down the road any other object that supports being a DocShellTreeItem Query accordingly to determine the capabilities.

Definition at line 75 of file nsIXULWindow.idl.

const unsigned long nsIXULWindow::raisedZ = 6 [inherited]

Definition at line 121 of file nsIXULWindow.idl.

const unsigned long nsIWebProgressListener::STATE_IS_BROKEN = 0x00000001 [inherited]

Definition at line 205 of file nsIWebProgressListener.idl.

const unsigned long nsIWebProgressListener::STATE_IS_DOCUMENT = 0x00020000 [inherited]

Definition at line 163 of file nsIWebProgressListener.idl.

const unsigned long nsIWebProgressListener::STATE_IS_INSECURE = 0x00000004 [inherited]

State Security Flags.

These flags describe the security state reported by a call to the onSecurityChange method. These flags are mutually exclusive.

STATE_IS_INSECURE This flag indicates that the data corresponding to the request was received over an insecure channel.

STATE_IS_BROKEN This flag indicates an unknown security state. This may mean that the request is being loaded as part of a page in which some content was received over an insecure channel.

STATE_IS_SECURE This flag indicates that the data corresponding to the request was received over a secure channel. The degree of security is expressed by STATE_SECURE_HIGH, STATE_SECURE_MED, or STATE_SECURE_LOW.

Definition at line 204 of file nsIWebProgressListener.idl.

const unsigned long nsIWebProgressListener::STATE_IS_NETWORK = 0x00040000 [inherited]

Definition at line 164 of file nsIWebProgressListener.idl.

const unsigned long nsIWebProgressListener::STATE_IS_REQUEST = 0x00010000 [inherited]

State Type Flags.

These flags further describe the entity for which the state transition is occuring. These flags are NOT mutually exclusive (i.e., an onStateChange event may indicate some combination of these flags).

STATE_IS_REQUEST This flag indicates that the state transition is for a request, which includes but is not limited to document requests. (See below for a description of document requests.) Other types of requests, such as requests for inline content (e.g., images and stylesheets) are considered normal requests.

STATE_IS_DOCUMENT This flag indicates that the state transition is for a document request. This flag is set in addition to STATE_IS_REQUEST. A document request supports the nsIChannel interface and its loadFlags attribute includes the nsIChannel::LOAD_DOCUMENT_URI flag.

A document request does not complete until all requests associated with the loading of its corresponding document have completed. This includes other document requests (e.g., corresponding to HTML <iframe> elements). The document corresponding to a document request is available via the DOMWindow attribute of onStateChange's aWebProgress parameter.

STATE_IS_NETWORK This flag indicates that the state transition corresponds to the start or stop of activity in the indicated nsIWebProgress instance. This flag is accompanied by either STATE_START or STATE_STOP, and it may be combined with other State Type Flags.

Unlike STATE_IS_WINDOW, this flag is only set when activity within the nsIWebProgress instance being observed starts or stops. If activity only occurs in a child nsIWebProgress instance, then this flag will be set to indicate the start and stop of that activity.

For example, in the case of navigation within a single frame of a HTML frameset, a nsIWebProgressListener instance attached to the nsIWebProgress of the frameset window will receive onStateChange calls with the STATE_IS_NETWORK flag set to indicate the start and stop of said navigation. In other words, an observer of an outer window can determine when activity, that may be constrained to a child window or set of child windows, starts and stops.

STATE_IS_WINDOW This flag indicates that the state transition corresponds to the start or stop of activity in the indicated nsIWebProgress instance. This flag is accompanied by either STATE_START or STATE_STOP, and it may be combined with other State Type Flags.

This flag is similar to STATE_IS_DOCUMENT. However, when a document request completes, two onStateChange calls with STATE_STOP are generated. The document request is passed as aRequest to both calls. The first has STATE_IS_REQUEST and STATE_IS_DOCUMENT set, and the second has the STATE_IS_WINDOW flag set (and possibly the STATE_IS_NETWORK flag set as well -- see above for a description of when the STATE_IS_NETWORK flag may be set). This second STATE_STOP event may be useful as a way to partition the work that occurs when a document request completes.

Definition at line 162 of file nsIWebProgressListener.idl.

const unsigned long nsIWebProgressListener::STATE_IS_SECURE = 0x00000002 [inherited]

Definition at line 206 of file nsIWebProgressListener.idl.

const unsigned long nsIWebProgressListener::STATE_IS_WINDOW = 0x00080000 [inherited]

Definition at line 165 of file nsIWebProgressListener.idl.

const unsigned long nsIWebProgressListener::STATE_NEGOTIATING = 0x00000008 [inherited]

Definition at line 98 of file nsIWebProgressListener.idl.

const unsigned long nsIWebProgressListener::STATE_REDIRECTING = 0x00000002 [inherited]

Definition at line 96 of file nsIWebProgressListener.idl.

const unsigned long nsIWebProgressListener::STATE_RESTORING = 0x01000000 [inherited]

State Modifier Flags.

These flags further describe the transition which is occuring. These flags are NOT mutually exclusive (i.e., an onStateChange event may indicate some combination of these flags).

STATE_RESTORING This flag indicates that the state transition corresponds to the start or stop of activity for restoring a previously-rendered presentation. As such, there is no actual network activity associated with this request, and any modifications made to the document or presentation when it was originally loaded will still be present.

Definition at line 182 of file nsIWebProgressListener.idl.

const unsigned long nsIWebProgressListener::STATE_SECURE_HIGH = 0x00040000 [inherited]

Security Strength Flags.

These flags describe the security strength and accompany STATE_IS_SECURE in a call to the onSecurityChange method. These flags are mutually exclusive.

These flags are not meant to provide a precise description of data transfer security. These are instead intended as a rough indicator that may be used to, for example, color code a security indicator or otherwise provide basic data transfer security feedback to the user.

STATE_SECURE_HIGH This flag indicates a high degree of security.

STATE_SECURE_MED This flag indicates a medium degree of security.

STATE_SECURE_LOW This flag indicates a low degree of security.

Definition at line 229 of file nsIWebProgressListener.idl.

const unsigned long nsIWebProgressListener::STATE_SECURE_LOW = 0x00020000 [inherited]

Definition at line 231 of file nsIWebProgressListener.idl.

const unsigned long nsIWebProgressListener::STATE_SECURE_MED = 0x00010000 [inherited]

Definition at line 230 of file nsIWebProgressListener.idl.

const unsigned long nsIWebProgressListener::STATE_START = 0x00000001 [inherited]

State Transition Flags.

These flags indicate the various states that requests may transition through as they are being loaded. These flags are mutually exclusive.

For any given request, onStateChange is called once with the STATE_START flag, zero or more times with the STATE_TRANSFERRING flag or once with the STATE_REDIRECTING flag, and then finally once with the STATE_STOP flag. NOTE: For document requests, a second STATE_STOP is generated (see the description of STATE_IS_WINDOW for more details).

STATE_START This flag indicates the start of a request. This flag is set when a request is initiated. The request is complete when onStateChange is called for the same request with the STATE_STOP flag set.

STATE_REDIRECTING This flag indicates that a request is being redirected. The request passed to onStateChange is the request that is being redirected. When a redirect occurs, a new request is generated automatically to process the new request. Expect a corresponding STATE_START event for the new request, and a STATE_STOP for the redirected request.

STATE_TRANSFERRING This flag indicates that data for a request is being transferred to an end consumer. This flag indicates that the request has been targeted, and that the user may start seeing content corresponding to the request.

STATE_NEGOTIATING This flag is not used.

STATE_STOP This flag indicates the completion of a request. The aStatus parameter to onStateChange indicates the final status of the request.

Definition at line 95 of file nsIWebProgressListener.idl.

const unsigned long nsIWebProgressListener::STATE_STOP = 0x00000010 [inherited]

Definition at line 99 of file nsIWebProgressListener.idl.

const unsigned long nsIWebProgressListener::STATE_TRANSFERRING = 0x00000004 [inherited]

Definition at line 97 of file nsIWebProgressListener.idl.

attribute wstring nsIBaseWindow::title [inherited]

Definition at line 222 of file nsIBaseWindow.idl.

Definition at line 192 of file nsIBaseWindow.idl.

Definition at line 140 of file nsIXULWindow.idl.

attribute unsigned long nsIXULWindow::zLevel [inherited]

Definition at line 124 of file nsIXULWindow.idl.


The documentation for this class was generated from the following files: