Bug 1205511 - Use nsPresContext::DevToCSSPixelScale() where appropriate. r=kats

--HG--
extra : source : 16ed1b039eb1522f555c35e9df6e5632c69ff0a4
This commit is contained in:
Botond Ballo 2015-09-28 20:14:26 -04:00
Родитель 705ac24ef9
Коммит 72a3a301c4
4 изменённых файлов: 11 добавлений и 18 удалений

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

@ -7838,9 +7838,7 @@ nsDocument::GetViewportInfo(const ScreenIntSize& aDisplaySize)
// pixel an integer, and we want the adjusted value.
float fullZoom = context ? context->DeviceContext()->GetFullZoom() : 1.0;
fullZoom = (fullZoom == 0.0) ? 1.0 : fullZoom;
CSSToLayoutDeviceScale layoutDeviceScale(
(float)nsPresContext::AppUnitsPerCSSPixel() /
context->AppUnitsPerDevPixel());
CSSToLayoutDeviceScale layoutDeviceScale = context->CSSToDevPixelScale();
CSSToScreenScale defaultScale = layoutDeviceScale
* LayoutDeviceToScreenScale(1.0);

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

@ -118,8 +118,8 @@ MobileViewportManager::UpdateResolution(const nsViewportInfo& aViewportInfo,
const CSSSize& aViewport,
const Maybe<float>& aDisplayWidthChangeRatio)
{
CSSToLayoutDeviceScale cssToDev((float)nsPresContext::AppUnitsPerCSSPixel()
/ mPresShell->GetPresContext()->AppUnitsPerDevPixel());
CSSToLayoutDeviceScale cssToDev =
mPresShell->GetPresContext()->CSSToDevPixelScale();
LayoutDeviceToLayerScale res(nsLayoutUtils::GetResolution(mPresShell));
if (mIsFirstPaint) {

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

@ -207,9 +207,8 @@ ZoomConstraintsClient::RefreshZoomConstraints()
if (zoomConstraints.mAllowDoubleTapZoom) {
// If the CSS viewport is narrower than the screen (i.e. width <= device-width)
// then we disable double-tap-to-zoom behaviour.
int32_t auPerDevPixel = mPresShell->GetPresContext()->AppUnitsPerDevPixel();
CSSToLayoutDeviceScale scale(
(float)nsPresContext::AppUnitsPerCSSPixel() / auPerDevPixel);
CSSToLayoutDeviceScale scale =
mPresShell->GetPresContext()->CSSToDevPixelScale();
if ((viewportInfo.GetSize() * scale).width <= screenSize.width) {
zoomConstraints.mAllowDoubleTapZoom = false;
}

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

@ -2486,12 +2486,10 @@ nsLayoutUtils::TransformPoints(nsIFrame* aFromFrame, nsIFrame* aToFrame,
}
downToDest.Invert();
Matrix4x4 upToAncestor = GetTransformToAncestor(aFromFrame, nearestCommonAncestor);
CSSToLayoutDeviceScale devPixelsPerCSSPixelFromFrame(
double(nsPresContext::AppUnitsPerCSSPixel())/
aFromFrame->PresContext()->AppUnitsPerDevPixel());
CSSToLayoutDeviceScale devPixelsPerCSSPixelToFrame(
double(nsPresContext::AppUnitsPerCSSPixel())/
aToFrame->PresContext()->AppUnitsPerDevPixel());
CSSToLayoutDeviceScale devPixelsPerCSSPixelFromFrame =
aFromFrame->PresContext()->CSSToDevPixelScale();
CSSToLayoutDeviceScale devPixelsPerCSSPixelToFrame =
aToFrame->PresContext()->CSSToDevPixelScale();
for (uint32_t i = 0; i < aPointCount; ++i) {
LayoutDevicePoint devPixels = aPoints[i] * devPixelsPerCSSPixelFromFrame;
// What should the behaviour be if some of the points aren't invertible
@ -2970,8 +2968,7 @@ nsLayoutUtils::CalculateBasicFrameMetrics(nsIScrollableFrame* aScrollFrame) {
FrameMetrics metrics;
nsPresContext* presContext = frame->PresContext();
nsIPresShell* presShell = presContext->PresShell();
CSSToLayoutDeviceScale deviceScale(float(nsPresContext::AppUnitsPerCSSPixel())
/ presContext->AppUnitsPerDevPixel());
CSSToLayoutDeviceScale deviceScale = presContext->CSSToDevPixelScale();
float resolution = 1.0f;
if (frame == presShell->GetRootScrollFrame()) {
// Only the root scrollable frame for a given presShell should pick up
@ -8399,8 +8396,7 @@ nsLayoutUtils::ComputeFrameMetrics(nsIFrame* aForFrame,
* nsLayoutUtils::GetTransformToAncestorScale(aScrollFrame ? aScrollFrame : aForFrame));
metrics.SetExtraResolution(metrics.GetCumulativeResolution() / resolutionToScreen);
metrics.SetDevPixelsPerCSSPixel(CSSToLayoutDeviceScale(
(float)nsPresContext::AppUnitsPerCSSPixel() / auPerDevPixel));
metrics.SetDevPixelsPerCSSPixel(presContext->CSSToDevPixelScale());
// Initially, AsyncPanZoomController should render the content to the screen
// at the painted resolution.