From 37cc5f01d302689a1e437fe9d8bec343dd701564 Mon Sep 17 00:00:00 2001 From: Oleg Romashin Date: Fri, 15 Jul 2011 14:30:29 -0700 Subject: [PATCH] Backed out changeset 31cbb80c705e, win burning --- content/base/src/nsFrameLoader.cpp | 44 ++---------------------------- content/base/src/nsFrameLoader.h | 1 - dom/ipc/PBrowser.ipdl | 2 +- dom/ipc/TabChild.cpp | 28 +++---------------- dom/ipc/TabChild.h | 3 +- dom/ipc/TabParent.cpp | 4 +-- dom/ipc/TabParent.h | 2 +- 7 files changed, 11 insertions(+), 73 deletions(-) diff --git a/content/base/src/nsFrameLoader.cpp b/content/base/src/nsFrameLoader.cpp index 03476ca661e..94cf36dcac7 100644 --- a/content/base/src/nsFrameLoader.cpp +++ b/content/base/src/nsFrameLoader.cpp @@ -914,9 +914,7 @@ nsFrameLoader::ShowRemoteFrame(const nsIntSize& size) EnsureMessageManager(); } else { - nsRect dimensions; - NS_ENSURE_SUCCESS(GetWindowDimensions(dimensions), false); - mRemoteBrowser->UpdateDimensions(dimensions, size); + mRemoteBrowser->Move(size); } return true; @@ -1602,51 +1600,13 @@ nsFrameLoader::CheckForRecursiveLoad(nsIURI* aURI) return NS_OK; } -NS_IMETHODIMP -nsFrameLoader::GetWindowDimensions(nsRect& aRect) -{ - // Need to get outer window position here - nsIDocument* doc = mOwnerContent->GetDocument(); - if (!doc) { - return NS_ERROR_FAILURE; - } - - if (doc->GetDisplayDocument()) { - return NS_ERROR_FAILURE; - } - - nsCOMPtr parentAsWebNav = - do_GetInterface(doc->GetScriptGlobalObject()); - - if (!parentAsWebNav) { - return NS_ERROR_FAILURE; - } - - nsCOMPtr parentAsItem(do_QueryInterface(parentAsWebNav)); - - NS_ASSERTION(mIsTopLevelContent, "Outer dimensions must be taken only from TopLevel content"); - - nsCOMPtr parentOwner; - if (NS_FAILED(parentAsItem->GetTreeOwner(getter_AddRefs(parentOwner))) || - !parentOwner) { - return NS_ERROR_FAILURE; - } - - nsCOMPtr treeOwnerAsWin(do_GetInterface(parentOwner)); - treeOwnerAsWin->GetPosition(&aRect.x, &aRect.y); - treeOwnerAsWin->GetSize(&aRect.width, &aRect.height); - return NS_OK; -} - NS_IMETHODIMP nsFrameLoader::UpdatePositionAndSize(nsIFrame *aIFrame) { if (mRemoteFrame) { if (mRemoteBrowser) { nsIntSize size = GetSubDocumentSize(aIFrame); - nsRect dimensions; - NS_ENSURE_SUCCESS(GetWindowDimensions(dimensions), NS_ERROR_FAILURE); - mRemoteBrowser->UpdateDimensions(dimensions, size); + mRemoteBrowser->Move(size); } return NS_OK; } diff --git a/content/base/src/nsFrameLoader.h b/content/base/src/nsFrameLoader.h index 88423ffe84f..9859f3e5fff 100644 --- a/content/base/src/nsFrameLoader.h +++ b/content/base/src/nsFrameLoader.h @@ -296,7 +296,6 @@ private: // Properly retrieves documentSize of any subdocument type. NS_HIDDEN_(nsIntSize) GetSubDocumentSize(const nsIFrame *aIFrame); - nsresult GetWindowDimensions(nsRect& aRect); // Updates the subdocument position and size. This gets called only // when we have our own in-process DocShell. diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl index 34c08b9cfb6..45ea475a34d 100644 --- a/dom/ipc/PBrowser.ipdl +++ b/dom/ipc/PBrowser.ipdl @@ -239,7 +239,7 @@ child: LoadURL(nsCString uri); - UpdateDimensions(nsRect rect, nsIntSize size); + Move(nsIntSize size); /** * Sending an activate message moves focus to the child. diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index bfebc715299..a599b7e7b75 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -122,7 +122,6 @@ TabChild::TabChild(PRUint32 aChromeFlags) : mRemoteFrame(nsnull) , mTabChildGlobal(nsnull) , mChromeFlags(aChromeFlags) - , mOuterRect(0, 0, 0, 0) { printf("creating %d!\n", NS_IsMainThread()); } @@ -262,20 +261,9 @@ NS_IMETHODIMP TabChild::GetDimensions(PRUint32 aFlags, PRInt32* aX, PRInt32* aY, PRInt32* aCx, PRInt32* aCy) { - if (aX) { - *aX = mOuterRect.x; - } - if (aY) { - *aY = mOuterRect.y; - } - if (aCx) { - *aCx = mOuterRect.width; - } - if (aCy) { - *aCy = mOuterRect.height; - } + NS_NOTREACHED("TabChild::GetDimensions not supported in TabChild"); - return NS_OK; + return NS_ERROR_NOT_IMPLEMENTED; } NS_IMETHODIMP @@ -546,16 +534,9 @@ TabChild::RecvShow(const nsIntSize& size) } bool -TabChild::RecvUpdateDimensions(const nsRect& rect, const nsIntSize& size) +TabChild::RecvMove(const nsIntSize& size) { -#ifdef DEBUG - printf("[TabChild] Update Dimensions to (x,y,w,h)= (%ud, %ud, %ud, %ud) and move to (w,h)= (%ud, %ud)\n", rect.x, rect.y, rect.width, rect.height, size.width, size.height); -#endif - - mOuterRect.x = rect.x; - mOuterRect.y = rect.y; - mOuterRect.width = rect.width; - mOuterRect.height = rect.height; + printf("[TabChild] RESIZE to (w,h)= (%ud, %ud)\n", size.width, size.height); mWidget->Resize(0, 0, size.width, size.height, PR_TRUE); @@ -563,7 +544,6 @@ TabChild::RecvUpdateDimensions(const nsRect& rect, const nsIntSize& size) nsCOMPtr baseWin = do_QueryInterface(mWebNav); baseWin->SetPositionAndSize(0, 0, size.width, size.height, PR_TRUE); - return true; } diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index 5e141dcabcb..85dfc090d43 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -178,7 +178,7 @@ public: virtual bool RecvLoadURL(const nsCString& uri); virtual bool RecvShow(const nsIntSize& size); - virtual bool RecvUpdateDimensions(const nsRect& rect, const nsIntSize& size); + virtual bool RecvMove(const nsIntSize& size); virtual bool RecvActivate(); virtual bool RecvDeactivate(); virtual bool RecvMouseEvent(const nsString& aType, @@ -268,7 +268,6 @@ private: RenderFrameChild* mRemoteFrame; nsRefPtr mTabChildGlobal; PRUint32 mChromeFlags; - nsIntRect mOuterRect; DISALLOW_EVIL_CONSTRUCTORS(TabChild); }; diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index 822541e6bd2..915b605b294 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -209,9 +209,9 @@ TabParent::Show(const nsIntSize& size) } void -TabParent::UpdateDimensions(const nsRect& rect, const nsIntSize& size) +TabParent::Move(const nsIntSize& size) { - unused << SendUpdateDimensions(rect, size); + unused << SendMove(size); } void diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h index 2a1aed31d22..d1abb6d6018 100644 --- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -126,7 +126,7 @@ public: // message-sending functions under a layer of indirection and // eating the return values void Show(const nsIntSize& size); - void UpdateDimensions(const nsRect& rect, const nsIntSize& size); + void Move(const nsIntSize& size); void Activate(); void Deactivate(); void SendMouseEvent(const nsAString& aType, float aX, float aY,