зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1224482 (part 3) - Replace GetClientOffsetUntyped() with GetClientOffset(). r=kats.
The patch also changes nsMenuPopupFrame::mLastClientOffset to LayoutDeviceIntPoint. --HG-- extra : rebase_source : d7c0784efd332e382db3f2857c8f43eabc1c807c
This commit is contained in:
Родитель
7a746a27ea
Коммит
f38ebf7649
|
@ -1501,7 +1501,7 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, bool aIsMove, bool aS
|
|||
// to save time since they will never have a titlebar.
|
||||
nsIWidget* widget = view->GetWidget();
|
||||
if (mPopupType == ePopupTypePanel && widget) {
|
||||
mLastClientOffset = widget->GetClientOffsetUntyped();
|
||||
mLastClientOffset = widget->GetClientOffset();
|
||||
viewPoint.x += presContext->DevPixelsToAppUnits(mLastClientOffset.x);
|
||||
viewPoint.y += presContext->DevPixelsToAppUnits(mLastClientOffset.y);
|
||||
}
|
||||
|
@ -2168,7 +2168,7 @@ nsMenuPopupFrame::MoveTo(const CSSIntPoint& aPos, bool aUpdateAttrs)
|
|||
{
|
||||
nsIWidget* widget = GetWidget();
|
||||
if ((mScreenRect.x == aPos.x && mScreenRect.y == aPos.y) &&
|
||||
(!widget || widget->GetClientOffsetUntyped() == mLastClientOffset)) {
|
||||
(!widget || widget->GetClientOffset() == mLastClientOffset)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -389,7 +389,10 @@ public:
|
|||
// or (-1, -1, 0, 0) if anchored.
|
||||
nsIntRect GetScreenAnchorRect() const { return mScreenRect; }
|
||||
|
||||
nsIntPoint GetLastClientOffset() const { return mLastClientOffset; }
|
||||
mozilla::LayoutDeviceIntPoint GetLastClientOffset() const
|
||||
{
|
||||
return mLastClientOffset;
|
||||
}
|
||||
|
||||
// Return the alignment of the popup
|
||||
int8_t GetAlignmentPosition() const;
|
||||
|
@ -526,7 +529,7 @@ protected:
|
|||
// The value of the client offset of our widget the last time we positioned
|
||||
// ourselves. We store this so that we can detect when it changes but the
|
||||
// position of our widget didn't change.
|
||||
nsIntPoint mLastClientOffset;
|
||||
mozilla::LayoutDeviceIntPoint mLastClientOffset;
|
||||
|
||||
nsPopupType mPopupType; // type of popup
|
||||
nsPopupState mPopupState; // open state of the popup
|
||||
|
|
|
@ -473,7 +473,8 @@ nsXULPopupManager::PopupMoved(nsIFrame* aFrame, nsIntPoint aPnt)
|
|||
nsIntRect curDevSize = view->CalcWidgetBounds(eWindowType_popup);
|
||||
nsIWidget* widget = menuPopupFrame->GetWidget();
|
||||
if (curDevSize.x == aPnt.x && curDevSize.y == aPnt.y &&
|
||||
(!widget || widget->GetClientOffsetUntyped() == menuPopupFrame->GetLastClientOffset())) {
|
||||
(!widget || widget->GetClientOffset() ==
|
||||
menuPopupFrame->GetLastClientOffset())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -551,7 +551,7 @@ public:
|
|||
|
||||
bool IsPluginFocused() { return mPluginFocused; }
|
||||
|
||||
virtual nsIntPoint GetClientOffsetUntyped() override;
|
||||
virtual mozilla::LayoutDeviceIntPoint GetClientOffset() override;
|
||||
|
||||
void DispatchAPZWheelInputEvent(mozilla::InputData& aEvent, bool aCanTriggerSwipe);
|
||||
|
||||
|
|
|
@ -1522,15 +1522,15 @@ void nsChildView::ReportSizeEvent()
|
|||
|
||||
#pragma mark -
|
||||
|
||||
nsIntPoint nsChildView::GetClientOffsetUntyped()
|
||||
LayoutDeviceIntPoint nsChildView::GetClientOffset()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
NSPoint origin = [mView convertPoint:NSMakePoint(0, 0) toView:nil];
|
||||
origin.y = [[mView window] frame].size.height - origin.y;
|
||||
return CocoaPointsToDevPixels(origin);
|
||||
return LayoutDeviceIntPoint::FromUnknownPoint(CocoaPointsToDevPixels(origin));
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(nsIntPoint(0, 0));
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0, 0));
|
||||
}
|
||||
|
||||
// Return the offset between this child view and the screen.
|
||||
|
|
|
@ -271,7 +271,7 @@ public:
|
|||
virtual bool IsVisible() const override;
|
||||
NS_IMETHOD SetFocus(bool aState=false) override;
|
||||
virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
||||
virtual nsIntPoint GetClientOffsetUntyped() override;
|
||||
virtual mozilla::LayoutDeviceIntPoint GetClientOffset() override;
|
||||
virtual mozilla::LayoutDeviceIntSize
|
||||
ClientToWindowSize(const mozilla::LayoutDeviceIntSize& aClientSize) override;
|
||||
|
||||
|
|
|
@ -1980,16 +1980,17 @@ LayoutDeviceIntPoint nsCocoaWindow::WidgetToScreenOffset()
|
|||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0));
|
||||
}
|
||||
|
||||
nsIntPoint nsCocoaWindow::GetClientOffsetUntyped()
|
||||
LayoutDeviceIntPoint nsCocoaWindow::GetClientOffset()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
nsIntRect clientRect;
|
||||
GetClientBoundsUntyped(clientRect);
|
||||
LayoutDeviceIntRect clientRect;
|
||||
GetClientBounds(clientRect);
|
||||
|
||||
return clientRect.TopLeft() - mBounds.TopLeft();
|
||||
return clientRect.TopLeft() -
|
||||
LayoutDeviceIntPoint::FromUnknownPoint(mBounds.TopLeft());
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(nsIntPoint(0, 0));
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0, 0));
|
||||
}
|
||||
|
||||
LayoutDeviceIntSize
|
||||
|
|
|
@ -1561,10 +1561,10 @@ nsWindow::UpdateClientOffset()
|
|||
mClientOffset = nsIntPoint(left, top);
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
nsWindow::GetClientOffsetUntyped()
|
||||
LayoutDeviceIntPoint
|
||||
nsWindow::GetClientOffset()
|
||||
{
|
||||
return mClientOffset;
|
||||
return LayoutDeviceIntPoint::FromUnknownPoint(mClientOffset);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -134,7 +134,7 @@ public:
|
|||
NS_IMETHOD GetScreenBounds(mozilla::LayoutDeviceIntRect &aRect) override;
|
||||
NS_IMETHOD GetClientBounds(mozilla::LayoutDeviceIntRect &aRect) override;
|
||||
virtual mozilla::gfx::IntSize GetClientSize() override;
|
||||
virtual nsIntPoint GetClientOffsetUntyped() override;
|
||||
virtual mozilla::LayoutDeviceIntPoint GetClientOffset() override;
|
||||
NS_IMETHOD SetCursor(nsCursor aCursor) override;
|
||||
NS_IMETHOD SetCursor(imgIContainer* aCursor,
|
||||
uint32_t aHotspotX, uint32_t aHotspotY) override;
|
||||
|
|
|
@ -1343,10 +1343,10 @@ NS_METHOD nsBaseWidget::GetRestoredBounds(LayoutDeviceIntRect& aRect)
|
|||
return GetScreenBounds(aRect);
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
nsBaseWidget::GetClientOffsetUntyped()
|
||||
LayoutDeviceIntPoint
|
||||
nsBaseWidget::GetClientOffset()
|
||||
{
|
||||
return nsIntPoint(0, 0);
|
||||
return LayoutDeviceIntPoint(0, 0);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -195,7 +195,7 @@ public:
|
|||
mozilla::LayoutDeviceIntMargin &margins) override;
|
||||
NS_IMETHOD SetNonClientMargins(
|
||||
mozilla::LayoutDeviceIntMargin &margins) override;
|
||||
virtual nsIntPoint GetClientOffsetUntyped() override;
|
||||
virtual mozilla::LayoutDeviceIntPoint GetClientOffset() override;
|
||||
NS_IMETHOD EnableDragDrop(bool aEnable) override;
|
||||
NS_IMETHOD GetAttention(int32_t aCycleCount) override;
|
||||
virtual bool HasPendingInputEvent() override;
|
||||
|
|
|
@ -890,17 +890,9 @@ class nsIWidget : public nsISupports {
|
|||
/**
|
||||
* Get the client offset from the window origin.
|
||||
*
|
||||
* The untyped version exists temporarily to ease conversion to typed
|
||||
* coordinates.
|
||||
*
|
||||
* @return the x and y of the offset.
|
||||
*
|
||||
*/
|
||||
virtual mozilla::LayoutDeviceIntPoint GetClientOffset() {
|
||||
nsIntPoint tmp = GetClientOffsetUntyped();
|
||||
return mozilla::LayoutDeviceIntPoint::FromUnknownPoint(tmp);
|
||||
}
|
||||
virtual nsIntPoint GetClientOffsetUntyped() = 0;
|
||||
virtual mozilla::LayoutDeviceIntPoint GetClientOffset() = 0;
|
||||
|
||||
/**
|
||||
* Equivalent to GetClientBounds but only returns the size.
|
||||
|
|
|
@ -1993,19 +1993,19 @@ NS_METHOD nsWindow::GetRestoredBounds(LayoutDeviceIntRect &aRect)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// return the x,y offset of the client area from the origin
|
||||
// of the window. If the window is borderless returns (0,0).
|
||||
nsIntPoint
|
||||
nsWindow::GetClientOffsetUntyped()
|
||||
// Return the x,y offset of the client area from the origin of the window. If
|
||||
// the window is borderless returns (0,0).
|
||||
LayoutDeviceIntPoint
|
||||
nsWindow::GetClientOffset()
|
||||
{
|
||||
if (!mWnd) {
|
||||
return nsIntPoint(0, 0);
|
||||
return LayoutDeviceIntPoint(0, 0);
|
||||
}
|
||||
|
||||
RECT r1;
|
||||
GetWindowRect(mWnd, &r1);
|
||||
LayoutDeviceIntPoint pt = WidgetToScreenOffset();
|
||||
return nsIntPoint(pt.x - r1.left, pt.y - r1.top);
|
||||
return LayoutDeviceIntPoint(pt.x - r1.left, pt.y - r1.top);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -120,7 +120,7 @@ public:
|
|||
NS_IMETHOD GetScreenBounds(mozilla::LayoutDeviceIntRect &aRect) override;
|
||||
NS_IMETHOD GetRestoredBounds(mozilla::LayoutDeviceIntRect &aRect) override;
|
||||
NS_IMETHOD GetClientBounds(mozilla::LayoutDeviceIntRect &aRect) override;
|
||||
virtual nsIntPoint GetClientOffsetUntyped() override;
|
||||
virtual mozilla::LayoutDeviceIntPoint GetClientOffset() override;
|
||||
void SetBackgroundColor(const nscolor &aColor);
|
||||
NS_IMETHOD SetCursor(imgIContainer* aCursor,
|
||||
uint32_t aHotspotX, uint32_t aHotspotY);
|
||||
|
|
Загрузка…
Ссылка в новой задаче