diff --git a/docshell/base/nsWebShell.cpp b/docshell/base/nsWebShell.cpp index 0f359559a088..41a917179863 100644 --- a/docshell/base/nsWebShell.cpp +++ b/docshell/base/nsWebShell.cpp @@ -632,6 +632,7 @@ nsWebShell::Init(nsNativeWidget aNativeParent, } widgetInit.clipChildren = PR_FALSE; + widgetInit.mBorderStyle = eBorderStyle_3DChildWindow; mWindow->Create(aNativeParent, aBounds, nsWebShell::HandleEvent, mDeviceContext, nsnull, nsnull, &widgetInit); diff --git a/webshell/public/nsIBrowserWindow.h b/webshell/public/nsIBrowserWindow.h index 3e6f92c83cf5..34861b5fbbd3 100644 --- a/webshell/public/nsIBrowserWindow.h +++ b/webshell/public/nsIBrowserWindow.h @@ -90,6 +90,16 @@ public: NS_IMETHOD GetWebShell(nsIWebShell*& aResult) = 0; + /** + * Finds text in content + */ + NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) = 0; + + /** + * Redraws contents of browser window + */ + NS_IMETHOD ForceRefresh() = 0; + // XXX minimize, maximize // XXX event control: enable/disable window close box, stick to glass, modal }; diff --git a/webshell/src/nsWebShell.cpp b/webshell/src/nsWebShell.cpp index 0f359559a088..41a917179863 100644 --- a/webshell/src/nsWebShell.cpp +++ b/webshell/src/nsWebShell.cpp @@ -632,6 +632,7 @@ nsWebShell::Init(nsNativeWidget aNativeParent, } widgetInit.clipChildren = PR_FALSE; + widgetInit.mBorderStyle = eBorderStyle_3DChildWindow; mWindow->Create(aNativeParent, aBounds, nsWebShell::HandleEvent, mDeviceContext, nsnull, nsnull, &widgetInit); diff --git a/webshell/tests/viewer/nsBrowserWindow.cpp b/webshell/tests/viewer/nsBrowserWindow.cpp index edf4f555a769..a4b72712224c 100644 --- a/webshell/tests/viewer/nsBrowserWindow.cpp +++ b/webshell/tests/viewer/nsBrowserWindow.cpp @@ -540,6 +540,46 @@ static void* GetItemsNativeData(nsISupports* aObject) return result; } +//--------------------------------------------------------------- +NS_IMETHODIMP nsBrowserWindow::FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) +{ + nsIPresShell* shell = GetPresShell(); + if (nsnull != shell) { + nsIDocument* doc = shell->GetDocument(); + if (nsnull != doc) { + PRBool foundIt = PR_FALSE; + doc->FindNext(aSearchStr, aMatchCase, aSearchDown, aIsFound); + if (!aIsFound) { + // Display Dialog here + } + ForceRefresh(); + NS_RELEASE(doc); + } + NS_RELEASE(shell); + } + return NS_OK; +} + +//--------------------------------------------------------------- +NS_IMETHODIMP nsBrowserWindow::ForceRefresh() +{ + nsIPresShell* shell = GetPresShell(); + if (nsnull != shell) { + nsIViewManager* vm = shell->GetViewManager(); + if (nsnull != vm) { + nsIView* root; + vm->GetRootView(root); + if (nsnull != root) { + vm->UpdateView(root, (nsIRegion*)nsnull, NS_VMREFRESH_IMMEDIATE); + } + NS_RELEASE(vm); + } + NS_RELEASE(shell); + } + return NS_OK; +} + + /**-------------------------------------------------------------------------------- * Main Handler *-------------------------------------------------------------------------------- @@ -564,21 +604,8 @@ nsEventStatus nsBrowserWindow::ProcessDialogEvent(nsGUIEvent *aEvent) nsString searchStr; PRUint32 actualSize; mTextField->GetText(searchStr, 255,actualSize); - - nsIPresShell* shell = GetPresShell(); - if (nsnull != shell) { - nsIDocument* doc = shell->GetDocument(); - if (nsnull != doc) { - PRBool foundIt = PR_FALSE; - doc->FindNext(searchStr, matchCase, findDwn, foundIt); - if (!foundIt) { - // Display Dialog here - } - ForceRefresh(); - NS_RELEASE(doc); - } - NS_RELEASE(shell); - } + PRBool foundIt; + FindNext(searchStr, matchCase, findDwn, foundIt); } } break; @@ -712,7 +739,7 @@ nsBrowserWindow::DoFind() widget->SetForegroundColor(textFGColor); widget->SetClientData(this); widget->SetFocus(); - NS_RELEASE(widget); + NS_RELEASE(widget); } xx += 200 + 5; @@ -729,7 +756,7 @@ nsBrowserWindow::DoFind() { widget->SetClientData(this); mUpRadioBtn->SetLabel("Up"); - NS_RELEASE(widget); + NS_RELEASE(widget); } y += h + 2; @@ -741,7 +768,7 @@ nsBrowserWindow::DoFind() { widget->SetClientData(this); mDwnRadioBtn->SetLabel("Down"); - NS_RELEASE(widget); + NS_RELEASE(widget); } // Create Match CheckButton @@ -752,7 +779,7 @@ nsBrowserWindow::DoFind() { widget->SetClientData(this); mMatchCheckBtn->SetLabel("Match Case"); - NS_RELEASE(widget); + NS_RELEASE(widget); } mUpRadioBtn->SetState(PR_FALSE); @@ -766,7 +793,7 @@ nsBrowserWindow::DoFind() { widget->SetClientData(this); mFindBtn->SetLabel("Find Next"); - NS_RELEASE(widget); + NS_RELEASE(widget); } // Create Cancel Button @@ -777,7 +804,7 @@ nsBrowserWindow::DoFind() { widget->SetClientData(this); mCancelBtn->SetLabel("Cancel"); - NS_RELEASE(widget); + NS_RELEASE(widget); } } mTextField->SelectAll(); @@ -800,25 +827,6 @@ nsBrowserWindow::DoSelectAll() } } -void -nsBrowserWindow::ForceRefresh() -{ - nsIPresShell* shell = GetPresShell(); - if (nsnull != shell) { - nsIViewManager* vm = shell->GetViewManager(); - if (nsnull != vm) { - nsIView* root; - vm->GetRootView(root); - if (nsnull != root) { - vm->UpdateView(root, (nsIRegion*)nsnull, NS_VMREFRESH_IMMEDIATE | - NS_VMREFRESH_AUTO_DOUBLE_BUFFER); - } - NS_RELEASE(vm); - } - NS_RELEASE(shell); - } -} - //---------------------------------------------------------------------- @@ -898,9 +906,12 @@ nsBrowserWindow::Init(nsIAppShell* aAppShell, if (NS_OK != rv) { return rv; } + nsWidgetInitData initData; + initData.mBorderStyle = eBorderStyle_dialog; + nsRect r(0, 0, aBounds.width, aBounds.height); mWindow->Create((nsIWidget*)NULL, r, HandleBrowserEvent, - nsnull, aAppShell); + nsnull, aAppShell, nsnull, &initData); mWindow->GetBounds(r); // Create web shell diff --git a/webshell/tests/viewer/nsBrowserWindow.h b/webshell/tests/viewer/nsBrowserWindow.h index 9cce90a91dc5..8b1d9ff8c670 100644 --- a/webshell/tests/viewer/nsBrowserWindow.h +++ b/webshell/tests/viewer/nsBrowserWindow.h @@ -83,6 +83,8 @@ public: NS_IMETHOD GetStatus(PRUnichar** aResult); NS_IMETHOD SetProgress(PRInt32 aProgress, PRInt32 aProgressMax); NS_IMETHOD GetWebShell(nsIWebShell*& aResult); + NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound); + NS_IMETHOD ForceRefresh(); // nsIStreamObserver NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType); @@ -133,7 +135,6 @@ public: void DoFind(); void DoSelectAll(); - void ForceRefresh(); void ShowPrintPreview(PRInt32 aID);