mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-12 19:19:15 +00:00
Bug 1075670 - Make event.screen[XY] work in content processes (r=smaug,kats,tn,joshmoz)
This commit is contained in:
parent
9a5e98b683
commit
3fe715e93a
@ -3779,8 +3779,7 @@
|
|||||||
};
|
};
|
||||||
let popup = browser.ownerDocument.getElementById("contentAreaContextMenu");
|
let popup = browser.ownerDocument.getElementById("contentAreaContextMenu");
|
||||||
let event = gContextMenuContentData.event;
|
let event = gContextMenuContentData.event;
|
||||||
let pos = browser.mapScreenCoordinatesFromContent(event.screenX, event.screenY);
|
popup.openPopupAtScreen(event.screenX, event.screenY, true);
|
||||||
popup.openPopupAtScreen(pos.x, pos.y, true);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "DOMWebNotificationClicked": {
|
case "DOMWebNotificationClicked": {
|
||||||
|
@ -884,8 +884,7 @@ nsFrameLoader::ShowRemoteFrame(const ScreenIntSize& size,
|
|||||||
|
|
||||||
// Don't show remote iframe if we are waiting for the completion of reflow.
|
// Don't show remote iframe if we are waiting for the completion of reflow.
|
||||||
if (!aFrame || !(aFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
|
if (!aFrame || !(aFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
|
||||||
nsIntPoint chromeDisp = aFrame->GetChromeDisplacement();
|
mRemoteBrowser->UpdateDimensions(dimensions, size);
|
||||||
mRemoteBrowser->UpdateDimensions(dimensions, size, chromeDisp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1383,6 +1382,12 @@ nsFrameLoader::StartDestroy()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the TabParent has installed any event listeners on the window, this is
|
||||||
|
// its last chance to remove them while we're still in the document.
|
||||||
|
if (mRemoteBrowser) {
|
||||||
|
mRemoteBrowser->RemoveWindowListeners();
|
||||||
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIDocument> doc;
|
nsCOMPtr<nsIDocument> doc;
|
||||||
bool dynamicSubframeRemoval = false;
|
bool dynamicSubframeRemoval = false;
|
||||||
if (mOwnerContent) {
|
if (mOwnerContent) {
|
||||||
@ -2058,8 +2063,7 @@ nsFrameLoader::UpdatePositionAndSize(nsSubDocumentFrame *aIFrame)
|
|||||||
ScreenIntSize size = aIFrame->GetSubdocumentSize();
|
ScreenIntSize size = aIFrame->GetSubdocumentSize();
|
||||||
nsIntRect dimensions;
|
nsIntRect dimensions;
|
||||||
NS_ENSURE_SUCCESS(GetWindowDimensions(dimensions), NS_ERROR_FAILURE);
|
NS_ENSURE_SUCCESS(GetWindowDimensions(dimensions), NS_ERROR_FAILURE);
|
||||||
nsIntPoint chromeDisp = aIFrame->GetChromeDisplacement();
|
mRemoteBrowser->UpdateDimensions(dimensions, size);
|
||||||
mRemoteBrowser->UpdateDimensions(dimensions, size, chromeDisp);
|
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -229,6 +229,9 @@ public:
|
|||||||
void ActivateUpdateHitRegion();
|
void ActivateUpdateHitRegion();
|
||||||
void DeactivateUpdateHitRegion();
|
void DeactivateUpdateHitRegion();
|
||||||
|
|
||||||
|
// Properly retrieves documentSize of any subdocument type.
|
||||||
|
nsresult GetWindowDimensions(nsIntRect& aRect);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void SetOwnerContent(mozilla::dom::Element* aContent);
|
void SetOwnerContent(mozilla::dom::Element* aContent);
|
||||||
@ -284,9 +287,6 @@ private:
|
|||||||
nsresult MaybeCreateDocShell();
|
nsresult MaybeCreateDocShell();
|
||||||
nsresult EnsureMessageManager();
|
nsresult EnsureMessageManager();
|
||||||
|
|
||||||
// Properly retrieves documentSize of any subdocument type.
|
|
||||||
nsresult GetWindowDimensions(nsIntRect& aRect);
|
|
||||||
|
|
||||||
// Updates the subdocument position and size. This gets called only
|
// Updates the subdocument position and size. This gets called only
|
||||||
// when we have our own in-process DocShell.
|
// when we have our own in-process DocShell.
|
||||||
void UpdateBaseWindowPositionAndSize(nsSubDocumentFrame *aIFrame);
|
void UpdateBaseWindowPositionAndSize(nsSubDocumentFrame *aIFrame);
|
||||||
|
@ -2026,7 +2026,7 @@ TabChild::RecvUpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size,
|
|||||||
mOrientation = orientation;
|
mOrientation = orientation;
|
||||||
ScreenIntSize oldScreenSize = mInnerSize;
|
ScreenIntSize oldScreenSize = mInnerSize;
|
||||||
mInnerSize = size;
|
mInnerSize = size;
|
||||||
mWidget->Resize(0, 0, size.width, size.height,
|
mWidget->Resize(rect.x + chromeDisp.x, rect.y + chromeDisp.y, size.width, size.height,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(WebNavigation());
|
nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(WebNavigation());
|
||||||
|
@ -80,6 +80,7 @@
|
|||||||
#include "nsICancelable.h"
|
#include "nsICancelable.h"
|
||||||
#include "gfxPrefs.h"
|
#include "gfxPrefs.h"
|
||||||
#include "nsILoginManagerPrompter.h"
|
#include "nsILoginManagerPrompter.h"
|
||||||
|
#include "nsPIWindowRoot.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
@ -267,6 +268,7 @@ TabParent::TabParent(nsIContentParent* aManager,
|
|||||||
, mDefaultScale(0)
|
, mDefaultScale(0)
|
||||||
, mShown(false)
|
, mShown(false)
|
||||||
, mUpdatedDimensions(false)
|
, mUpdatedDimensions(false)
|
||||||
|
, mChromeOffset(0, 0)
|
||||||
, mManager(aManager)
|
, mManager(aManager)
|
||||||
, mMarkedDestroying(false)
|
, mMarkedDestroying(false)
|
||||||
, mIsDestroyed(false)
|
, mIsDestroyed(false)
|
||||||
@ -325,10 +327,36 @@ TabParent::CacheFrameLoader(nsFrameLoader* aFrameLoader)
|
|||||||
void
|
void
|
||||||
TabParent::SetOwnerElement(Element* aElement)
|
TabParent::SetOwnerElement(Element* aElement)
|
||||||
{
|
{
|
||||||
|
// If we held previous content then unregister for its events.
|
||||||
|
RemoveWindowListeners();
|
||||||
|
|
||||||
|
// Update to the new content, and register to listen for events from it.
|
||||||
mFrameElement = aElement;
|
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();
|
TryCacheDPIAndScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TabParent::RemoveWindowListeners()
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TabParent::GetAppType(nsAString& aOut)
|
TabParent::GetAppType(nsAString& aOut)
|
||||||
{
|
{
|
||||||
@ -880,8 +908,7 @@ TabParent::RecvSetDimensions(const uint32_t& aFlags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TabParent::UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size,
|
TabParent::UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size)
|
||||||
const nsIntPoint& aChromeDisp)
|
|
||||||
{
|
{
|
||||||
if (mIsDestroyed) {
|
if (mIsDestroyed) {
|
||||||
return;
|
return;
|
||||||
@ -889,15 +916,25 @@ TabParent::UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size,
|
|||||||
hal::ScreenConfiguration config;
|
hal::ScreenConfiguration config;
|
||||||
hal::GetCurrentScreenConfiguration(&config);
|
hal::GetCurrentScreenConfiguration(&config);
|
||||||
ScreenOrientation orientation = config.orientation();
|
ScreenOrientation orientation = config.orientation();
|
||||||
|
nsIntPoint chromeOffset = -LayoutDevicePixel::ToUntyped(GetChildProcessOffset());
|
||||||
|
|
||||||
if (!mUpdatedDimensions || mOrientation != orientation ||
|
if (!mUpdatedDimensions || mOrientation != orientation ||
|
||||||
mDimensions != size || !mRect.IsEqualEdges(rect)) {
|
mDimensions != size || !mRect.IsEqualEdges(rect) ||
|
||||||
|
chromeOffset != mChromeOffset) {
|
||||||
|
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||||
|
nsIntRect contentRect = rect;
|
||||||
|
if (widget) {
|
||||||
|
contentRect.x += widget->GetClientOffset().x;
|
||||||
|
contentRect.y += widget->GetClientOffset().y;
|
||||||
|
}
|
||||||
|
|
||||||
mUpdatedDimensions = true;
|
mUpdatedDimensions = true;
|
||||||
mRect = rect;
|
mRect = contentRect;
|
||||||
mDimensions = size;
|
mDimensions = size;
|
||||||
mOrientation = orientation;
|
mOrientation = orientation;
|
||||||
|
mChromeOffset = chromeOffset;
|
||||||
|
|
||||||
unused << SendUpdateDimensions(mRect, mDimensions, mOrientation, aChromeDisp);
|
unused << SendUpdateDimensions(mRect, mDimensions, mOrientation, mChromeOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2740,6 +2777,27 @@ TabParent::DeallocPPluginWidgetParent(mozilla::plugins::PPluginWidgetParent* aAc
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
TabParent::HandleEvent(nsIDOMEvent* aEvent)
|
||||||
|
{
|
||||||
|
nsAutoString eventType;
|
||||||
|
aEvent->GetType(eventType);
|
||||||
|
|
||||||
|
if (eventType.EqualsLiteral("MozUpdateWindowPos") && !mIsDestroyed) {
|
||||||
|
// 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);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
class FakeChannel final : public nsIChannel,
|
class FakeChannel final : public nsIChannel,
|
||||||
public nsIAuthPromptCallback,
|
public nsIAuthPromptCallback,
|
||||||
public nsIInterfaceRequestor,
|
public nsIInterfaceRequestor,
|
||||||
|
@ -60,6 +60,7 @@ class Element;
|
|||||||
struct StructuredCloneData;
|
struct StructuredCloneData;
|
||||||
|
|
||||||
class TabParent final : public PBrowserParent
|
class TabParent final : public PBrowserParent
|
||||||
|
, public nsIDOMEventListener
|
||||||
, public nsITabParent
|
, public nsITabParent
|
||||||
, public nsIAuthPromptProvider
|
, public nsIAuthPromptProvider
|
||||||
, public nsISecureBrowserUI
|
, public nsISecureBrowserUI
|
||||||
@ -73,6 +74,8 @@ class TabParent final : public PBrowserParent
|
|||||||
public:
|
public:
|
||||||
// nsITabParent
|
// nsITabParent
|
||||||
NS_DECL_NSITABPARENT
|
NS_DECL_NSITABPARENT
|
||||||
|
// nsIDOMEventListener interfaces
|
||||||
|
NS_DECL_NSIDOMEVENTLISTENER
|
||||||
|
|
||||||
TabParent(nsIContentParent* aManager,
|
TabParent(nsIContentParent* aManager,
|
||||||
const TabId& aTabId,
|
const TabId& aTabId,
|
||||||
@ -107,6 +110,8 @@ public:
|
|||||||
|
|
||||||
void Destroy();
|
void Destroy();
|
||||||
|
|
||||||
|
void RemoveWindowListeners();
|
||||||
|
|
||||||
virtual bool RecvMoveFocus(const bool& aForward) override;
|
virtual bool RecvMoveFocus(const bool& aForward) override;
|
||||||
virtual bool RecvEvent(const RemoteDOMEvent& aEvent) override;
|
virtual bool RecvEvent(const RemoteDOMEvent& aEvent) override;
|
||||||
virtual bool RecvReplyKeyEvent(const WidgetKeyboardEvent& aEvent) override;
|
virtual bool RecvReplyKeyEvent(const WidgetKeyboardEvent& aEvent) override;
|
||||||
@ -225,8 +230,7 @@ public:
|
|||||||
// message-sending functions under a layer of indirection and
|
// message-sending functions under a layer of indirection and
|
||||||
// eating the return values
|
// eating the return values
|
||||||
void Show(const ScreenIntSize& size, bool aParentIsActive);
|
void Show(const ScreenIntSize& size, bool aParentIsActive);
|
||||||
void UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size,
|
void UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size);
|
||||||
const nsIntPoint& chromeDisp);
|
|
||||||
void UpdateFrame(const layers::FrameMetrics& aFrameMetrics);
|
void UpdateFrame(const layers::FrameMetrics& aFrameMetrics);
|
||||||
void UIResolutionChanged();
|
void UIResolutionChanged();
|
||||||
void RequestFlingSnap(const FrameMetrics::ViewID& aScrollId,
|
void RequestFlingSnap(const FrameMetrics::ViewID& aScrollId,
|
||||||
@ -427,6 +431,7 @@ protected:
|
|||||||
CSSToLayoutDeviceScale mDefaultScale;
|
CSSToLayoutDeviceScale mDefaultScale;
|
||||||
bool mShown;
|
bool mShown;
|
||||||
bool mUpdatedDimensions;
|
bool mUpdatedDimensions;
|
||||||
|
nsIntPoint mChromeOffset;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
already_AddRefed<nsFrameLoader> GetFrameLoader(bool aUseCachedFrameLoaderAfterDestroy = false) const;
|
already_AddRefed<nsFrameLoader> GetFrameLoader(bool aUseCachedFrameLoaderAfterDestroy = false) const;
|
||||||
|
@ -790,7 +790,6 @@ NPBool nsPluginInstanceOwner::ConvertPointPuppet(PuppetWidget *widget,
|
|||||||
tabContentBounds.ScaleInverseRoundOut(scaleFactor);
|
tabContentBounds.ScaleInverseRoundOut(scaleFactor);
|
||||||
int32_t windowH = tabContentBounds.height + int(chromeSize.y);
|
int32_t windowH = tabContentBounds.height + int(chromeSize.y);
|
||||||
|
|
||||||
// This is actually relative to window-chrome.
|
|
||||||
nsPoint pluginPosition = AsNsPoint(pluginFrame->GetScreenRect().TopLeft());
|
nsPoint pluginPosition = AsNsPoint(pluginFrame->GetScreenRect().TopLeft());
|
||||||
|
|
||||||
// Convert (sourceX, sourceY) to 'real' (not PuppetWidget) screen space.
|
// Convert (sourceX, sourceY) to 'real' (not PuppetWidget) screen space.
|
||||||
@ -800,8 +799,8 @@ NPBool nsPluginInstanceOwner::ConvertPointPuppet(PuppetWidget *widget,
|
|||||||
nsPoint screenPoint;
|
nsPoint screenPoint;
|
||||||
switch (sourceSpace) {
|
switch (sourceSpace) {
|
||||||
case NPCoordinateSpacePlugin:
|
case NPCoordinateSpacePlugin:
|
||||||
screenPoint = sourcePoint + pluginFrame->GetContentRectRelativeToSelf().TopLeft() +
|
screenPoint = sourcePoint + pluginPosition +
|
||||||
chromeSize + pluginPosition + windowPosition;
|
pluginFrame->GetContentRectRelativeToSelf().TopLeft() / nsPresContext::AppUnitsPerCSSPixel();
|
||||||
break;
|
break;
|
||||||
case NPCoordinateSpaceWindow:
|
case NPCoordinateSpaceWindow:
|
||||||
screenPoint = nsPoint(sourcePoint.x, windowH-sourcePoint.y) +
|
screenPoint = nsPoint(sourcePoint.x, windowH-sourcePoint.y) +
|
||||||
@ -824,8 +823,8 @@ NPBool nsPluginInstanceOwner::ConvertPointPuppet(PuppetWidget *widget,
|
|||||||
nsPoint destPoint;
|
nsPoint destPoint;
|
||||||
switch (destSpace) {
|
switch (destSpace) {
|
||||||
case NPCoordinateSpacePlugin:
|
case NPCoordinateSpacePlugin:
|
||||||
destPoint = screenPoint - pluginFrame->GetContentRectRelativeToSelf().TopLeft() -
|
destPoint = screenPoint - pluginPosition -
|
||||||
chromeSize - pluginPosition - windowPosition;
|
pluginFrame->GetContentRectRelativeToSelf().TopLeft() / nsPresContext::AppUnitsPerCSSPixel();
|
||||||
break;
|
break;
|
||||||
case NPCoordinateSpaceWindow:
|
case NPCoordinateSpaceWindow:
|
||||||
destPoint = screenPoint - windowPosition;
|
destPoint = screenPoint - windowPosition;
|
||||||
|
@ -1452,8 +1452,14 @@ ChromeTooltipListener::sTooltipCallback(nsITimer *aTimer,
|
|||||||
if (textFound) {
|
if (textFound) {
|
||||||
nsString tipText(tooltipText);
|
nsString tipText(tooltipText);
|
||||||
LayoutDeviceIntPoint screenDot = widget->WidgetToScreenOffset();
|
LayoutDeviceIntPoint screenDot = widget->WidgetToScreenOffset();
|
||||||
self->ShowTooltip(self->mMouseScreenX - screenDot.x,
|
double scaleFactor = 1.0;
|
||||||
self->mMouseScreenY - screenDot.y,
|
if (shell->GetPresContext()) {
|
||||||
|
scaleFactor = double(nsPresContext::AppUnitsPerCSSPixel())/
|
||||||
|
shell->GetPresContext()->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom();
|
||||||
|
}
|
||||||
|
// ShowTooltip expects widget-relative position.
|
||||||
|
self->ShowTooltip(self->mMouseScreenX - screenDot.x / scaleFactor,
|
||||||
|
self->mMouseScreenY - screenDot.y / scaleFactor,
|
||||||
tipText);
|
tipText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -902,6 +902,7 @@ nsDisplayScrollLayer::ComputeFrameMetrics(nsIFrame* aForFrame,
|
|||||||
if (widget) {
|
if (widget) {
|
||||||
nsIntRect widgetBounds;
|
nsIntRect widgetBounds;
|
||||||
widget->GetBounds(widgetBounds);
|
widget->GetBounds(widgetBounds);
|
||||||
|
widgetBounds.MoveTo(0,0);
|
||||||
metrics.mCompositionBounds = ParentLayerRect(ViewAs<ParentLayerPixel>(widgetBounds));
|
metrics.mCompositionBounds = ParentLayerRect(ViewAs<ParentLayerPixel>(widgetBounds));
|
||||||
#ifdef MOZ_WIDGET_ANDROID
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
if (frameBounds.height < metrics.mCompositionBounds.height) {
|
if (frameBounds.height < metrics.mCompositionBounds.height) {
|
||||||
|
@ -1275,24 +1275,3 @@ nsSubDocumentFrame::ObtainIntrinsicSizeFrame()
|
|||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntPoint
|
|
||||||
nsSubDocumentFrame::GetChromeDisplacement()
|
|
||||||
{
|
|
||||||
nsIFrame* nextFrame = nsLayoutUtils::GetCrossDocParentFrame(this);
|
|
||||||
if (!nextFrame) {
|
|
||||||
NS_WARNING("Couldn't find window chrome to calculate displacement to.");
|
|
||||||
return nsIntPoint();
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIFrame* rootFrame = nextFrame;
|
|
||||||
while (nextFrame) {
|
|
||||||
rootFrame = nextFrame;
|
|
||||||
nextFrame = nsLayoutUtils::GetCrossDocParentFrame(rootFrame);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsPoint offset = GetOffsetToCrossDoc(rootFrame);
|
|
||||||
int32_t appUnitsPerDevPixel = rootFrame->PresContext()->AppUnitsPerDevPixel();
|
|
||||||
return nsIntPoint((int)(offset.x/appUnitsPerDevPixel),
|
|
||||||
(int)(offset.y/appUnitsPerDevPixel));
|
|
||||||
}
|
|
||||||
|
@ -128,8 +128,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool PassPointerEventsToChildren();
|
bool PassPointerEventsToChildren();
|
||||||
|
|
||||||
nsIntPoint GetChromeDisplacement();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class AsyncFrameInit;
|
friend class AsyncFrameInit;
|
||||||
|
|
||||||
|
@ -81,9 +81,8 @@ this.AutoCompleteE10S = {
|
|||||||
this.popup.hidden = false;
|
this.popup.hidden = false;
|
||||||
this.popup.setAttribute("width", rect.width);
|
this.popup.setAttribute("width", rect.width);
|
||||||
|
|
||||||
let {x, y} = this.browser.mapScreenCoordinatesFromContent(rect.left, rect.top + rect.height);
|
this.x = rect.left;
|
||||||
this.x = x;
|
this.y = rect.top + rect.height;
|
||||||
this.y = y;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_showPopup: function(results) {
|
_showPopup: function(results) {
|
||||||
|
@ -892,8 +892,7 @@
|
|||||||
if (!this.autoscrollEnabled) {
|
if (!this.autoscrollEnabled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let pos = this.mapScreenCoordinatesFromContent(data.screenX, data.screenY);
|
this.startScroll(data.scrolldir, data.screenX, data.screenY);
|
||||||
this.startScroll(data.scrolldir, pos.x, pos.y);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case "Autoscroll:Cancel":
|
case "Autoscroll:Cancel":
|
||||||
@ -1074,25 +1073,6 @@
|
|||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
<!--
|
|
||||||
For out-of-process code, event.screen[XY] is relative to the
|
|
||||||
left/top of the content view. For in-process code,
|
|
||||||
event.screen[XY] is relative to the left/top of the screen. We
|
|
||||||
use this method to map screen coordinates received from a
|
|
||||||
(possibly out-of-process) <browser> element to coordinates
|
|
||||||
that are relative to the screen. This code handles the
|
|
||||||
in-process case, where we return the coordinates unchanged.
|
|
||||||
-->
|
|
||||||
<method name="mapScreenCoordinatesFromContent">
|
|
||||||
<parameter name="aScreenX"/>
|
|
||||||
<parameter name="aScreenY"/>
|
|
||||||
<body>
|
|
||||||
<![CDATA[
|
|
||||||
return { x: aScreenX, y: aScreenY };
|
|
||||||
]]>
|
|
||||||
</body>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<method name="swapDocShells">
|
<method name="swapDocShells">
|
||||||
<parameter name="aOtherBrowser"/>
|
<parameter name="aOtherBrowser"/>
|
||||||
<body>
|
<body>
|
||||||
|
@ -387,27 +387,6 @@
|
|||||||
]]></body>
|
]]></body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
<!--
|
|
||||||
For out-of-process code, event.screen[XY] is relative to the
|
|
||||||
left/top of the content view. For in-process code,
|
|
||||||
event.screen[XY] is relative to the left/top of the screen. We
|
|
||||||
use this method to map screen coordinates received from a
|
|
||||||
(possibly out-of-process) <browser> element to coordinates
|
|
||||||
that are relative to the screen. This code handles the
|
|
||||||
out-of-process case, where we need to translate by the screen
|
|
||||||
position of the <browser> element.
|
|
||||||
-->
|
|
||||||
<method name="mapScreenCoordinatesFromContent">
|
|
||||||
<parameter name="aScreenX"/>
|
|
||||||
<parameter name="aScreenY"/>
|
|
||||||
<body>
|
|
||||||
<![CDATA[
|
|
||||||
return { x: aScreenX + this.boxObject.screenX,
|
|
||||||
y: aScreenY + this.boxObject.screenY };
|
|
||||||
]]>
|
|
||||||
</body>
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<method name="enableDisableCommands">
|
<method name="enableDisableCommands">
|
||||||
<parameter name="aAction"/>
|
<parameter name="aAction"/>
|
||||||
<parameter name="aEnabledLength"/>
|
<parameter name="aEnabledLength"/>
|
||||||
|
@ -28,8 +28,7 @@ this.SelectParentHelper = {
|
|||||||
currentBrowser = browser;
|
currentBrowser = browser;
|
||||||
this._registerListeners(menulist.menupopup);
|
this._registerListeners(menulist.menupopup);
|
||||||
|
|
||||||
let {x, y} = browser.mapScreenCoordinatesFromContent(rect.left, rect.top + rect.height);
|
menulist.menupopup.openPopupAtScreen(rect.left, rect.top + rect.height);
|
||||||
menulist.menupopup.openPopupAtScreen(x, y);
|
|
||||||
menulist.selectedItem.scrollIntoView();
|
menulist.selectedItem.scrollIntoView();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1013,6 +1013,13 @@ PuppetWidget::GetWindowPosition()
|
|||||||
return nsIntPoint(winX, winY);
|
return nsIntPoint(winX, winY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_METHOD
|
||||||
|
PuppetWidget::GetScreenBounds(nsIntRect &aRect) {
|
||||||
|
aRect.MoveTo(LayoutDeviceIntPoint::ToUntyped(WidgetToScreenOffset()));
|
||||||
|
aRect.SizeTo(mBounds.Size());
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
PuppetScreen::PuppetScreen(void *nativeScreen)
|
PuppetScreen::PuppetScreen(void *nativeScreen)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ public:
|
|||||||
int32_t* aY) override
|
int32_t* aY) override
|
||||||
{ *aX = kMaxDimension; *aY = kMaxDimension; return NS_OK; }
|
{ *aX = kMaxDimension; *aY = kMaxDimension; return NS_OK; }
|
||||||
|
|
||||||
// We're always at <0, 0>, and so ignore move requests.
|
// Widget position is controlled by the parent process via TabChild.
|
||||||
NS_IMETHOD Move(double aX, double aY) override
|
NS_IMETHOD Move(double aX, double aY) override
|
||||||
{ return NS_OK; }
|
{ return NS_OK; }
|
||||||
|
|
||||||
@ -90,8 +90,14 @@ public:
|
|||||||
double aWidth,
|
double aWidth,
|
||||||
double aHeight,
|
double aHeight,
|
||||||
bool aRepaint) override
|
bool aRepaint) override
|
||||||
// (we're always at <0, 0>)
|
{
|
||||||
{ return Resize(aWidth, aHeight, aRepaint); }
|
if (mBounds.x != aX || mBounds.y != aY) {
|
||||||
|
NotifyWindowMoved(aX, aY);
|
||||||
|
}
|
||||||
|
mBounds.x = aX;
|
||||||
|
mBounds.y = aY;
|
||||||
|
return Resize(aWidth, aHeight, aRepaint);
|
||||||
|
}
|
||||||
|
|
||||||
// XXX/cjones: copying gtk behavior here; unclear what disabling a
|
// XXX/cjones: copying gtk behavior here; unclear what disabling a
|
||||||
// widget is supposed to entail
|
// widget is supposed to entail
|
||||||
@ -121,9 +127,8 @@ public:
|
|||||||
NS_IMETHOD SetTitle(const nsAString& aTitle) override
|
NS_IMETHOD SetTitle(const nsAString& aTitle) override
|
||||||
{ return NS_ERROR_UNEXPECTED; }
|
{ return NS_ERROR_UNEXPECTED; }
|
||||||
|
|
||||||
// PuppetWidgets are always at <0, 0>.
|
|
||||||
virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() override
|
virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() override
|
||||||
{ return mozilla::LayoutDeviceIntPoint(0, 0); }
|
{ return LayoutDeviceIntPoint::FromUntyped(GetWindowPosition() + GetChromeDimensions()); }
|
||||||
|
|
||||||
void InitEvent(WidgetGUIEvent& aEvent, nsIntPoint* aPoint = nullptr);
|
void InitEvent(WidgetGUIEvent& aEvent, nsIntPoint* aPoint = nullptr);
|
||||||
|
|
||||||
@ -198,6 +203,8 @@ public:
|
|||||||
// Get the screen position of the application window.
|
// Get the screen position of the application window.
|
||||||
nsIntPoint GetWindowPosition();
|
nsIntPoint GetWindowPosition();
|
||||||
|
|
||||||
|
NS_IMETHOD GetScreenBounds(nsIntRect &aRect) override;
|
||||||
|
|
||||||
NS_IMETHOD StartPluginIME(const mozilla::WidgetKeyboardEvent& aKeyboardEvent,
|
NS_IMETHOD StartPluginIME(const mozilla::WidgetKeyboardEvent& aKeyboardEvent,
|
||||||
int32_t aPanelX, int32_t aPanelY,
|
int32_t aPanelX, int32_t aPanelY,
|
||||||
nsString& aCommitted) override;
|
nsString& aCommitted) override;
|
||||||
|
@ -71,6 +71,8 @@
|
|||||||
#include "mozilla/DebugOnly.h"
|
#include "mozilla/DebugOnly.h"
|
||||||
#include "mozilla/MouseEvents.h"
|
#include "mozilla/MouseEvents.h"
|
||||||
|
|
||||||
|
#include "nsPIWindowRoot.h"
|
||||||
|
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
#include "nsINativeMenuService.h"
|
#include "nsINativeMenuService.h"
|
||||||
#define USE_NATIVE_MENUS
|
#define USE_NATIVE_MENUS
|
||||||
@ -257,6 +259,15 @@ nsWebShellWindow::WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y)
|
|||||||
pm->AdjustPopupsOnWindowChange(window);
|
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
|
// Persist position, but not immediately, in case this OS is firing
|
||||||
// repeated move events as the user drags the window
|
// repeated move events as the user drags the window
|
||||||
SetPersistenceTimer(PAD_POSITION);
|
SetPersistenceTimer(PAD_POSITION);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user