Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: chrome/browser/ui/views/frame/glass_browser_frame_view.cc

Issue 2011723002: Floor rather than round the top border thickness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/win/windows_version.h" 10 #include "base/win/windows_version.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 int GlassBrowserFrameView::FrameBorderThickness() const { 319 int GlassBrowserFrameView::FrameBorderThickness() const {
320 return (frame()->IsMaximized() || frame()->IsFullscreen()) ? 320 return (frame()->IsMaximized() || frame()->IsFullscreen()) ?
321 0 : display::win::GetSystemMetricsInDIP(SM_CXSIZEFRAME); 321 0 : display::win::GetSystemMetricsInDIP(SM_CXSIZEFRAME);
322 } 322 }
323 323
324 int GlassBrowserFrameView::FrameTopBorderThickness(bool restored) const { 324 int GlassBrowserFrameView::FrameTopBorderThickness(bool restored) const {
325 // Distinct from FrameBorderThickness() because Windows gives maximized 325 // Distinct from FrameBorderThickness() because Windows gives maximized
326 // windows an offscreen CYSIZEFRAME-thick region around the edges. The 326 // windows an offscreen CYSIZEFRAME-thick region around the edges. The
327 // left/right/bottom edges don't worry about this because we cancel them out 327 // left/right/bottom edges don't worry about this because we cancel them out
328 // in BrowserDesktopWindowTreeHostWin::GetClientAreaInsets() so the offscreen 328 // in BrowserDesktopWindowTreeHostWin::GetClientAreaInsets() so the offscreen
329 // area is non-client as far as Windows is concerned. However because we want 329 // area is non-client as far as Windows is concerned. However we can't do this
330 // to push away the top part of the glass's gradient in Win7 we set the top 330 // with the top inset because otherwise Windows will give us a standard
331 // client inset to 0. Thus we must compensate here to avoid having UI elements 331 // titlebar. Thus we must compensate here to avoid having UI elements drift
332 // drift off the top of the screen. 332 // off the top of the screen.
333 return (frame()->IsFullscreen() && !restored) ? 333 if (frame()->IsFullscreen() && !restored)
334 0 : display::win::GetSystemMetricsInDIP(SM_CYSIZEFRAME); 334 return 0;
335 // Mouse and touch locations are floored but GetSystemMetricsInDIP is rounded,
336 // so we need to floor instead or else the difference will cause the hittest
337 // to fail when it ought to succeed.
338 return std::floor(GetSystemMetrics(SM_CYSIZEFRAME) /
339 display::win::GetDPIScale());
335 } 340 }
336 341
337 int GlassBrowserFrameView::TopAreaHeight(bool restored) const { 342 int GlassBrowserFrameView::TopAreaHeight(bool restored) const {
338 if (frame()->IsFullscreen() && !restored) 343 if (frame()->IsFullscreen() && !restored)
339 return 0; 344 return 0;
340 345
341 const int top = FrameTopBorderThickness(restored); 346 const int top = FrameTopBorderThickness(restored);
342 // The tab top inset is equal to the height of any shadow region above the 347 // The tab top inset is equal to the height of any shadow region above the
343 // tabs, plus a 1 px top stroke. In maximized mode, we want to push the 348 // tabs, plus a 1 px top stroke. In maximized mode, we want to push the
344 // shadow region off the top of the screen but leave the top stroke. 349 // shadow region off the top of the screen but leave the top stroke.
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 static bool initialized = false; 673 static bool initialized = false;
669 if (!initialized) { 674 if (!initialized) {
670 for (int i = 0; i < kThrobberIconCount; ++i) { 675 for (int i = 0; i < kThrobberIconCount; ++i) {
671 throbber_icons_[i] = 676 throbber_icons_[i] =
672 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); 677 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i);
673 DCHECK(throbber_icons_[i]); 678 DCHECK(throbber_icons_[i]);
674 } 679 }
675 initialized = true; 680 initialized = true;
676 } 681 }
677 } 682 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698