Bug 1830667 - Update APZCTreeManager::mDPI when display DPI changes. r=dlrobertson,win-reviewers,handyman,emilio

Differential Revision: https://phabricator.services.mozilla.com/D202280
This commit is contained in:
Álvaro Costa 2024-02-24 19:25:30 +00:00
parent 5ef8c80ed3
commit cab89107ca
5 changed files with 13 additions and 0 deletions

View file

@ -2220,6 +2220,7 @@ void nsCocoaWindow::BackingScaleFactorChanged() {
}
mBackingScaleFactor = newScale;
NotifyAPZOfDPIChange();
if (!mWidgetListener || mWidgetListener->GetAppWindow()) {
return;

View file

@ -5375,6 +5375,7 @@ void nsWindow::OnDPIChanged() {
}
mWidgetListener->UIResolutionChanged();
}
NotifyAPZOfDPIChange();
}
void nsWindow::OnCheckResize() { mPendingConfigures++; }
@ -5408,6 +5409,8 @@ void nsWindow::OnScaleChanged(bool aNotify) {
return;
}
NotifyAPZOfDPIChange();
LOG("OnScaleChanged %d, %f -> %d, %f\n", int(mCeiledScaleFactor),
mFractionalScaleFactor, newCeiled, newFractional);

View file

@ -547,6 +547,12 @@ nsIWidget* nsBaseWidget::GetSheetWindowParent(void) { return nullptr; }
float nsBaseWidget::GetDPI() { return 96.0f; }
void nsBaseWidget::NotifyAPZOfDPIChange() {
if (mAPZC) {
mAPZC->SetDPI(GetDPI());
}
}
CSSToLayoutDeviceScale nsIWidget::GetDefaultScale() {
double devPixelsPerCSSPixel = StaticPrefs::layout_css_devPixelsPerPx();

View file

@ -354,6 +354,8 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
// theme changes.
void NotifyThemeChanged(mozilla::widget::ThemeChangeKind);
void NotifyAPZOfDPIChange();
#ifdef ACCESSIBILITY
// Get the accessible for the window.
mozilla::a11y::LocalAccessible* GetRootAccessible();

View file

@ -8536,6 +8536,7 @@ void nsWindow::ChangedDPI() {
presShell->BackingScaleFactorChanged();
}
}
NotifyAPZOfDPIChange();
}
static Result<POINTER_FLAGS, nsresult> PointerStateToFlag(