OLD | NEW |
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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 widget && (widget->IsMaximized() || widget->IsFullscreen()); | 703 widget && (widget->IsMaximized() || widget->IsFullscreen()); |
704 TabResources::GetHitTestMask(width(), height(), include_top_shadow, mask); | 704 TabResources::GetHitTestMask(width(), height(), include_top_shadow, mask); |
705 | 705 |
706 // It is possible for a portion of the tab to be occluded if tabs are | 706 // It is possible for a portion of the tab to be occluded if tabs are |
707 // stacked, so modify the hit test mask to only include the visible | 707 // stacked, so modify the hit test mask to only include the visible |
708 // region of the tab. | 708 // region of the tab. |
709 gfx::Rect clip; | 709 gfx::Rect clip; |
710 controller_->ShouldPaintTab(this, &clip); | 710 controller_->ShouldPaintTab(this, &clip); |
711 if (clip.size().GetArea()) { | 711 if (clip.size().GetArea()) { |
712 SkRect intersection(mask->getBounds()); | 712 SkRect intersection(mask->getBounds()); |
713 intersection.intersect(RectToSkRect(clip)); | |
714 mask->reset(); | 713 mask->reset(); |
| 714 if (!intersection.intersect(RectToSkRect(clip))) |
| 715 return false; |
715 mask->addRect(intersection); | 716 mask->addRect(intersection); |
716 } | 717 } |
717 | |
718 return true; | 718 return true; |
719 } | 719 } |
720 | 720 |
721 //////////////////////////////////////////////////////////////////////////////// | 721 //////////////////////////////////////////////////////////////////////////////// |
722 // Tab, views::View overrides: | 722 // Tab, views::View overrides: |
723 | 723 |
724 void Tab::OnPaint(gfx::Canvas* canvas) { | 724 void Tab::OnPaint(gfx::Canvas* canvas) { |
725 // Don't paint if we're narrower than we can render correctly. (This should | 725 // Don't paint if we're narrower than we can render correctly. (This should |
726 // only happen during animations). | 726 // only happen during animations). |
727 if (width() < GetMinimumUnselectedSize().width() && !data().mini) | 727 if (width() < GetMinimumUnselectedSize().width() && !data().mini) |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1599 const gfx::ImageSkia& image) { | 1599 const gfx::ImageSkia& image) { |
1600 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1600 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
1601 ImageCacheEntry entry; | 1601 ImageCacheEntry entry; |
1602 entry.resource_id = resource_id; | 1602 entry.resource_id = resource_id; |
1603 entry.scale_factor = scale_factor; | 1603 entry.scale_factor = scale_factor; |
1604 entry.image = image; | 1604 entry.image = image; |
1605 image_cache_->push_front(entry); | 1605 image_cache_->push_front(entry); |
1606 if (image_cache_->size() > kMaxImageCacheSize) | 1606 if (image_cache_->size() > kMaxImageCacheSize) |
1607 image_cache_->pop_back(); | 1607 image_cache_->pop_back(); |
1608 } | 1608 } |
OLD | NEW |