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

Side by Side Diff: chrome/browser/ui/views/tabs/tab.cc

Issue 1403413006: Distill the concept of the "tab top exclusion region", an area inside the tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@combine_background_image_getters
Patch Set: Fix indenting error Created 5 years, 1 month 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 | « chrome/browser/ui/views/layout_constants.cc ('k') | 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/tabs/tab.h" 5 #include "chrome/browser/ui/views/tabs/tab.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 const bool extend_to_top = 692 const bool extend_to_top =
693 widget && (widget->IsMaximized() || widget->IsFullscreen()); 693 widget && (widget->IsMaximized() || widget->IsFullscreen());
694 694
695 // Hit mask constants. 695 // Hit mask constants.
696 const SkScalar kTabCapWidth = 15; 696 const SkScalar kTabCapWidth = 15;
697 const SkScalar kTabTopCurveWidth = 4; 697 const SkScalar kTabTopCurveWidth = 4;
698 const SkScalar kTabBottomCurveWidth = 3; 698 const SkScalar kTabBottomCurveWidth = 3;
699 #if defined(OS_MACOSX) 699 #if defined(OS_MACOSX)
700 // Mac's Cocoa UI doesn't have shadows. 700 // Mac's Cocoa UI doesn't have shadows.
701 const SkScalar kTabInset = 0; 701 const SkScalar kTabInset = 0;
702 const SkScalar kTabTop = 0;
703 #elif defined(TOOLKIT_VIEWS) 702 #elif defined(TOOLKIT_VIEWS)
704 // The views browser UI has shadows in the left, right and top parts of the 703 // The views browser UI has shadows in the left, right and top parts of the
705 // tab. 704 // tab.
706 const SkScalar kTabInset = 6; 705 const SkScalar kTabInset = 6;
707 const SkScalar kTabTop = 2;
708 #endif 706 #endif
709 707
710 SkScalar left = kTabInset; 708 SkScalar left = kTabInset;
711 SkScalar top = kTabTop; 709 SkScalar top = GetLayoutConstant(TAB_TOP_EXCLUSION_HEIGHT);
712 SkScalar right = SkIntToScalar(width()) - kTabInset; 710 SkScalar right = SkIntToScalar(width()) - kTabInset;
713 SkScalar bottom = SkIntToScalar(height()); 711 SkScalar bottom = SkIntToScalar(height());
714 712
715 // Start in the lower-left corner. 713 // Start in the lower-left corner.
716 mask->moveTo(left, bottom); 714 mask->moveTo(left, bottom);
717 715
718 // Left end cap. 716 // Left end cap.
719 mask->lineTo(left + kTabBottomCurveWidth, bottom - kTabBottomCurveWidth); 717 mask->lineTo(left + kTabBottomCurveWidth, bottom - kTabBottomCurveWidth);
720 mask->lineTo(left + kTabCapWidth - kTabTopCurveWidth, 718 mask->lineTo(left + kTabCapWidth - kTabTopCurveWidth,
721 top + kTabTopCurveWidth); 719 top + kTabTopCurveWidth);
722 mask->lineTo(left + kTabCapWidth, top); 720 mask->lineTo(left + kTabCapWidth, top);
723 721
724 // Extend over the top shadow area if we have one and the caller wants it. 722 // Extend over the top shadow area if we have one and the caller wants it.
725 if (kTabTop > 0 && extend_to_top) { 723 if (top > 0 && extend_to_top) {
726 mask->lineTo(left + kTabCapWidth, 0); 724 mask->lineTo(left + kTabCapWidth, 0);
727 mask->lineTo(right - kTabCapWidth, 0); 725 mask->lineTo(right - kTabCapWidth, 0);
728 } 726 }
729 727
730 // Connect to the right cap. 728 // Connect to the right cap.
731 mask->lineTo(right - kTabCapWidth, top); 729 mask->lineTo(right - kTabCapWidth, top);
732 730
733 // Right end cap. 731 // Right end cap.
734 mask->lineTo(right - kTabCapWidth + kTabTopCurveWidth, 732 mask->lineTo(right - kTabCapWidth + kTabTopCurveWidth,
735 top + kTabTopCurveWidth); 733 top + kTabTopCurveWidth);
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 const gfx::ImageSkia& image) { 1541 const gfx::ImageSkia& image) {
1544 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); 1542 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE);
1545 ImageCacheEntry entry; 1543 ImageCacheEntry entry;
1546 entry.resource_id = resource_id; 1544 entry.resource_id = resource_id;
1547 entry.scale_factor = scale_factor; 1545 entry.scale_factor = scale_factor;
1548 entry.image = image; 1546 entry.image = image;
1549 image_cache_->push_front(entry); 1547 image_cache_->push_front(entry);
1550 if (image_cache_->size() > kMaxImageCacheSize) 1548 if (image_cache_->size() > kMaxImageCacheSize)
1551 image_cache_->pop_back(); 1549 image_cache_->pop_back();
1552 } 1550 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/layout_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698