Chromium Code Reviews| 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(); |
| 715 mask->addRect(intersection); | 714 if (intersection.intersect(RectToSkRect(clip))) { |
|
sky
2015/01/05 16:32:44
If the two don't intersect, then I think this func
tdanderson
2015/01/05 17:16:43
I agree. Change the block starting at line 711 to
robertphillips
2015/01/05 19:31:56
Done.
| |
| 715 mask->addRect(intersection); | |
| 716 } | |
| 716 } | 717 } |
| 717 | 718 |
| 718 return true; | 719 return true; |
| 719 } | 720 } |
| 720 | 721 |
| 721 //////////////////////////////////////////////////////////////////////////////// | 722 //////////////////////////////////////////////////////////////////////////////// |
| 722 // Tab, views::View overrides: | 723 // Tab, views::View overrides: |
| 723 | 724 |
| 724 void Tab::OnPaint(gfx::Canvas* canvas) { | 725 void Tab::OnPaint(gfx::Canvas* canvas) { |
| 725 // Don't paint if we're narrower than we can render correctly. (This should | 726 // Don't paint if we're narrower than we can render correctly. (This should |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1599 const gfx::ImageSkia& image) { | 1600 const gfx::ImageSkia& image) { |
| 1600 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1601 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
| 1601 ImageCacheEntry entry; | 1602 ImageCacheEntry entry; |
| 1602 entry.resource_id = resource_id; | 1603 entry.resource_id = resource_id; |
| 1603 entry.scale_factor = scale_factor; | 1604 entry.scale_factor = scale_factor; |
| 1604 entry.image = image; | 1605 entry.image = image; |
| 1605 image_cache_->push_front(entry); | 1606 image_cache_->push_front(entry); |
| 1606 if (image_cache_->size() > kMaxImageCacheSize) | 1607 if (image_cache_->size() > kMaxImageCacheSize) |
| 1607 image_cache_->pop_back(); | 1608 image_cache_->pop_back(); |
| 1608 } | 1609 } |
| OLD | NEW |