Bug 1039818 - Extract the implementation of nsIDOMWindowUtils::GetResolution into nsLayoutUtils. r=ehsan

This commit is contained in:
Botond Ballo 2015-04-10 19:33:56 -04:00
parent 61617910aa
commit 74e65ccce9
3 changed files with 17 additions and 6 deletions

View File

@ -541,12 +541,7 @@ nsDOMWindowUtils::GetResolution(float* aResolution)
return NS_ERROR_FAILURE;
}
nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollable();
if (sf) {
*aResolution = sf->GetResolution();
} else {
*aResolution = presShell->GetResolution();
}
*aResolution = nsLayoutUtils::GetResolution(presShell);
return NS_OK;
}

View File

@ -7989,6 +7989,16 @@ nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(nsIPresShell* aShell)
return false;
}
/* static */ float
nsLayoutUtils::GetResolution(nsIPresShell* aPresShell)
{
nsIScrollableFrame* sf = aPresShell->GetRootScrollFrameAsScrollable();
if (sf) {
return sf->GetResolution();
}
return aPresShell->GetResolution();
}
/* static */ uint32_t
nsLayoutUtils::GetTouchActionFromFrame(nsIFrame* aFrame)
{

View File

@ -2577,6 +2577,12 @@ public:
static bool HasApzAwareListeners(mozilla::EventListenerManager* aElm);
static bool HasDocumentLevelListenersForApzAwareEvents(nsIPresShell* aShell);
/**
* Get the resolution at which rescalable web content is drawn
* (see nsIDOMWindowUtils.getResolution).
*/
static float GetResolution(nsIPresShell* aPresShell);
private:
static uint32_t sFontSizeInflationEmPerLine;
static uint32_t sFontSizeInflationMinTwips;