refactor: add NativeWindow::SetShape() (#47131)

use NativeWindow::SetShape() in api::BaseWindow
This commit is contained in:
Charles Kerr
2025-05-19 08:29:29 +00:00
committed by GitHub
parent e2f496cfbc
commit 208bbc0504
3 changed files with 7 additions and 2 deletions

View File

@@ -684,7 +684,7 @@ double BaseWindow::GetOpacity() const {
}
void BaseWindow::SetShape(const std::vector<gfx::Rect>& rects) {
window_->widget()->SetShape(std::make_unique<std::vector<gfx::Rect>>(rects));
window_->SetShape(rects);
}
void BaseWindow::SetRepresentedFilename(const std::string& filename) {

View File

@@ -289,6 +289,10 @@ NativeWindow* NativeWindow::FromWidget(const views::Widget* widget) {
widget->GetNativeWindowProperty(kNativeWindowKey.c_str()));
}
void NativeWindow::SetShape(const std::vector<gfx::Rect>& rects) {
widget()->SetShape(std::make_unique<std::vector<gfx::Rect>>(rects));
}
void NativeWindow::SetSize(const gfx::Size& size, bool animate) {
SetBounds(gfx::Rect(GetPosition(), size), animate);
}

View File

@@ -101,9 +101,10 @@ class NativeWindow : public base::SupportsUserData,
virtual bool IsMinimized() const = 0;
virtual void SetFullScreen(bool fullscreen) = 0;
virtual bool IsFullscreen() const = 0;
virtual void SetBounds(const gfx::Rect& bounds, bool animate = false) = 0;
virtual gfx::Rect GetBounds() const = 0;
void SetShape(const std::vector<gfx::Rect>& rects);
void SetSize(const gfx::Size& size, bool animate = false);
[[nodiscard]] gfx::Size GetSize() const;