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

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

Issue 134203004: Temporary fix for bad hit testing of tab close button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« 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/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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 418
419 gfx::Rect button_bounds(GetContentsBounds()); 419 gfx::Rect button_bounds(GetContentsBounds());
420 button_bounds.set_x(GetMirroredXForRect(button_bounds)); 420 button_bounds.set_x(GetMirroredXForRect(button_bounds));
421 gfx::RectF tab_bounds_f(gfx::SkRectToRectF(tab_mask.getBounds())); 421 gfx::RectF tab_bounds_f(gfx::SkRectToRectF(tab_mask.getBounds()));
422 views::View::ConvertRectToTarget(tab_, this, &tab_bounds_f); 422 views::View::ConvertRectToTarget(tab_, this, &tab_bounds_f);
423 gfx::Rect tab_bounds = gfx::ToEnclosingRect(tab_bounds_f); 423 gfx::Rect tab_bounds = gfx::ToEnclosingRect(tab_bounds_f);
424 424
425 // If the button is hidden behind another tab, the hit test mask is empty. 425 // If the button is hidden behind another tab, the hit test mask is empty.
426 // Otherwise set the hit test mask to be the contents bounds. 426 // Otherwise set the hit test mask to be the contents bounds.
427 path->reset(); 427 path->reset();
428 if (tab_bounds.Contains(button_bounds)) { 428 if (tab_bounds.Intersects(button_bounds)) {
429 // Include the padding in the hit test mask for touch events. 429 // Include the padding in the hit test mask for touch events.
430 if (source == HIT_TEST_SOURCE_TOUCH) 430 if (source == HIT_TEST_SOURCE_TOUCH)
431 button_bounds = GetLocalBounds(); 431 button_bounds = GetLocalBounds();
432 432
433 // TODO: this isn't quite right, really need to intersect the two regions.
433 path->addRect(RectToSkRect(button_bounds)); 434 path->addRect(RectToSkRect(button_bounds));
434 } 435 }
435 } 436 }
436 437
437 virtual const char* GetClassName() const OVERRIDE { 438 virtual const char* GetClassName() const OVERRIDE {
438 return kTabCloseButtonName; 439 return kTabCloseButtonName;
439 } 440 }
440 441
441 private: 442 private:
442 Tab* tab_; 443 Tab* tab_;
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1764 const gfx::ImageSkia& image) { 1765 const gfx::ImageSkia& image) {
1765 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); 1766 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE);
1766 ImageCacheEntry entry; 1767 ImageCacheEntry entry;
1767 entry.resource_id = resource_id; 1768 entry.resource_id = resource_id;
1768 entry.scale_factor = scale_factor; 1769 entry.scale_factor = scale_factor;
1769 entry.image = image; 1770 entry.image = image;
1770 image_cache_->push_front(entry); 1771 image_cache_->push_front(entry);
1771 if (image_cache_->size() > kMaxImageCacheSize) 1772 if (image_cache_->size() > kMaxImageCacheSize)
1772 image_cache_->pop_back(); 1773 image_cache_->pop_back();
1773 } 1774 }
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