feat: implement win.setAspectRatio() on Linux (#19516)

This commit is contained in:
Erick Zhao 2019-11-01 12:22:07 -04:00 committed by Shelley Vohr
parent 4240017cb6
commit dcf6f046d9
5 changed files with 45 additions and 2 deletions

View file

@ -709,6 +709,18 @@ bool NativeWindowViews::IsResizable() {
return CanResize();
}
void NativeWindowViews::SetAspectRatio(double aspect_ratio,
const gfx::Size& extra_size) {
NativeWindow::SetAspectRatio(aspect_ratio, extra_size);
#if defined(OS_LINUX)
gfx::SizeF aspect(aspect_ratio, 1.0);
// Scale up because SetAspectRatio() truncates aspect value to int
aspect.Scale(100);
widget()->SetAspectRatio(aspect);
#endif
}
void NativeWindowViews::SetMovable(bool movable) {
movable_ = movable;
}