mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1224482 (part 7) - Make GetScaledScreenBounds() return a CSSIntRect. r=kats.
Also changes mOriginalBounds to a CSSIntRect*.
This commit is contained in:
parent
989819b3ac
commit
dd3b0ed624
@ -804,8 +804,9 @@ NS_IMETHODIMP nsBaseWidget::MakeFullScreen(bool aFullScreen, nsIScreen* aScreen)
|
||||
HideWindowChrome(aFullScreen);
|
||||
|
||||
if (aFullScreen) {
|
||||
if (!mOriginalBounds)
|
||||
mOriginalBounds = new nsIntRect();
|
||||
if (!mOriginalBounds) {
|
||||
mOriginalBounds = new CSSIntRect();
|
||||
}
|
||||
*mOriginalBounds = GetScaledScreenBounds();
|
||||
|
||||
// Move to top-left corner of screen and size to the screen dimensions
|
||||
@ -1725,17 +1726,16 @@ nsBaseWidget::StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics)
|
||||
NewRunnableMethod(mAPZC.get(), &APZCTreeManager::StartScrollbarDrag, guid, aDragMetrics));
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
CSSIntRect
|
||||
nsBaseWidget::GetScaledScreenBounds()
|
||||
{
|
||||
nsIntRect bounds;
|
||||
GetScreenBoundsUntyped(bounds);
|
||||
LayoutDeviceIntRect bounds;
|
||||
GetScreenBounds(bounds);
|
||||
|
||||
// *Dividing* a LayoutDeviceIntRect by a CSSToLayoutDeviceScale gives a
|
||||
// CSSIntRect.
|
||||
CSSToLayoutDeviceScale scale = GetDefaultScale();
|
||||
bounds.x = NSToIntRound(bounds.x / scale.scale);
|
||||
bounds.y = NSToIntRound(bounds.y / scale.scale);
|
||||
bounds.width = NSToIntRound(bounds.width / scale.scale);
|
||||
bounds.height = NSToIntRound(bounds.height / scale.scale);
|
||||
return bounds;
|
||||
return RoundedToInt(bounds / scale);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIScreen>
|
||||
@ -1747,7 +1747,7 @@ nsBaseWidget::GetWidgetScreen()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIntRect bounds = GetScaledScreenBounds();
|
||||
CSSIntRect bounds = GetScaledScreenBounds();
|
||||
nsCOMPtr<nsIScreen> screen;
|
||||
screenManager->ScreenForRect(bounds.x, bounds.y,
|
||||
bounds.width, bounds.height,
|
||||
|
@ -98,6 +98,7 @@ protected:
|
||||
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
|
||||
typedef mozilla::layers::APZEventState APZEventState;
|
||||
typedef mozilla::layers::SetAllowedTouchBehaviorCallback SetAllowedTouchBehaviorCallback;
|
||||
typedef mozilla::CSSIntRect CSSIntRect;
|
||||
typedef mozilla::ScreenRotation ScreenRotation;
|
||||
|
||||
virtual ~nsBaseWidget();
|
||||
@ -288,7 +289,7 @@ public:
|
||||
|
||||
// return the widget's outside dimensions
|
||||
// in global coordinates in display pixel.
|
||||
nsIntRect GetScaledScreenBounds();
|
||||
CSSIntRect GetScaledScreenBounds();
|
||||
|
||||
// return the screen the widget is in.
|
||||
already_AddRefed<nsIScreen> GetWidgetScreen();
|
||||
@ -507,7 +508,7 @@ protected:
|
||||
nsCursor mCursor;
|
||||
nsBorderStyle mBorderStyle;
|
||||
nsIntRect mBounds;
|
||||
nsIntRect* mOriginalBounds;
|
||||
CSSIntRect* mOriginalBounds;
|
||||
// When this pointer is null, the widget is not clipped
|
||||
mozilla::UniquePtr<nsIntRect[]> mClipRects;
|
||||
uint32_t mClipRectCount;
|
||||
|
Loading…
Reference in New Issue
Block a user