Bug 1075670 - Make tooltips respect HiDPI displays. r=smaug

Tooltip math was not HiDPI-ready. Bug is exposed by this patch.
This commit is contained in:
David Parks 2015-01-28 16:32:46 -08:00
parent a21ee9d991
commit 57904a9eb6

View File

@ -1453,9 +1453,15 @@ ChromeTooltipListener::sTooltipCallback(nsITimer *aTimer,
if (textFound) {
nsString tipText(tooltipText);
LayoutDeviceIntPoint screenDot = widget->WidgetToScreenOffset();
self->ShowTooltip(self->mMouseScreenX - screenDot.x,
self->mMouseScreenY - screenDot.y,
tipText);
double scaleFactor = 1.0;
if (shell->GetPresContext()) {
scaleFactor = double(nsPresContext::AppUnitsPerCSSPixel())/
shell->GetPresContext()->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom();
}
// ShowTooltip expects widget-relative position.
self->ShowTooltip(self->mMouseScreenX - screenDot.x / scaleFactor,
self->mMouseScreenY - screenDot.y / scaleFactor,
tipText);
}
}