зеркало из https://github.com/electron/electron.git
fix failed BrowserWindow tests
This commit is contained in:
Родитель
75a624434c
Коммит
39242c978f
|
@ -150,6 +150,7 @@ class NativeWindowMac : public NativeWindow,
|
||||||
void DeleteDelegate() override;
|
void DeleteDelegate() override;
|
||||||
views::Widget* GetWidget() override;
|
views::Widget* GetWidget() override;
|
||||||
const views::Widget* GetWidget() const override;
|
const views::Widget* GetWidget() const override;
|
||||||
|
bool CanResize() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InternalSetParentWindow(NativeWindow* parent, bool attach);
|
void InternalSetParentWindow(NativeWindow* parent, bool attach);
|
||||||
|
@ -174,12 +175,10 @@ class NativeWindowMac : public NativeWindow,
|
||||||
NSView* content_view_;
|
NSView* content_view_;
|
||||||
|
|
||||||
bool is_kiosk_;
|
bool is_kiosk_;
|
||||||
|
|
||||||
bool was_fullscreen_;
|
bool was_fullscreen_;
|
||||||
|
|
||||||
bool zoom_to_page_width_;
|
bool zoom_to_page_width_;
|
||||||
|
|
||||||
bool fullscreen_window_title_;
|
bool fullscreen_window_title_;
|
||||||
|
bool resizable_;
|
||||||
|
|
||||||
NSInteger attention_request_id_; // identifier from requestUserAttention
|
NSInteger attention_request_id_; // identifier from requestUserAttention
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "skia/ext/skia_utils_mac.h"
|
#include "skia/ext/skia_utils_mac.h"
|
||||||
#include "ui/gfx/skia_util.h"
|
#include "ui/gfx/skia_util.h"
|
||||||
#include "ui/gl/gpu_switching_manager.h"
|
#include "ui/gl/gpu_switching_manager.h"
|
||||||
|
#include "ui/views/background.h"
|
||||||
#include "ui/views/widget/widget.h"
|
#include "ui/views/widget/widget.h"
|
||||||
|
|
||||||
// Custom Quit, Minimize and Full Screen button container for frameless
|
// Custom Quit, Minimize and Full Screen button container for frameless
|
||||||
|
@ -239,6 +240,7 @@ NativeWindowMac::NativeWindowMac(const mate::Dictionary& options,
|
||||||
was_fullscreen_(false),
|
was_fullscreen_(false),
|
||||||
zoom_to_page_width_(false),
|
zoom_to_page_width_(false),
|
||||||
fullscreen_window_title_(false),
|
fullscreen_window_title_(false),
|
||||||
|
resizable_(true),
|
||||||
attention_request_id_(0),
|
attention_request_id_(0),
|
||||||
title_bar_style_(NORMAL),
|
title_bar_style_(NORMAL),
|
||||||
always_simple_fullscreen_(false),
|
always_simple_fullscreen_(false),
|
||||||
|
@ -253,8 +255,11 @@ NativeWindowMac::NativeWindowMac(const mate::Dictionary& options,
|
||||||
width,
|
width,
|
||||||
height);
|
height);
|
||||||
|
|
||||||
bool resizable = true;
|
options.Get(options::kResizable, &resizable_);
|
||||||
options.Get(options::kResizable, &resizable);
|
options.Get(options::kTitleBarStyle, &title_bar_style_);
|
||||||
|
options.Get(options::kZoomToPageWidth, &zoom_to_page_width_);
|
||||||
|
options.Get(options::kFullscreenWindowTitle, &fullscreen_window_title_);
|
||||||
|
options.Get(options::kSimpleFullScreen, &always_simple_fullscreen_);
|
||||||
|
|
||||||
bool minimizable = true;
|
bool minimizable = true;
|
||||||
options.Get(options::kMinimizable, &minimizable);
|
options.Get(options::kMinimizable, &minimizable);
|
||||||
|
@ -265,8 +270,6 @@ NativeWindowMac::NativeWindowMac(const mate::Dictionary& options,
|
||||||
bool closable = true;
|
bool closable = true;
|
||||||
options.Get(options::kClosable, &closable);
|
options.Get(options::kClosable, &closable);
|
||||||
|
|
||||||
options.Get(options::kTitleBarStyle, &title_bar_style_);
|
|
||||||
|
|
||||||
std::string tabbingIdentifier;
|
std::string tabbingIdentifier;
|
||||||
options.Get(options::kTabbingIdentifier, &tabbingIdentifier);
|
options.Get(options::kTabbingIdentifier, &tabbingIdentifier);
|
||||||
|
|
||||||
|
@ -301,9 +304,6 @@ NativeWindowMac::NativeWindowMac(const mate::Dictionary& options,
|
||||||
if (!useStandardWindow || transparent() || !has_frame()) {
|
if (!useStandardWindow || transparent() || !has_frame()) {
|
||||||
styleMask |= NSTexturedBackgroundWindowMask;
|
styleMask |= NSTexturedBackgroundWindowMask;
|
||||||
}
|
}
|
||||||
if (resizable) {
|
|
||||||
styleMask |= NSResizableWindowMask;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create views::Widget and assign window_ with it.
|
// Create views::Widget and assign window_ with it.
|
||||||
// TODO(zcbenz): Get rid of the window_ in future.
|
// TODO(zcbenz): Get rid of the window_ in future.
|
||||||
|
@ -387,17 +387,11 @@ NativeWindowMac::NativeWindowMac(const mate::Dictionary& options,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// On macOS the initial window size doesn't include window frame.
|
// Resize to content bounds.
|
||||||
bool use_content_size = false;
|
bool use_content_size = false;
|
||||||
options.Get(options::kUseContentSize, &use_content_size);
|
options.Get(options::kUseContentSize, &use_content_size);
|
||||||
if (!has_frame() || !use_content_size)
|
if (!has_frame() || use_content_size)
|
||||||
NativeWindow::SetSize(gfx::Size(width, height));
|
SetContentSize(gfx::Size(width, height));
|
||||||
|
|
||||||
options.Get(options::kZoomToPageWidth, &zoom_to_page_width_);
|
|
||||||
|
|
||||||
options.Get(options::kFullscreenWindowTitle, &fullscreen_window_title_);
|
|
||||||
|
|
||||||
options.Get(options::kSimpleFullScreen, &always_simple_fullscreen_);
|
|
||||||
|
|
||||||
// Enable the NSView to accept first mouse event.
|
// Enable the NSView to accept first mouse event.
|
||||||
bool acceptsFirstMouse = false;
|
bool acceptsFirstMouse = false;
|
||||||
|
@ -719,6 +713,7 @@ void NativeWindowMac::SetContentSizeConstraints(
|
||||||
void NativeWindowMac::MoveTop() {
|
void NativeWindowMac::MoveTop() {
|
||||||
[window_ orderWindow:NSWindowAbove relativeTo:0];
|
[window_ orderWindow:NSWindowAbove relativeTo:0];
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::SetResizable(bool resizable) {
|
void NativeWindowMac::SetResizable(bool resizable) {
|
||||||
SetStyleMask(resizable, NSResizableWindowMask);
|
SetStyleMask(resizable, NSResizableWindowMask);
|
||||||
}
|
}
|
||||||
|
@ -979,9 +974,7 @@ bool NativeWindowMac::IsKiosk() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::SetBackgroundColor(SkColor color) {
|
void NativeWindowMac::SetBackgroundColor(SkColor color) {
|
||||||
base::ScopedCFTypeRef<CGColorRef> cgcolor(
|
widget_->GetRootView()->SetBackground(views::CreateSolidBackground(color));
|
||||||
skia::CGColorCreateFromSkColor(color));
|
|
||||||
[[[window_ contentView] layer] setBackgroundColor:cgcolor];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::SetHasShadow(bool has_shadow) {
|
void NativeWindowMac::SetHasShadow(bool has_shadow) {
|
||||||
|
@ -1307,6 +1300,10 @@ const views::Widget* NativeWindowMac::GetWidget() const {
|
||||||
return widget_.get();
|
return widget_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NativeWindowMac::CanResize() const {
|
||||||
|
return resizable_;
|
||||||
|
}
|
||||||
|
|
||||||
void NativeWindowMac::InternalSetParentWindow(NativeWindow* parent,
|
void NativeWindowMac::InternalSetParentWindow(NativeWindow* parent,
|
||||||
bool attach) {
|
bool attach) {
|
||||||
if (is_modal())
|
if (is_modal())
|
||||||
|
|
|
@ -116,10 +116,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidResize:(NSNotification*)notification {
|
- (void)windowDidResize:(NSNotification*)notification {
|
||||||
|
[super windowDidResize:notification];
|
||||||
shell_->NotifyWindowResize();
|
shell_->NotifyWindowResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidMove:(NSNotification*)notification {
|
- (void)windowDidMove:(NSNotification*)notification {
|
||||||
|
[super windowDidMove:notification];
|
||||||
// TODO(zcbenz): Remove the alias after figuring out a proper
|
// TODO(zcbenz): Remove the alias after figuring out a proper
|
||||||
// way to dispatch move.
|
// way to dispatch move.
|
||||||
shell_->NotifyWindowMove();
|
shell_->NotifyWindowMove();
|
||||||
|
@ -135,10 +137,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidMiniaturize:(NSNotification*)notification {
|
- (void)windowDidMiniaturize:(NSNotification*)notification {
|
||||||
|
[super windowDidMiniaturize:notification];
|
||||||
shell_->NotifyWindowMinimize();
|
shell_->NotifyWindowMinimize();
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)windowDidDeminiaturize:(NSNotification*)notification {
|
- (void)windowDidDeminiaturize:(NSNotification*)notification {
|
||||||
|
[super windowDidDeminiaturize:notification];
|
||||||
[shell_->GetNativeWindow() setLevel:level_];
|
[shell_->GetNativeWindow() setLevel:level_];
|
||||||
shell_->NotifyWindowRestore();
|
shell_->NotifyWindowRestore();
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче