Bug 1224482 (part 7) - Make GetScaledScreenBounds() return a CSSIntRect. r=kats.

Also changes mOriginalBounds to a CSSIntRect*.

--HG--
extra : rebase_source : 4580d2c5266c6d88a7114d03b974cb9358d8051d
This commit is contained in:
Nicholas Nethercote 2015-11-13 01:37:02 -08:00
Родитель 7e046817ef
Коммит 1dc3cd94f1
2 изменённых файлов: 14 добавлений и 13 удалений

Просмотреть файл

@ -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;