gfx::NativeView is no longer NSView on mac

https://chromium-review.googlesource.com/c/1270343
This commit is contained in:
Jeremy Apthorp 2019-01-09 12:25:19 -08:00
parent 70887ae21a
commit d228bdfb9e
12 changed files with 78 additions and 53 deletions

View file

@ -160,7 +160,8 @@ namespace atom {
NativeBrowserViewMac::NativeBrowserViewMac(
InspectableWebContents* inspectable_web_contents)
: NativeBrowserView(inspectable_web_contents) {
auto* view = GetInspectableWebContentsView()->GetNativeView();
auto* view =
GetInspectableWebContentsView()->GetNativeView().GetNativeNSView();
view.autoresizingMask = kDefaultAutoResizingMask;
}
@ -175,12 +176,14 @@ void NativeBrowserViewMac::SetAutoResizeFlags(uint8_t flags) {
autoresizing_mask |= NSViewHeightSizable;
}
auto* view = GetInspectableWebContentsView()->GetNativeView();
auto* view =
GetInspectableWebContentsView()->GetNativeView().GetNativeNSView();
view.autoresizingMask = autoresizing_mask;
}
void NativeBrowserViewMac::SetBounds(const gfx::Rect& bounds) {
auto* view = GetInspectableWebContentsView()->GetNativeView();
auto* view =
GetInspectableWebContentsView()->GetNativeView().GetNativeNSView();
auto* superview = view.superview;
const auto superview_height = superview ? superview.frame.size.height : 0;
view.frame =
@ -189,15 +192,17 @@ void NativeBrowserViewMac::SetBounds(const gfx::Rect& bounds) {
}
void NativeBrowserViewMac::SetBackgroundColor(SkColor color) {
auto* view = GetInspectableWebContentsView()->GetNativeView();
auto* view =
GetInspectableWebContentsView()->GetNativeView().GetNativeNSView();
view.wantsLayer = YES;
view.layer.backgroundColor = skia::CGColorCreateFromSkColor(color);
}
void NativeBrowserViewMac::UpdateDraggableRegions(
const std::vector<gfx::Rect>& drag_exclude_rects) {
NSView* web_view = GetWebContents()->GetNativeView();
NSView* inspectable_view = GetInspectableWebContentsView()->GetNativeView();
NSView* web_view = GetWebContents()->GetNativeView().GetNativeNSView();
NSView* inspectable_view =
GetInspectableWebContentsView()->GetNativeView().GetNativeNSView();
NSView* window_content_view = inspectable_view.superview;
const auto window_content_view_height = NSHeight(window_content_view.bounds);