From cbee62f04370694af7cfc18f70805d415ab5c412 Mon Sep 17 00:00:00 2001 From: "thomasvl@chromium.org" Date: Fri, 5 Mar 2010 18:04:01 +0000 Subject: [Mac] Change when we trigger a download shelf layout As part of awakeFromNib a dangerous download would set it's state and trigger a layout grabbing the initial size before the proper localized text was loaded and the view sized. This made the item "stick" at the wrong size. Now setState: doesn't trigger a layout and instead only force a layout when the dangerous state is cleared. BUG=28446,28705,32775 TEST=see bugs Review URL: http://codereview.chromium.org/668161 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40747 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/cocoa/download_item_controller.mm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/chrome/browser/cocoa/download_item_controller.mm b/chrome/browser/cocoa/download_item_controller.mm index f20c548..cf0caf8 100644 --- a/chrome/browser/cocoa/download_item_controller.mm +++ b/chrome/browser/cocoa/download_item_controller.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -218,6 +218,10 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu { - (void)clearDangerousMode { [self setState:kNormal]; + // The state change hide the dangerouse download view and is now showing the + // download progress view. This means the view is likely to be a different + // size, so trigger a shelf layout to fix up spacing. + [shelf_ layoutItems]; } - (BOOL)isDangerousMode { @@ -236,7 +240,9 @@ class DownloadShelfContextMenuMac : public DownloadShelfContextMenu { [progressView_ setHidden:YES]; [dangerousDownloadView_ setHidden:NO]; } - [shelf_ layoutItems]; + // NOTE: Do not relayout the shelf, as this could get called during initial + // setup of the the item, so the localized text and sizing might not have + // happened yet. } // Called after the current theme has changed. -- cgit v1.1