From 039908a244a2b1862cff1322aeee25d56e8a03eb Mon Sep 17 00:00:00 2001 From: gellert Date: Tue, 23 May 2017 11:41:59 +0200 Subject: [PATCH] various fixes for macos --- atom/browser/native_window_mac.h | 10 +++++----- atom/browser/native_window_mac.mm | 10 +++++----- atom/browser/osr/osr_render_widget_host_view.cc | 4 ++-- atom/browser/ui/autofill_popup.cc | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/atom/browser/native_window_mac.h b/atom/browser/native_window_mac.h index 69bf3afef65a..b5271e4d4364 100644 --- a/atom/browser/native_window_mac.h +++ b/atom/browser/native_window_mac.h @@ -89,9 +89,9 @@ class NativeWindowMac : public NativeWindow, void SetContentProtection(bool enable) override; void SetBrowserView(NativeBrowserView* browser_view) override; void SetParentWindow(NativeWindow* parent) override; - gfx::NativeView GetNativeView() override; - gfx::NativeWindow GetNativeWindow() override; - gfx::AcceleratedWidget GetAcceleratedWidget() override; + gfx::NativeView GetNativeView() const override; + gfx::NativeWindow GetNativeWindow() const override; + gfx::AcceleratedWidget GetAcceleratedWidget() const override; void SetProgressBar(double progress, const ProgressState state) override; void SetOverlayIcon(const gfx::Image& overlay, const std::string& description) override; @@ -140,8 +140,8 @@ class NativeWindowMac : public NativeWindow, private: // NativeWindow: - gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds); - gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds); + gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) const; + gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) const; void UpdateDraggableRegions( const std::vector& regions) override; diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index 755e46c4f326..e5192c8b6293 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -1314,15 +1314,15 @@ void NativeWindowMac::SetParentWindow(NativeWindow* parent) { [parent->GetNativeWindow() addChildWindow:window_ ordered:NSWindowAbove]; } -gfx::NativeView NativeWindowMac::GetNativeView() { +gfx::NativeView NativeWindowMac::GetNativeView() const { return inspectable_web_contents()->GetView()->GetNativeView(); } -gfx::NativeWindow NativeWindowMac::GetNativeWindow() { +gfx::NativeWindow NativeWindowMac::GetNativeWindow() const { return window_; } -gfx::AcceleratedWidget NativeWindowMac::GetAcceleratedWidget() { +gfx::AcceleratedWidget NativeWindowMac::GetAcceleratedWidget() const { return inspectable_web_contents()->GetView()->GetNativeView(); } @@ -1498,7 +1498,7 @@ std::vector NativeWindowMac::CalculateNonDraggableRegions( } gfx::Rect NativeWindowMac::ContentBoundsToWindowBounds( - const gfx::Rect& bounds) { + const gfx::Rect& bounds) const { if (has_frame()) { gfx::Rect window_bounds( [window_ frameRectForContentRect:bounds.ToCGRect()]); @@ -1511,7 +1511,7 @@ gfx::Rect NativeWindowMac::ContentBoundsToWindowBounds( } gfx::Rect NativeWindowMac::WindowBoundsToContentBounds( - const gfx::Rect& bounds) { + const gfx::Rect& bounds) const { if (has_frame()) { gfx::Rect content_bounds( [window_ contentRectForFrameRect:bounds.ToCGRect()]); diff --git a/atom/browser/osr/osr_render_widget_host_view.cc b/atom/browser/osr/osr_render_widget_host_view.cc index 005a4755e5b4..11523a660b8f 100644 --- a/atom/browser/osr/osr_render_widget_host_view.cc +++ b/atom/browser/osr/osr_render_widget_host_view.cc @@ -1041,14 +1041,14 @@ void OffScreenRenderWidgetHostView::OnPaint( pos.x(), pos.y(), pos.width(), pos.height())); } - for (int i = 0; i < damages.size(); i++) { + for (size_t i = 0; i < damages.size(); i++) { CopyBitmapTo(bitmap, *(bitmaps[i]), damages[i]); } damage.Intersect(GetViewBounds()); callback_.Run(damage, bitmap); - for (int i = 0; i < damages.size(); i++) { + for (size_t i = 0; i < damages.size(); i++) { CopyBitmapTo(bitmap, originals[i], damages[i]); } } diff --git a/atom/browser/ui/autofill_popup.cc b/atom/browser/ui/autofill_popup.cc index b1adaf6b1d6b..db787003bdee 100644 --- a/atom/browser/ui/autofill_popup.cc +++ b/atom/browser/ui/autofill_popup.cc @@ -205,7 +205,7 @@ int AutofillPopup::GetDesiredPopupHeight() { int AutofillPopup::GetDesiredPopupWidth() { int popup_width = element_bounds_.width(); - for (int i = 0; i < values_.size(); ++i) { + for (size_t i = 0; i < values_.size(); ++i) { int row_size = kEndPadding + 2 * kPopupBorderThickness + gfx::GetStringWidth(GetValueAt(i), GetValueFontListForRow(i)) + gfx::GetStringWidth(GetLabelAt(i), GetLabelFontListForRow(i)); @@ -256,7 +256,7 @@ base::string16 AutofillPopup::GetLabelAt(int i) { int AutofillPopup::LineFromY(int y) const { int current_height = kPopupBorderThickness; - for (int i = 0; i < values_.size(); ++i) { + for (size_t i = 0; i < values_.size(); ++i) { current_height += kRowHeight; if (y <= current_height)