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

Issue 10291002: Fix crash in touch layout code. Without this can end up indexing into (Closed)

Created:
8 years, 7 months ago by sky
Modified:
8 years, 7 months ago
CC:
chromium-reviews
Visibility:
Public.

Description

Fix crash in touch layout code. Without this can end up indexing into view model with a -1. BUG=125127 TEST=covered by unit test R=ben@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=134818

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+5 lines, -1 line) Patch
M chrome/browser/ui/views/tabs/touch_tab_strip_layout.cc View 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/ui/views/tabs/touch_tab_strip_layout_unittest.cc View 1 chunk +3 lines, -0 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
sky
8 years, 7 months ago (2012-05-01 21:47:25 UTC) #1
Ben Goodger (Google)
8 years, 7 months ago (2012-05-01 22:07:30 UTC) #2
LGTM

On Tue, May 1, 2012 at 2:47 PM, <sky@chromium.org> wrote:

> Reviewers: Ben Goodger (Google),
>
> Description:
> Fix crash in touch layout code. Without this can end up indexing into
> view model with a -1.
>
> BUG=125127
> TEST=covered by unit test
> R=ben@chromium.org
>
>
> Please review this at
http://codereview.chromium.**org/10291002/<http://codereview.chromium.org/102...
>
> SVN Base:
svn://svn.chromium.org/chrome/**trunk/src<http://svn.chromium.org/chrome/trunk/src>
>
> Affected files:
>  M chrome/browser/ui/views/tabs/**touch_tab_strip_layout.cc
>  M chrome/browser/ui/views/tabs/**touch_tab_strip_layout_**unittest.cc
>
>
> Index: chrome/browser/ui/views/tabs/**touch_tab_strip_layout.cc
> diff --git a/chrome/browser/ui/views/**tabs/touch_tab_strip_layout.cc
> b/chrome/browser/ui/views/**tabs/touch_tab_strip_layout.cc
> index c96c37faa0085c26d4e011230378bd**7f84216590..**
> 1b5d7cd2d4e483937c25a54c0fc9d6**9f276054ea 100644
> --- a/chrome/browser/ui/views/**tabs/touch_tab_strip_layout.cc
> +++ b/chrome/browser/ui/views/**tabs/touch_tab_strip_layout.cc
> @@ -312,7 +312,8 @@ void TouchTabStripLayout::**AdjustTrailingStackedTabs()
> {
>          ideal_x(index - 1) >= max_stacked_x) {
>     index--;
>   }
> -  if (ideal_x(index) - ideal_x(index - 1) <= stacked_padding_ &&
> +  if (index > active_index() &&
> +      ideal_x(index) - ideal_x(index - 1) <= stacked_padding_ &&
>       ideal_x(index - 1) >= max_stacked_x) {
>     index--;
>   }
> Index: chrome/browser/ui/views/tabs/**touch_tab_strip_layout_**unittest.cc
> diff --git
a/chrome/browser/ui/views/**tabs/touch_tab_strip_layout_**unittest.cc
> b/chrome/browser/ui/views/**tabs/touch_tab_strip_layout_**unittest.cc
> index a93bcac43240eba885f5f0c67d086c**96cefbf69c..**
> c0a359ba13fabd9067050a3c74e7c2**c4d4ce5511 100644
> --- a/chrome/browser/ui/views/**tabs/touch_tab_strip_layout_**unittest.cc
> +++ b/chrome/browser/ui/views/**tabs/touch_tab_strip_layout_**unittest.cc
> @@ -323,6 +323,9 @@ TEST_F(**TouchTabStripLayoutTest, SetWidth) {
>     CommonTestData common_data;
>     int new_width;
>   } test_data[] = {
> +    // Verifies a bug in AdjustTrailingStackedTabs().
> +    { { 0, 103, 100, -10, 2, 0, 0, "", "0 2"}, 102 },
> +
>     { { 8, 250, 100, -10, 2, 2, 2, "0 4 8 98 148 150", "0 4 8 98 160 250"},
>       350 },
>     { { 8, 250, 100, -10, 2, 2, 2, "0 4 8 98 148 150", "0 4 8 96 98 100"},
>
>
>

Powered by Google App Engine
This is Rietveld 408576698