This commit is contained in:
Kevin Sawicki 2016-10-27 12:13:45 -07:00
parent a991570677
commit 2fc46f638f

View file

@ -117,22 +117,22 @@ bool ScopedDisableResize::disable_resize_ = false;
if (!web_contents) if (!web_contents)
return frame; return frame;
CGFloat pageWidth = static_cast<CGFloat>( CGFloat page_width = static_cast<CGFloat>(
web_contents->GetPreferredSize().width()); web_contents->GetPreferredSize().width());
NSRect currentFrame = [window frame]; NSRect window_frame = [window frame];
// Never shrink from the current size on zoom. // Never shrink from the current size on zoom.
CGFloat zoomedWidth = std::max(pageWidth, NSWidth(currentFrame)); CGFloat zoomed_width = std::max(page_width, NSWidth(window_frame));
// |frame| determines our maximum extents. We need to set the origin of the // |frame| determines our maximum extents. We need to set the origin of the
// frame -- and only move it left if necessary. // frame -- and only move it left if necessary.
if (currentFrame.origin.x + zoomedWidth > NSMaxX(frame)) if (window_frame.origin.x + zoomed_width > NSMaxX(frame))
frame.origin.x = NSMaxX(frame) - zoomedWidth; frame.origin.x = NSMaxX(frame) - zoomed_width;
else else
frame.origin.x = currentFrame.origin.x; frame.origin.x = window_frame.origin.x;
// Set the width. Don't touch y or height. // Set the width. Don't touch y or height.
frame.size.width = zoomedWidth; frame.size.width = zoomed_width;
return frame; return frame;
} }