various fixes for macos

This commit is contained in:
gellert 2017-05-23 11:41:59 +02:00
parent df911593d8
commit 039908a244
4 changed files with 14 additions and 14 deletions

View file

@ -89,9 +89,9 @@ class NativeWindowMac : public NativeWindow,
void SetContentProtection(bool enable) override; void SetContentProtection(bool enable) override;
void SetBrowserView(NativeBrowserView* browser_view) override; void SetBrowserView(NativeBrowserView* browser_view) override;
void SetParentWindow(NativeWindow* parent) override; void SetParentWindow(NativeWindow* parent) override;
gfx::NativeView GetNativeView() override; gfx::NativeView GetNativeView() const override;
gfx::NativeWindow GetNativeWindow() override; gfx::NativeWindow GetNativeWindow() const override;
gfx::AcceleratedWidget GetAcceleratedWidget() override; gfx::AcceleratedWidget GetAcceleratedWidget() const override;
void SetProgressBar(double progress, const ProgressState state) override; void SetProgressBar(double progress, const ProgressState state) override;
void SetOverlayIcon(const gfx::Image& overlay, void SetOverlayIcon(const gfx::Image& overlay,
const std::string& description) override; const std::string& description) override;
@ -140,8 +140,8 @@ class NativeWindowMac : public NativeWindow,
private: private:
// NativeWindow: // NativeWindow:
gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds); gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) const;
gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds); gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) const;
void UpdateDraggableRegions( void UpdateDraggableRegions(
const std::vector<DraggableRegion>& regions) override; const std::vector<DraggableRegion>& regions) override;

View file

@ -1314,15 +1314,15 @@ void NativeWindowMac::SetParentWindow(NativeWindow* parent) {
[parent->GetNativeWindow() addChildWindow:window_ ordered:NSWindowAbove]; [parent->GetNativeWindow() addChildWindow:window_ ordered:NSWindowAbove];
} }
gfx::NativeView NativeWindowMac::GetNativeView() { gfx::NativeView NativeWindowMac::GetNativeView() const {
return inspectable_web_contents()->GetView()->GetNativeView(); return inspectable_web_contents()->GetView()->GetNativeView();
} }
gfx::NativeWindow NativeWindowMac::GetNativeWindow() { gfx::NativeWindow NativeWindowMac::GetNativeWindow() const {
return window_; return window_;
} }
gfx::AcceleratedWidget NativeWindowMac::GetAcceleratedWidget() { gfx::AcceleratedWidget NativeWindowMac::GetAcceleratedWidget() const {
return inspectable_web_contents()->GetView()->GetNativeView(); return inspectable_web_contents()->GetView()->GetNativeView();
} }
@ -1498,7 +1498,7 @@ std::vector<gfx::Rect> NativeWindowMac::CalculateNonDraggableRegions(
} }
gfx::Rect NativeWindowMac::ContentBoundsToWindowBounds( gfx::Rect NativeWindowMac::ContentBoundsToWindowBounds(
const gfx::Rect& bounds) { const gfx::Rect& bounds) const {
if (has_frame()) { if (has_frame()) {
gfx::Rect window_bounds( gfx::Rect window_bounds(
[window_ frameRectForContentRect:bounds.ToCGRect()]); [window_ frameRectForContentRect:bounds.ToCGRect()]);
@ -1511,7 +1511,7 @@ gfx::Rect NativeWindowMac::ContentBoundsToWindowBounds(
} }
gfx::Rect NativeWindowMac::WindowBoundsToContentBounds( gfx::Rect NativeWindowMac::WindowBoundsToContentBounds(
const gfx::Rect& bounds) { const gfx::Rect& bounds) const {
if (has_frame()) { if (has_frame()) {
gfx::Rect content_bounds( gfx::Rect content_bounds(
[window_ contentRectForFrameRect:bounds.ToCGRect()]); [window_ contentRectForFrameRect:bounds.ToCGRect()]);

View file

@ -1041,14 +1041,14 @@ void OffScreenRenderWidgetHostView::OnPaint(
pos.x(), pos.y(), pos.width(), pos.height())); 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]); CopyBitmapTo(bitmap, *(bitmaps[i]), damages[i]);
} }
damage.Intersect(GetViewBounds()); damage.Intersect(GetViewBounds());
callback_.Run(damage, bitmap); 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]); CopyBitmapTo(bitmap, originals[i], damages[i]);
} }
} }

View file

@ -205,7 +205,7 @@ int AutofillPopup::GetDesiredPopupHeight() {
int AutofillPopup::GetDesiredPopupWidth() { int AutofillPopup::GetDesiredPopupWidth() {
int popup_width = element_bounds_.width(); 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 + int row_size = kEndPadding + 2 * kPopupBorderThickness +
gfx::GetStringWidth(GetValueAt(i), GetValueFontListForRow(i)) + gfx::GetStringWidth(GetValueAt(i), GetValueFontListForRow(i)) +
gfx::GetStringWidth(GetLabelAt(i), GetLabelFontListForRow(i)); gfx::GetStringWidth(GetLabelAt(i), GetLabelFontListForRow(i));
@ -256,7 +256,7 @@ base::string16 AutofillPopup::GetLabelAt(int i) {
int AutofillPopup::LineFromY(int y) const { int AutofillPopup::LineFromY(int y) const {
int current_height = kPopupBorderThickness; int current_height = kPopupBorderThickness;
for (int i = 0; i < values_.size(); ++i) { for (size_t i = 0; i < values_.size(); ++i) {
current_height += kRowHeight; current_height += kRowHeight;
if (y <= current_height) if (y <= current_height)