Skip to content

Commit

Permalink
Fix mac name mismatch and make variable name more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
mlaurencin committed Sep 16, 2020
1 parent ae365b3 commit 5128cb0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
36 changes: 18 additions & 18 deletions shell/browser/native_browser_view_mac.mm
Expand Up @@ -162,10 +162,10 @@ - (BOOL)mouseDownCanMoveWindow {
NativeBrowserViewMac::NativeBrowserViewMac(
InspectableWebContents* inspectable_web_contents)
: NativeBrowserView(inspectable_web_contents) {
auto* contents = GetInspectableWebContentsView();
if (!contents)
auto* iwc_view = GetInspectableWebContentsView();
if (!iwc_view)
return;
auto* view = contents->GetNativeView().GetNativeNSView();
auto* view = iwc_view->GetNativeView().GetNativeNSView();
view.autoresizingMask = kDefaultAutoResizingMask;
}

Expand All @@ -188,18 +188,18 @@ - (BOOL)mouseDownCanMoveWindow {
NSViewMaxYMargin | NSViewMinYMargin | NSViewHeightSizable;
}

auto* contents = GetInspectableWebContentsView();
if (!contents)
auto* iwc_view = GetInspectableWebContentsView();
if (!iwc_view)
return;
auto* view = contents->GetNativeView().GetNativeNSView();
auto* view = iwc_view->GetNativeView().GetNativeNSView();
view.autoresizingMask = autoresizing_mask;
}

void NativeBrowserViewMac::SetBounds(const gfx::Rect& bounds) {
auto* contents = GetInspectableWebContentsView();
if (!contents)
auto* iwc_view = GetInspectableWebContentsView();
if (!iwc_view)
return;
auto* view = contents->GetNativeView().GetNativeNSView();
auto* view = iwc_view->GetNativeView().GetNativeNSView();
auto* superview = view.superview;
const auto superview_height = superview ? superview.frame.size.height : 0;
view.frame =
Expand All @@ -208,10 +208,10 @@ - (BOOL)mouseDownCanMoveWindow {
}

gfx::Rect NativeBrowserViewMac::GetBounds() {
auto* contents = GetInspectableWebContentsView();
if (!contents)
auto* iwc_view = GetInspectableWebContentsView();
if (!iwc_view)
return gfx::Rect();
NSView* view = contents->GetNativeView().GetNativeNSView();
NSView* view = iwc_view->GetNativeView().GetNativeNSView();
const int superview_height =
(view.superview) ? view.superview.frame.size.height : 0;
return gfx::Rect(
Expand All @@ -221,22 +221,22 @@ - (BOOL)mouseDownCanMoveWindow {
}

void NativeBrowserViewMac::SetBackgroundColor(SkColor color) {
auto* contents = GetInspectableWebContentsView();
if (!contents)
auto* iwc_view = GetInspectableWebContentsView();
if (!iwc_view)
return;
auto* view = contents->GetNativeView().GetNativeNSView();
auto* view = iwc_view->GetNativeView().GetNativeNSView();
view.wantsLayer = YES;
view.layer.backgroundColor = skia::CGColorCreateFromSkColor(color);
}

void NativeBrowserViewMac::UpdateDraggableRegions(
const std::vector<gfx::Rect>& drag_exclude_rects) {
auto* inspectable_contents = GetInspectableWebContentsView();
auto* iwc_view = GetInspectableWebContentsView();
auto* web_contents = GetWebContents();
if (!(inspectable_contents && web_contents))
if (!(iwc_view && web_contents))
return;
NSView* web_view = GetWebContents()->GetNativeView().GetNativeNSView();
NSView* inspectable_view = contents->GetNativeView().GetNativeNSView();
NSView* inspectable_view = iwc_view->GetNativeView().GetNativeNSView();
NSView* window_content_view = inspectable_view.superview;
const auto window_content_view_height = NSHeight(window_content_view.bounds);

Expand Down
36 changes: 18 additions & 18 deletions shell/browser/native_browser_view_views.cc
Expand Up @@ -26,10 +26,10 @@ void NativeBrowserViewViews::SetAutoResizeProportions(
const gfx::Size& window_size) {
if ((auto_resize_flags_ & AutoResizeFlags::kAutoResizeHorizontal) &&
!auto_horizontal_proportion_set_) {
auto* contents = GetInspectableWebContentsView();
if (contents)
auto* iwc_view = GetInspectableWebContentsView();
if (iwc_view)
return;
auto* view = contents->GetView();
auto* view = iwc_view->GetView();
auto view_bounds = view->bounds();
auto_horizontal_proportion_width_ =
static_cast<float>(window_size.width()) /
Expand All @@ -40,10 +40,10 @@ void NativeBrowserViewViews::SetAutoResizeProportions(
}
if ((auto_resize_flags_ & AutoResizeFlags::kAutoResizeVertical) &&
!auto_vertical_proportion_set_) {
auto* contents = GetInspectableWebContentsView();
if (contents)
auto* iwc_view = GetInspectableWebContentsView();
if (iwc_view)
return;
auto* view = contents->GetView();
auto* view = iwc_view->GetView();
auto view_bounds = view->bounds();
auto_vertical_proportion_height_ =
static_cast<float>(window_size.height()) /
Expand All @@ -57,10 +57,10 @@ void NativeBrowserViewViews::SetAutoResizeProportions(
void NativeBrowserViewViews::AutoResize(const gfx::Rect& new_window,
int width_delta,
int height_delta) {
auto* contents = GetInspectableWebContentsView();
if (contents)
auto* iwc_view = GetInspectableWebContentsView();
if (iwc_view)
return;
auto* view = contents->GetView();
auto* view = iwc_view->GetView();
const auto flags = GetAutoResizeFlags();
if (!(flags & kAutoResizeWidth)) {
width_delta = 0;
Expand Down Expand Up @@ -101,26 +101,26 @@ void NativeBrowserViewViews::ResetAutoResizeProportions() {
}

void NativeBrowserViewViews::SetBounds(const gfx::Rect& bounds) {
auto* contents = GetInspectableWebContentsView();
if (!contents)
auto* iwc_view = GetInspectableWebContentsView();
if (!iwc_view)
return;
auto* view = contents->GetView();
auto* view = iwc_view->GetView();
view->SetBoundsRect(bounds);
ResetAutoResizeProportions();
}

gfx::Rect NativeBrowserViewViews::GetBounds() {
auto* contents = GetInspectableWebContentsView();
if (!contents)
auto* iwc_view = GetInspectableWebContentsView();
if (!iwc_view)
return gfx::Rect();
return contents->GetView()->bounds();
return iwc_view->GetView()->bounds();
}

void NativeBrowserViewViews::SetBackgroundColor(SkColor color) {
auto* contents = GetInspectableWebContentsView();
if (!contents)
auto* iwc_view = GetInspectableWebContentsView();
if (!iwc_view)
return;
auto* view = contents->GetView();
auto* view = iwc_view->GetView();
view->SetBackground(views::CreateSolidBackground(color));
view->SchedulePaint();
}
Expand Down

0 comments on commit 5128cb0

Please sign in to comment.