Bug 1149041 - Make nsIWidget::SizeConstraints use LayoutDeviceIntSize instead of unit-less nsIntSize. r=roc

This commit is contained in:
Mats Palmgren 2015-03-30 10:37:34 +00:00
parent e2ec4cc5dc
commit bea9838586
4 changed files with 16 additions and 14 deletions

View File

@ -669,12 +669,12 @@ void nsContainerFrame::SetSizeConstraints(nsPresContext* aPresContext,
const nsSize& aMinSize,
const nsSize& aMaxSize)
{
nsIntSize devMinSize(aPresContext->AppUnitsToDevPixels(aMinSize.width),
aPresContext->AppUnitsToDevPixels(aMinSize.height));
nsIntSize devMaxSize(aMaxSize.width == NS_INTRINSICSIZE ? NS_MAXSIZE :
aPresContext->AppUnitsToDevPixels(aMaxSize.width),
aMaxSize.height == NS_INTRINSICSIZE ? NS_MAXSIZE :
aPresContext->AppUnitsToDevPixels(aMaxSize.height));
LayoutDeviceIntSize devMinSize(aPresContext->AppUnitsToDevPixels(aMinSize.width),
aPresContext->AppUnitsToDevPixels(aMinSize.height));
LayoutDeviceIntSize devMaxSize(aMaxSize.width == NS_INTRINSICSIZE ? NS_MAXSIZE :
aPresContext->AppUnitsToDevPixels(aMaxSize.width),
aMaxSize.height == NS_INTRINSICSIZE ? NS_MAXSIZE :
aPresContext->AppUnitsToDevPixels(aMaxSize.height));
// MinSize has a priority over MaxSize
if (devMinSize.width > devMaxSize.width)

View File

@ -4089,14 +4089,14 @@ nsWindow::SetHasMappedToplevel(bool aState)
}
}
nsIntSize
nsWindow::GetSafeWindowSize(nsIntSize aSize)
LayoutDeviceIntSize
nsWindow::GetSafeWindowSize(LayoutDeviceIntSize aSize)
{
// The X protocol uses CARD32 for window sizes, but the server (1.11.3)
// reads it as CARD16. Sizes of pixmaps, used for drawing, are (unsigned)
// CARD16 in the protocol, but the server's ProcCreatePixmap returns
// BadAlloc if dimensions cannot be represented by signed shorts.
nsIntSize result = aSize;
LayoutDeviceIntSize result = aSize;
const int32_t kInt16Max = 32767;
if (result.width > kInt16Max) {
result.width = kInt16Max;

View File

@ -38,6 +38,7 @@
#include "prlog.h"
#include "nsTArray.h"
#include "Units.h"
extern PRLogModuleInfo *gWidgetLog;
extern PRLogModuleInfo *gWidgetFocusLog;
@ -211,7 +212,7 @@ private:
void NativeShow (bool aAction);
void SetHasMappedToplevel(bool aState);
nsIntSize GetSafeWindowSize(nsIntSize aSize);
mozilla::LayoutDeviceIntSize GetSafeWindowSize(mozilla::LayoutDeviceIntSize aSize);
void EnsureGrabs (void);
void GrabPointer (guint32 aTime);

View File

@ -24,6 +24,7 @@
#include "mozilla/TimeStamp.h"
#include "Units.h"
#include "mozilla/gfx/Point.h"
#include "Units.h"
// forward declarations
class nsFontMetrics;
@ -545,15 +546,15 @@ struct SizeConstraints {
{
}
SizeConstraints(nsIntSize aMinSize,
nsIntSize aMaxSize)
SizeConstraints(mozilla::LayoutDeviceIntSize aMinSize,
mozilla::LayoutDeviceIntSize aMaxSize)
: mMinSize(aMinSize),
mMaxSize(aMaxSize)
{
}
nsIntSize mMinSize;
nsIntSize mMaxSize;
mozilla::LayoutDeviceIntSize mMinSize;
mozilla::LayoutDeviceIntSize mMaxSize;
};
// IMEMessage is shared by IMEStateManager and TextComposition.