Commit e5a8ba67 authored by bsep's avatar bsep Committed by Commit bot

Change status bubble rendering at hidpi and when there is no client edge

The recently removed client edge on Windows 10 made the status bubble
overlap the window edge. This patch clips out the bubble border when the
bubble is docked, and leaves it unchanged when it's floating. Also made
the border always 1 pixel even at hidpi to make it look more consistent
with the material UI.

BUG=636479

Review-Url: https://codereview.chromium.org/2247563002
Cr-Commit-Position: refs/heads/master@{#415216}
parent 9d638a1e
......@@ -167,6 +167,7 @@
#endif
#if defined(OS_WIN)
#include "base/win/windows_version.h"
#include "chrome/browser/win/jumplist.h"
#include "ui/gfx/color_palette.h"
#include "ui/native_theme/native_theme_dark_win.h"
......@@ -543,7 +544,8 @@ void BrowserView::Paint1pxHorizontalLine(gfx::Canvas* canvas,
}
void BrowserView::InitStatusBubble() {
status_bubble_.reset(new StatusBubbleViews(contents_web_view_));
status_bubble_.reset(
new StatusBubbleViews(contents_web_view_, HasClientEdge()));
contents_web_view_->SetStatusBubble(status_bubble_.get());
}
......@@ -607,6 +609,15 @@ bool BrowserView::IsRegularOrGuestSession() const {
return profiles::IsRegularOrGuestSession(browser_.get());
}
bool BrowserView::HasClientEdge() const {
#if defined(OS_WIN)
return base::win::GetVersion() < base::win::VERSION_WIN10 ||
!frame_->ShouldUseNativeFrame();
#else
return true;
#endif
}
bool BrowserView::GetAccelerator(int cmd_id,
ui::Accelerator* accelerator) const {
// We retrieve the accelerator information for standard accelerators
......
......@@ -202,6 +202,10 @@ class BrowserView : public BrowserWindow,
// not incognito or a guest session.
bool IsRegularOrGuestSession() const;
// Returns whether or not a client edge (the border around the web content)
// should be laid out and drawn.
bool HasClientEdge() const;
// Provides the containing frame with the accelerator for the specified
// command id. This can be used to provide menu item shortcut hints etc.
// Returns true if an accelerator was found for the specified |cmd_id|, false
......
......@@ -338,7 +338,7 @@ bool GlassBrowserFrameView::DoesIntersectRect(const views::View* target,
int GlassBrowserFrameView::ClientBorderThickness(bool restored) const {
// The frame ends abruptly at the 1 pixel window border drawn by Windows 10.
if (base::win::GetVersion() >= base::win::VERSION_WIN10)
if (!browser_view()->HasClientEdge())
return 0;
if ((frame()->IsMaximized() || frame()->IsFullscreen()) && !restored)
......
......@@ -35,7 +35,7 @@ class StatusBubbleViews : public StatusBubble {
static const int kTotalVerticalPadding = 7;
// |base_view| is the view that this bubble is positioned relative to.
explicit StatusBubbleViews(views::View* base_view);
StatusBubbleViews(views::View* base_view, bool has_client_edge);
~StatusBubbleViews() override;
views::View* base_view() { return base_view_; }
......@@ -139,6 +139,10 @@ class StatusBubbleViews : public StatusBubble {
// change size immediately, with no hover.
bool is_expanded_;
// Whether or not the frame that the bubble will be painting inside has a
// client edge. Affects layout.
const bool has_client_edge_;
// Times expansion of status bubble when URL is too long for standard width.
base::WeakPtrFactory<StatusBubbleViews> expand_timer_factory_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment