Bug 1189837 - Subtract scrollbars in LD pixels rather than CSS pixels. r=mstange

This commit is contained in:
Kartikaya Gupta 2015-08-05 14:39:42 -04:00
parent 036c083e8d
commit 63a4a4b834
2 changed files with 13 additions and 4 deletions

View File

@ -263,6 +263,13 @@ struct LayoutDevicePixel {
NSAppUnitsToFloatPixels(aPoint.y, aAppUnitsPerDevPixel)); NSAppUnitsToFloatPixels(aPoint.y, aAppUnitsPerDevPixel));
} }
static LayoutDeviceMargin FromAppUnits(const nsMargin& aMargin, nscoord aAppUnitsPerDevPixel) {
return LayoutDeviceMargin(NSAppUnitsToFloatPixels(aMargin.top, aAppUnitsPerDevPixel),
NSAppUnitsToFloatPixels(aMargin.right, aAppUnitsPerDevPixel),
NSAppUnitsToFloatPixels(aMargin.bottom, aAppUnitsPerDevPixel),
NSAppUnitsToFloatPixels(aMargin.left, aAppUnitsPerDevPixel));
}
static LayoutDeviceIntPoint FromAppUnitsRounded(const nsPoint& aPoint, nscoord aAppUnitsPerDevPixel) { static LayoutDeviceIntPoint FromAppUnitsRounded(const nsPoint& aPoint, nscoord aAppUnitsPerDevPixel) {
return LayoutDeviceIntPoint(NSAppUnitsToIntPixels(aPoint.x, aAppUnitsPerDevPixel), return LayoutDeviceIntPoint(NSAppUnitsToIntPixels(aPoint.x, aAppUnitsPerDevPixel),
NSAppUnitsToIntPixels(aPoint.y, aAppUnitsPerDevPixel)); NSAppUnitsToIntPixels(aPoint.y, aAppUnitsPerDevPixel));

View File

@ -7901,8 +7901,9 @@ nsLayoutUtils::CalculateRootCompositionSize(nsIFrame* aFrame,
// Adjust composition size for the size of scroll bars. // Adjust composition size for the size of scroll bars.
nsIFrame* rootRootScrollFrame = rootPresShell ? rootPresShell->GetRootScrollFrame() : nullptr; nsIFrame* rootRootScrollFrame = rootPresShell ? rootPresShell->GetRootScrollFrame() : nullptr;
nsMargin scrollbarMargins = ScrollbarAreaToExcludeFromCompositionBoundsFor(rootRootScrollFrame); nsMargin scrollbarMargins = ScrollbarAreaToExcludeFromCompositionBoundsFor(rootRootScrollFrame);
CSSMargin margins = CSSMargin::FromAppUnits(scrollbarMargins); LayoutDeviceMargin margins = LayoutDeviceMargin::FromAppUnits(scrollbarMargins,
// Scrollbars are not subject to scaling, so CSS pixels = layer pixels for them. rootPresContext->AppUnitsPerDevPixel());
// Scrollbars are not subject to resolution scaling, so LD pixels = layer pixels for them.
rootCompositionSize.width -= margins.LeftRight(); rootCompositionSize.width -= margins.LeftRight();
rootCompositionSize.height -= margins.TopBottom(); rootCompositionSize.height -= margins.TopBottom();
@ -8433,8 +8434,9 @@ nsLayoutUtils::ComputeFrameMetrics(nsIFrame* aForFrame,
} }
nsMargin sizes = ScrollbarAreaToExcludeFromCompositionBoundsFor(aScrollFrame); nsMargin sizes = ScrollbarAreaToExcludeFromCompositionBoundsFor(aScrollFrame);
// Scrollbars are not subject to scaling, so CSS pixels = layer pixels for them. // Scrollbars are not subject to resolution scaling, so LD pixels = layer pixels for them.
ParentLayerMargin boundMargins = CSSMargin::FromAppUnits(sizes) * CSSToParentLayerScale(1.0f); ParentLayerMargin boundMargins = LayoutDeviceMargin::FromAppUnits(sizes, auPerDevPixel)
* LayoutDeviceToParentLayerScale(1.0f);
frameBounds.Deflate(boundMargins); frameBounds.Deflate(boundMargins);
metrics.SetCompositionBounds(frameBounds); metrics.SetCompositionBounds(frameBounds);