Skip to content

Commit

Permalink
Back out 47de36ef3ab4 (bug 1075670) for breaking context menu in e10s…
Browse files Browse the repository at this point in the history
… CLOSED TREE
  • Loading branch information
bill-mccloskey committed Jan 29, 2015
1 parent 84f7fbb commit 773e64f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 67 deletions.
6 changes: 3 additions & 3 deletions dom/base/nsFrameLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,6 @@ class nsFrameLoader MOZ_FINAL : public nsIFrameLoader,
void ActivateUpdateHitRegion();
void DeactivateUpdateHitRegion();

// Properly retrieves documentSize of any subdocument type.
nsresult GetWindowDimensions(nsIntRect& aRect);

private:

void SetOwnerContent(mozilla::dom::Element* aContent);
Expand Down Expand Up @@ -285,6 +282,9 @@ class nsFrameLoader MOZ_FINAL : public nsIFrameLoader,
nsresult MaybeCreateDocShell();
nsresult EnsureMessageManager();

// Properly retrieves documentSize of any subdocument type.
nsresult GetWindowDimensions(nsIntRect& aRect);

// Updates the subdocument position and size. This gets called only
// when we have our own in-process DocShell.
void UpdateBaseWindowPositionAndSize(nsSubDocumentFrame *aIFrame);
Expand Down
47 changes: 1 addition & 46 deletions dom/ipc/TabParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
#include "nsICancelable.h"
#include "gfxPrefs.h"
#include "nsILoginManagerPrompter.h"
#include "nsPIWindowRoot.h"
#include <algorithm>

using namespace mozilla::dom;
Expand Down Expand Up @@ -317,27 +316,7 @@ TabParent::RemoveTabParentFromTable(uint64_t aLayersId)
void
TabParent::SetOwnerElement(Element* aElement)
{
// If we held previous content then unregister for its events.
if (mFrameElement && mFrameElement->OwnerDoc()->GetWindow()) {
nsCOMPtr<nsPIDOMWindow> window = mFrameElement->OwnerDoc()->GetWindow();
nsCOMPtr<EventTarget> eventTarget = window->GetTopWindowRoot();
if (eventTarget) {
eventTarget->RemoveEventListener(NS_LITERAL_STRING("MozUpdateWindowPos"),
this, false);
}
}

// Update to the new content, and register to listen for events from it.
mFrameElement = aElement;
if (mFrameElement && mFrameElement->OwnerDoc()->GetWindow()) {
nsCOMPtr<nsPIDOMWindow> window = mFrameElement->OwnerDoc()->GetWindow();
nsCOMPtr<EventTarget> eventTarget = window->GetTopWindowRoot();
if (eventTarget) {
eventTarget->AddEventListener(NS_LITERAL_STRING("MozUpdateWindowPos"),
this, false, false);
}
}

TryCacheDPIAndScale();
}

Expand Down Expand Up @@ -373,8 +352,6 @@ TabParent::Destroy()
return;
}

SetOwnerElement(nullptr);

// If this fails, it's most likely due to a content-process crash,
// and auto-cleanup will kick in. Otherwise, the child side will
// destroy itself and send back __delete__().
Expand Down Expand Up @@ -823,9 +800,8 @@ TabParent::UpdateDimensions(const nsIntRect& rect, const nsIntSize& size,
mRect = rect;
mDimensions = size;
mOrientation = orientation;
mChromeDisp = aChromeDisp;

unused << SendUpdateDimensions(mRect, mDimensions, mOrientation, mChromeDisp);
unused << SendUpdateDimensions(mRect, mDimensions, mOrientation, aChromeDisp);
}
}

Expand Down Expand Up @@ -2574,27 +2550,6 @@ TabParent::DeallocPPluginWidgetParent(mozilla::plugins::PPluginWidgetParent* aAc
return true;
}

nsresult
TabParent::HandleEvent(nsIDOMEvent* aEvent)
{
nsAutoString eventType;
aEvent->GetType(eventType);

if (eventType.EqualsLiteral("MozUpdateWindowPos")) {
// This event is sent when the widget moved. Therefore we only update
// the position.
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
if (!frameLoader) {
return NS_OK;
}
nsIntRect windowDims;
NS_ENSURE_SUCCESS(frameLoader->GetWindowDimensions(windowDims), NS_ERROR_FAILURE);
UpdateDimensions(windowDims, mDimensions, mChromeDisp);
return NS_OK;
}
return NS_OK;
}

class FakeChannel MOZ_FINAL : public nsIChannel,
public nsIAuthPromptCallback,
public nsIInterfaceRequestor,
Expand Down
8 changes: 1 addition & 7 deletions dom/ipc/TabParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "Units.h"
#include "WritingModes.h"
#include "js/TypeDecls.h"
#include "nsIDOMEventListener.h"

class nsFrameLoader;
class nsIContent;
Expand Down Expand Up @@ -58,8 +57,7 @@ class nsIContentParent;
class Element;
struct StructuredCloneData;

class TabParent : public PBrowserParent
, public nsIDOMEventListener
class TabParent : public PBrowserParent
, public nsITabParent
, public nsIAuthPromptProvider
, public nsISecureBrowserUI
Expand Down Expand Up @@ -100,9 +98,6 @@ class TabParent : public PBrowserParent
mBrowserDOMWindow = aBrowserDOMWindow;
}

// nsIDOMEventListener interfaces
NS_DECL_NSIDOMEVENTLISTENER

already_AddRefed<nsILoadContext> GetLoadContext();

nsIXULBrowserWindow* GetXULBrowserWindow();
Expand Down Expand Up @@ -430,7 +425,6 @@ class TabParent : public PBrowserParent
nsIntRect mRect;
nsIntSize mDimensions;
ScreenOrientation mOrientation;
nsIntPoint mChromeDisp;
float mDPI;
CSSToLayoutDeviceScale mDefaultScale;
bool mShown;
Expand Down
11 changes: 0 additions & 11 deletions xpfe/appshell/nsWebShellWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/MouseEvents.h"

#include "nsPIWindowRoot.h"

#ifdef XP_MACOSX
#include "nsINativeMenuService.h"
#define USE_NATIVE_MENUS
Expand Down Expand Up @@ -260,15 +258,6 @@ nsWebShellWindow::WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y)
pm->AdjustPopupsOnWindowChange(window);
}

// Notify all tabs that the widget moved.
if (mDocShell && mDocShell->GetWindow()) {
nsCOMPtr<EventTarget> eventTarget = mDocShell->GetWindow()->GetTopWindowRoot();
nsContentUtils::DispatchChromeEvent(mDocShell->GetDocument(),
eventTarget,
NS_LITERAL_STRING("MozUpdateWindowPos"),
false, false, nullptr);
}

// Persist position, but not immediately, in case this OS is firing
// repeated move events as the user drags the window
SetPersistenceTimer(PAD_POSITION);
Expand Down

0 comments on commit 773e64f

Please sign in to comment.