Bug 1239589 - Change nsBaseWidget::mBounds to a LayoutDeviceIntRect. r=kats.
This patch removes dozens of ToUnknown/FromUnknown conversions and doesn't add any new ones, which is nice. It also removes UntypedDevPixelsToCocoaPoints(), which is no longer needed.
This commit is contained in:
@@ -64,7 +64,7 @@ PluginWidgetProxy::Create(nsIWidget* aParent,
|
|||||||
|
|
||||||
BaseCreate(aParent, aInitData);
|
BaseCreate(aParent, aInitData);
|
||||||
|
|
||||||
mBounds = aRect.ToUnknownRect();
|
mBounds = aRect;
|
||||||
mEnabled = true;
|
mEnabled = true;
|
||||||
mVisible = true;
|
mVisible = true;
|
||||||
|
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ using namespace mozilla::layers;
|
|||||||
using namespace mozilla::widget;
|
using namespace mozilla::widget;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
InvalidateRegion(nsIWidget* aWidget, const nsIntRegion& aRegion)
|
InvalidateRegion(nsIWidget* aWidget, const LayoutDeviceIntRegion& aRegion)
|
||||||
{
|
{
|
||||||
nsIntRegionRectIterator it(aRegion);
|
LayoutDeviceIntRegion::RectIterator it(aRegion);
|
||||||
while(const nsIntRect* r = it.Next()) {
|
while(const LayoutDeviceIntRect* r = it.Next()) {
|
||||||
aWidget->Invalidate(LayoutDeviceIntRect::FromUnknownRect(*r));
|
aWidget->Invalidate(*r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ PuppetWidget::Create(nsIWidget* aParent,
|
|||||||
|
|
||||||
BaseCreate(nullptr, aInitData);
|
BaseCreate(nullptr, aInitData);
|
||||||
|
|
||||||
mBounds = aRect.ToUnknownRect();
|
mBounds = aRect;
|
||||||
mEnabled = true;
|
mEnabled = true;
|
||||||
mVisible = true;
|
mVisible = true;
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ PuppetWidget::Show(bool aState)
|
|||||||
|
|
||||||
if (!wasVisible && mVisible) {
|
if (!wasVisible && mVisible) {
|
||||||
Resize(mBounds.width, mBounds.height, false);
|
Resize(mBounds.width, mBounds.height, false);
|
||||||
Invalidate(LayoutDeviceIntRect::FromUnknownRect(mBounds));
|
Invalidate(mBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@@ -208,8 +208,9 @@ PuppetWidget::Resize(double aWidth,
|
|||||||
double aHeight,
|
double aHeight,
|
||||||
bool aRepaint)
|
bool aRepaint)
|
||||||
{
|
{
|
||||||
nsIntRect oldBounds = mBounds;
|
LayoutDeviceIntRect oldBounds = mBounds;
|
||||||
mBounds.SizeTo(nsIntSize(NSToIntRound(aWidth), NSToIntRound(aHeight)));
|
mBounds.SizeTo(LayoutDeviceIntSize(NSToIntRound(aWidth),
|
||||||
|
NSToIntRound(aHeight)));
|
||||||
|
|
||||||
if (mChild) {
|
if (mChild) {
|
||||||
return mChild->Resize(aWidth, aHeight, aRepaint);
|
return mChild->Resize(aWidth, aHeight, aRepaint);
|
||||||
@@ -218,8 +219,8 @@ PuppetWidget::Resize(double aWidth,
|
|||||||
// XXX: roc says that |aRepaint| dictates whether or not to
|
// XXX: roc says that |aRepaint| dictates whether or not to
|
||||||
// invalidate the expanded area
|
// invalidate the expanded area
|
||||||
if (oldBounds.Size() < mBounds.Size() && aRepaint) {
|
if (oldBounds.Size() < mBounds.Size() && aRepaint) {
|
||||||
nsIntRegion dirty(mBounds);
|
LayoutDeviceIntRegion dirty(mBounds);
|
||||||
dirty.Sub(dirty, oldBounds);
|
dirty.Sub(dirty, oldBounds);
|
||||||
InvalidateRegion(this, dirty);
|
InvalidateRegion(this, dirty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1240,7 +1241,7 @@ PuppetWidget::GetWindowPosition()
|
|||||||
NS_METHOD
|
NS_METHOD
|
||||||
PuppetWidget::GetScreenBounds(LayoutDeviceIntRect& aRect) {
|
PuppetWidget::GetScreenBounds(LayoutDeviceIntRect& aRect) {
|
||||||
aRect.MoveTo(WidgetToScreenOffset());
|
aRect.MoveTo(WidgetToScreenOffset());
|
||||||
aRect.SizeTo(LayoutDeviceIntSize::FromUnknownSize(mBounds.Size()));
|
aRect.SizeTo(mBounds.Size());
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1075,7 +1075,7 @@ nsWindow::Create(nsIWidget* aParent,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mBounds = aRect.ToUnknownRect();
|
mBounds = aRect;
|
||||||
|
|
||||||
// for toplevel windows, bounds are fixed to full screen size
|
// for toplevel windows, bounds are fixed to full screen size
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
|
|||||||
@@ -535,11 +535,6 @@ public:
|
|||||||
CGFloat DevPixelsToCocoaPoints(int32_t aPixels) const {
|
CGFloat DevPixelsToCocoaPoints(int32_t aPixels) const {
|
||||||
return nsCocoaUtils::DevPixelsToCocoaPoints(aPixels, BackingScaleFactor());
|
return nsCocoaUtils::DevPixelsToCocoaPoints(aPixels, BackingScaleFactor());
|
||||||
}
|
}
|
||||||
// XXX: all calls to this function should eventually be replaced with calls
|
|
||||||
// to DevPixelsToCocoaPoints().
|
|
||||||
NSRect UntypedDevPixelsToCocoaPoints(const nsIntRect& aRect) const {
|
|
||||||
return nsCocoaUtils::UntypedDevPixelsToCocoaPoints(aRect, BackingScaleFactor());
|
|
||||||
}
|
|
||||||
NSRect DevPixelsToCocoaPoints(const LayoutDeviceIntRect& aRect) const {
|
NSRect DevPixelsToCocoaPoints(const LayoutDeviceIntRect& aRect) const {
|
||||||
return nsCocoaUtils::DevPixelsToCocoaPoints(aRect, BackingScaleFactor());
|
return nsCocoaUtils::DevPixelsToCocoaPoints(aRect, BackingScaleFactor());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -496,7 +496,7 @@ nsresult nsChildView::Create(nsIWidget* aParent,
|
|||||||
gChildViewMethodsSwizzled = true;
|
gChildViewMethodsSwizzled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mBounds = aRect.ToUnknownRect();
|
mBounds = aRect;
|
||||||
|
|
||||||
// Ensure that the toolkit is created.
|
// Ensure that the toolkit is created.
|
||||||
nsToolkit::GetToolkit();
|
nsToolkit::GetToolkit();
|
||||||
@@ -522,8 +522,7 @@ nsresult nsChildView::Create(nsIWidget* aParent,
|
|||||||
// create our parallel NSView and hook it up to our parent. Recall
|
// create our parallel NSView and hook it up to our parent. Recall
|
||||||
// that NS_NATIVE_WIDGET is the NSView.
|
// that NS_NATIVE_WIDGET is the NSView.
|
||||||
CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mParentView);
|
CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mParentView);
|
||||||
NSRect r = nsCocoaUtils::DevPixelsToCocoaPoints(
|
NSRect r = nsCocoaUtils::DevPixelsToCocoaPoints(mBounds, scaleFactor);
|
||||||
LayoutDeviceIntRect::FromUnknownRect(mBounds), scaleFactor);
|
|
||||||
mView = [(NSView<mozView>*)CreateCocoaView(r) retain];
|
mView = [(NSView<mozView>*)CreateCocoaView(r) retain];
|
||||||
if (!mView) {
|
if (!mView) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
@@ -929,9 +928,7 @@ NS_IMETHODIMP nsChildView::SetCursor(imgIContainer* aCursor,
|
|||||||
// Get this component dimension
|
// Get this component dimension
|
||||||
NS_IMETHODIMP nsChildView::GetBounds(LayoutDeviceIntRect& aRect)
|
NS_IMETHODIMP nsChildView::GetBounds(LayoutDeviceIntRect& aRect)
|
||||||
{
|
{
|
||||||
aRect = !mView
|
aRect = !mView ? mBounds : CocoaPointsToDevPixels([mView frame]);
|
||||||
? LayoutDeviceIntRect::FromUnknownRect(mBounds)
|
|
||||||
: CocoaPointsToDevPixels([mView frame]);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1023,7 +1020,7 @@ NS_IMETHODIMP nsChildView::Move(double aX, double aY)
|
|||||||
mBounds.y = y;
|
mBounds.y = y;
|
||||||
|
|
||||||
ManipulateViewWithoutNeedingDisplay(mView, ^{
|
ManipulateViewWithoutNeedingDisplay(mView, ^{
|
||||||
[mView setFrame:UntypedDevPixelsToCocoaPoints(mBounds)];
|
[mView setFrame:DevPixelsToCocoaPoints(mBounds)];
|
||||||
});
|
});
|
||||||
|
|
||||||
NotifyRollupGeometryChange();
|
NotifyRollupGeometryChange();
|
||||||
@@ -1048,7 +1045,7 @@ NS_IMETHODIMP nsChildView::Resize(double aWidth, double aHeight, bool aRepaint)
|
|||||||
mBounds.height = height;
|
mBounds.height = height;
|
||||||
|
|
||||||
ManipulateViewWithoutNeedingDisplay(mView, ^{
|
ManipulateViewWithoutNeedingDisplay(mView, ^{
|
||||||
[mView setFrame:UntypedDevPixelsToCocoaPoints(mBounds)];
|
[mView setFrame:DevPixelsToCocoaPoints(mBounds)];
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mVisible && aRepaint)
|
if (mVisible && aRepaint)
|
||||||
@@ -1087,7 +1084,7 @@ NS_IMETHODIMP nsChildView::Resize(double aX, double aY,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ManipulateViewWithoutNeedingDisplay(mView, ^{
|
ManipulateViewWithoutNeedingDisplay(mView, ^{
|
||||||
[mView setFrame:UntypedDevPixelsToCocoaPoints(mBounds)];
|
[mView setFrame:DevPixelsToCocoaPoints(mBounds)];
|
||||||
});
|
});
|
||||||
|
|
||||||
if (mVisible && aRepaint)
|
if (mVisible && aRepaint)
|
||||||
@@ -2650,8 +2647,7 @@ nsChildView::StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion)
|
|||||||
}
|
}
|
||||||
|
|
||||||
LayoutDeviceIntRegion dirtyRegion(aInvalidRegion);
|
LayoutDeviceIntRegion dirtyRegion(aInvalidRegion);
|
||||||
LayoutDeviceIntSize renderSize =
|
LayoutDeviceIntSize renderSize = mBounds.Size();
|
||||||
LayoutDeviceIntSize::FromUnknownSize(mBounds.Size());
|
|
||||||
|
|
||||||
if (!mBasicCompositorImage) {
|
if (!mBasicCompositorImage) {
|
||||||
mBasicCompositorImage = new RectTextureImage(mGLPresenter->gl());
|
mBasicCompositorImage = new RectTextureImage(mGLPresenter->gl());
|
||||||
@@ -2662,7 +2658,7 @@ nsChildView::StartRemoteDrawingInRegion(LayoutDeviceIntRegion& aInvalidRegion)
|
|||||||
|
|
||||||
if (!drawTarget) {
|
if (!drawTarget) {
|
||||||
// Composite unchanged textures.
|
// Composite unchanged textures.
|
||||||
DoRemoteComposition(LayoutDeviceIntRect::FromUnknownRect(mBounds));
|
DoRemoteComposition(mBounds);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2675,7 +2671,7 @@ void
|
|||||||
nsChildView::EndRemoteDrawing()
|
nsChildView::EndRemoteDrawing()
|
||||||
{
|
{
|
||||||
mBasicCompositorImage->EndUpdate(true);
|
mBasicCompositorImage->EndUpdate(true);
|
||||||
DoRemoteComposition(LayoutDeviceIntRect::FromUnknownRect(mBounds));
|
DoRemoteComposition(mBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -184,17 +184,6 @@ public:
|
|||||||
(CGFloat)aPt.y / aBackingScale);
|
(CGFloat)aPt.y / aBackingScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: all calls to this function should eventually be replaced with calls
|
|
||||||
// to DevPixelsToCocoaPoints().
|
|
||||||
static NSRect
|
|
||||||
UntypedDevPixelsToCocoaPoints(const nsIntRect& aRect, CGFloat aBackingScale)
|
|
||||||
{
|
|
||||||
return NSMakeRect((CGFloat)aRect.x / aBackingScale,
|
|
||||||
(CGFloat)aRect.y / aBackingScale,
|
|
||||||
(CGFloat)aRect.width / aBackingScale,
|
|
||||||
(CGFloat)aRect.height / aBackingScale);
|
|
||||||
}
|
|
||||||
|
|
||||||
static NSRect
|
static NSRect
|
||||||
DevPixelsToCocoaPoints(const LayoutDeviceIntRect& aRect,
|
DevPixelsToCocoaPoints(const LayoutDeviceIntRect& aRect,
|
||||||
CGFloat aBackingScale)
|
CGFloat aBackingScale)
|
||||||
|
|||||||
@@ -1621,8 +1621,8 @@ nsCocoaWindow::UpdateBounds()
|
|||||||
if (mWindow) {
|
if (mWindow) {
|
||||||
frame = [mWindow frame];
|
frame = [mWindow frame];
|
||||||
}
|
}
|
||||||
mBounds = nsCocoaUtils::CocoaRectToGeckoRectDevPix(
|
mBounds =
|
||||||
frame, BackingScaleFactor()).ToUnknownRect();
|
nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, BackingScaleFactor());
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsCocoaWindow::GetScreenBounds(LayoutDeviceIntRect &aRect)
|
NS_IMETHODIMP nsCocoaWindow::GetScreenBounds(LayoutDeviceIntRect &aRect)
|
||||||
@@ -1631,10 +1631,10 @@ NS_IMETHODIMP nsCocoaWindow::GetScreenBounds(LayoutDeviceIntRect &aRect)
|
|||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
LayoutDeviceIntRect r = nsCocoaUtils::CocoaRectToGeckoRectDevPix([mWindow frame], BackingScaleFactor());
|
LayoutDeviceIntRect r = nsCocoaUtils::CocoaRectToGeckoRectDevPix([mWindow frame], BackingScaleFactor());
|
||||||
NS_ASSERTION(mWindow && mBounds == r.ToUnknownRect(), "mBounds out of sync!");
|
NS_ASSERTION(mWindow && mBounds == r, "mBounds out of sync!");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
aRect = LayoutDeviceIntRect::FromUnknownRect(mBounds);
|
aRect = mBounds;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||||
@@ -2025,8 +2025,7 @@ LayoutDeviceIntPoint nsCocoaWindow::GetClientOffset()
|
|||||||
LayoutDeviceIntRect clientRect;
|
LayoutDeviceIntRect clientRect;
|
||||||
GetClientBounds(clientRect);
|
GetClientBounds(clientRect);
|
||||||
|
|
||||||
return clientRect.TopLeft() -
|
return clientRect.TopLeft() - mBounds.TopLeft();
|
||||||
LayoutDeviceIntPoint::FromUnknownPoint(mBounds.TopLeft());
|
|
||||||
|
|
||||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0, 0));
|
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0, 0));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -344,13 +344,13 @@ nsWindow::Create(nsIWidget* aParent,
|
|||||||
|
|
||||||
mScreen = static_cast<nsScreenGonk*>(screen.get());
|
mScreen = static_cast<nsScreenGonk*>(screen.get());
|
||||||
|
|
||||||
mBounds = aRect.ToUnknownRect();
|
mBounds = aRect;
|
||||||
|
|
||||||
mParent = (nsWindow *)aParent;
|
mParent = (nsWindow *)aParent;
|
||||||
mVisible = false;
|
mVisible = false;
|
||||||
|
|
||||||
if (!aParent) {
|
if (!aParent) {
|
||||||
mBounds = mScreen->GetRect().ToUnknownRect();
|
mBounds = mScreen->GetRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
mComposer2D = HwcComposer2D::GetInstance();
|
mComposer2D = HwcComposer2D::GetInstance();
|
||||||
@@ -448,14 +448,14 @@ nsWindow::Resize(double aX,
|
|||||||
double aHeight,
|
double aHeight,
|
||||||
bool aRepaint)
|
bool aRepaint)
|
||||||
{
|
{
|
||||||
mBounds = nsIntRect(NSToIntRound(aX), NSToIntRound(aY),
|
mBounds = LayoutDeviceIntRect(NSToIntRound(aX), NSToIntRound(aY),
|
||||||
NSToIntRound(aWidth), NSToIntRound(aHeight));
|
NSToIntRound(aWidth), NSToIntRound(aHeight));
|
||||||
if (mWidgetListener) {
|
if (mWidgetListener) {
|
||||||
mWidgetListener->WindowResized(this, mBounds.width, mBounds.height);
|
mWidgetListener->WindowResized(this, mBounds.width, mBounds.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aRepaint) {
|
if (aRepaint) {
|
||||||
Invalidate(LayoutDeviceIntRect::FromUnknownRect(mBounds));
|
Invalidate(mBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@@ -726,7 +726,7 @@ nsWindow::BringToTop()
|
|||||||
mWidgetListener->WindowActivated();
|
mWidgetListener->WindowActivated();
|
||||||
}
|
}
|
||||||
|
|
||||||
Invalidate(LayoutDeviceIntRect::FromUnknownRect(mBounds));
|
Invalidate(mBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -1497,7 +1497,7 @@ nsWindow::GetScreenBounds(LayoutDeviceIntRect& aRect)
|
|||||||
// bounds (bug 581863). gdk_window_get_frame_extents would give the
|
// bounds (bug 581863). gdk_window_get_frame_extents would give the
|
||||||
// frame bounds, but mBounds.Size() is returned here for consistency
|
// frame bounds, but mBounds.Size() is returned here for consistency
|
||||||
// with Resize.
|
// with Resize.
|
||||||
aRect.SizeTo(LayoutDeviceIntSize::FromUnknownSize(mBounds.Size()));
|
aRect.SizeTo(mBounds.Size());
|
||||||
LOG(("GetScreenBounds %d,%d | %dx%d\n",
|
LOG(("GetScreenBounds %d,%d | %dx%d\n",
|
||||||
aRect.x, aRect.y, aRect.width, aRect.height));
|
aRect.x, aRect.y, aRect.width, aRect.height));
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@@ -2419,7 +2419,7 @@ nsWindow::OnConfigureEvent(GtkWidget *aWidget, GdkEventConfigure *aEvent)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
mBounds.MoveTo(screenBounds.TopLeft().ToUnknownPoint());
|
mBounds.MoveTo(screenBounds.TopLeft());
|
||||||
|
|
||||||
// XXX mozilla will invalidate the entire window after this move
|
// XXX mozilla will invalidate the entire window after this move
|
||||||
// complete. wtf?
|
// complete. wtf?
|
||||||
@@ -2450,7 +2450,7 @@ nsWindow::OnSizeAllocate(GtkAllocation *aAllocation)
|
|||||||
(void *)this, aAllocation->x, aAllocation->y,
|
(void *)this, aAllocation->x, aAllocation->y,
|
||||||
aAllocation->width, aAllocation->height));
|
aAllocation->width, aAllocation->height));
|
||||||
|
|
||||||
nsIntSize size = GdkRectToDevicePixels(*aAllocation).Size();
|
LayoutDeviceIntSize size = GdkRectToDevicePixels(*aAllocation).Size();
|
||||||
|
|
||||||
if (mBounds.Size() == size)
|
if (mBounds.Size() == size)
|
||||||
return;
|
return;
|
||||||
@@ -3542,7 +3542,7 @@ nsWindow::Create(nsIWidget* aParent,
|
|||||||
CommonCreate(aParent, listenForResizes);
|
CommonCreate(aParent, listenForResizes);
|
||||||
|
|
||||||
// save our bounds
|
// save our bounds
|
||||||
mBounds = aRect.ToUnknownRect();
|
mBounds = aRect;
|
||||||
ConstrainSize(&mBounds.width, &mBounds.height);
|
ConstrainSize(&mBounds.width, &mBounds.height);
|
||||||
|
|
||||||
// figure out our parent window
|
// figure out our parent window
|
||||||
@@ -4035,7 +4035,7 @@ nsWindow::NativeResize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
GdkRectangle size = DevicePixelsToGdkSizeRoundUp(mBounds.Size());
|
GdkRectangle size = DevicePixelsToGdkSizeRoundUp(mBounds.Size());
|
||||||
|
|
||||||
LOG(("nsWindow::NativeResize [%p] %d %d\n", (void *)this,
|
LOG(("nsWindow::NativeResize [%p] %d %d\n", (void *)this,
|
||||||
size.width, size.height));
|
size.width, size.height));
|
||||||
|
|
||||||
@@ -4301,14 +4301,12 @@ nsWindow::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
|
|||||||
nsWindow* w = static_cast<nsWindow*>(configuration.mChild.get());
|
nsWindow* w = static_cast<nsWindow*>(configuration.mChild.get());
|
||||||
NS_ASSERTION(w->GetParent() == this,
|
NS_ASSERTION(w->GetParent() == this,
|
||||||
"Configured widget is not a child");
|
"Configured widget is not a child");
|
||||||
LayoutDeviceIntRect wBounds =
|
|
||||||
LayoutDeviceIntRect::FromUnknownRect(w->mBounds);
|
|
||||||
w->SetWindowClipRegion(configuration.mClipRegion, true);
|
w->SetWindowClipRegion(configuration.mClipRegion, true);
|
||||||
if (wBounds.Size() != configuration.mBounds.Size()) {
|
if (w->mBounds.Size() != configuration.mBounds.Size()) {
|
||||||
w->Resize(configuration.mBounds.x, configuration.mBounds.y,
|
w->Resize(configuration.mBounds.x, configuration.mBounds.y,
|
||||||
configuration.mBounds.width, configuration.mBounds.height,
|
configuration.mBounds.width, configuration.mBounds.height,
|
||||||
true);
|
true);
|
||||||
} else if (wBounds.TopLeft() != configuration.mBounds.TopLeft()) {
|
} else if (w->mBounds.TopLeft() != configuration.mBounds.TopLeft()) {
|
||||||
w->Move(configuration.mBounds.x, configuration.mBounds.y);
|
w->Move(configuration.mBounds.x, configuration.mBounds.y);
|
||||||
}
|
}
|
||||||
w->SetWindowClipRegion(configuration.mClipRegion, false);
|
w->SetWindowClipRegion(configuration.mClipRegion, false);
|
||||||
@@ -6702,7 +6700,7 @@ nsWindow::DevicePixelsToGdkCoordRoundDown(int pixels) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GdkPoint
|
GdkPoint
|
||||||
nsWindow::DevicePixelsToGdkPointRoundDown(nsIntPoint point) {
|
nsWindow::DevicePixelsToGdkPointRoundDown(LayoutDeviceIntPoint point) {
|
||||||
gint scale = GdkScaleFactor();
|
gint scale = GdkScaleFactor();
|
||||||
return { point.x / scale, point.y / scale };
|
return { point.x / scale, point.y / scale };
|
||||||
}
|
}
|
||||||
@@ -6718,7 +6716,7 @@ nsWindow::DevicePixelsToGdkRectRoundOut(LayoutDeviceIntRect rect) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GdkRectangle
|
GdkRectangle
|
||||||
nsWindow::DevicePixelsToGdkSizeRoundUp(nsIntSize pixelSize) {
|
nsWindow::DevicePixelsToGdkSizeRoundUp(LayoutDeviceIntSize pixelSize) {
|
||||||
gint scale = GdkScaleFactor();
|
gint scale = GdkScaleFactor();
|
||||||
gint width = (pixelSize.width + scale - 1) / scale;
|
gint width = (pixelSize.width + scale - 1) / scale;
|
||||||
gint height = (pixelSize.height + scale - 1) / scale;
|
gint height = (pixelSize.height + scale - 1) / scale;
|
||||||
@@ -6744,13 +6742,13 @@ nsWindow::GdkPointToDevicePixels(GdkPoint point) {
|
|||||||
point.y * scale);
|
point.y * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntRect
|
LayoutDeviceIntRect
|
||||||
nsWindow::GdkRectToDevicePixels(GdkRectangle rect) {
|
nsWindow::GdkRectToDevicePixels(GdkRectangle rect) {
|
||||||
gint scale = GdkScaleFactor();
|
gint scale = GdkScaleFactor();
|
||||||
return nsIntRect(rect.x * scale,
|
return LayoutDeviceIntRect(rect.x * scale,
|
||||||
rect.y * scale,
|
rect.y * scale,
|
||||||
rect.width * scale,
|
rect.width * scale,
|
||||||
rect.height * scale);
|
rect.height * scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|||||||
@@ -340,14 +340,14 @@ public:
|
|||||||
// To GDK
|
// To GDK
|
||||||
gint DevicePixelsToGdkCoordRoundUp(int pixels);
|
gint DevicePixelsToGdkCoordRoundUp(int pixels);
|
||||||
gint DevicePixelsToGdkCoordRoundDown(int pixels);
|
gint DevicePixelsToGdkCoordRoundDown(int pixels);
|
||||||
GdkPoint DevicePixelsToGdkPointRoundDown(nsIntPoint point);
|
GdkPoint DevicePixelsToGdkPointRoundDown(LayoutDeviceIntPoint point);
|
||||||
GdkRectangle DevicePixelsToGdkSizeRoundUp(nsIntSize pixelSize);
|
GdkRectangle DevicePixelsToGdkSizeRoundUp(LayoutDeviceIntSize pixelSize);
|
||||||
|
|
||||||
// From GDK
|
// From GDK
|
||||||
int GdkCoordToDevicePixels(gint coord);
|
int GdkCoordToDevicePixels(gint coord);
|
||||||
LayoutDeviceIntPoint GdkPointToDevicePixels(GdkPoint point);
|
LayoutDeviceIntPoint GdkPointToDevicePixels(GdkPoint point);
|
||||||
LayoutDeviceIntPoint GdkEventCoordsToDevicePixels(gdouble x, gdouble y);
|
LayoutDeviceIntPoint GdkEventCoordsToDevicePixels(gdouble x, gdouble y);
|
||||||
nsIntRect GdkRectToDevicePixels(GdkRectangle rect);
|
LayoutDeviceIntRect GdkRectToDevicePixels(GdkRectangle rect);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~nsWindow();
|
virtual ~nsWindow();
|
||||||
|
|||||||
@@ -1443,7 +1443,7 @@ NS_METHOD nsBaseWidget::GetClientBounds(LayoutDeviceIntRect &aRect)
|
|||||||
**/
|
**/
|
||||||
NS_METHOD nsBaseWidget::GetBounds(LayoutDeviceIntRect &aRect)
|
NS_METHOD nsBaseWidget::GetBounds(LayoutDeviceIntRect &aRect)
|
||||||
{
|
{
|
||||||
aRect = LayoutDeviceIntRect::FromUnknownRect(mBounds);
|
aRect = mBounds;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ protected:
|
|||||||
RefPtr<TextEventDispatcher> mTextEventDispatcher;
|
RefPtr<TextEventDispatcher> mTextEventDispatcher;
|
||||||
nsCursor mCursor;
|
nsCursor mCursor;
|
||||||
nsBorderStyle mBorderStyle;
|
nsBorderStyle mBorderStyle;
|
||||||
nsIntRect mBounds;
|
LayoutDeviceIntRect mBounds;
|
||||||
LayoutDeviceIntRect* mOriginalBounds;
|
LayoutDeviceIntRect* mOriginalBounds;
|
||||||
// When this pointer is null, the widget is not clipped
|
// When this pointer is null, the widget is not clipped
|
||||||
mozilla::UniquePtr<LayoutDeviceIntRect[]> mClipRects;
|
mozilla::UniquePtr<LayoutDeviceIntRect[]> mClipRects;
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ nsWindow::Create(nsIWidget* aParent,
|
|||||||
mParent = (nsWindow *)aParent;
|
mParent = (nsWindow *)aParent;
|
||||||
|
|
||||||
// save our bounds
|
// save our bounds
|
||||||
mBounds = aRect.ToUnknownRect();
|
mBounds = aRect;
|
||||||
|
|
||||||
// find native parent
|
// find native parent
|
||||||
MozQWidget *parent = nullptr;
|
MozQWidget *parent = nullptr;
|
||||||
@@ -466,8 +466,7 @@ nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
|||||||
// synthesize a resize event if this isn't a toplevel
|
// synthesize a resize event if this isn't a toplevel
|
||||||
if (mIsTopLevel || mListenForResizes) {
|
if (mIsTopLevel || mListenForResizes) {
|
||||||
nsEventStatus status;
|
nsEventStatus status;
|
||||||
DispatchResizeEvent(LayoutDeviceIntRect::FromUnknownRect(mBounds),
|
DispatchResizeEvent(mBounds, status);
|
||||||
status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NotifyRollupGeometryChange();
|
NotifyRollupGeometryChange();
|
||||||
@@ -530,8 +529,7 @@ nsWindow::Resize(double aX, double aY, double aWidth, double aHeight,
|
|||||||
if (mIsTopLevel || mListenForResizes) {
|
if (mIsTopLevel || mListenForResizes) {
|
||||||
// synthesize a resize event
|
// synthesize a resize event
|
||||||
nsEventStatus status;
|
nsEventStatus status;
|
||||||
DispatchResizeEvent(LayoutDeviceIntRect::FromUnknownRect(mBounds),
|
DispatchResizeEvent(mBounds, status);
|
||||||
status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aRepaint) {
|
if (aRepaint) {
|
||||||
@@ -603,13 +601,11 @@ nsWindow::ConfigureChildren(const nsTArray<nsIWidget::Configuration>& aConfigura
|
|||||||
NS_ASSERTION(w->GetParent() == this,
|
NS_ASSERTION(w->GetParent() == this,
|
||||||
"Configured widget is not a child");
|
"Configured widget is not a child");
|
||||||
|
|
||||||
LayoutDeviceIntRect wBounds =
|
if (w->mBounds.Size() != configuration.mBounds.Size()) {
|
||||||
LayoutDeviceIntRect::FromUnknownRect(w->mBounds);
|
|
||||||
if (wBounds.Size() != configuration.mBounds.Size()) {
|
|
||||||
w->Resize(configuration.mBounds.x, configuration.mBounds.y,
|
w->Resize(configuration.mBounds.x, configuration.mBounds.y,
|
||||||
configuration.mBounds.width, configuration.mBounds.height,
|
configuration.mBounds.width, configuration.mBounds.height,
|
||||||
true);
|
true);
|
||||||
} else if (wBounds.TopLeft() != configuration.mBounds.TopLeft()) {
|
} else if (w->mBounds.TopLeft() != configuration.mBounds.TopLeft()) {
|
||||||
w->Move(configuration.mBounds.x, configuration.mBounds.y);
|
w->Move(configuration.mBounds.x, configuration.mBounds.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1503,8 +1499,7 @@ void find_first_visible_parent(QWindow* aItem, QWindow*& aVisibleItem)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsWindow::GetScreenBounds(LayoutDeviceIntRect& aRect)
|
nsWindow::GetScreenBounds(LayoutDeviceIntRect& aRect)
|
||||||
{
|
{
|
||||||
aRect = LayoutDeviceIntRect(LayoutDeviceIntPoint(0, 0),
|
aRect = LayoutDeviceIntRect(LayoutDeviceIntPoint(0, 0), mBounds.Size());
|
||||||
LayoutDeviceIntSize::FromUnknownSize(mBounds.Size()));
|
|
||||||
if (mIsTopLevel) {
|
if (mIsTopLevel) {
|
||||||
QPoint pos = mWidget->position();
|
QPoint pos = mWidget->position();
|
||||||
aRect.MoveTo(pos.x(), pos.y());
|
aRect.MoveTo(pos.x(), pos.y());
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public:
|
|||||||
|
|
||||||
NS_DECL_NSISCREENMANAGER
|
NS_DECL_NSISCREENMANAGER
|
||||||
|
|
||||||
static nsIntRect GetBounds();
|
static LayoutDeviceIntRect GetBounds();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual ~UIKitScreenManager () {}
|
virtual ~UIKitScreenManager () {}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include "nsScreenManager.h"
|
#include "nsScreenManager.h"
|
||||||
#include "nsAppShell.h"
|
#include "nsAppShell.h"
|
||||||
|
|
||||||
static nsIntRect gScreenBounds;
|
static LayoutDeviceIntRect gScreenBounds;
|
||||||
static bool gScreenBoundsSet = false;
|
static bool gScreenBoundsSet = false;
|
||||||
|
|
||||||
UIKitScreen::UIKitScreen(UIScreen* aScreen)
|
UIKitScreen::UIKitScreen(UIScreen* aScreen)
|
||||||
@@ -83,7 +83,7 @@ UIKitScreenManager::UIKitScreenManager()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIntRect
|
LayoutDeviceIntRect
|
||||||
UIKitScreenManager::GetBounds()
|
UIKitScreenManager::GetBounds()
|
||||||
{
|
{
|
||||||
if (!gScreenBoundsSet) {
|
if (!gScreenBoundsSet) {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ UIKitPointsToDevPixels(CGPoint aPoint, CGFloat aBackingScale)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CGRect
|
static CGRect
|
||||||
DevPixelsToUIKitPoints(const nsIntRect& aRect, CGFloat aBackingScale)
|
DevPixelsToUIKitPoints(const LayoutDeviceIntRect& aRect, CGFloat aBackingScale)
|
||||||
{
|
{
|
||||||
return CGRectMake((CGFloat)aRect.x / aBackingScale,
|
return CGRectMake((CGFloat)aRect.x / aBackingScale,
|
||||||
(CGFloat)aRect.y / aBackingScale,
|
(CGFloat)aRect.y / aBackingScale,
|
||||||
@@ -493,7 +493,7 @@ nsWindow::Create(nsIWidget* aParent,
|
|||||||
mBounds.height = cgRect.size.height;
|
mBounds.height = cgRect.size.height;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mBounds = aRect.ToUnknownRect();
|
mBounds = aRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALOG("nsWindow[%p]::Create bounds: %d %d %d %d", (void*)this,
|
ALOG("nsWindow[%p]::Create bounds: %d %d %d %d", (void*)this,
|
||||||
|
|||||||
@@ -548,7 +548,7 @@ nsWindow::Create(nsIWidget* aParent,
|
|||||||
nullptr : aParent;
|
nullptr : aParent;
|
||||||
|
|
||||||
mIsTopWidgetWindow = (nullptr == baseParent);
|
mIsTopWidgetWindow = (nullptr == baseParent);
|
||||||
mBounds = aRect.ToUnknownRect();
|
mBounds = aRect;
|
||||||
|
|
||||||
// Ensure that the toolkit is created.
|
// Ensure that the toolkit is created.
|
||||||
nsToolkit::GetToolkit();
|
nsToolkit::GetToolkit();
|
||||||
@@ -2030,7 +2030,7 @@ NS_METHOD nsWindow::GetBounds(LayoutDeviceIntRect& aRect)
|
|||||||
aRect.x = r.left;
|
aRect.x = r.left;
|
||||||
aRect.y = r.top;
|
aRect.y = r.top;
|
||||||
} else {
|
} else {
|
||||||
aRect = LayoutDeviceIntRect::FromUnknownRect(mBounds);
|
aRect = mBounds;
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@@ -2066,7 +2066,7 @@ NS_METHOD nsWindow::GetScreenBounds(LayoutDeviceIntRect& aRect)
|
|||||||
aRect.x = r.left;
|
aRect.x = r.left;
|
||||||
aRect.y = r.top;
|
aRect.y = r.top;
|
||||||
} else {
|
} else {
|
||||||
aRect = LayoutDeviceIntRect::FromUnknownRect(mBounds);
|
aRect = mBounds;
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -585,7 +585,7 @@ protected:
|
|||||||
HDC mPaintDC; // only set during painting
|
HDC mPaintDC; // only set during painting
|
||||||
HDC mCompositeDC; // only set during StartRemoteDrawing
|
HDC mCompositeDC; // only set during StartRemoteDrawing
|
||||||
|
|
||||||
nsIntRect mLastPaintBounds;
|
LayoutDeviceIntRect mLastPaintBounds;
|
||||||
|
|
||||||
// Used for displayport suppression during window resize
|
// Used for displayport suppression during window resize
|
||||||
enum ResizeState {
|
enum ResizeState {
|
||||||
|
|||||||
Reference in New Issue
Block a user