diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-27 22:01:09 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-27 22:01:09 +0000 |
commit | e09cc594ec748ec3bd3275980cb422eef81d52e2 (patch) | |
tree | f5d365294133f632dd28daf74ee51c24d3856568 /chrome/browser/ntp_background_util.cc | |
parent | e468816fe2fdde97f56be94b2e06dcc33fbe259e (diff) | |
download | chromium_src-e09cc594ec748ec3bd3275980cb422eef81d52e2.zip chromium_src-e09cc594ec748ec3bd3275980cb422eef81d52e2.tar.gz chromium_src-e09cc594ec748ec3bd3275980cb422eef81d52e2.tar.bz2 |
Revert 123804 - ntp theme fixes
1. fix where the theme background is displayed for default (0) alignment -- it should be center center. This matches what the bookmark bar does. This may break some themes that rely on the default being top-left alignment. I can't see a way around this.
2. Fix the bookmark bar for vertical center alignment.
3. update the ntp background when the bookmark bar is attached/detached.
TODO: transition (3) so that it looks good on windows and mac.
BUG=115594
TEST=manual
Review URL: https://chromiumcodereview.appspot.com/9467027
TBR=estade@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9475026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123811 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ntp_background_util.cc')
-rw-r--r-- | chrome/browser/ntp_background_util.cc | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/chrome/browser/ntp_background_util.cc b/chrome/browser/ntp_background_util.cc index 297a0f0..c6682d0 100644 --- a/chrome/browser/ntp_background_util.cc +++ b/chrome/browser/ntp_background_util.cc @@ -4,8 +4,6 @@ #include "chrome/browser/ntp_background_util.h" -#include <cmath> - #include "base/logging.h" #include "chrome/browser/themes/theme_service.h" #include "grit/theme_resources.h" @@ -24,22 +22,15 @@ void PaintThemeBackground( int width = area.width() + ntp_background->width(); int height = area.height() + ntp_background->height(); - if (alignment & ThemeService::ALIGN_BOTTOM) { + if (alignment & ThemeService::ALIGN_BOTTOM) y_pos += area.height() + tab_contents_height - ntp_background->height(); - } else if (alignment & ThemeService::ALIGN_TOP) { - // no op - } else { // ALIGN_CENTER - y_pos += std::floor(area.height() + tab_contents_height / 2.0 - - ntp_background->height() / 2.0 + 0.5); - } if (alignment & ThemeService::ALIGN_RIGHT) { x_pos += area.width() - ntp_background->width(); } else if (alignment & ThemeService::ALIGN_LEFT) { // no op } else { // ALIGN_CENTER - x_pos += - std::floor(area.width() / 2.0 - ntp_background->width() / 2.0 + 0.5); + x_pos += area.width() / 2 - ntp_background->width() / 2; } if (tiling != ThemeService::REPEAT && @@ -77,7 +68,7 @@ void NtpBackgroundUtil::PaintBackgroundDetachedMode(ui::ThemeProvider* tp, tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_TILING, &tiling); int alignment; if (tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_ALIGNMENT, - &alignment)) { + &alignment)) { SkBitmap* ntp_background = tp->GetBitmapNamed(IDR_THEME_NTP_BACKGROUND); PaintThemeBackground( |