mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-24 03:19:06 +00:00
Bug 613076 - Fix GetDPI in the content process. r=cjones a=blocking-fennec
This commit is contained in:
parent
1f7fe6e2e3
commit
2d67e7738f
@ -175,6 +175,11 @@ parent:
|
||||
|
||||
SetIMEOpenState(PRBool value);
|
||||
|
||||
/**
|
||||
* Gets the DPI of the screen corresponding to this browser.
|
||||
*/
|
||||
sync GetDPI() returns (float value);
|
||||
|
||||
PContentPermissionRequest(nsCString aType, URI uri);
|
||||
|
||||
PContentDialog(PRUint32 aType, nsCString aName, nsCString aFeatures,
|
||||
|
@ -69,6 +69,7 @@
|
||||
#include "nsIPromptFactory.h"
|
||||
#include "nsIContent.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "nsDebug.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::ipc;
|
||||
@ -538,6 +539,15 @@ TabParent::RecvSetIMEOpenState(const PRBool& aValue)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvGetDPI(float* aValue)
|
||||
{
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
NS_ABORT_IF_FALSE(widget, "Must have a widget to find the DPI!");
|
||||
*aValue = widget->GetDPI();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::ReceiveMessage(const nsString& aMessage,
|
||||
PRBool aSync,
|
||||
|
@ -105,6 +105,7 @@ public:
|
||||
virtual bool RecvSetInputMode(const PRUint32& aValue, const nsString& aType, const nsString& aAction);
|
||||
virtual bool RecvGetIMEOpenState(PRBool* aValue);
|
||||
virtual bool RecvSetIMEOpenState(const PRBool& aValue);
|
||||
virtual bool RecvGetDPI(float* aValue);
|
||||
virtual PContentDialogParent* AllocPContentDialog(const PRUint32& aType,
|
||||
const nsCString& aName,
|
||||
const nsCString& aFeatures,
|
||||
@ -116,6 +117,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void LoadURL(nsIURI* aURI);
|
||||
// XXX/cjones: it's not clear what we gain by hiding these
|
||||
// message-sending functions under a layer of indirection and
|
||||
|
@ -78,6 +78,7 @@ NS_IMPL_ISUPPORTS_INHERITED1(PuppetWidget, nsBaseWidget,
|
||||
|
||||
PuppetWidget::PuppetWidget(PBrowserChild *aTabChild)
|
||||
: mTabChild(aTabChild)
|
||||
, mDPI(-1)
|
||||
{
|
||||
MOZ_COUNT_CTOR(PuppetWidget);
|
||||
}
|
||||
@ -550,5 +551,16 @@ PuppetWidget::PaintTask::Run()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
float
|
||||
PuppetWidget::GetDPI()
|
||||
{
|
||||
if (mDPI < 0) {
|
||||
NS_ABORT_IF_FALSE(mTabChild, "Need TabChild to get the DPI from!");
|
||||
mTabChild->SendGetDPI(&mDPI);
|
||||
}
|
||||
|
||||
return mDPI;
|
||||
}
|
||||
|
||||
} // namespace widget
|
||||
} // namespace mozilla
|
||||
|
@ -179,6 +179,12 @@ public:
|
||||
PRUint32 aNewEnd);
|
||||
NS_IMETHOD OnIMESelectionChange(void);
|
||||
|
||||
// Gets the DPI of the screen corresponding to this widget.
|
||||
// Contacts the parent process which gets the DPI from the
|
||||
// proper widget there. TODO: Handle DPI changes that happen
|
||||
// later on.
|
||||
virtual float GetDPI();
|
||||
|
||||
private:
|
||||
nsresult DispatchPaintEvent();
|
||||
nsresult DispatchResizeEvent();
|
||||
@ -223,6 +229,9 @@ private:
|
||||
// Note that if seqno overflows (~50 days at 1 ms increment rate),
|
||||
// events will be discarded until new focus/blur occurs
|
||||
PRUint32 mIMELastBlurSeqno;
|
||||
|
||||
// The DPI of the screen corresponding to this widget
|
||||
float mDPI;
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
|
Loading…
x
Reference in New Issue
Block a user