diff options
96 files changed, 1631 insertions, 1664 deletions
diff --git a/chrome/browser/automation/ui_controls.cc b/chrome/browser/automation/ui_controls.cc index 0eb4202..9fe42201 100644 --- a/chrome/browser/automation/ui_controls.cc +++ b/chrome/browser/automation/ui_controls.cc @@ -336,7 +336,7 @@ void MoveMouseToCenterAndPress( ChromeViews::View* view, MouseButton button, int state, Task* task) { DCHECK(view); DCHECK(view->GetViewContainer()); - CPoint view_center(view->GetWidth() / 2, view->GetHeight() / 2); + CPoint view_center(view->width() / 2, view->height() / 2); ChromeViews::View::ConvertPointToScreen(view, &view_center); SendMouseMove(view_center.x, view_center.y); SendMouseEventsNotifyWhenDone(button, state, task); diff --git a/chrome/browser/bookmarks/bookmark_storage.h b/chrome/browser/bookmarks/bookmark_storage.h index 6ec4184..c645a7f 100644 --- a/chrome/browser/bookmarks/bookmark_storage.h +++ b/chrome/browser/bookmarks/bookmark_storage.h @@ -1,96 +1,96 @@ -// Copyright (c) 2006-2008 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.
-
-#ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_
-#define CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_
-
-#include "base/ref_counted.h"
-#include "base/task.h"
-#include "chrome/browser/browser_process.h"
-
-class BookmarkModel;
-class Profile;
-class Value;
-
-// BookmarkStorage handles reading/write the bookmark bar model. The
-// BookmarkModel uses the BookmarkStorage to load bookmarks from disk, as well
-// as notifying the BookmarkStorage every time the model changes.
-//
-// Internally BookmarkStorage uses BookmarkCodec to do the actual read/write.
-
-class BookmarkStorage : public base::RefCountedThreadSafe<BookmarkStorage> {
- friend class BookmarkStorageBackend;
-
- public:
- // Creates a BookmarkStorage for the specified model
- BookmarkStorage(Profile* profile, BookmarkModel* model);
-
- // Loads the bookmarks into the model, notifying the model when done. If
- // load_from_history is true, the bookmarks are loaded from the file written
- // by history (StarredURLDatabase).
- void LoadBookmarks(bool load_from_history);
-
- // Schedules saving the bookmark bar model to disk.
- void ScheduleSave();
-
- // Notification the bookmark bar model is going to be deleted. If there is
- // a pending save, it is saved immediately.
- void BookmarkModelDeleted();
-
- private:
- // Callback from backend with the results of the bookmark file.
- void LoadedBookmarks(Value* root_value,
- bool bookmark_file_exists,
- bool loaded_from_history);
-
- // Schedules a save on the backend thread.
- void SaveNow();
-
- // Returns the thread the backend is run on.
- base::Thread* backend_thread() const { return backend_thread_; }
-
- // The model. The model is NULL once BookmarkModelDeleted has been invoked.
- BookmarkModel* model_;
-
- // Used to delay saves.
- ScopedRunnableMethodFactory<BookmarkStorage> save_factory_;
-
- // The backend handles actual reading/writing to disk.
- scoped_refptr<BookmarkStorageBackend> backend_;
-
- // Thread read/writing is run on. This comes from the profile, and is null
- // during testing.
- base::Thread* backend_thread_;
-
- DISALLOW_COPY_AND_ASSIGN(BookmarkStorage);
-};
-
-// Used to save the bookmarks on the file thread.
-class BookmarkStorageBackend :
- public base::RefCountedThreadSafe<BookmarkStorageBackend> {
- public:
- explicit BookmarkStorageBackend(const std::wstring& path,
- const std::wstring& tmp_histor_path);
-
- // Writes the specified value to disk. This takes ownership of |value| and
- // deletes it when done.
- void Write(Value* value);
-
- // Reads the bookmarks from kBookmarksFileName. Notifies |service| with
- // the results on the specified MessageLoop.
- void Read(scoped_refptr<BookmarkStorage> service,
- MessageLoop* message_loop,
- bool load_from_history);
-
- private:
- // Path we read/write to.
- const std::wstring path_;
-
- // Path bookmarks are read from if asked to load from history file.
- const std::wstring tmp_history_path_;
-
- DISALLOW_COPY_AND_ASSIGN(BookmarkStorageBackend);
-};
-
-#endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_
+// Copyright (c) 2006-2008 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. + +#ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_ +#define CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_ + +#include "base/ref_counted.h" +#include "base/task.h" +#include "chrome/browser/browser_process.h" + +class BookmarkModel; +class Profile; +class Value; + +// BookmarkStorage handles reading/write the bookmark bar model. The +// BookmarkModel uses the BookmarkStorage to load bookmarks from disk, as well +// as notifying the BookmarkStorage every time the model changes. +// +// Internally BookmarkStorage uses BookmarkCodec to do the actual read/write. + +class BookmarkStorage : public base::RefCountedThreadSafe<BookmarkStorage> { + friend class BookmarkStorageBackend; + + public: + // Creates a BookmarkStorage for the specified model + BookmarkStorage(Profile* profile, BookmarkModel* model); + + // Loads the bookmarks into the model, notifying the model when done. If + // load_from_history is true, the bookmarks are loaded from the file written + // by history (StarredURLDatabase). + void LoadBookmarks(bool load_from_history); + + // Schedules saving the bookmark bar model to disk. + void ScheduleSave(); + + // Notification the bookmark bar model is going to be deleted. If there is + // a pending save, it is saved immediately. + void BookmarkModelDeleted(); + + private: + // Callback from backend with the results of the bookmark file. + void LoadedBookmarks(Value* root_value, + bool bookmark_file_exists, + bool loaded_from_history); + + // Schedules a save on the backend thread. + void SaveNow(); + + // Returns the thread the backend is run on. + base::Thread* backend_thread() const { return backend_thread_; } + + // The model. The model is NULL once BookmarkModelDeleted has been invoked. + BookmarkModel* model_; + + // Used to delay saves. + ScopedRunnableMethodFactory<BookmarkStorage> save_factory_; + + // The backend handles actual reading/writing to disk. + scoped_refptr<BookmarkStorageBackend> backend_; + + // Thread read/writing is run on. This comes from the profile, and is null + // during testing. + base::Thread* backend_thread_; + + DISALLOW_COPY_AND_ASSIGN(BookmarkStorage); +}; + +// Used to save the bookmarks on the file thread. +class BookmarkStorageBackend : + public base::RefCountedThreadSafe<BookmarkStorageBackend> { + public: + explicit BookmarkStorageBackend(const std::wstring& path, + const std::wstring& tmp_histor_path); + + // Writes the specified value to disk. This takes ownership of |value| and + // deletes it when done. + void Write(Value* value); + + // Reads the bookmarks from kBookmarksFileName. Notifies |service| with + // the results on the specified MessageLoop. + void Read(scoped_refptr<BookmarkStorage> service, + MessageLoop* message_loop, + bool load_from_history); + + private: + // Path we read/write to. + const std::wstring path_; + + // Path bookmarks are read from if asked to load from history file. + const std::wstring tmp_history_path_; + + DISALLOW_COPY_AND_ASSIGN(BookmarkStorageBackend); +}; + +#endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_STORAGE_H_ diff --git a/chrome/browser/debugger/debugger_view.cc b/chrome/browser/debugger/debugger_view.cc index b65b021..494a23f 100644 --- a/chrome/browser/debugger/debugger_view.cc +++ b/chrome/browser/debugger/debugger_view.cc @@ -44,7 +44,7 @@ void DebuggerView::GetPreferredSize(CSize* out) { } void DebuggerView::Layout() { - web_container_->SetBounds(0, 0, GetWidth(), GetHeight()); + web_container_->SetBounds(0, 0, width(), height()); } void DebuggerView::DidChangeBounds(const CRect& previous, diff --git a/chrome/browser/find_in_page_controller.cc b/chrome/browser/find_in_page_controller.cc index fabc772..baa4973 100644 --- a/chrome/browser/find_in_page_controller.cc +++ b/chrome/browser/find_in_page_controller.cc @@ -387,7 +387,7 @@ void FindInPageController::AnimationProgressed( // First, we calculate how many pixels to slide the window. find_dialog_animation_offset_ = static_cast<int>((1.0 - animation_->GetCurrentValue()) * - view_->GetHeight()); + view_->height()); // This call makes sure it appears in the right location, the size and shape // is correct and that it slides in the right direction. diff --git a/chrome/browser/find_in_page_view.cc b/chrome/browser/find_in_page_view.cc index 993ab64..c6507f4 100644 --- a/chrome/browser/find_in_page_view.cc +++ b/chrome/browser/find_in_page_view.cc @@ -342,26 +342,26 @@ void FindInPageView::Layout() { // First we draw the close button on the far right. close_button_->GetPreferredSize(&sz); close_button_->SetBounds(panel_size.cx - sz.cx - kMarginRightOfCloseButton, - (GetHeight() - sz.cy) / 2, + (height() - sz.cy) / 2, sz.cx, sz.cy); close_button_->SetListener(this, CLOSE_TAG); // Next, the FindNext button to the left the close button. find_next_button_->GetPreferredSize(&sz); - find_next_button_->SetBounds(close_button_->GetX() - - find_next_button_->GetWidth() - + find_next_button_->SetBounds(close_button_->x() - + find_next_button_->width() - kMarginLeftOfCloseButton, - (GetHeight() - sz.cy) / 2, + (height() - sz.cy) / 2, sz.cx, sz.cy); find_next_button_->SetListener(this, FIND_NEXT_TAG); // Then, the FindPrevious button to the left the FindNext button. find_previous_button_->GetPreferredSize(&sz); - find_previous_button_->SetBounds(find_next_button_->GetX() - - find_previous_button_->GetWidth(), - (GetHeight() - sz.cy) / 2, + find_previous_button_->SetBounds(find_next_button_->x() - + find_previous_button_->width(), + (height() - sz.cy) / 2, sz.cx, sz.cy); find_previous_button_->SetListener(this, FIND_PREVIOUS_TAG); @@ -372,18 +372,18 @@ void FindInPageView::Layout() { // of breathing room (margins around the text). sz.cx += kMatchCountExtraWidth; sz.cx = std::max(kMatchCountMinWidth, static_cast<int>(sz.cx)); - match_count_text_->SetBounds(find_previous_button_->GetX() - + match_count_text_->SetBounds(find_previous_button_->x() - kWhiteSpaceAfterMatchCountLabel - sz.cx, - (GetHeight() - sz.cy) / 2 + 1, + (height() - sz.cy) / 2 + 1, sz.cx, sz.cy); // And whatever space is left in between, gets filled up by the find edit box. find_text_->GetPreferredSize(&sz); - sz.cx = match_count_text_->GetX() - kMarginLeftOfFindTextField; - find_text_->SetBounds(match_count_text_->GetX() - sz.cx, - (GetHeight() - sz.cy) / 2 + 1, + sz.cx = match_count_text_->x() - kMarginLeftOfFindTextField; + find_text_->SetBounds(match_count_text_->x() - sz.cx, + (height() - sz.cy) / 2 + 1, sz.cx, sz.cy); find_text_->SetController(this); @@ -392,12 +392,12 @@ void FindInPageView::Layout() { // The focus forwarder view is a hidden view that should cover the area // between the find text box and the find button so that when the user clicks // in that area we focus on the find text box. - int find_text_edge = find_text_->GetX() + find_text_->GetWidth(); + int find_text_edge = find_text_->x() + find_text_->width(); focus_forwarder_view_->SetBounds(find_text_edge, - find_previous_button_->GetY(), - find_previous_button_->GetX() - + find_previous_button_->y(), + find_previous_button_->x() - find_text_edge, - find_previous_button_->GetHeight()); + find_previous_button_->height()); } void FindInPageView::DidChangeBounds(const CRect& old_bounds, diff --git a/chrome/browser/history_view.cc b/chrome/browser/history_view.cc index 5add4fc..340280a 100644 --- a/chrome/browser/history_view.cc +++ b/chrome/browser/history_view.cc @@ -162,10 +162,10 @@ void SnippetRenderer::Paint(ChromeCanvas* canvas) { const int width = ProcessRun(NULL, 0, 0, match_iter, iter.prev(), iter.pos()); // Advance to the next line if necessary. - if (x + width > GetWidth()) { + if (x + width > View::width()) { x = 0; y += line_height; - if (y >= GetHeight()) + if (y >= height()) return; // Out of vertical space. } ProcessRun(canvas, x, y, match_iter, iter.prev(), iter.pos()); @@ -209,7 +209,7 @@ int SnippetRenderer::ProcessRun( if (canvas) { canvas->DrawStringInt(run, *font, SkColorSetRGB(0, 0, 0), x + total_width, y, - width, GetHeight(), + width, height(), ChromeCanvas::TEXT_VALIGN_BOTTOM); } @@ -338,7 +338,7 @@ HistoryItemRenderer::~HistoryItemRenderer() { void HistoryItemRenderer::GetThumbnailBounds(CRect* rect) { DCHECK(rect); - rect->right = GetWidth() - kEntryPadding; + rect->right = width() - kEntryPadding; rect->left = rect->right - kThumbnailWidth; rect->top = kEntryPadding; rect->bottom = rect->top + kThumbnailHeight; @@ -421,7 +421,7 @@ void HistoryItemRenderer::Layout() { GetThumbnailBounds(&thumbnail_rect); max_x = thumbnail_rect.left - kEntryPadding; } else { - max_x = GetWidth() - kEntryPadding; + max_x = width() - kEntryPadding; } // Calculate the ideal positions of some items. If possible, we @@ -564,8 +564,8 @@ void HistoryItemRenderer::StarStateChanged(bool state) { // Shift the location to make the bubble appear at a visually pleasing // location. gfx::Rect star_bounds(star_location.x, star_location.y + 4, - star_toggle_->GetWidth(), - star_toggle_->GetHeight()); + star_toggle_->width(), + star_toggle_->height()); HWND parent = GetViewContainer()->GetHWND(); Profile* profile = model_->profile(); GURL url = model_->GetURL(model_index_); @@ -869,9 +869,7 @@ void HistoryView::Layout() { kEntryPadding + kNoResultTextHeight); } - int x = GetX(); - int y = GetY(); - SetBounds(x, y, width, height); + SetBounds(x(), y(), width, height); } HistoryView::BreakOffsets::iterator HistoryView::GetBreakOffsetIteratorForY( @@ -904,7 +902,7 @@ void HistoryView::Paint(ChromeCanvas* canvas) { if (!canvas->getClipBounds(&clip)) return; - const int content_width = GetWidth() - kLeftMargin - kRightMargin; + const int content_width = width() - kLeftMargin - kRightMargin; const int x1 = kLeftMargin; int clip_y = SkScalarRound(clip.fTop); @@ -1114,7 +1112,7 @@ bool HistoryView::GetFloatingViewIDForPoint(int x, int y, int* id) { // +-------------- // First, verify the x coordinate is within the correct region. - if (x < kLeftMargin || x > GetWidth() - kRightMargin || + if (x < kLeftMargin || x > width() - kRightMargin || y >= GetLastEntryMaxY()) { return false; } @@ -1207,7 +1205,7 @@ ChromeViews::View* HistoryView::ValidateFloatingViewForID(int id) { show_results_); renderer->SetModel(model_.get(), model_index); renderer->SetBounds(kLeftMargin, y, - GetWidth() - kLeftMargin - kRightMargin, + width() - kLeftMargin - kRightMargin, GetEntryHeight()); floating_view = renderer; } @@ -1312,7 +1310,7 @@ gfx::Rect HistoryView::CalculateDeleteControlBounds(int base_y) { // the link. Additionally this should be baseline aligned with the date. I'm // not doing that now as a redesign of HistoryView is in the works. const int delete_width = GetDeleteControlWidth(); - const int delete_x = GetWidth() - kRightMargin - delete_width; + const int delete_x = width() - kRightMargin - delete_width; return gfx::Rect(delete_x, base_y + kDeleteControlOffset, delete_width, diff --git a/chrome/browser/native_ui_contents.cc b/chrome/browser/native_ui_contents.cc index e4dce38..0a1dfad 100644 --- a/chrome/browser/native_ui_contents.cc +++ b/chrome/browser/native_ui_contents.cc @@ -285,8 +285,8 @@ bool NativeUIContents::NavigateToPendingEntry(bool reload) { void NativeUIContents::Layout() { if (current_view_) { ChromeViews::RootView* root_view = GetRootView(); - current_view_->SetBounds(0, 0, root_view->GetWidth(), - root_view->GetHeight()); + current_view_->SetBounds(0, 0, root_view->width(), + root_view->height()); current_view_->Layout(); } } @@ -430,7 +430,7 @@ NativeUIBackground::~NativeUIBackground() { void NativeUIBackground::Paint(ChromeCanvas* canvas, ChromeViews::View* view) const { static const SkColor kBackground = SkColorSetRGB(255, 255, 255); - canvas->FillRectInt(kBackground, 0, 0, view->GetWidth(), view->GetHeight()); + canvas->FillRectInt(kBackground, 0, 0, view->width(), view->height()); } ///////////////////////////////////////////////////////////////////////////// @@ -605,7 +605,7 @@ void SearchableUIContainer::Layout() { static_cast<int>(search_button_size.cx) + kDestinationSmallerMargin; - product_logo_->SetBounds(std::max(GetWidth() - kProductLogo->width() - + product_logo_->SetBounds(std::max(width() - kProductLogo->width() - kProductLogoPadding, field_width), kProductLogoPadding, @@ -615,13 +615,13 @@ void SearchableUIContainer::Layout() { void SearchableUIContainer::Paint(ChromeCanvas* canvas) { SkColor top_color(kBackground); canvas->FillRectInt(top_color, 0, 0, - GetWidth(), scroll_view_->GetY()); + width(), scroll_view_->y()); - canvas->FillRectInt(kBottomMarginColor, 0, scroll_view_->GetY() - - kBottomMargin, GetWidth(), kBottomMargin); + canvas->FillRectInt(kBottomMarginColor, 0, scroll_view_->y() - + kBottomMargin, width(), kBottomMargin); canvas->FillRectInt(SkColorSetRGB(196, 196, 196), - 0, scroll_view_->GetY() - 1, GetWidth(), 1); + 0, scroll_view_->y() - 1, width(), 1); } ChromeViews::TextField* SearchableUIContainer::GetSearchField() const { diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc index 5d648a6..6ee840c 100644 --- a/chrome/browser/views/about_chrome_view.cc +++ b/chrome/browser/views/about_chrome_view.cc @@ -176,8 +176,8 @@ void AboutChromeView::Layout() { // Then we have the version number right below it. version_label_->GetPreferredSize(&sz); version_label_->SetBounds(kPanelHorizMargin, - about_title_label_->GetY() + - about_title_label_->GetHeight() + + about_title_label_->y() + + about_title_label_->height() + kRelatedControlVerticalSpacing, kVersionFieldWidth, sz.cy); @@ -223,7 +223,7 @@ void AboutChromeView::Layout() { // the throbber. We specify width to the end of the dialog because it contains // variable length messages. update_label_.GetPreferredSize(&sz); - int update_label_x = throbber_->GetX() + throbber_->GetWidth() + + int update_label_x = throbber_->x() + throbber_->width() + kRelatedControlHorizontalSpacing; update_label_.SetHorizontalAlignment(ChromeViews::Label::ALIGN_LEFT); update_label_.SetBounds(update_label_x, diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index 9de3d13..b7475ee 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -248,11 +248,11 @@ class BookmarkButton : public ChromeViews::TextButton { paint.setAlpha(static_cast<int>( (1.0 - show_animation_->GetCurrentValue()) * 255)); paint.setShader(gfx::CreateGradientShader(0, - GetHeight() + kTopMargin + kBottomMargin, + height() + kTopMargin + kBottomMargin, kTopBorderColor, kBackgroundColor))->safeUnref(); - canvas->FillRectInt(0, -kTopMargin, GetWidth(), - GetHeight() + kTopMargin + kBottomMargin, paint); + canvas->FillRectInt(0, -kTopMargin, width(), + height() + kTopMargin + kBottomMargin, paint); } virtual void AnimationProgressed(const Animation* animation) { @@ -559,21 +559,21 @@ class ButtonSeparatorView : public ChromeViews::View { virtual void Paint(ChromeCanvas* canvas) { SkPaint paint; paint.setShader(gfx::CreateGradientShader(0, - GetHeight() / 2, + height() / 2, kTopBorderColor, kSeparatorColor))->safeUnref(); SkRect rc = {SkIntToScalar(kSeparatorStartX), SkIntToScalar(0), - SkIntToScalar(1), SkIntToScalar(GetHeight() / 2) }; + SkIntToScalar(1), SkIntToScalar(height() / 2) }; canvas->drawRect(rc, paint); SkPaint paint_down; - paint_down.setShader(gfx::CreateGradientShader(GetHeight() / 2, - GetHeight(), + paint_down.setShader(gfx::CreateGradientShader(height() / 2, + height(), kSeparatorColor, kBackgroundColor))->safeUnref(); SkRect rc_down = { - SkIntToScalar(kSeparatorStartX), SkIntToScalar(GetHeight() / 2), - SkIntToScalar(1), SkIntToScalar(GetHeight() - 1) }; + SkIntToScalar(kSeparatorStartX), SkIntToScalar(height() / 2), + SkIntToScalar(1), SkIntToScalar(height() - 1) }; canvas->drawRect(rc_down, paint_down); } @@ -717,8 +717,8 @@ void BookmarkBarView::Layout() { // visible region and made invisible. int x = kLeftMargin; int y = kTopMargin; - int width = GetWidth() - kRightMargin - kLeftMargin; - int height = GetHeight() - kTopMargin - kBottomMargin; + int width = View::width() - kRightMargin - kLeftMargin; + int height = View::height() - kTopMargin - kBottomMargin; int separator_margin = kSeparatorMargin; if (IsNewTabPage()) { @@ -799,7 +799,7 @@ void BookmarkBarView::DidChangeBounds(const CRect& previous, void BookmarkBarView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { - if (is_add && child == this && GetHeight() > 0) { + if (is_add && child == this && height() > 0) { // We only layout while parented. When we become parented, if our bounds // haven't changed, DidChangeBounds won't get invoked and we won't layout. // Therefore we always force a layout when added. @@ -808,15 +808,12 @@ void BookmarkBarView::ViewHierarchyChanged(bool is_add, } void BookmarkBarView::Paint(ChromeCanvas* canvas) { - int width = GetWidth(); - int height = GetHeight(); - if (IsNewTabPage() && (!IsAlwaysShown() || size_animation_->IsAnimating())) { // Draw the background to match the new tab page. - canvas->FillRectInt(kNewtabBackgroundColor, 0, 0, width, height); + canvas->FillRectInt(kNewtabBackgroundColor, 0, 0, width(), height()); // Draw the 'bottom' of the toolbar above our bubble. - canvas->FillRectInt(kBottomBorderColor, 0, 0, width, 1); + canvas->FillRectInt(kBottomBorderColor, 0, 0, width(), 1); SkRect rect; @@ -832,8 +829,8 @@ void BookmarkBarView::Paint(ChromeCanvas* canvas) { (kNewtabVerticalPadding) * current_state; rect.set(SkDoubleToScalar(h_padding - 0.5), SkDoubleToScalar(v_padding - 0.5), - SkDoubleToScalar(width - h_padding - 0.5), - SkDoubleToScalar(height - v_padding - 0.5)); + SkDoubleToScalar(width() - h_padding - 0.5), + SkDoubleToScalar(height() - v_padding - 0.5)); double roundness = static_cast<double> (kNewtabBarRoundness) * current_state; @@ -842,7 +839,7 @@ void BookmarkBarView::Paint(ChromeCanvas* canvas) { SkPaint paint; paint.setAntiAlias(true); paint.setShader(gfx::CreateGradientShader(0, - height, + height(), kTopBorderColor, kBackgroundColor))->safeUnref(); @@ -862,13 +859,13 @@ void BookmarkBarView::Paint(ChromeCanvas* canvas) { } else { SkPaint paint; paint.setShader(gfx::CreateGradientShader(0, - height, + height(), kTopBorderColor, kBackgroundColor))->safeUnref(); - canvas->FillRectInt(0, 0, width, height, paint); + canvas->FillRectInt(0, 0, width(), height(), paint); - canvas->FillRectInt(kTopBorderColor, 0, 0, width, 1); - canvas->FillRectInt(kBottomBorderColor, 0, height - 1, width, 1); + canvas->FillRectInt(kTopBorderColor, 0, 0, width(), 1); + canvas->FillRectInt(kBottomBorderColor, 0, height() - 1, width(), 1); } } @@ -882,20 +879,20 @@ void BookmarkBarView::PaintChildren(ChromeCanvas* canvas) { DCHECK(index <= GetBookmarkButtonCount()); int x = 0; int y = 0; - int h = GetHeight(); + int h = height(); if (index == GetBookmarkButtonCount()) { if (index == 0) { x = kLeftMargin; } else { - x = GetBookmarkButton(index - 1)->GetX() + - GetBookmarkButton(index - 1)->GetWidth(); + x = GetBookmarkButton(index - 1)->x() + + GetBookmarkButton(index - 1)->width(); } } else { - x = GetBookmarkButton(index)->GetX(); + x = GetBookmarkButton(index)->x(); } if (GetBookmarkButtonCount() > 0 && GetBookmarkButton(0)->IsVisible()) { - y = GetBookmarkButton(0)->GetY(); - h = GetBookmarkButton(0)->GetHeight(); + y = GetBookmarkButton(0)->y(); + h = GetBookmarkButton(0)->height(); } // Since the drop indicator is painted directly onto the canvas, we must @@ -931,12 +928,12 @@ int BookmarkBarView::OnDragUpdated(const DropTargetEvent& event) { return 0; if (drop_info_->valid && - (drop_info_->x == event.GetX() && drop_info_->y == event.GetY())) { + (drop_info_->x == event.x() && drop_info_->y == event.y())) { return drop_info_->drag_operation; } - drop_info_->x = event.GetX(); - drop_info_->y = event.GetY(); + drop_info_->x = event.x(); + drop_info_->y = event.y(); int drop_index; bool drop_on; @@ -1277,10 +1274,10 @@ void BookmarkBarView::WriteDragData(View* sender, for (int i = 0; i < GetBookmarkButtonCount(); ++i) { if (sender == GetBookmarkButton(i)) { ChromeViews::TextButton* button = GetBookmarkButton(i); - ChromeCanvas canvas(button->GetWidth(), button->GetHeight(), false); + ChromeCanvas canvas(button->width(), button->height(), false); button->Paint(&canvas, true); - drag_utils::SetDragImageOnDataObject(canvas, button->GetWidth(), - button->GetHeight(), press_x, + drag_utils::SetDragImageOnDataObject(canvas, button->width(), + button->height(), press_x, press_y, data); WriteDragData(model_->GetBookmarkBarNode()->GetChild(i), data); return; @@ -1316,12 +1313,12 @@ void BookmarkBarView::RunMenu(ChromeViews::View* view, // When we set the menu's position, we must take into account the mirrored // position of the View relative to its parent. This can be easily done by - // passing the right flag to View::GetX(). + // passing the right flag to View::x(). int x = view->GetX(APPLY_MIRRORING_TRANSFORMATION); - int height = GetHeight() - kMenuOffset; + int bar_height = height() - kMenuOffset; if (IsNewTabPage() && !IsAlwaysShown()) - height -= kNewtabVerticalPadding; + bar_height -= kNewtabVerticalPadding; int start_index = 0; if (view == other_bookmarked_button_) { @@ -1358,7 +1355,7 @@ void BookmarkBarView::RunMenu(ChromeViews::View* view, HWND parent_hwnd = GetViewContainer()->GetHWND(); menu_runner_->RunMenuAt(parent_hwnd, gfx::Rect(screen_loc.x, screen_loc.y, - view->GetWidth(), height), + view->width(), bar_height), anchor_point, false); } @@ -1492,7 +1489,7 @@ void BookmarkBarView::ShowDropFolderForNode(BookmarkNode* node) { // Note that both the anchor position and the position of the menu itself // change depending on the locale. Also note that we must apply the // mirroring transformation when querying for the child View bounds - // (View::GetX(), specifically) so that we end up with the correct screen + // (View::x(), specifically) so that we end up with the correct screen // coordinates if the View in question is mirrored. MenuItemView::AnchorPosition anchor = MenuItemView::TOPLEFT; if (node == model_->other_node()) { @@ -1528,8 +1525,8 @@ void BookmarkBarView::ShowDropFolderForNode(BookmarkNode* node) { drop_menu_runner_->RunMenuAt( GetViewContainer()->GetHWND(), gfx::Rect(screen_loc.x, screen_loc.y, - view_to_position_menu_from->GetWidth(), - view_to_position_menu_from->GetHeight()), + view_to_position_menu_from->width(), + view_to_position_menu_from->height()), anchor, true); } @@ -1570,23 +1567,23 @@ int BookmarkBarView::CalculateDropOperation(const DropTargetEvent& event, // right-to-left on RTL locales). Thus, in order to make sure the drop // coordinates calculation works, we mirror the event's X coordinate if the // locale is RTL. - int mirrored_x = MirroredXCoordinateInsideView(event.GetX()); + int mirrored_x = MirroredXCoordinateInsideView(event.x()); *index = -1; *drop_on = false; *is_over_other = *is_over_overflow = false; - if (event.GetY() < other_bookmarked_button_->GetY() || - event.GetY() >= other_bookmarked_button_->GetY() + - other_bookmarked_button_->GetHeight()) { + if (event.y() < other_bookmarked_button_->y() || + event.y() >= other_bookmarked_button_->y() + + other_bookmarked_button_->height()) { // Mouse isn't over a button. return DragDropTypes::DRAG_NONE; } bool found = false; - const int other_delta_x = mirrored_x - other_bookmarked_button_->GetX(); + const int other_delta_x = mirrored_x - other_bookmarked_button_->x(); if (other_delta_x >= 0 && - other_delta_x < other_bookmarked_button_->GetWidth()) { + other_delta_x < other_bookmarked_button_->width()) { // Mouse is over 'other' folder. *is_over_other = true; *drop_on = true; @@ -1600,8 +1597,8 @@ int BookmarkBarView::CalculateDropOperation(const DropTargetEvent& event, for (int i = 0; i < GetBookmarkButtonCount() && GetBookmarkButton(i)->IsVisible() && !found; i++) { ChromeViews::TextButton* button = GetBookmarkButton(i); - int button_x = mirrored_x - button->GetX(); - int button_w = button->GetWidth(); + int button_x = mirrored_x - button->x(); + int button_w = button->width(); if (button_x < button_w) { found = true; BookmarkNode* node = model_->GetBookmarkBarNode()->GetChild(i); @@ -1626,9 +1623,9 @@ int BookmarkBarView::CalculateDropOperation(const DropTargetEvent& event, if (!found) { if (overflow_button_->IsVisible()) { // Are we over the overflow button? - int overflow_delta_x = mirrored_x - overflow_button_->GetX(); + int overflow_delta_x = mirrored_x - overflow_button_->x(); if (overflow_delta_x >= 0 && - overflow_delta_x < overflow_button_->GetWidth()) { + overflow_delta_x < overflow_button_->width()) { // Mouse is over overflow button. *index = GetFirstHiddenNodeIndex(); *is_over_overflow = true; @@ -1639,7 +1636,7 @@ int BookmarkBarView::CalculateDropOperation(const DropTargetEvent& event, } else { return DragDropTypes::DRAG_NONE; } - } else if (mirrored_x < other_bookmarked_button_->GetX()) { + } else if (mirrored_x < other_bookmarked_button_->x()) { // Mouse is after the last visible button but before more recently // bookmarked; use the last visible index. *index = GetFirstHiddenNodeIndex(); @@ -1837,4 +1834,3 @@ void BookmarkBarView::StopThrobbing(bool immediate) { throbbing_view_->StartThrobbing(immediate ? 0 : 4); throbbing_view_ = NULL; } - diff --git a/chrome/browser/views/bookmark_bar_view_test.cc b/chrome/browser/views/bookmark_bar_view_test.cc index 211d88d..547f992 100644 --- a/chrome/browser/views/bookmark_bar_view_test.cc +++ b/chrome/browser/views/bookmark_bar_view_test.cc @@ -428,7 +428,7 @@ class BookmarkBarViewTest5 : public BookmarkBarViewEventTestBase { void Step3() { ChromeViews::MenuItemView* target_menu = bb_view_->GetMenu()->GetSubmenu()->GetMenuItemAt(1); - CPoint loc(1, target_menu->GetHeight() - 1); + CPoint loc(1, target_menu->height() - 1); ChromeViews::View::ConvertPointToScreen(target_menu, &loc); // Start a drag. @@ -443,7 +443,7 @@ class BookmarkBarViewTest5 : public BookmarkBarViewEventTestBase { // Drop the item so that it's now the second item. ChromeViews::MenuItemView* target_menu = bb_view_->GetMenu()->GetSubmenu()->GetMenuItemAt(1); - CPoint loc(1, target_menu->GetHeight() - 1); + CPoint loc(1, target_menu->height() - 1); ChromeViews::View::ConvertPointToScreen(target_menu, &loc); ui_controls::SendMouseMove(loc.x, loc.y); @@ -537,7 +537,7 @@ class BookmarkBarViewTest7 : public BookmarkBarViewEventTestBase { // Drag over other button. ChromeViews::TextButton* other_button = bb_view_->other_bookmarked_button(); - CPoint loc(other_button->GetWidth() / 2, other_button->GetHeight() / 2); + CPoint loc(other_button->width() / 2, other_button->height() / 2); ChromeViews::View::ConvertPointToScreen(other_button, &loc); // Start a drag. @@ -610,7 +610,7 @@ class BookmarkBarViewTest8 : public BookmarkBarViewEventTestBase { // Drag over other button. ChromeViews::TextButton* other_button = bb_view_->other_bookmarked_button(); - CPoint loc(other_button->GetWidth() / 2, other_button->GetHeight() / 2); + CPoint loc(other_button->width() / 2, other_button->height() / 2); ChromeViews::View::ConvertPointToScreen(other_button, &loc); // Start a drag. @@ -628,7 +628,7 @@ class BookmarkBarViewTest8 : public BookmarkBarViewEventTestBase { // Now drag back over first menu. ChromeViews::TextButton* button = bb_view_->GetBookmarkButton(0); - CPoint loc(button->GetWidth() / 2, button->GetHeight() / 2); + CPoint loc(button->width() / 2, button->height() / 2); ChromeViews::View::ConvertPointToScreen(button, &loc); ui_controls::SendMouseMoveNotifyWhenDone(loc.x, loc.y, NewRunnableMethod(this, &BookmarkBarViewTest8::Step5)); @@ -693,8 +693,8 @@ class BookmarkBarViewTest9 : public BookmarkBarViewEventTestBase { ASSERT_TRUE(scroll_container != NULL); ChromeViews::View* scroll_down_button = scroll_container->GetChildViewAt(1); ASSERT_TRUE(scroll_down_button); - CPoint loc(scroll_down_button->GetWidth() / 2, - scroll_down_button->GetHeight() / 2); + CPoint loc(scroll_down_button->width() / 2, + scroll_down_button->height() / 2); ChromeViews::View::ConvertPointToScreen(scroll_down_button, &loc); ui_controls::SendMouseMoveNotifyWhenDone( loc.x, loc.y, CreateEventTask(this, &BookmarkBarViewTest9::Step3)); diff --git a/chrome/browser/views/clear_browsing_data.cc b/chrome/browser/views/clear_browsing_data.cc index 06d9b6d..328cf6f 100644 --- a/chrome/browser/views/clear_browsing_data.cc +++ b/chrome/browser/views/clear_browsing_data.cc @@ -125,44 +125,44 @@ void ClearBrowsingDataView::Layout() { // Check-boxes go beneath it (with a little indentation). del_history_checkbox_->GetPreferredSize(&sz); del_history_checkbox_->SetBounds(2 * kPanelHorizMargin, - delete_all_label_->GetY() + - delete_all_label_->GetHeight() + + delete_all_label_->y() + + delete_all_label_->height() + kRelatedControlVerticalSpacing, sz.cx, sz.cy); del_downloads_checkbox_->GetPreferredSize(&sz); del_downloads_checkbox_->SetBounds(2 * kPanelHorizMargin, - del_history_checkbox_->GetY() + - del_history_checkbox_->GetHeight() + + del_history_checkbox_->y() + + del_history_checkbox_->height() + kRelatedControlVerticalSpacing, sz.cx, sz.cy); del_cache_checkbox_->GetPreferredSize(&sz); del_cache_checkbox_->SetBounds(2 * kPanelHorizMargin, - del_downloads_checkbox_->GetY() + - del_downloads_checkbox_->GetHeight() + + del_downloads_checkbox_->y() + + del_downloads_checkbox_->height() + kRelatedControlVerticalSpacing, sz.cx, sz.cy); del_cookies_checkbox_->GetPreferredSize(&sz); del_cookies_checkbox_->SetBounds(2 * kPanelHorizMargin, - del_cache_checkbox_->GetY() + - del_cache_checkbox_->GetHeight() + + del_cache_checkbox_->y() + + del_cache_checkbox_->height() + kRelatedControlVerticalSpacing, sz.cx, sz.cy); del_passwords_checkbox_->GetPreferredSize(&sz); del_passwords_checkbox_->SetBounds(2 * kPanelHorizMargin, - del_cookies_checkbox_->GetY() + - del_cookies_checkbox_->GetHeight() + + del_cookies_checkbox_->y() + + del_cookies_checkbox_->height() + kRelatedControlVerticalSpacing, sz.cx, sz.cy); // Time period label is next below the combo boxes. time_period_label_->GetPreferredSize(&sz); time_period_label_->SetBounds(kPanelHorizMargin, - del_passwords_checkbox_->GetY() + - del_passwords_checkbox_->GetHeight() + + del_passwords_checkbox_->y() + + del_passwords_checkbox_->height() + kRelatedControlVerticalSpacing + kExtraMarginForTimePeriodLabel, sz.cx, sz.cy); @@ -171,10 +171,10 @@ void ClearBrowsingDataView::Layout() { // vertically to the label as well. int label_y_size = sz.cy; time_period_combobox_->GetPreferredSize(&sz); - time_period_combobox_->SetBounds(time_period_label_->GetX() + - time_period_label_->GetWidth() + + time_period_combobox_->SetBounds(time_period_label_->x() + + time_period_label_->width() + kRelatedControlVerticalSpacing, - time_period_label_->GetY() - + time_period_label_->y() - ((sz.cy - label_y_size) / 2), sz.cx, sz.cy); @@ -192,7 +192,7 @@ void ClearBrowsingDataView::Layout() { // The status label should be at the bottom of the screen, to the right of // the throbber. status_label_.GetPreferredSize(&sz); - int status_label_x = throbber_->GetX() + throbber_->GetWidth() + + int status_label_x = throbber_->x() + throbber_->width() + kRelatedControlHorizontalSpacing; status_label_.SetHorizontalAlignment(ChromeViews::Label::ALIGN_LEFT); status_label_.SetBounds(status_label_x, diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc index 4766ea3..7da4086 100644 --- a/chrome/browser/views/constrained_window_impl.cc +++ b/chrome/browser/views/constrained_window_impl.cc @@ -583,7 +583,7 @@ void ConstrainedWindowNonClientView::Layout() { } close_button_->GetPreferredSize(&ps); - close_button_->SetBounds(GetWidth() - ps.cx - kWindowControlsRightOffset, + close_button_->SetBounds(width() - ps.cx - kWindowControlsRightOffset, kWindowControlsTopOffset, ps.cx, ps.cy); int titlebar_height = CalculateTitlebarHeight(); @@ -599,14 +599,14 @@ void ConstrainedWindowNonClientView::Layout() { if (window_delegate_->ShouldShowWindowTitle()) { int spacing = kWindowLeftSpacing; - int title_right = close_button_->GetX() - spacing; + int title_right = close_button_->x() - spacing; int title_left = icon_bounds_.right() + spacing; title_bounds_.SetRect(title_left, kTitleTopOffset, title_right - title_left, title_font_.height()); } } - client_bounds_ = CalculateClientAreaBounds(GetWidth(), GetHeight()); + client_bounds_ = CalculateClientAreaBounds(width(), height()); if (should_display_url_field) { location_bar_->SetBounds(client_bounds_.x() - kLocationBarOffset, client_bounds_.y() - location_bar_height - @@ -673,9 +673,6 @@ void ConstrainedWindowNonClientView::UpdateThrobber() { } void ConstrainedWindowNonClientView::PaintFrameBorder(ChromeCanvas* canvas) { - int width = GetWidth(); - int height = GetHeight(); - SkBitmap* top_left_corner = resources_->GetPartBitmap(FRAME_TOP_LEFT_CORNER); SkBitmap* top_right_corner = resources_->GetPartBitmap(FRAME_TOP_RIGHT_CORNER); @@ -691,33 +688,33 @@ void ConstrainedWindowNonClientView::PaintFrameBorder(ChromeCanvas* canvas) { // Top. canvas->DrawBitmapInt(*top_left_corner, 0, 0); canvas->TileImageInt(*top_edge, top_left_corner->width(), 0, - width - top_right_corner->width(), top_edge->height()); + width() - top_right_corner->width(), top_edge->height()); canvas->DrawBitmapInt( - *top_right_corner, width - top_right_corner->width(), 0); + *top_right_corner, width() - top_right_corner->width(), 0); // Right. int top_stack_height = top_right_corner->height(); - canvas->TileImageInt(*right_edge, width - right_edge->width(), + canvas->TileImageInt(*right_edge, width() - right_edge->width(), top_stack_height, right_edge->width(), - height - top_stack_height - + height() - top_stack_height - bottom_right_corner->height()); // Bottom. canvas->DrawBitmapInt(*bottom_right_corner, - width - bottom_right_corner->width(), - height - bottom_right_corner->height()); + width() - bottom_right_corner->width(), + height() - bottom_right_corner->height()); canvas->TileImageInt(*bottom_edge, bottom_left_corner->width(), - height - bottom_edge->height(), - width - bottom_left_corner->width() - + height() - bottom_edge->height(), + width() - bottom_left_corner->width() - bottom_right_corner->width(), bottom_edge->height()); canvas->DrawBitmapInt(*bottom_left_corner, 0, - height - bottom_left_corner->height()); + height() - bottom_left_corner->height()); // Left. top_stack_height = top_left_corner->height(); canvas->TileImageInt(*left_edge, 0, top_stack_height, left_edge->width(), - height - top_stack_height - + height() - top_stack_height - bottom_left_corner->height()); // Contents Border. @@ -1139,8 +1136,8 @@ void ConstrainedWindowImpl::InitSizeForContents( contents_container_->Attach(constrained_contents_->GetContainerHWND()); constrained_contents_->SizeContents( - gfx::Size(contents_container_->GetWidth(), - contents_container_->GetHeight())); + gfx::Size(contents_container_->width(), + contents_container_->height())); current_bounds_ = initial_bounds; // Note that this is HWND_TOP, not HWND_TOPMOST... this is important diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc index 8ed9408..a03b5bc 100644 --- a/chrome/browser/views/download_item_view.cc +++ b/chrome/browser/views/download_item_view.cc @@ -229,8 +229,7 @@ void DownloadItemView::OnDownloadUpdated(DownloadItem* download) { // Load an icon for the file type we're downloading, and animate any in progress // download state. void DownloadItemView::Paint(ChromeCanvas* canvas) { - int height = GetHeight(); - int center_width = GetWidth() - kLeftPadding - + int center_width = width() - kLeftPadding - normal_body_image_set_.left->width() - normal_body_image_set_.right->width() - normal_drop_down_image_set_.center->width(); @@ -427,8 +426,8 @@ bool DownloadItemView::OnMousePressed(const ChromeViews::MouseEvent& event) { complete_animation_->End(); if (event.IsOnlyLeftMouseButton()) { - WTL::CPoint point(event.GetX(), event.GetY()); - if (event.GetX() < drop_down_x_) { + WTL::CPoint point(event.x(), event.y()); + if (event.x() < drop_down_x_) { SetState(PUSHED, NORMAL); return true; } @@ -452,9 +451,9 @@ bool DownloadItemView::OnMousePressed(const ChromeViews::MouseEvent& event) { // // TODO(idana): when bug# 1163334 is fixed the following check should be // replaced with UILayoutIsRightToLeft(). - point.y = GetHeight(); + point.y = height(); if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) { - point.x = GetWidth(); + point.x = width(); } else { point.x = drop_down_x_; } @@ -472,7 +471,7 @@ bool DownloadItemView::OnMousePressed(const ChromeViews::MouseEvent& event) { } void DownloadItemView::OnMouseMoved(const ChromeViews::MouseEvent& event) { - bool on_body = event.GetX() < drop_down_x_; + bool on_body = event.x() < drop_down_x_; SetState(on_body ? HOT : NORMAL, on_body ? NORMAL : HOT); if (on_body) { body_hover_animation_->Show(); @@ -491,7 +490,7 @@ void DownloadItemView::OnMouseReleased(const ChromeViews::MouseEvent& event, starting_drag_ = false; return; } - if (event.IsOnlyLeftMouseButton() && event.GetX() < drop_down_x_) + if (event.IsOnlyLeftMouseButton() && event.x() < drop_down_x_) OpenDownload(); SetState(NORMAL, NORMAL); diff --git a/chrome/browser/views/download_shelf_view.cc b/chrome/browser/views/download_shelf_view.cc index df6b7d5..4ab60d1 100644 --- a/chrome/browser/views/download_shelf_view.cc +++ b/chrome/browser/views/download_shelf_view.cc @@ -156,7 +156,7 @@ void DownloadShelfView::Paint(ChromeCanvas* canvas) { } void DownloadShelfView::PaintBorder(ChromeCanvas* canvas) { - canvas->FillRectInt(kBorderColor, 0, 0, GetWidth(), 1); + canvas->FillRectInt(kBorderColor, 0, 0, width(), 1); } void DownloadShelfView::GetPreferredSize(CSize *out) { @@ -203,8 +203,6 @@ void DownloadShelfView::AnimationEnded(const Animation *animation) { } void DownloadShelfView::Layout() { - int width = GetWidth(); - int height = GetHeight(); CSize image_size; arrow_image_->GetPreferredSize(&image_size); CSize close_button_size; @@ -212,21 +210,21 @@ void DownloadShelfView::Layout() { CSize show_all_size; show_all_view_->GetPreferredSize(&show_all_size); int max_download_x = - std::max<int>(0, width - kRightPadding - close_button_size.cx - + std::max<int>(0, width() - kRightPadding - close_button_size.cx - kCloseAndLinkPadding - show_all_size.cx - image_size.cx - kDownloadPadding); int next_x = max_download_x + kDownloadPadding; // Align vertically with show_all_view_. - arrow_image_->SetBounds(next_x, CenterPosition(show_all_size.cy, height), + arrow_image_->SetBounds(next_x, CenterPosition(show_all_size.cy, height()), image_size.cx, image_size.cy); next_x += image_size.cx + kDownloadsTitlePadding; show_all_view_->SetBounds(next_x, - CenterPosition(show_all_size.cy, height), + CenterPosition(show_all_size.cy, height()), show_all_size.cx, show_all_size.cy); next_x += show_all_size.cx + kCloseAndLinkPadding; close_button_->SetBounds(next_x, - CenterPosition(close_button_size.cy, height), + CenterPosition(close_button_size.cy, height()), close_button_size.cx, close_button_size.cy); @@ -239,18 +237,18 @@ void DownloadShelfView::Layout() { int x = next_x; // Figure out width of item. - int width = view_size.cx; + int item_width = view_size.cx; if (new_item_animation_->IsAnimating() && ri == download_views_.rbegin()) { - width = static_cast<int>(static_cast<double>(view_size.cx) * + item_width = static_cast<int>(static_cast<double>(view_size.cx) * new_item_animation_->GetCurrentValue()); } - next_x += (width + kDownloadPadding); + next_x += (item_width + kDownloadPadding); // Make sure our item can be contained within the shelf. if (next_x < max_download_x) { (*ri)->SetVisible(true); - (*ri)->SetBounds(x, CenterPosition(view_size.cy, height), width, + (*ri)->SetBounds(x, CenterPosition(view_size.cy, height()), item_width, view_size.cy); } else { (*ri)->SetVisible(false); diff --git a/chrome/browser/views/download_tab_view.cc b/chrome/browser/views/download_tab_view.cc index 8c31275..62e5668 100644 --- a/chrome/browser/views/download_tab_view.cc +++ b/chrome/browser/views/download_tab_view.cc @@ -262,7 +262,7 @@ void DownloadItemTabView::LayoutComplete() { file_name_size.cy + kVerticalPadding + download_util::kBigProgressIconOffset, std::min(kFilenameSize, - static_cast<int>(GetWidth() - dx)), + static_cast<int>(width() - dx)), url_size.cy); download_url_->SetVisible(true); dx += kFilenameSize + kSpacer; @@ -309,7 +309,7 @@ void DownloadItemTabView::LayoutCancelled() { file_name_size.cy + kVerticalPadding + download_util::kBigProgressIconOffset, std::min(kFilenameSize - kProgressSize - kSpacer, - static_cast<int>(GetWidth() - dx)), + static_cast<int>(width() - dx)), url_size.cy); download_url_->SetVisible(true); @@ -395,7 +395,7 @@ void DownloadItemTabView::LayoutInProgress() { download_url_->SetBounds(dx, file_name_size.cy + kVerticalPadding + download_util::kBigProgressIconOffset, std::min(kFilenameSize - kProgressSize - kSpacer, - static_cast<int>(GetWidth() - dx)), + static_cast<int>(width() - dx)), url_size.cy); download_url_->SetVisible(true); @@ -585,7 +585,7 @@ void DownloadItemTabView::DidChangeBounds(const CRect& previous, } bool DownloadItemTabView::OnMousePressed(const ChromeViews::MouseEvent& event) { - CPoint point(event.GetX(), event.GetY()); + CPoint point(event.x(), event.y()); // If the click is in the highlight region, then highlight this download. // Otherwise, remove the highlighting from any download. @@ -623,7 +623,7 @@ bool DownloadItemTabView::OnMouseDragged(const ChromeViews::MouseEvent& event) { if (model_->state() != DownloadItem::COMPLETE) return false; - CPoint point(event.GetX(), event.GetY()); + CPoint point(event.x(), event.y()); // In order to make sure drag and drop works as expected when the UI is // mirrored, we can either flip the mouse X coordinate or flip the X position @@ -723,12 +723,9 @@ void DownloadTabView::Layout() { View* v = GetParent(); if (v) { v->GetLocalBounds(&r, true); - int x = GetX(); - int y = GetY(); - int w = v->GetWidth(); int h = static_cast<int>(downloads_.size()) * (download_util::kBigProgressIconSize + kSpacer) + kSpacer; - SetBounds(x, y, w, h); + SetBounds(x(), y(), v->width(), h); } } @@ -752,7 +749,7 @@ void DownloadTabView::Paint(ChromeCanvas* canvas) { continue; download_rect.set(SkIntToScalar(0), SkIntToScalar(y), - SkIntToScalar(GetWidth()), + SkIntToScalar(width()), SkIntToScalar(y + download_util::kBigProgressIconSize)); if (SkRect::Intersects(clip, download_rect)) { // The DownloadManager stores downloads earliest first, but this @@ -761,7 +758,7 @@ void DownloadTabView::Paint(ChromeCanvas* canvas) { download_renderer_.SetModel(downloads_[index], this); PaintFloatingView(canvas, &download_renderer_, 0, y, - GetWidth(), download_util::kBigProgressIconSize); + width(), download_util::kBigProgressIconSize); } } } @@ -796,7 +793,7 @@ ChromeViews::View* DownloadTabView::CreateFloatingViewForIndex(int index) { dl->SetModel(downloads_[index], this); int row = static_cast<int>(downloads_.size()) - 1 - index; int y_pos = row * (download_util::kBigProgressIconSize + kSpacer) + kSpacer; - dl->SetBounds(0, y_pos, GetWidth(), download_util::kBigProgressIconSize); + dl->SetBounds(0, y_pos, width(), download_util::kBigProgressIconSize); dl->Layout(); AttachFloatingView(dl, index); return dl; @@ -1023,7 +1020,7 @@ bool DownloadTabView::ItemIsSelected(DownloadItem* download) { void DownloadTabView::SchedulePaintForViewAtIndex(int index) { int y = GetYPositionForIndex(index); - SchedulePaint(0, y, GetWidth(), download_util::kBigProgressIconSize); + SchedulePaint(0, y, width(), download_util::kBigProgressIconSize); } int DownloadTabView::GetYPositionForIndex(int index) { diff --git a/chrome/browser/views/first_run_bubble.cc b/chrome/browser/views/first_run_bubble.cc index 6696e55..2dfc8ef 100644 --- a/chrome/browser/views/first_run_bubble.cc +++ b/chrome/browser/views/first_run_bubble.cc @@ -126,7 +126,7 @@ class FirstRunBubbleView : public ChromeViews::View, canvas.cx - kBubblePadding * 2, pref_size.cy); - int next_v_space = label1_->GetY() + pref_size.cy + + int next_v_space = label1_->y() + pref_size.cy + kRelatedControlSmallVerticalSpacing; label2_->GetPreferredSize(&pref_size); @@ -134,7 +134,7 @@ class FirstRunBubbleView : public ChromeViews::View, canvas.cx - kBubblePadding * 2, pref_size.cy); - next_v_space = label2_->GetY() + label2_->GetHeight() + + next_v_space = label2_->y() + label2_->height() + kPanelSubVerticalSpacing; label3_->GetPreferredSize(&pref_size); @@ -148,8 +148,8 @@ class FirstRunBubbleView : public ChromeViews::View, pref_size.cx, pref_size.cy); keep_button_->GetPreferredSize(&pref_size); - keep_button_->SetBounds(change_button_->GetX() - pref_size.cx - - kRelatedButtonHSpacing, change_button_->GetY(), + keep_button_->SetBounds(change_button_->x() - pref_size.cx - + kRelatedButtonHSpacing, change_button_->y(), pref_size.cx, pref_size.cy); } diff --git a/chrome/browser/views/first_run_customize_view.cc b/chrome/browser/views/first_run_customize_view.cc index 1109ac9..378a135 100644 --- a/chrome/browser/views/first_run_customize_view.cc +++ b/chrome/browser/views/first_run_customize_view.cc @@ -104,8 +104,8 @@ void FirstRunCustomizeView::Layout() { canvas.cx - pref_size.cx, pref_size.cy); AdjustDialogWidth(main_label_); - int next_v_space = background_image()->GetY() + - background_image()->GetHeight() + kPanelVertMargin; + int next_v_space = background_image()->y() + + background_image()->height() + kPanelVertMargin; import_cbox_->GetPreferredSize(&pref_size); import_cbox_->SetBounds(kPanelHorizMargin, next_v_space, @@ -113,8 +113,8 @@ void FirstRunCustomizeView::Layout() { import_cbox_->SetIsSelected(true); - int x_offset = import_cbox_->GetX() + - import_cbox_->GetWidth(); + int x_offset = import_cbox_->x() + + import_cbox_->width(); import_from_combo_->GetPreferredSize(&pref_size); import_from_combo_->SetBounds(x_offset, next_v_space, @@ -122,7 +122,7 @@ void FirstRunCustomizeView::Layout() { AdjustDialogWidth(import_from_combo_); - next_v_space = import_cbox_->GetY() + import_cbox_->GetHeight() + + next_v_space = import_cbox_->y() + import_cbox_->height() + kUnrelatedControlVerticalSpacing; default_browser_cbox_->GetPreferredSize(&pref_size); @@ -131,7 +131,7 @@ void FirstRunCustomizeView::Layout() { AdjustDialogWidth(default_browser_cbox_); - next_v_space += default_browser_cbox_->GetHeight() + + next_v_space += default_browser_cbox_->height() + kUnrelatedControlVerticalSpacing; shortcuts_label_->GetPreferredSize(&pref_size); @@ -140,7 +140,7 @@ void FirstRunCustomizeView::Layout() { AdjustDialogWidth(shortcuts_label_); - next_v_space += shortcuts_label_->GetHeight() + + next_v_space += shortcuts_label_->height() + kRelatedControlVerticalSpacing; desktop_shortcut_cbox_->GetPreferredSize(&pref_size); @@ -149,7 +149,7 @@ void FirstRunCustomizeView::Layout() { AdjustDialogWidth(desktop_shortcut_cbox_); - next_v_space += desktop_shortcut_cbox_->GetHeight() + + next_v_space += desktop_shortcut_cbox_->height() + kRelatedControlVerticalSpacing; quick_shortcut_cbox_->GetPreferredSize(&pref_size); diff --git a/chrome/browser/views/first_run_view.cc b/chrome/browser/views/first_run_view.cc index 9e581e3..1796b56 100644 --- a/chrome/browser/views/first_run_view.cc +++ b/chrome/browser/views/first_run_view.cc @@ -107,30 +107,30 @@ void FirstRunView::Layout() { CSize pref_size; welcome_label_->GetPreferredSize(&pref_size); // Wrap the label text before we overlap the product icon. - int label_width = background_image()->GetWidth() - + int label_width = background_image()->width() - rb.GetBitmapNamed(IDR_WIZARD_ICON)->width() - kPanelHorizMargin; welcome_label_->SetBounds(kPanelHorizMargin, kPanelVertMargin, label_width, pref_size.cy); AdjustDialogWidth(welcome_label_); - int next_v_space = background_image()->GetY() + - background_image()->GetHeight() + kPanelVertMargin; + int next_v_space = background_image()->y() + + background_image()->height() + kPanelVertMargin; actions_label_->GetPreferredSize(&pref_size); actions_label_->SetBounds(kPanelHorizMargin, next_v_space, pref_size.cx, pref_size.cy); AdjustDialogWidth(actions_label_); - next_v_space = actions_label_->GetY() + - actions_label_->GetHeight() + kVertSpacing; + next_v_space = actions_label_->y() + + actions_label_->height() + kVertSpacing; - label_width = GetWidth() - (2 * kPanelHorizMargin); + label_width = width() - (2 * kPanelHorizMargin); int label_height = actions_import_->GetHeightForWidth(label_width); actions_import_->SetBounds(kPanelHorizMargin, next_v_space, label_width, label_height); - next_v_space = actions_import_->GetY() + - actions_import_->GetHeight() + kVertSpacing; + next_v_space = actions_import_->y() + + actions_import_->height() + kVertSpacing; AdjustDialogWidth(actions_import_); label_height = actions_shorcuts_->GetHeightForWidth(label_width); @@ -138,8 +138,8 @@ void FirstRunView::Layout() { label_height); AdjustDialogWidth(actions_shorcuts_); - next_v_space = actions_shorcuts_->GetY() + - actions_shorcuts_->GetHeight() + + next_v_space = actions_shorcuts_->y() + + actions_shorcuts_->height() + kUnrelatedControlVerticalSpacing; customize_link_->GetPreferredSize(&pref_size); diff --git a/chrome/browser/views/first_run_view_base.cc b/chrome/browser/views/first_run_view_base.cc index e6aa69d..df1268b 100644 --- a/chrome/browser/views/first_run_view_base.cc +++ b/chrome/browser/views/first_run_view_base.cc @@ -118,8 +118,8 @@ void FirstRunViewBase::Layout() { background_image_->GetPreferredSize(&pref_size); background_image_->SetBounds(0, 0, canvas.cx, pref_size.cy); - int next_v_space = background_image_->GetY() + - background_image_->GetHeight() - 2; + int next_v_space = background_image_->y() + + background_image_->height() - 2; separator_1_->GetPreferredSize(&pref_size); separator_1_->SetBounds(0 , next_v_space, canvas.cx + 1, pref_size.cy); diff --git a/chrome/browser/views/frame/aero_glass_frame.cc b/chrome/browser/views/frame/aero_glass_frame.cc index 2d7d4bf..f951b3d 100644 --- a/chrome/browser/views/frame/aero_glass_frame.cc +++ b/chrome/browser/views/frame/aero_glass_frame.cc @@ -207,7 +207,7 @@ void AeroGlassFrame::UpdateDWMFrame() { gfx::Rect tabstrip_bounds = GetBoundsForTabStrip(browser_view_->tabstrip()); client_edge_top_height = - client_view()->GetY() + tabstrip_bounds.bottom(); + client_view()->y() + tabstrip_bounds.bottom(); } // Now poke the DWM. diff --git a/chrome/browser/views/frame/aero_glass_non_client_view.cc b/chrome/browser/views/frame/aero_glass_non_client_view.cc index 5a359b4..16bafa3 100644 --- a/chrome/browser/views/frame/aero_glass_non_client_view.cc +++ b/chrome/browser/views/frame/aero_glass_non_client_view.cc @@ -127,7 +127,7 @@ AeroGlassNonClientView::~AeroGlassNonClientView() { gfx::Rect AeroGlassNonClientView::GetBoundsForTabStrip(TabStrip* tabstrip) { // If we are maximized, the tab strip will be in line with the window // controls, so we need to make sure they don't overlap. - int tabstrip_width = browser_view_->GetWidth(); + int tabstrip_width = browser_view_->width(); if(frame_->IsMaximized()) { TITLEBARINFOEX titlebar_info; titlebar_info.cbSize = sizeof(TITLEBARINFOEX); @@ -145,17 +145,17 @@ gfx::Rect AeroGlassNonClientView::GetBoundsForTabStrip(TabStrip* tabstrip) { /////////////////////////////////////////////////////////////////////////////// // AeroGlassNonClientView, ChromeViews::NonClientView implementation: -gfx::Rect AeroGlassNonClientView::CalculateClientAreaBounds(int width, - int height) const { +gfx::Rect AeroGlassNonClientView::CalculateClientAreaBounds(int win_width, + int win_height) const { if (!browser_view_->IsToolbarVisible()) { // App windows don't have a toolbar. - return gfx::Rect(0, 0, GetWidth(), GetHeight()); + return gfx::Rect(0, 0, width(), height()); } int top_margin = CalculateNonClientTopHeight(); return gfx::Rect(kWindowHorizontalClientEdgeWidth, top_margin, - std::max(0, width - (2 * kWindowHorizontalClientEdgeWidth)), - std::max(0, height - top_margin - kWindowBottomClientEdgeHeight)); + std::max(0, win_width - (2 * kWindowHorizontalClientEdgeWidth)), + std::max(0, win_height - top_margin - kWindowBottomClientEdgeHeight)); } gfx::Size AeroGlassNonClientView::CalculateWindowSizeForClientSize( @@ -190,8 +190,8 @@ int AeroGlassNonClientView::NonClientHitTest(const gfx::Point& point) { // high, we need to make sure the right hit-test codes are returned for the // caption area above the tabs and the top sizing border. int client_view_right = - frame_->client_view()->GetX() + frame_->client_view()->GetWidth(); - if (point.x() >= frame_->client_view()->GetX() && + frame_->client_view()->x() + frame_->client_view()->width(); + if (point.x() >= frame_->client_view()->x() && point.x() < client_view_right) { if (point.y() < kWindowSizingBorderSize) return HTTOP; @@ -328,9 +328,9 @@ void AeroGlassNonClientView::PaintClientEdge(ChromeCanvas* canvas) { // the left and right sides of the toolbar background. client_area_bounds.SetRect( client_area_bounds.x(), - frame_->client_view()->GetY() + toolbar_bounds.bottom() - kPixel, + frame_->client_view()->y() + toolbar_bounds.bottom() - kPixel, client_area_bounds.width(), - std::max(0, GetHeight() - frame_->client_view()->GetY() - + std::max(0, height() - frame_->client_view()->y() - toolbar_bounds.bottom() + kPixel)); int fudge = frame_->window_delegate()->ShouldShowWindowTitle() ? kPixel : 0; @@ -362,17 +362,17 @@ void AeroGlassNonClientView::LayoutDistributorLogo() { int logo_w = distributor_logo_.width(); int logo_h = distributor_logo_.height(); - int w = GetWidth(); + int w = width(); int mbx = frame_->GetMinimizeButtonOffset(); logo_bounds_.SetRect( - GetWidth() - frame_->GetMinimizeButtonOffset() - logo_w, + width() - frame_->GetMinimizeButtonOffset() - logo_w, kDistributorLogoVerticalOffset, logo_w, logo_h); } void AeroGlassNonClientView::LayoutClientView() { gfx::Rect client_bounds( - CalculateClientAreaBounds(GetWidth(), GetHeight())); + CalculateClientAreaBounds(width(), height())); frame_->client_view()->SetBounds(client_bounds.ToRECT()); } diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 514f17d..5bff85a 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -45,7 +45,7 @@ void BrowserView::LayoutStatusBubble(int status_bubble_y) { status_bubble_->SetBounds(kStatusBubbleOffset, status_bubble_y - kStatusBubbleHeight + kStatusBubbleOffset, - GetWidth() / 3, + width() / 3, kStatusBubbleHeight); } @@ -219,7 +219,7 @@ int BrowserView::NonClientHitTest(const gfx::Point& point) { // BrowserView, ChromeViews::View overrides: void BrowserView::Layout() { - toolbar_->SetBounds(0, 0, GetWidth(), GetHeight()); + toolbar_->SetBounds(0, 0, width(), height()); } void BrowserView::DidChangeBounds(const CRect& previous, diff --git a/chrome/browser/views/frame/browser_view2.cc b/chrome/browser/views/frame/browser_view2.cc index 1ce9174..b609d1c 100644 --- a/chrome/browser/views/frame/browser_view2.cc +++ b/chrome/browser/views/frame/browser_view2.cc @@ -126,7 +126,7 @@ gfx::Rect BrowserView2::GetToolbarBounds() const { gfx::Rect BrowserView2::GetClientAreaBounds() const { CRect bounds; contents_container_->GetBounds(&bounds); - bounds.OffsetRect(GetX(), GetY()); + bounds.OffsetRect(x(), y()); return gfx::Rect(bounds); } @@ -727,7 +727,7 @@ int BrowserView2::NonClientHitTest(const gfx::Point& point) { // starved of dragable area, let's give it to window dragging (this also // makes sense visually). if (!window->IsMaximized() && - (point_in_view_coords.y < tabstrip_->GetY() + kTabShadowSize)) { + (point_in_view_coords.y < tabstrip_->y() + kTabShadowSize)) { // We return HTNOWHERE as this is a signal to our containing // NonClientView that it should figure out what the correct hit-test // code is given the mouse position... @@ -740,7 +740,7 @@ int BrowserView2::NonClientHitTest(const gfx::Point& point) { // client area. CRect bounds; GetBounds(&bounds); - bounds.top += toolbar_->GetY(); + bounds.top += toolbar_->y(); if (gfx::Rect(bounds).Contains(point.x(), point.y())) return HTCLIENT; @@ -749,7 +749,7 @@ int BrowserView2::NonClientHitTest(const gfx::Point& point) { // in the window caption (e.g. the area to the right of the tabstrip // underneath the window controls). GetBounds(&bounds); - bounds.bottom = GetY() + toolbar_->GetY(); + bounds.bottom = y() + toolbar_->y(); if (gfx::Rect(bounds).Contains(point.x(), point.y())) return HTCAPTION; @@ -853,19 +853,19 @@ bool BrowserView2::ShouldForwardToTabStrip( if (!tabstrip_->IsVisible()) return false; - const int tab_y = tabstrip_->GetY(); - const int tab_height = tabstrip_->GetHeight(); - if (event.GetY() >= tab_y + tab_height) + const int tab_y = tabstrip_->y(); + const int tab_height = tabstrip_->height(); + if (event.y() >= tab_y + tab_height) return false; - if (event.GetY() >= tab_y) + if (event.y() >= tab_y) return true; // Mouse isn't over the tab strip. Only forward if the mouse isn't over // another view on the tab strip or is over a view we were told the user can // drop on. ChromeViews::View* view_over_mouse = - GetViewForPoint(CPoint(event.GetX(), event.GetY())); + GetViewForPoint(CPoint(event.x(), event.y())); return (view_over_mouse == this || view_over_mouse == tabstrip_ || dropable_views_.find(view_over_mouse) != dropable_views_.end()); } @@ -899,7 +899,7 @@ int BrowserView2::LayoutToolbar(int top) { // by a pixel to make things look good. if (!IsTabStripVisible() && win_util::ShouldUseVistaFrame()) ps.cy -= 1; - int browser_view_width = GetWidth(); + int browser_view_width = width(); #ifdef CHROME_PERSONALIZATION if (IsPersonalizationEnabled()) Personalization::AdjustBrowserView(personalization_, &browser_view_width); @@ -935,7 +935,7 @@ int BrowserView2::LayoutBookmarkBar(int top) { active_bookmark_bar_->GetPreferredSize(&ps); if (!active_info_bar_ || show_bookmark_bar_pref_.GetValue()) top -= kSeparationLineHeight; - active_bookmark_bar_->SetBounds(0, top, GetWidth(), ps.cy); + active_bookmark_bar_->SetBounds(0, top, width(), ps.cy); top += ps.cy; } return top; @@ -944,7 +944,7 @@ int BrowserView2::LayoutInfoBar(int top) { if (SupportsWindowFeature(FEATURE_INFOBAR) && active_info_bar_) { CSize ps; active_info_bar_->GetPreferredSize(&ps); - active_info_bar_->SetBounds(0, top, GetWidth(), ps.cy); + active_info_bar_->SetBounds(0, top, width(), ps.cy); top += ps.cy; if (SupportsWindowFeature(FEATURE_BOOKMARKBAR) && active_bookmark_bar_ && !show_bookmark_bar_pref_.GetValue()) { @@ -955,15 +955,15 @@ int BrowserView2::LayoutInfoBar(int top) { } void BrowserView2::LayoutTabContents(int top, int bottom) { - contents_container_->SetBounds(0, top, GetWidth(), bottom - top); + contents_container_->SetBounds(0, top, width(), bottom - top); } int BrowserView2::LayoutDownloadShelf() { - int bottom = GetHeight(); + int bottom = height(); if (SupportsWindowFeature(FEATURE_DOWNLOADSHELF) && active_download_shelf_) { CSize ps; active_download_shelf_->GetPreferredSize(&ps); - active_download_shelf_->SetBounds(0, bottom - ps.cy, GetWidth(), ps.cy); + active_download_shelf_->SetBounds(0, bottom - ps.cy, width(), ps.cy); bottom -= ps.cy; } return bottom; @@ -971,9 +971,9 @@ int BrowserView2::LayoutDownloadShelf() { void BrowserView2::LayoutStatusBubble(int top) { int status_bubble_y = - top - kStatusBubbleHeight + kStatusBubbleOffset + GetY(); + top - kStatusBubbleHeight + kStatusBubbleOffset + y(); status_bubble_->SetBounds(kStatusBubbleOffset, status_bubble_y, - GetWidth() / 3, kStatusBubbleHeight); + width() / 3, kStatusBubbleHeight); } bool BrowserView2::MaybeShowBookmarkBar(TabContents* contents) { @@ -1019,7 +1019,7 @@ bool BrowserView2::UpdateChildViewAndLayout(ChromeViews::View* new_view, if (new_view) { CSize pref_size; new_view->GetPreferredSize(&pref_size); - if (pref_size.cy != new_view->GetHeight()) + if (pref_size.cy != new_view->height()) return true; } return false; @@ -1032,7 +1032,7 @@ bool BrowserView2::UpdateChildViewAndLayout(ChromeViews::View* new_view, int current_height = 0; if (*old_view) { - current_height = (*old_view)->GetHeight(); + current_height = (*old_view)->height(); RemoveChildView(*old_view); } diff --git a/chrome/browser/views/frame/browser_window_factory.cc b/chrome/browser/views/frame/browser_window_factory.cc index 9968e58..1586e48 100644 --- a/chrome/browser/views/frame/browser_window_factory.cc +++ b/chrome/browser/views/frame/browser_window_factory.cc @@ -1,67 +1,67 @@ -// Copyright (c) 2006-2008 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.
-
-#include "base/command_line.h"
-#include "chrome/browser/browser.h"
-#include "chrome/browser/browser_process.h" // TODO(beng): remove once done.
-#include "chrome/browser/browser_window.h"
-#include "chrome/browser/frame_util.h"
-#include "chrome/browser/views/frame/aero_glass_frame.h"
-#include "chrome/browser/views/frame/browser_frame.h"
-#include "chrome/browser/views/frame/browser_view.h"
-#include "chrome/browser/views/frame/browser_view2.h"
-#include "chrome/browser/views/frame/opaque_frame.h"
-#include "chrome/common/win_util.h"
-
-///////////////////////////////////////////////////////////////////////////////
-// BrowserWindow, public:
-
-// static
-BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser,
- const gfx::Rect& bounds,
- int show_command) {
- // TODO(beng): fix this hack.
- // To get us off the ground and allow us to incrementally migrate
- // BrowserWindow functionality from XP/VistaFrame to BrowserView,
- // all objects need to implement the BrowserWindow interface.
- // However BrowserView is the one that Browser has a ref to, and
- // calls that BrowserView can't perform directly are passed on to
- // its frame. Eventually this will be better, I promise.
- if (g_browser_process->IsUsingNewFrames()) {
- BrowserView2* browser_view = new BrowserView2(browser);
- BrowserFrame::CreateForBrowserView(BrowserFrame::GetActiveFrameType(),
- browser_view, bounds, show_command);
- return browser_view;
- }
- BrowserWindow* window = FrameUtil::CreateBrowserWindow(bounds, browser);
- return window->GetBrowserView();
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// BrowserFrame, public:
-
-// static
-BrowserFrame::FrameType BrowserFrame::GetActiveFrameType() {
- return win_util::ShouldUseVistaFrame() ? BrowserFrame::FRAMETYPE_AERO_GLASS
- : BrowserFrame::FRAMETYPE_OPAQUE;
-}
-
-// static
-BrowserFrame* BrowserFrame::CreateForBrowserView(BrowserFrame::FrameType type,
- BrowserView2* browser_view,
- const gfx::Rect& bounds,
- int show_command) {
- if (type == FRAMETYPE_OPAQUE) {
- OpaqueFrame* frame = new OpaqueFrame(browser_view);
- frame->Init(NULL, bounds);
- return frame;
- } else if (type == FRAMETYPE_AERO_GLASS) {
- AeroGlassFrame* frame = new AeroGlassFrame(browser_view);
- frame->Init(bounds);
- return frame;
- }
- NOTREACHED() << "Unsupported frame type";
- return NULL;
-}
-
+// Copyright (c) 2006-2008 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. + +#include "base/command_line.h" +#include "chrome/browser/browser.h" +#include "chrome/browser/browser_process.h" // TODO(beng): remove once done. +#include "chrome/browser/browser_window.h" +#include "chrome/browser/frame_util.h" +#include "chrome/browser/views/frame/aero_glass_frame.h" +#include "chrome/browser/views/frame/browser_frame.h" +#include "chrome/browser/views/frame/browser_view.h" +#include "chrome/browser/views/frame/browser_view2.h" +#include "chrome/browser/views/frame/opaque_frame.h" +#include "chrome/common/win_util.h" + +/////////////////////////////////////////////////////////////////////////////// +// BrowserWindow, public: + +// static +BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser, + const gfx::Rect& bounds, + int show_command) { + // TODO(beng): fix this hack. + // To get us off the ground and allow us to incrementally migrate + // BrowserWindow functionality from XP/VistaFrame to BrowserView, + // all objects need to implement the BrowserWindow interface. + // However BrowserView is the one that Browser has a ref to, and + // calls that BrowserView can't perform directly are passed on to + // its frame. Eventually this will be better, I promise. + if (g_browser_process->IsUsingNewFrames()) { + BrowserView2* browser_view = new BrowserView2(browser); + BrowserFrame::CreateForBrowserView(BrowserFrame::GetActiveFrameType(), + browser_view, bounds, show_command); + return browser_view; + } + BrowserWindow* window = FrameUtil::CreateBrowserWindow(bounds, browser); + return window->GetBrowserView(); +} + +/////////////////////////////////////////////////////////////////////////////// +// BrowserFrame, public: + +// static +BrowserFrame::FrameType BrowserFrame::GetActiveFrameType() { + return win_util::ShouldUseVistaFrame() ? BrowserFrame::FRAMETYPE_AERO_GLASS + : BrowserFrame::FRAMETYPE_OPAQUE; +} + +// static +BrowserFrame* BrowserFrame::CreateForBrowserView(BrowserFrame::FrameType type, + BrowserView2* browser_view, + const gfx::Rect& bounds, + int show_command) { + if (type == FRAMETYPE_OPAQUE) { + OpaqueFrame* frame = new OpaqueFrame(browser_view); + frame->Init(NULL, bounds); + return frame; + } else if (type == FRAMETYPE_AERO_GLASS) { + AeroGlassFrame* frame = new AeroGlassFrame(browser_view); + frame->Init(bounds); + return frame; + } + NOTREACHED() << "Unsupported frame type"; + return NULL; +} + diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc index 6febf81..b85186b 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.cc +++ b/chrome/browser/views/frame/opaque_non_client_view.cc @@ -457,7 +457,7 @@ gfx::Rect OpaqueNonClientView::GetWindowBoundsForClientBounds( gfx::Rect OpaqueNonClientView::GetBoundsForTabStrip(TabStrip* tabstrip) { int tabstrip_height = tabstrip->GetPreferredHeight(); int tabstrip_x = otr_avatar_bounds_.right(); - return gfx::Rect(tabstrip_x, 0, minimize_button_->GetX() - tabstrip_x, + return gfx::Rect(tabstrip_x, 0, minimize_button_->x() - tabstrip_x, tabstrip_height); } @@ -701,9 +701,6 @@ int OpaqueNonClientView::CalculateNonClientTopHeight() const { } void OpaqueNonClientView::PaintFrameBorder(ChromeCanvas* canvas) { - int width = GetWidth(); - int height = GetHeight(); - SkBitmap* top_left_corner = resources()->GetPartBitmap(FRAME_TOP_LEFT_CORNER); SkBitmap* top_right_corner = @@ -720,33 +717,33 @@ void OpaqueNonClientView::PaintFrameBorder(ChromeCanvas* canvas) { // Top. canvas->DrawBitmapInt(*top_left_corner, 0, 0); canvas->TileImageInt(*top_edge, top_left_corner->width(), 0, - width - top_right_corner->width(), top_edge->height()); + width() - top_right_corner->width(), top_edge->height()); canvas->DrawBitmapInt(*top_right_corner, - width - top_right_corner->width(), 0); + width() - top_right_corner->width(), 0); // Right. int top_stack_height = top_right_corner->height(); - canvas->TileImageInt(*right_edge, width - right_edge->width(), + canvas->TileImageInt(*right_edge, width() - right_edge->width(), top_stack_height, right_edge->width(), - height - top_stack_height - + height() - top_stack_height - bottom_right_corner->height()); // Bottom. canvas->DrawBitmapInt(*bottom_right_corner, - width - bottom_right_corner->width(), - height - bottom_right_corner->height()); + width() - bottom_right_corner->width(), + height() - bottom_right_corner->height()); canvas->TileImageInt(*bottom_edge, bottom_left_corner->width(), - height - bottom_edge->height(), - width - bottom_left_corner->width() - + height() - bottom_edge->height(), + width() - bottom_left_corner->width() - bottom_right_corner->width(), bottom_edge->height()); canvas->DrawBitmapInt(*bottom_left_corner, 0, - height - bottom_left_corner->height()); + height() - bottom_left_corner->height()); // Left. top_stack_height = top_left_corner->height(); canvas->TileImageInt(*left_edge, 0, top_stack_height, left_edge->width(), - height - top_stack_height - + height() - top_stack_height - bottom_left_corner->height()); } @@ -754,9 +751,9 @@ void OpaqueNonClientView::PaintMaximizedFrameBorder(ChromeCanvas* canvas) { SkBitmap* top_edge = resources()->GetPartBitmap(FRAME_MAXIMIZED_TOP_EDGE); SkBitmap* bottom_edge = resources()->GetPartBitmap(FRAME_MAXIMIZED_BOTTOM_EDGE); - canvas->TileImageInt(*top_edge, 0, 0, GetWidth(), top_edge->height()); - canvas->TileImageInt(*bottom_edge, 0, GetHeight() - bottom_edge->height(), - GetWidth(), bottom_edge->height()); + canvas->TileImageInt(*top_edge, 0, 0, width(), top_edge->height()); + canvas->TileImageInt(*bottom_edge, 0, height() - bottom_edge->height(), + width(), bottom_edge->height()); } void OpaqueNonClientView::PaintOTRAvatar(ChromeCanvas* canvas) { @@ -835,9 +832,9 @@ void OpaqueNonClientView::PaintClientEdge(ChromeCanvas* canvas) { int fudge = frame_->window_delegate()->ShouldShowWindowTitle() ? 0 : 1; client_area_bounds.SetRect( client_area_bounds.x(), - frame_->client_view()->GetY() + toolbar_bounds.bottom() - fudge, + frame_->client_view()->y() + toolbar_bounds.bottom() - fudge, client_area_bounds.width(), - std::max(0, GetHeight() - frame_->client_view()->GetY() - + std::max(0, height() - frame_->client_view()->y() - toolbar_bounds.bottom() + fudge - kWindowVerticalBorderBottomSize)); // Now the fudge inverts for app vs browser windows. @@ -883,46 +880,46 @@ void OpaqueNonClientView::LayoutWindowControls() { close_button_->SetImageAlignment(ChromeViews::Button::ALIGN_LEFT, ChromeViews::Button::ALIGN_BOTTOM); close_button_->SetBounds( - GetWidth() - ps.cx - kWindowControlsRightZoomedOffset, + width() - ps.cx - kWindowControlsRightZoomedOffset, 0, ps.cx + kWindowControlsRightZoomedOffset, ps.cy + kWindowControlsTopZoomedOffset); restore_button_->GetPreferredSize(&ps); restore_button_->SetImageAlignment(ChromeViews::Button::ALIGN_LEFT, ChromeViews::Button::ALIGN_BOTTOM); - restore_button_->SetBounds(close_button_->GetX() - ps.cx, 0, ps.cx, + restore_button_->SetBounds(close_button_->x() - ps.cx, 0, ps.cx, ps.cy + kWindowControlsTopZoomedOffset); minimize_button_->GetPreferredSize(&ps); minimize_button_->SetImageAlignment(ChromeViews::Button::ALIGN_LEFT, ChromeViews::Button::ALIGN_BOTTOM); - minimize_button_->SetBounds(restore_button_->GetX() - ps.cx, 0, ps.cx, + minimize_button_->SetBounds(restore_button_->x() - ps.cx, 0, ps.cx, ps.cy + kWindowControlsTopZoomedOffset); } else if (frame_->IsMinimized()) { close_button_->GetPreferredSize(&ps); close_button_->SetImageAlignment(ChromeViews::Button::ALIGN_LEFT, ChromeViews::Button::ALIGN_BOTTOM); close_button_->SetBounds( - GetWidth() - ps.cx - kWindowControlsRightZoomedOffset, + width() - ps.cx - kWindowControlsRightZoomedOffset, 0, ps.cx + kWindowControlsRightZoomedOffset, ps.cy + kWindowControlsTopZoomedOffset); restore_button_->GetPreferredSize(&ps); restore_button_->SetImageAlignment(ChromeViews::Button::ALIGN_LEFT, ChromeViews::Button::ALIGN_BOTTOM); - restore_button_->SetBounds(close_button_->GetX() - ps.cx, 0, ps.cx, + restore_button_->SetBounds(close_button_->x() - ps.cx, 0, ps.cx, ps.cy + kWindowControlsTopZoomedOffset); minimize_button_->GetPreferredSize(&ps); minimize_button_->SetImageAlignment(ChromeViews::Button::ALIGN_LEFT, ChromeViews::Button::ALIGN_BOTTOM); - minimize_button_->SetBounds(restore_button_->GetX() - ps.cx, 0, ps.cx, + minimize_button_->SetBounds(restore_button_->x() - ps.cx, 0, ps.cx, ps.cy + kWindowControlsTopZoomedOffset); } else { close_button_->GetPreferredSize(&ps); close_button_->SetImageAlignment(ChromeViews::Button::ALIGN_LEFT, ChromeViews::Button::ALIGN_TOP); - close_button_->SetBounds(GetWidth() - kWindowControlsRightOffset - ps.cx, + close_button_->SetBounds(width() - kWindowControlsRightOffset - ps.cx, kWindowControlsTopOffset, ps.cx, ps.cy); restore_button_->SetVisible(false); @@ -931,13 +928,13 @@ void OpaqueNonClientView::LayoutWindowControls() { maximize_button_->GetPreferredSize(&ps); maximize_button_->SetImageAlignment(ChromeViews::Button::ALIGN_LEFT, ChromeViews::Button::ALIGN_TOP); - maximize_button_->SetBounds(close_button_->GetX() - ps.cx, + maximize_button_->SetBounds(close_button_->x() - ps.cx, kWindowControlsTopOffset, ps.cx, ps.cy); minimize_button_->GetPreferredSize(&ps); minimize_button_->SetImageAlignment(ChromeViews::Button::ALIGN_LEFT, ChromeViews::Button::ALIGN_TOP); - minimize_button_->SetBounds(maximize_button_->GetX() - ps.cx, + minimize_button_->SetBounds(maximize_button_->x() - ps.cx, kWindowControlsTopOffset, ps.cx, ps.cy); } } @@ -973,7 +970,7 @@ void OpaqueNonClientView::LayoutDistributorLogo() { APPLY_MIRRORING_TRANSFORMATION); logo_x = minimize_bounds.right + kDistributorLogoHorizontalOffset; } else { - logo_x = minimize_button_->GetX() - logo_w - + logo_x = minimize_button_->x() - logo_w - kDistributorLogoHorizontalOffset; } logo_bounds_.SetRect(logo_x, kDistributorLogoVerticalOffset, logo_w, logo_h); @@ -995,7 +992,7 @@ void OpaqueNonClientView::LayoutTitleBar() { // Size the title, if visible. if (d->ShouldShowWindowTitle()) { int spacing = d->ShouldShowWindowIcon() ? kWindowIconTitleSpacing : 0; - int title_right = minimize_button_->GetX(); + int title_right = minimize_button_->x(); int icon_right = icon_bounds_.right(); int title_left = icon_right + spacing; title_bounds_.SetRect(title_left, kTitleTopOffset + top_offset, @@ -1006,7 +1003,7 @@ void OpaqueNonClientView::LayoutTitleBar() { void OpaqueNonClientView::LayoutClientView() { gfx::Rect client_bounds( - CalculateClientAreaBounds(GetWidth(), GetHeight())); + CalculateClientAreaBounds(width(), height())); frame_->client_view()->SetBounds(client_bounds.ToRECT()); } diff --git a/chrome/browser/views/hwnd_html_view.cc b/chrome/browser/views/hwnd_html_view.cc index d1c543a..ebb610b 100644 --- a/chrome/browser/views/hwnd_html_view.cc +++ b/chrome/browser/views/hwnd_html_view.cc @@ -1,52 +1,52 @@ -// Copyright (c) 2006-2008 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.
-
-#include "chrome/browser/views/hwnd_html_view.h"
-
-#include "chrome/browser/render_view_host.h"
-#include "chrome/browser/render_widget_host_hwnd.h"
-#include "chrome/browser/render_view_host_delegate.h"
-#include "chrome/browser/site_instance.h"
-#include "chrome/views/view_container.h"
-
-HWNDHtmlView::~HWNDHtmlView() {
- if (render_view_host_) {
- Detach();
- render_view_host_->Shutdown();
- render_view_host_ = NULL;
- }
-}
-
-void HWNDHtmlView::Init(HWND parent_hwnd) {
- DCHECK(!render_view_host_) << "Already initialized.";
- RenderViewHost* rvh = new RenderViewHost(
- SiteInstance::CreateSiteInstance(delegate_->GetProfile()),
- delegate_, MSG_ROUTING_NONE, NULL);
- render_view_host_ = rvh;
-
- RenderWidgetHostHWND* view = new RenderWidgetHostHWND(rvh);
- rvh->set_view(view);
-
- // Create the HWND. Note:
- // RenderWidgetHostHWND supports windowed plugins, but if we ever also wanted
- // to support constrained windows with this, we would need an additional
- // HWND to parent off of because windowed plugin HWNDs cannot exist in the
- // same z-order as constrained windows.
- HWND hwnd = view->Create(parent_hwnd);
- view->ShowWindow(SW_SHOW);
- ChromeViews::HWNDView::Attach(hwnd);
-
- // Start up the renderer.
- if (allow_dom_ui_bindings_)
- rvh->AllowDOMUIBindings();
- rvh->CreateRenderView();
- rvh->NavigateToURL(content_url_);
- initialized_ = true;
-}
-
-void HWNDHtmlView::ViewHierarchyChanged(bool is_add, View* parent,
- View* child) {
- if (is_add && GetViewContainer() && !initialized_)
- Init(GetViewContainer()->GetHWND());
-}
+// Copyright (c) 2006-2008 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. + +#include "chrome/browser/views/hwnd_html_view.h" + +#include "chrome/browser/render_view_host.h" +#include "chrome/browser/render_widget_host_hwnd.h" +#include "chrome/browser/render_view_host_delegate.h" +#include "chrome/browser/site_instance.h" +#include "chrome/views/view_container.h" + +HWNDHtmlView::~HWNDHtmlView() { + if (render_view_host_) { + Detach(); + render_view_host_->Shutdown(); + render_view_host_ = NULL; + } +} + +void HWNDHtmlView::Init(HWND parent_hwnd) { + DCHECK(!render_view_host_) << "Already initialized."; + RenderViewHost* rvh = new RenderViewHost( + SiteInstance::CreateSiteInstance(delegate_->GetProfile()), + delegate_, MSG_ROUTING_NONE, NULL); + render_view_host_ = rvh; + + RenderWidgetHostHWND* view = new RenderWidgetHostHWND(rvh); + rvh->set_view(view); + + // Create the HWND. Note: + // RenderWidgetHostHWND supports windowed plugins, but if we ever also wanted + // to support constrained windows with this, we would need an additional + // HWND to parent off of because windowed plugin HWNDs cannot exist in the + // same z-order as constrained windows. + HWND hwnd = view->Create(parent_hwnd); + view->ShowWindow(SW_SHOW); + ChromeViews::HWNDView::Attach(hwnd); + + // Start up the renderer. + if (allow_dom_ui_bindings_) + rvh->AllowDOMUIBindings(); + rvh->CreateRenderView(); + rvh->NavigateToURL(content_url_); + initialized_ = true; +} + +void HWNDHtmlView::ViewHierarchyChanged(bool is_add, View* parent, + View* child) { + if (is_add && GetViewContainer() && !initialized_) + Init(GetViewContainer()->GetHWND()); +} diff --git a/chrome/browser/views/hwnd_html_view.h b/chrome/browser/views/hwnd_html_view.h index a0cd7e5..a91bb97 100644 --- a/chrome/browser/views/hwnd_html_view.h +++ b/chrome/browser/views/hwnd_html_view.h @@ -1,59 +1,59 @@ -// Copyright (c) 2006-2008 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.
-
-#ifndef CHROME_BROWSER_VIEWS_HWND_HTML_VIEW_H_
-#define CHROME_BROWSER_VIEWS_HWND_HTML_VIEW_H_
-
-#include "googleurl/src/gurl.h"
-#include "chrome/views/hwnd_view.h"
-
-class RenderViewHost;
-class RenderViewHostDelegate;
-
-// A simple view that wraps a RenderViewHost in an HWNDView to facilitate
-// rendering HTML as arbitrary browser views.
-// TODO(timsteele): (bug 1317303). This should replace DOMView.
-class HWNDHtmlView : public ChromeViews::HWNDView {
- public:
- HWNDHtmlView(const GURL& content_url, RenderViewHostDelegate* delegate,
- bool allow_dom_ui_bindings)
- : render_view_host_(NULL),
- content_url_(content_url),
- allow_dom_ui_bindings_(allow_dom_ui_bindings),
- delegate_(delegate),
- initialized_(false) {
- }
- virtual ~HWNDHtmlView();
-
- RenderViewHost* render_view_host() { return render_view_host_; }
-
- protected:
- // View overrides.
- virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child);
-
- private:
- // Initialize the view, parented to |parent|, and show it.
- void Init(HWND parent);
-
- // The URL of the HTML content to render and show in this view.
- GURL content_url_;
-
- // Our HTML rendering component.
- RenderViewHost* render_view_host_;
-
- // Whether or not the rendered content is permitted to send messages back to
- // the view, through |delegate_| via ProcessDOMUIMessage.
- bool allow_dom_ui_bindings_;
-
- // True after Init() has completed.
- bool initialized_;
-
- // The delegate for our render_view_host.
- RenderViewHostDelegate* delegate_;
-
- DISALLOW_EVIL_CONSTRUCTORS(HWNDHtmlView);
-};
-
-#endif // CHROME_BROWSER_VIEWS_HWND_HTML_VIEW_H_
-
+// Copyright (c) 2006-2008 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. + +#ifndef CHROME_BROWSER_VIEWS_HWND_HTML_VIEW_H_ +#define CHROME_BROWSER_VIEWS_HWND_HTML_VIEW_H_ + +#include "googleurl/src/gurl.h" +#include "chrome/views/hwnd_view.h" + +class RenderViewHost; +class RenderViewHostDelegate; + +// A simple view that wraps a RenderViewHost in an HWNDView to facilitate +// rendering HTML as arbitrary browser views. +// TODO(timsteele): (bug 1317303). This should replace DOMView. +class HWNDHtmlView : public ChromeViews::HWNDView { + public: + HWNDHtmlView(const GURL& content_url, RenderViewHostDelegate* delegate, + bool allow_dom_ui_bindings) + : render_view_host_(NULL), + content_url_(content_url), + allow_dom_ui_bindings_(allow_dom_ui_bindings), + delegate_(delegate), + initialized_(false) { + } + virtual ~HWNDHtmlView(); + + RenderViewHost* render_view_host() { return render_view_host_; } + + protected: + // View overrides. + virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child); + + private: + // Initialize the view, parented to |parent|, and show it. + void Init(HWND parent); + + // The URL of the HTML content to render and show in this view. + GURL content_url_; + + // Our HTML rendering component. + RenderViewHost* render_view_host_; + + // Whether or not the rendered content is permitted to send messages back to + // the view, through |delegate_| via ProcessDOMUIMessage. + bool allow_dom_ui_bindings_; + + // True after Init() has completed. + bool initialized_; + + // The delegate for our render_view_host. + RenderViewHostDelegate* delegate_; + + DISALLOW_EVIL_CONSTRUCTORS(HWNDHtmlView); +}; + +#endif // CHROME_BROWSER_VIEWS_HWND_HTML_VIEW_H_ + diff --git a/chrome/browser/views/importer_lock_view.cc b/chrome/browser/views/importer_lock_view.cc index 2b8dc58..e3aec26 100644 --- a/chrome/browser/views/importer_lock_view.cc +++ b/chrome/browser/views/importer_lock_view.cc @@ -43,8 +43,8 @@ void ImporterLockView::GetPreferredSize(CSize *out) { void ImporterLockView::Layout() { description_label_->SetBounds(kPanelHorizMargin, kPanelVertMargin, - GetWidth() - 2 * kPanelHorizMargin, - GetHeight() - 2 * kPanelVertMargin); + width() - 2 * kPanelHorizMargin, + height() - 2 * kPanelVertMargin); } std::wstring ImporterLockView::GetDialogButtonLabel( diff --git a/chrome/browser/views/info_bar_item_view.cc b/chrome/browser/views/info_bar_item_view.cc index d5b7411..985b1c6 100644 --- a/chrome/browser/views/info_bar_item_view.cc +++ b/chrome/browser/views/info_bar_item_view.cc @@ -51,7 +51,7 @@ int InfoBarItemView::CenterPosition(int size, int target_size) { } void InfoBarItemView::GetPreferredSize(CSize* out) { - out->cx = GetParent()->GetWidth(); + out->cx = GetParent()->width(); out->cy = static_cast<int>(kInfoBarHeight * animation_->GetCurrentValue()); } @@ -90,11 +90,8 @@ void InfoBarItemView::GetPreferredSize(CSize* out) { // left views. Note in this case, the padding appears to the right of the view // left aligned view. Removing works the same, but in reverse. void InfoBarItemView::Layout() { - const int width = GetWidth(); - const int height = GetHeight(); - - int next_x = width - kButtonHEdgeMargin; - int height_diff = static_cast<int>(kInfoBarHeight) - height; + int next_x = width() - kButtonHEdgeMargin; + int height_diff = static_cast<int>(kInfoBarHeight) - height(); const int child_count = GetChildViewCount(); // Anything greater than or equal to insert_index_ is laid out on the right, // with the greatest index (the first one added to the right) being laid out diff --git a/chrome/browser/views/info_bar_view.cc b/chrome/browser/views/info_bar_view.cc index 56c2ecc..00a704f9 100644 --- a/chrome/browser/views/info_bar_view.cc +++ b/chrome/browser/views/info_bar_view.cc @@ -64,18 +64,15 @@ void InfoBarView::GetPreferredSize(CSize *out) { if (v->IsVisible()) { CSize view_size; v->GetPreferredSize(&view_size); - out->cx = std::max(static_cast<int>(out->cx), v->GetWidth()); + out->cx = std::max(static_cast<int>(out->cx), v->width()); out->cy += static_cast<int>(view_size.cy) + kSeparatorHeight; } } } void InfoBarView::Layout() { - int width = GetWidth(); - int height = GetHeight(); - int x = 0; - int y = height; + int y = height(); // We lay the bars out from bottom to top. for (int i = 0; i < GetChildViewCount(); ++i) { @@ -85,7 +82,7 @@ void InfoBarView::Layout() { CSize view_size; v->GetPreferredSize(&view_size); - int view_width = std::max(static_cast<int>(view_size.cx), width); + int view_width = std::max(static_cast<int>(view_size.cx), width()); y = y - view_size.cy - kSeparatorHeight; v->SetBounds(x, y, @@ -156,14 +153,14 @@ int InfoBarView::GetActiveID() const { } void InfoBarView::PaintBorder(ChromeCanvas* canvas) { - canvas->FillRectInt(kBorderColorTop, 0, 0, GetWidth(), 1); + canvas->FillRectInt(kBorderColorTop, 0, 0, width(), 1); canvas->FillRectInt(kBorderColorBottom, - 0, GetHeight() - kSeparatorHeight - 1, - GetWidth(), kSeparatorHeight); + 0, height() - kSeparatorHeight - 1, + width(), kSeparatorHeight); if (GetChildViewCount() > 0) - canvas->FillRectInt(kSeparatorColor, 0, GetHeight() - kSeparatorHeight, - GetWidth(), kSeparatorHeight); + canvas->FillRectInt(kSeparatorColor, 0, height() - kSeparatorHeight, + width(), kSeparatorHeight); } void InfoBarView::PaintSeparators(ChromeCanvas* canvas) { @@ -187,8 +184,8 @@ void InfoBarView::PaintSeparator(ChromeCanvas* canvas, ChromeViews::View* v2) { canvas->FillRectInt(kSeparatorColor, 0, - v2->GetY() - kSeparatorHeight, - GetWidth(), + v2->y() - kSeparatorHeight, + width(), kSeparatorHeight); } diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc index 1a6dbca..0b6f3d6 100644 --- a/chrome/browser/views/info_bubble.cc +++ b/chrome/browser/views/info_bubble.cc @@ -251,15 +251,15 @@ void InfoBubble::ContentView::Layout() { View* content = GetChildViewAt(0); int x = kBorderSize; int y = kBorderSize; - int width = GetWidth() - kBorderSize - kBorderSize - + int content_width = width() - kBorderSize - kBorderSize - kInfoBubbleViewLeftMargin - kInfoBubbleViewRightMargin; - int height = GetHeight() - kBorderSize - kBorderSize - kArrowSize - + int content_height = height() - kBorderSize - kBorderSize - kArrowSize - kInfoBubbleViewTopMargin - kInfoBubbleViewBottomMargin; if (IsTop()) y += kArrowSize; x += kInfoBubbleViewLeftMargin; y += kInfoBubbleViewTopMargin; - content->SetBounds(x, y, width, height); + content->SetBounds(x, y, content_width, content_height); } HRGN InfoBubble::ContentView::GetMask(const CSize &size) { @@ -327,8 +327,8 @@ HRGN InfoBubble::ContentView::GetMask(const CSize &size) { void InfoBubble::ContentView::Paint(ChromeCanvas* canvas) { int bubble_x = 0; int bubble_y = 0; - int bubble_w = GetWidth(); - int bubble_h = GetHeight() - kArrowSize; + int bubble_w = width(); + int bubble_h = height() - kArrowSize; int border_w = bubble_w - 2 * kInfoBubbleCornerWidth; int border_h = bubble_h - 2 * kInfoBubbleCornerHeight; @@ -368,7 +368,7 @@ void InfoBubble::ContentView::Paint(ChromeCanvas* canvas) { // Right border. canvas->DrawRectInt(kBorderColor1, - GetWidth() - 1, bubble_y + kInfoBubbleCornerHeight, + width() - 1, bubble_y + kInfoBubbleCornerHeight, 0, border_h); // Draw the corners. @@ -382,7 +382,7 @@ void InfoBubble::ContentView::Paint(ChromeCanvas* canvas) { bubble_y + bubble_h - kInfoBubbleCornerHeight); // Draw the arrow and the notch of the arrow. - int arrow_x = IsLeft() ? kArrowXOffset : GetWidth() - kArrowXOffset; + int arrow_x = IsLeft() ? kArrowXOffset : width() - kArrowXOffset; int arrow_y = IsTop() ? bubble_y : bubble_y + bubble_h - 1; const int arrow_delta = IsTop() ? -1 : 1; for (int i = 0, y = arrow_y; i <= kArrowSize; ++i, y += arrow_delta) { diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc index d5eba49..dcdc5ae 100644 --- a/chrome/browser/views/location_bar_view.cc +++ b/chrome/browser/views/location_bar_view.cc @@ -234,11 +234,11 @@ void LocationBarView::Paint(ChromeCanvas* canvas) { if (popup_window_mode_ == false) { int bh = kBackground->height(); - canvas->TileImageInt(*kBackground, 0, (GetHeight() - bh) / 2, GetWidth(), + canvas->TileImageInt(*kBackground, 0, (height() - bh) / 2, width(), bh); canvas->FillRectInt(bg, kBackgroundHoriMargin, kBackgroundVertMargin, - GetWidth() - 2 * kBackgroundHoriMargin, + width() - 2 * kBackgroundHoriMargin, bh - kBackgroundVertMargin * 2); } else { canvas->TileImageInt(*kPopupBackgroundLeft, 0, 0, @@ -246,18 +246,18 @@ void LocationBarView::Paint(ChromeCanvas* canvas) { kPopupBackgroundLeft->height()); canvas->TileImageInt(*kPopupBackgroundCenter, kPopupBackgroundLeft->width(), 0, - GetWidth() - + width() - kPopupBackgroundLeft->width() - kPopupBackgroundRight->width(), kPopupBackgroundCenter->height()); canvas->TileImageInt(*kPopupBackgroundRight, - GetWidth() - kPopupBackgroundRight->width(), + width() - kPopupBackgroundRight->width(), 0, kPopupBackgroundRight->width(), kPopupBackgroundRight->height()); canvas->FillRectInt(bg, kPopupBackgroundHorzMargin, kPopupBackgroundVertMargin, - GetWidth() - kPopupBackgroundHorzMargin * 2, + width() - kPopupBackgroundHorzMargin * 2, kPopupBackgroundCenter->height() - kPopupBackgroundVertMargin * 2); } @@ -374,7 +374,7 @@ void LocationBarView::DoLayout(const bool force_layout) { RECT edit_bounds; location_entry_->GetClientRect(&edit_bounds); - int entry_width = GetWidth() - kEntryPadding - kEntryPadding; + int entry_width = width() - kEntryPadding - kEntryPadding; CSize security_image_size; if (security_image_view_.IsVisible()) { security_image_view_.GetPreferredSize(&security_image_size); @@ -401,17 +401,17 @@ void LocationBarView::DoLayout(const bool force_layout) { const SkBitmap* background = popup_window_mode_ ? kPopupBackgroundCenter : kBackground; int bh = background->height(); - int location_y = ((GetHeight() - bh) / 2) + kTextVertMargin; + int location_y = ((height() - bh) / 2) + kTextVertMargin; int location_height = bh - (2 * kTextVertMargin); if (info_label_.IsVisible()) { - info_label_.SetBounds(GetWidth() - kEntryPadding - info_label_size.cx, + info_label_.SetBounds(width() - kEntryPadding - info_label_size.cx, location_y, info_label_size.cx, location_height); } if (security_image_view_.IsVisible()) { const int info_label_width = info_label_size.cx ? info_label_size.cx + kInnerPadding : 0; - security_image_view_.SetBounds(GetWidth() - kEntryPadding - + security_image_view_.SetBounds(width() - kEntryPadding - info_label_width - security_image_size.cx, location_y, @@ -447,7 +447,7 @@ int LocationBarView::TextDisplayWidth() { POINT scroll_position; location_entry_->GetScrollPos(&scroll_position); const int position_x = last_char_position.x + scroll_position.x; - return UILayoutIsRightToLeft() ? GetWidth() - position_x : position_x; + return UILayoutIsRightToLeft() ? width() - position_x : position_x; } bool LocationBarView::UsePref(int pref_width, int text_width, int max_width) { @@ -459,7 +459,7 @@ bool LocationBarView::NeedsResize(View* view, int text_width, int max_width) { view->GetPreferredSize(&size); if (!UsePref(size.cx, text_width, max_width)) view->GetMinimumSize(&size); - return (view->GetWidth() != size.cx); + return (view->width() != size.cx); } bool LocationBarView::AdjustHints(int text_width, int max_width) { @@ -576,7 +576,7 @@ void LocationBarView::OnMouseEvent(const ChromeViews::MouseEvent& event, if (event.IsRightMouseButton()) flags |= MK_RBUTTON; - CPoint screen_point(event.GetX(), event.GetY()); + CPoint screen_point(event.x(), event.y()); ConvertPointToScreen(this, &screen_point); location_entry_->HandleExternalMsg(msg, flags, screen_point); @@ -637,7 +637,7 @@ void LocationBarView::SelectedKeywordView::SetFont(const ChromeFont& font) { void LocationBarView::SelectedKeywordView::Paint(ChromeCanvas* canvas) { canvas->TranslateInt(0, kBackgroundYOffset); - background_painter_.Paint(GetWidth(), GetHeight() - kTopInset, canvas); + background_painter_.Paint(width(), height() - kTopInset, canvas); canvas->TranslateInt(0, -kBackgroundYOffset); } @@ -658,11 +658,11 @@ void LocationBarView::SelectedKeywordView::DidChangeBounds( void LocationBarView::SelectedKeywordView::Layout() { CSize pref; GetPreferredSize(&pref); - bool at_pref = (GetWidth() == pref.cx); + bool at_pref = (width() == pref.cx); if (at_pref) - full_label_.SetBounds(0, 0, GetWidth(), GetHeight()); + full_label_.SetBounds(0, 0, width(), height()); else - partial_label_.SetBounds(0, 0, GetWidth(), GetHeight()); + partial_label_.SetBounds(0, 0, width(), height()); full_label_.SetVisible(at_pref); partial_label_.SetVisible(!at_pref); } @@ -757,7 +757,7 @@ void LocationBarView::KeywordHintView::SetKeyword(const std::wstring& keyword) { } void LocationBarView::KeywordHintView::Paint(ChromeCanvas* canvas) { - int image_x = leading_label_.IsVisible() ? leading_label_.GetWidth() : 0; + int image_x = leading_label_.IsVisible() ? leading_label_.width() : 0; // Since we paint the button image directly on the canvas (instead of using a // child view), we must mirror the button's position manually if the locale @@ -791,21 +791,20 @@ void LocationBarView::KeywordHintView::GetMinimumSize(CSize* out) { void LocationBarView::KeywordHintView::Layout() { // TODO(sky): baseline layout. - bool show_labels = (GetWidth() != kTabButtonBitmap->width()); + bool show_labels = (width() != kTabButtonBitmap->width()); leading_label_.SetVisible(show_labels); trailing_label_.SetVisible(show_labels); - int height = GetHeight(); int x = 0; CSize pref; if (show_labels) { leading_label_.GetPreferredSize(&pref); - leading_label_.SetBounds(x, 0, pref.cx, height); + leading_label_.SetBounds(x, 0, pref.cx, height()); x += pref.cx + kTabButtonBitmap->width(); trailing_label_.GetPreferredSize(&pref); - trailing_label_.SetBounds(x, 0, pref.cx, height); + trailing_label_.SetBounds(x, 0, pref.cx, height()); } } @@ -881,12 +880,12 @@ void LocationBarView::ShowFirstRunBubbleInternal() { // therefore we need to adjust the X coordinate so that bubble appears on the // right hand side of the location bar. if (UILayoutIsRightToLeft()) - location.x += GetWidth(); + location.x += width(); ChromeViews::View::ConvertPointToScreen(this, &location); // We try to guess that 20 pixels offset is a good place for the first // letter in the OmniBox. - gfx::Rect bounds(location.x, location.y, 20, GetHeight()); + gfx::Rect bounds(location.x, location.y, 20, height()); // Moving the bounds "backwards" so that it appears within the location bar // if the UI layout is RTL. @@ -957,7 +956,7 @@ void LocationBarView::SecurityImageView::ShowInfoBubble() { CPoint location(0, 0); ChromeViews::View::ConvertPointToScreen(this, &location); - gfx::Rect bounds(location.x, location.y, GetWidth(), GetHeight()); + gfx::Rect bounds(location.x, location.y, width(), height()); ChromeViews::Label* label = new ChromeViews::Label(text); label->SetMultiLine(true); diff --git a/chrome/browser/views/old_frames/frame_view.cc b/chrome/browser/views/old_frames/frame_view.cc index 3375d07..dab87e9 100644 --- a/chrome/browser/views/old_frames/frame_view.cc +++ b/chrome/browser/views/old_frames/frame_view.cc @@ -75,19 +75,19 @@ bool FrameView::ShouldForwardToTabStrip( if (!window_->GetTabStrip()->IsVisible()) return false; - const int tab_y = window_->GetTabStrip()->GetY(); - const int tab_height = window_->GetTabStrip()->GetHeight(); - if (event.GetY() >= tab_y + tab_height) + const int tab_y = window_->GetTabStrip()->y(); + const int tab_height = window_->GetTabStrip()->height(); + if (event.y() >= tab_y + tab_height) return false; - if (event.GetY() >= tab_y) + if (event.y() >= tab_y) return true; // Mouse isn't over the tab strip. Only forward if the mouse isn't over // another view on the tab strip or is over a view we were told the user can // drop on. ChromeViews::View* view_over_mouse = - GetViewForPoint(CPoint(event.GetX(), event.GetY())); + GetViewForPoint(CPoint(event.x(), event.y())); return (view_over_mouse == this || view_over_mouse == window_->GetTabStrip() || dropable_views_.find(view_over_mouse) != dropable_views_.end()); diff --git a/chrome/browser/views/old_frames/simple_vista_frame.cc b/chrome/browser/views/old_frames/simple_vista_frame.cc index c7090d7..884d748 100644 --- a/chrome/browser/views/old_frames/simple_vista_frame.cc +++ b/chrome/browser/views/old_frames/simple_vista_frame.cc @@ -118,7 +118,7 @@ void SimpleVistaFrame::SizeToContents(const gfx::Rect& contents_bounds) { GetBounds(&client_bounds, false); int left_edge_width = client_bounds.left - window_bounds.left; int top_edge_height = client_bounds.top - window_bounds.top + - location_bar_->GetHeight(); + location_bar_->height(); int right_edge_width = window_bounds.right - client_bounds.right; int bottom_edge_height = window_bounds.bottom - client_bounds.bottom; @@ -205,14 +205,14 @@ void SimpleVistaFrame::Layout() { TabContentsContainerView* container = GetTabContentsContainer(); CSize s; location_bar_->GetPreferredSize(&s); - location_bar_->SetBounds(container->GetX() - kLocationBarOutdent, - container->GetY() - kLocationBarOutdent, - container->GetWidth() + kLocationBarOutdent * 2, + location_bar_->SetBounds(container->x() - kLocationBarOutdent, + container->y() - kLocationBarOutdent, + container->width() + kLocationBarOutdent * 2, s.cy); - container->SetBounds(container->GetX(), - location_bar_->GetY() + location_bar_->GetHeight() - - kLocationBarSpacing, container->GetWidth(), - container->GetHeight() - location_bar_->GetHeight() + + container->SetBounds(container->x(), + location_bar_->y() + location_bar_->height() - + kLocationBarSpacing, container->width(), + container->height() - location_bar_->height() + 3); location_bar_->SetVisible(true); location_bar_->Layout(); diff --git a/chrome/browser/views/old_frames/simple_xp_frame.cc b/chrome/browser/views/old_frames/simple_xp_frame.cc index d4bf51a..44a5a54 100644 --- a/chrome/browser/views/old_frames/simple_xp_frame.cc +++ b/chrome/browser/views/old_frames/simple_xp_frame.cc @@ -93,7 +93,7 @@ void TitleBarMenuButton::GetPreferredSize(CSize *out) { void TitleBarMenuButton::Paint(ChromeCanvas* canvas) { if (GetState() == TextButton::BS_HOT || GetState() == TextButton::BS_PUSHED || menu_visible_) { - canvas->FillRectInt(kHotColor, 0, 0, GetWidth(), GetHeight()); + canvas->FillRectInt(kHotColor, 0, 0, width(), height()); } if (contents_) { @@ -104,8 +104,8 @@ void TitleBarMenuButton::Paint(ChromeCanvas* canvas) { PaintFloatingView(canvas, contents_, kVertBorderSize, - (GetHeight() - s.cy) / 2, - GetWidth() - kHorizMargin - drop_arrow_->width() - + (height() - s.cy) / 2, + width() - kHorizMargin - drop_arrow_->width() - (2 * kHorizBorderSize), s.cy); } @@ -114,8 +114,8 @@ void TitleBarMenuButton::Paint(ChromeCanvas* canvas) { // mirror the drop down arrow because is is drawn directly on the canvas // (instead of using a child View). Thus, we should mirror its position // manually. - gfx::Rect arrow_bounds(GetWidth() - drop_arrow_->width() - kHorizBorderSize, - (GetHeight() - drop_arrow_->height()) / 2, + gfx::Rect arrow_bounds(width() - drop_arrow_->width() - kHorizBorderSize, + (height() - drop_arrow_->height()) / 2, drop_arrow_->width(), drop_arrow_->height()); arrow_bounds.set_x(MirroredLeftPointForRect(arrow_bounds)); @@ -124,7 +124,7 @@ void TitleBarMenuButton::Paint(ChromeCanvas* canvas) { bool TitleBarMenuButton::OnMousePressed(const ChromeViews::MouseEvent& e) { if (e.GetFlags() & ChromeViews::MouseEvent::EF_IS_DOUBLE_CLICK) { - if (!HitTest(WTL::CPoint(e.GetX(), e.GetY()))) + if (!HitTest(WTL::CPoint(e.x(), e.y()))) return true; title_bar_->CloseWindow(); return true; @@ -196,10 +196,10 @@ void SimpleXPFrameTitleBar::RunMenu(ChromeViews::View* source, // flag. We also adjust the menu position because RTL menus use a different // anchor point. CPoint p(menu_button_->GetX(APPLY_MIRRORING_TRANSFORMATION), - menu_button_->GetY() + menu_button_->GetHeight()); + menu_button_->y() + menu_button_->height()); if (UILayoutIsRightToLeft()) - p.x += menu_button_->GetWidth(); + p.x += menu_button_->width(); View::ConvertPointToScreen(this, &p); parent_->RunMenu(p, hwnd); } @@ -207,14 +207,14 @@ void SimpleXPFrameTitleBar::RunMenu(ChromeViews::View* source, void SimpleXPFrameTitleBar::Layout() { CSize s; menu_button_->GetPreferredSize(&s); - menu_button_->SetBounds(kFavIconMargin, (GetHeight() - s.cy) / 2, + menu_button_->SetBounds(kFavIconMargin, (height() - s.cy) / 2, s.cx, s.cy); menu_button_->Layout(); - label_->SetBounds(menu_button_->GetX() + menu_button_->GetWidth() + + label_->SetBounds(menu_button_->x() + menu_button_->width() + kFavIconPadding, kLabelVerticalOffset, - GetWidth() - (menu_button_->GetX() + - menu_button_->GetWidth() + kFavIconPadding), - GetHeight()); + width() - (menu_button_->x() + + menu_button_->width() + kFavIconPadding), + height()); } bool SimpleXPFrameTitleBar::WillHandleMouseEvent(int x, int y) { @@ -222,7 +222,7 @@ bool SimpleXPFrameTitleBar::WillHandleMouseEvent(int x, int y) { // a way that returns the mirrored position and not the position set using // SetX()/SetBounds(). CPoint p(x - menu_button_->GetX(APPLY_MIRRORING_TRANSFORMATION), - y - menu_button_->GetY()); + y - menu_button_->y()); return menu_button_->HitTest(p); } @@ -314,8 +314,8 @@ void SimpleXPFrame::Layout() { if (IsTitleBarVisible()) { TabContentsContainerView* tccv = GetTabContentsContainer(); DCHECK(tccv); - title_bar_->SetBounds(tccv->GetX(), 0, - GetButtonXOrigin() - tccv->GetX(), + title_bar_->SetBounds(tccv->x(), 0, + GetButtonXOrigin() - tccv->x(), GetContentsYOrigin()); title_bar_->Layout(); } @@ -324,14 +324,14 @@ void SimpleXPFrame::Layout() { TabContentsContainerView* container = GetTabContentsContainer(); CSize s; location_bar_->GetPreferredSize(&s); - location_bar_->SetBounds(container->GetX() - kLocationBarOffset, - container->GetY(), - container->GetWidth() + kLocationBarOffset * 2, + location_bar_->SetBounds(container->x() - kLocationBarOffset, + container->y(), + container->width() + kLocationBarOffset * 2, s.cy); - container->SetBounds(container->GetX(), - location_bar_->GetY() + location_bar_->GetHeight() + - kLocationBarSpacing, container->GetWidth(), - container->GetHeight() - location_bar_->GetHeight() - + container->SetBounds(container->x(), + location_bar_->y() + location_bar_->height() + + kLocationBarSpacing, container->width(), + container->height() - location_bar_->height() - 1); location_bar_->SetVisible(true); location_bar_->Layout(); @@ -346,8 +346,8 @@ LRESULT SimpleXPFrame::OnNCHitTest(const CPoint& pt) { ChromeViews::View::ConvertPointToView(NULL, title_bar_, &p); if (!title_bar_->WillHandleMouseEvent(p.x, p.y) && p.x >= 0 && p.y >= kTopResizeBarHeight && - p.x < title_bar_->GetWidth() && - p.y < title_bar_->GetHeight()) { + p.x < title_bar_->width() && + p.y < title_bar_->height()) { return HTCAPTION; } } diff --git a/chrome/browser/views/old_frames/vista_frame.cc b/chrome/browser/views/old_frames/vista_frame.cc index ef531c0..3c25943 100644 --- a/chrome/browser/views/old_frames/vista_frame.cc +++ b/chrome/browser/views/old_frames/vista_frame.cc @@ -265,8 +265,8 @@ void VistaFrame::Layout() { tabstrip_bounds.width(), tabstrip_bounds.height()); - frame_view_->SetContentsOffset(tabstrip_->GetY() + - tabstrip_->GetHeight() - + frame_view_->SetContentsOffset(tabstrip_->y() + + tabstrip_->height() - kToolbarOverlapVertOffset); } else { tabstrip_->SetBounds(0, 0, 0, 0); @@ -279,17 +279,17 @@ void VistaFrame::Layout() { if (IsToolBarVisible()) { browser_view_->SetVisible(true); browser_view_->SetBounds(g_bitmaps[CT_LEFT_SIDE]->width(), - tabstrip_->GetY() + tabstrip_->GetHeight() - + tabstrip_->y() + tabstrip_->height() - kToolbarOverlapVertOffset, width - g_bitmaps[CT_LEFT_SIDE]->width() - g_bitmaps[CT_RIGHT_SIDE]->width(), g_bitmaps[CT_TOP_CENTER]->height()); browser_view_->Layout(); - toolbar_bottom = browser_view_->GetY() + browser_view_->GetHeight(); + toolbar_bottom = browser_view_->y() + browser_view_->height(); } else { browser_view_->SetBounds(0, 0, 0, 0); browser_view_->SetVisible(false); - toolbar_bottom = tabstrip_->GetY() + tabstrip_->GetHeight(); + toolbar_bottom = tabstrip_->y() + tabstrip_->height(); } int browser_x, browser_y; int browser_w, browser_h; @@ -581,8 +581,8 @@ bool VistaFrame::IsMaximized() { } gfx::Rect VistaFrame::GetBoundsForContentBounds(const gfx::Rect content_rect) { - if (tab_contents_container_->GetX() == 0 && - tab_contents_container_->GetWidth() == 0) { + if (tab_contents_container_->x() == 0 && + tab_contents_container_->width() == 0) { Layout(); } @@ -595,10 +595,10 @@ gfx::Rect VistaFrame::GetBoundsForContentBounds(const gfx::Rect content_rect) { r.set_x(content_rect.x() - p.x); r.set_y(content_rect.y() - p.y); r.set_width(p.x + content_rect.width() + - (bounds.Width() - (p.x + tab_contents_container_->GetWidth()))); + (bounds.Width() - (p.x + tab_contents_container_->width()))); r.set_height(p.y + content_rect.height() + (bounds.Height() - (p.y + - tab_contents_container_->GetHeight()))); + tab_contents_container_->height()))); return r; } @@ -975,8 +975,8 @@ LRESULT VistaFrame::OnNCHitTest(const CPoint& pt) { // If we are over the tabstrip if (tab_pt.x > 0 && tab_pt.y >= kTabShadowSize && - tab_pt.x < tabstrip_->GetWidth() && - tab_pt.y < tabstrip_->GetHeight()) { + tab_pt.x < tabstrip_->width() && + tab_pt.y < tabstrip_->height()) { ChromeViews::View* v = tabstrip_->GetViewForPoint(tab_pt); if (v == tabstrip_) return HTCAPTION; @@ -1039,7 +1039,7 @@ LRESULT VistaFrame::OnNCHitTest(const CPoint& pt) { return HTBOTTOM; } - if (p.y <= tabstrip_->GetY() + tabstrip_->GetHeight()) { + if (p.y <= tabstrip_->y() + tabstrip_->height()) { return HTCAPTION; } @@ -1281,19 +1281,19 @@ void VistaFrame::VistaFrameView::Paint(ChromeCanvas* canvas) { // When painting the border, exclude the contents area. This will prevent the // border bitmaps (which might be larger than the visible area) from coming // into the content area when there is no tab painted yet. - int x = parent_->tab_contents_container_->GetX(); - int y = parent_->tab_contents_container_->GetY(); + int x = parent_->tab_contents_container_->x(); + int y = parent_->tab_contents_container_->y(); SkRect clip; clip.set(SkIntToScalar(x), SkIntToScalar(y), - SkIntToScalar(x + parent_->tab_contents_container_->GetWidth()), - SkIntToScalar(y + parent_->tab_contents_container_->GetHeight())); + SkIntToScalar(x + parent_->tab_contents_container_->width()), + SkIntToScalar(y + parent_->tab_contents_container_->height())); canvas->clipRect(clip, SkRegion::kDifference_Op); PaintContentsBorder(canvas, 0, contents_offset_, - GetWidth(), - GetHeight() - contents_offset_); + width(), + height() - contents_offset_); canvas->restore(); } @@ -1361,7 +1361,7 @@ bool VistaFrame::VistaFrameView::ShouldForwardToTabStrip( if (min_x != std::numeric_limits<int>::max() && max_x != std::numeric_limits<int>::min() && max_y != std::numeric_limits<int>::min()) { - CPoint screen_drag_point(event.GetX(), event.GetY()); + CPoint screen_drag_point(event.x(), event.y()); ConvertPointToScreen(this, &screen_drag_point); if (screen_drag_point.x >= min_x && screen_drag_point.x <= max_x && screen_drag_point.y <= max_y) { @@ -1414,8 +1414,8 @@ void VistaFrame::ResetDWMFrame() { g_bitmaps[CT_TOP_RIGHT_CORNER]->width(), kDwmBorderSize + IsToolBarVisible() ? - browser_view_->GetY() + kToolbarOverlapVertOffset : - tabstrip_->GetHeight(), + browser_view_->y() + kToolbarOverlapVertOffset : + tabstrip_->height(), kDwmBorderSize + g_bitmaps[CT_BOTTOM_CENTER]->height()}; @@ -1446,7 +1446,7 @@ bool VistaFrame::UpdateChildViewAndLayout(ChromeViews::View* new_view, if (new_view) { CSize pref_size; new_view->GetPreferredSize(&pref_size); - if (pref_size.cy != new_view->GetHeight()) + if (pref_size.cy != new_view->height()) return true; } return false; @@ -1459,7 +1459,7 @@ bool VistaFrame::UpdateChildViewAndLayout(ChromeViews::View* new_view, int current_height = 0; if (*view) { - current_height = (*view)->GetHeight(); + current_height = (*view)->height(); root_view_.RemoveChildView(*view); } diff --git a/chrome/browser/views/old_frames/xp_frame.cc b/chrome/browser/views/old_frames/xp_frame.cc index 1a02f3a..8e3978f 100644 --- a/chrome/browser/views/old_frames/xp_frame.cc +++ b/chrome/browser/views/old_frames/xp_frame.cc @@ -559,12 +559,12 @@ void* XPFrame::GetPlatformID() { } int XPFrame::GetContentsYOrigin() { - int min_y = tab_contents_container_->GetY(); + int min_y = tab_contents_container_->y(); if (info_bar_view_) - min_y = std::min(min_y, info_bar_view_->GetY()); + min_y = std::min(min_y, info_bar_view_->y()); if (bookmark_bar_view_.get()) - min_y = std::min(min_y, bookmark_bar_view_->GetY()); + min_y = std::min(min_y, bookmark_bar_view_->y()); return min_y; } @@ -605,7 +605,7 @@ void XPFrame::Layout() { restore_button_->GetPreferredSize(&preferred_size); restore_button_->SetImageAlignment(ChromeViews::Button::ALIGN_LEFT, ChromeViews::Button::ALIGN_BOTTOM); - restore_button_->SetBounds(close_button_->GetX() - preferred_size.cx, + restore_button_->SetBounds(close_button_->x() - preferred_size.cx, 0, preferred_size.cx, preferred_size.cy + @@ -614,7 +614,7 @@ void XPFrame::Layout() { min_button_->GetPreferredSize(&preferred_size); min_button_->SetImageAlignment(ChromeViews::Button::ALIGN_LEFT, ChromeViews::Button::ALIGN_BOTTOM); - min_button_->SetBounds(restore_button_->GetX() - preferred_size.cx, + min_button_->SetBounds(restore_button_->x() - preferred_size.cx, 0, preferred_size.cx, preferred_size.cy + @@ -636,7 +636,7 @@ void XPFrame::Layout() { max_button_->GetPreferredSize(&preferred_size); max_button_->SetImageAlignment(ChromeViews::Button::ALIGN_LEFT, ChromeViews::Button::ALIGN_TOP); - max_button_->SetBounds(close_button_->GetX() - preferred_size.cx, + max_button_->SetBounds(close_button_->x() - preferred_size.cx, kWindowControlsTopOffset, preferred_size.cx, preferred_size.cy); @@ -644,13 +644,13 @@ void XPFrame::Layout() { min_button_->GetPreferredSize(&preferred_size); min_button_->SetImageAlignment(ChromeViews::Button::ALIGN_LEFT, ChromeViews::Button::ALIGN_TOP); - min_button_->SetBounds(max_button_->GetX() - preferred_size.cx, + min_button_->SetBounds(max_button_->x() - preferred_size.cx, kWindowControlsTopOffset, preferred_size.cx, preferred_size.cy); } - int right_limit = min_button_->GetX(); + int right_limit = min_button_->x(); int left_margin; int right_margin; int bottom_margin; @@ -702,7 +702,7 @@ void XPFrame::Layout() { CSize distributor_logo_size; distributor_logo_->GetPreferredSize(&distributor_logo_size); distributor_logo_->SetVisible(true); - distributor_logo_->SetBounds(min_button_->GetX() - + distributor_logo_->SetBounds(min_button_->x() - distributor_logo_size.cx - kDistributorLogoHorizontalOffset, kDistributorLogoVerticalOffset, @@ -715,7 +715,7 @@ void XPFrame::Layout() { right_limit - tab_strip_x - right_margin, tabstrip_->GetPreferredHeight()); - last_y = tabstrip_->GetY() + tabstrip_->GetHeight(); + last_y = tabstrip_->y() + tabstrip_->height(); } else { tabstrip_->SetBounds(0, 0, 0, 0); tabstrip_->SetVisible(false); @@ -736,8 +736,8 @@ void XPFrame::Layout() { browser_view_width, bitmaps[CT_TOP_CENTER]->height()); browser_view_->Layout(); - title_bar_height_ = browser_view_->GetY(); - last_y = browser_view_->GetY() + browser_view_->GetHeight(); + title_bar_height_ = browser_view_->y(); + last_y = browser_view_->y() + browser_view_->height(); } else { // If the tab strip is visible, we need to expose the toolbar for a small // offset. (kCollapsedToolbarHeight). @@ -746,7 +746,7 @@ void XPFrame::Layout() { last_y += kCollapsedToolbarHeight; } else { last_y = std::max(kMinTitleBarHeight, - close_button_->GetY() + close_button_->GetHeight()); + close_button_->y() + close_button_->height()); title_bar_height_ = last_y; } browser_view_->SetVisible(false); @@ -1724,10 +1724,10 @@ XPFrame::ResizeMode XPFrame::ComputeResizeMode(int x, int width, int height) { // Make sure we're not over a window control (they overlap our resize area). - if (x >= min_button_->GetX() && - x < close_button_->GetX() + close_button_->GetWidth() && - y >= min_button_->GetY() && - y < min_button_->GetY() + min_button_->GetHeight()) { + if (x >= min_button_->x() && + x < close_button_->x() + close_button_->width() && + y >= min_button_->y() && + y < min_button_->y() + min_button_->height()) { return RM_UNDEFINED; } @@ -1811,8 +1811,8 @@ bool XPFrame::IsMaximized() { } gfx::Rect XPFrame::GetBoundsForContentBounds(const gfx::Rect content_rect) { - if (tab_contents_container_->GetX() == 0 && - tab_contents_container_->GetWidth() == 0) { + if (tab_contents_container_->x() == 0 && + tab_contents_container_->width() == 0) { Layout(); } @@ -1825,10 +1825,10 @@ gfx::Rect XPFrame::GetBoundsForContentBounds(const gfx::Rect content_rect) { r.set_x(content_rect.x() - p.x); r.set_y(content_rect.y() - p.y); r.set_width(p.x + content_rect.width() + - (bounds.Width() - (p.x + tab_contents_container_->GetWidth()))); + (bounds.Width() - (p.x + tab_contents_container_->width()))); r.set_height(p.y + content_rect.height() + (bounds.Height() - (p.y + - tab_contents_container_->GetHeight()))); + tab_contents_container_->height()))); return r; } @@ -2000,8 +2000,6 @@ void XPFrame::ProcessMouseExited() { //////////////////////////////////////////////////////////////////////////////// void XPFrame::XPFrameView::PaintFrameBorder(ChromeCanvas* canvas) { - int width = GetWidth(); - int height = GetHeight(); int x, y; x = 0; y = 0; @@ -2037,9 +2035,9 @@ void XPFrame::XPFrameView::PaintFrameBorder(ChromeCanvas* canvas) { bottom_right_corner = bitmaps[DE_BOTTOM_RIGHT_CORNER]; } - int variable_width = width - top_left_corner->width() - + int variable_width = width() - top_left_corner->width() - top_right_corner->width(); - int variable_height = height - top_right_corner->height() - + int variable_height = height() - top_right_corner->height() - bottom_right_corner->height(); // Top @@ -2049,7 +2047,7 @@ void XPFrame::XPFrameView::PaintFrameBorder(ChromeCanvas* canvas) { y, variable_width, top_center->height()); - x = width - top_right_corner->width(); + x = width() - top_right_corner->width(); canvas->DrawBitmapInt(*top_right_corner, x, y); // Right side @@ -2061,16 +2059,16 @@ void XPFrame::XPFrameView::PaintFrameBorder(ChromeCanvas* canvas) { // Bottom canvas->DrawBitmapInt(*bottom_right_corner, - width - bottom_right_corner->width(), - height - bottom_right_corner->height()); + width() - bottom_right_corner->width(), + height() - bottom_right_corner->height()); canvas->TileImageInt(*bottom_center, bottom_left_corner->width(), - height - bottom_center->height(), + height() - bottom_center->height(), variable_width, bottom_center->height()); canvas->DrawBitmapInt(*bottom_left_corner, 0, - height - bottom_left_corner->height()); + height() - bottom_left_corner->height()); // Left canvas->TileImageInt(*left_side, @@ -2081,9 +2079,6 @@ void XPFrame::XPFrameView::PaintFrameBorder(ChromeCanvas* canvas) { } void XPFrame::XPFrameView::PaintFrameBorderZoomed(ChromeCanvas* canvas) { - int width = GetWidth(); - int height = GetHeight(); - static const SkBitmap * maximized_top; static const SkBitmap * maximized_bottom; @@ -2099,12 +2094,12 @@ void XPFrame::XPFrameView::PaintFrameBorderZoomed(ChromeCanvas* canvas) { canvas->TileImageInt(*maximized_top, 0, 0, - width, + width(), maximized_top->height()); canvas->TileImageInt(*maximized_bottom, 0, - height - maximized_bottom->height(), - width, + height() - maximized_bottom->height(), + width(), maximized_bottom->height()); } @@ -2211,12 +2206,12 @@ void XPFrame::XPFrameView::Paint(ChromeCanvas* canvas) { // When painting the border, exclude the contents area. This will prevent the // border bitmaps (which might be larger than the visible area) from coming // into the content area when there is no tab painted yet. - int x = parent_->tab_contents_container_->GetX(); - int y = parent_->tab_contents_container_->GetY(); + int x = parent_->tab_contents_container_->x(); + int y = parent_->tab_contents_container_->y(); SkRect clip; clip.set(SkIntToScalar(x), SkIntToScalar(y), - SkIntToScalar(x + parent_->tab_contents_container_->GetWidth()), - SkIntToScalar(y + parent_->tab_contents_container_->GetHeight())); + SkIntToScalar(x + parent_->tab_contents_container_->width()), + SkIntToScalar(y + parent_->tab_contents_container_->height())); canvas->clipRect(clip, SkRegion::kDifference_Op); if (parent_->IsZoomed()) { @@ -2224,7 +2219,7 @@ void XPFrame::XPFrameView::Paint(ChromeCanvas* canvas) { int y; bool should_draw_separator = false; if (parent_->IsToolBarVisible()) { - y = parent_->browser_view_->GetY(); + y = parent_->browser_view_->y(); } else if (parent_->IsTabStripVisible()) { y = parent_->GetContentsYOrigin() - kCollapsedToolbarHeight - kToolbarOverlapVertOffset; @@ -2232,13 +2227,13 @@ void XPFrame::XPFrameView::Paint(ChromeCanvas* canvas) { y = parent_->GetContentsYOrigin(); } - PaintContentsBorderZoomed(canvas, 0, y, GetWidth()); + PaintContentsBorderZoomed(canvas, 0, y, width()); } else { PaintFrameBorder(canvas); - int y, height; + int y, frame_height; if (parent_->IsToolBarVisible()) { - y = parent_->browser_view_->GetY(); - height = GetHeight() - (parent_->browser_view_->GetY() + + y = parent_->browser_view_->y(); + frame_height = height() - (parent_->browser_view_->y() + kContentBorderVertBottomOffset); } else { if (parent_->IsTabStripVisible()) { @@ -2247,12 +2242,12 @@ void XPFrame::XPFrameView::Paint(ChromeCanvas* canvas) { } else { y = parent_->GetContentsYOrigin(); } - height = GetHeight() - y - kContentBorderVertBottomOffset; + frame_height = height() - y - kContentBorderVertBottomOffset; } PaintContentsBorder(canvas, kContentBorderHorizOffset, y, - GetWidth() - (2 * kContentBorderHorizOffset), - height); + width() - (2 * kContentBorderHorizOffset), + frame_height); } canvas->restore(); @@ -2282,9 +2277,9 @@ bool XPFrame::XPFrameView::ShouldForwardToTabStrip( const ChromeViews::DropTargetEvent& event) { if (!FrameView::ShouldForwardToTabStrip(event)) return false; - if (parent_->IsZoomed() && event.GetX() >= parent_->min_button_->GetX() && - event.GetY() < (parent_->min_button_->GetY() + - parent_->min_button_->GetHeight())) { + if (parent_->IsZoomed() && event.x() >= parent_->min_button_->x() && + event.y() < (parent_->min_button_->y() + + parent_->min_button_->height())) { return false; } return true; @@ -2313,7 +2308,7 @@ bool XPFrame::UpdateChildViewAndLayout(ChromeViews::View* new_view, if (new_view) { CSize pref_size; new_view->GetPreferredSize(&pref_size); - if (pref_size.cy != new_view->GetHeight()) + if (pref_size.cy != new_view->height()) return true; } return false; @@ -2326,7 +2321,7 @@ bool XPFrame::UpdateChildViewAndLayout(ChromeViews::View* new_view, int current_height = 0; if (*view) { - current_height = (*view)->GetHeight(); + current_height = (*view)->height(); root_view_.RemoveChildView(*view); } diff --git a/chrome/browser/views/old_frames/xp_frame.h b/chrome/browser/views/old_frames/xp_frame.h index e91ffff..89df94c 100644 --- a/chrome/browser/views/old_frames/xp_frame.h +++ b/chrome/browser/views/old_frames/xp_frame.h @@ -224,7 +224,7 @@ class XPFrame : public BrowserWindow, // Return the X origin of the the first frame control button. int GetButtonXOrigin() { - return min_button_->GetX(); + return min_button_->x(); } // Return the Y location of the contents or infobar. diff --git a/chrome/browser/views/options/advanced_contents_view.cc b/chrome/browser/views/options/advanced_contents_view.cc index fe00d42..c063e33 100644 --- a/chrome/browser/views/options/advanced_contents_view.cc +++ b/chrome/browser/views/options/advanced_contents_view.cc @@ -385,8 +385,8 @@ void GeneralSection::Layout() { // do this then it will return 0 as a preferred width when GridLayout (called // from View::Layout) tries to access it. ChromeViews::View* parent = GetParent(); - if (parent && parent->GetWidth()) { - const int parent_width = parent->GetWidth(); + if (parent && parent->width()) { + const int parent_width = parent->width(); reporting_enabled_checkbox_->SetBounds(0, 0, parent_width - 20, 0); } View::Layout(); @@ -1101,8 +1101,8 @@ int AdvancedContentsView::GetLineScrollIncrement( void AdvancedContentsView::Layout() { ChromeViews::View* parent = GetParent(); - if (parent && parent->GetWidth()) { - const int width = parent->GetWidth(); + if (parent && parent->width()) { + const int width = parent->width(); const int height = GetHeightForWidth(width); SetBounds(0, 0, width, height); } else { diff --git a/chrome/browser/views/options/content_page_view.cc b/chrome/browser/views/options/content_page_view.cc index d138840a..bb70905 100644 --- a/chrome/browser/views/options/content_page_view.cc +++ b/chrome/browser/views/options/content_page_view.cc @@ -99,7 +99,7 @@ void FileDisplayArea::SetFile(const std::wstring& file_path) { void FileDisplayArea::Paint(ChromeCanvas* canvas) { HDC dc = canvas->beginPlatformPaint(); - RECT rect = { 0, 0, GetWidth(), GetHeight() }; + RECT rect = { 0, 0, width(), height() }; gfx::NativeTheme::instance()->PaintTextField( dc, EP_EDITTEXT, ETS_READONLY, 0, &rect, gfx::SkColorToCOLORREF(text_field_background_color_), true, true); @@ -114,8 +114,8 @@ void FileDisplayArea::Layout() { CSize ps; text_field_->GetPreferredSize(&ps); text_field_->SetBounds(icon_bounds_.right() + kFileIconTextFieldSpacing, - (GetHeight() - ps.cy) / 2, - GetWidth() - icon_bounds_.right() - + (height() - ps.cy) / 2, + width() - icon_bounds_.right() - kFileIconHorizontalSpacing - kFileIconTextFieldSpacing, ps.cy); } diff --git a/chrome/browser/views/options/cookies_view.cc b/chrome/browser/views/options/cookies_view.cc index 5ba17fd..888e37d 100644 --- a/chrome/browser/views/options/cookies_view.cc +++ b/chrome/browser/views/options/cookies_view.cc @@ -645,7 +645,7 @@ void CookiesView::Layout() { remove_button_->SetBounds(kPanelHorizMargin, y_buttons, ps.cx, ps.cy); remove_all_button_->GetPreferredSize(&ps); - int remove_all_x = remove_button_->GetX() + remove_button_->GetWidth() + + int remove_all_x = remove_button_->x() + remove_button_->width() + kRelatedControlHorizontalSpacing; remove_all_button_->SetBounds(remove_all_x, y_buttons, ps.cx, ps.cy); diff --git a/chrome/browser/views/options/fonts_languages_window_view.cc b/chrome/browser/views/options/fonts_languages_window_view.cc index fb87568..54c6952 100644 --- a/chrome/browser/views/options/fonts_languages_window_view.cc +++ b/chrome/browser/views/options/fonts_languages_window_view.cc @@ -63,8 +63,8 @@ ChromeViews::View* FontsLanguagesWindowView::GetContentsView() { void FontsLanguagesWindowView::Layout() { tabs_->SetBounds(kDialogPadding, kDialogPadding, - GetWidth() - (2 * kDialogPadding), - GetHeight() - (2 * kDialogPadding)); + width() - (2 * kDialogPadding), + height() - (2 * kDialogPadding)); } void FontsLanguagesWindowView::GetPreferredSize(CSize* out) { diff --git a/chrome/browser/views/options/fonts_page_view.cc b/chrome/browser/views/options/fonts_page_view.cc index 0d9c559b..db44561 100644 --- a/chrome/browser/views/options/fonts_page_view.cc +++ b/chrome/browser/views/options/fonts_page_view.cc @@ -158,7 +158,7 @@ void FontDisplayView::SetFontType(const std::wstring& font_name, void FontDisplayView::Paint(ChromeCanvas* canvas) { HDC dc = canvas->beginPlatformPaint(); - RECT rect = { 0, 0, GetWidth(), GetHeight() }; + RECT rect = { 0, 0, width(), height() }; gfx::NativeTheme::instance()->PaintTextField( dc, EP_BACKGROUND, EBS_NORMAL, 0, &rect, ::GetSysColor(COLOR_3DFACE), true, true); @@ -166,7 +166,7 @@ void FontDisplayView::Paint(ChromeCanvas* canvas) { } void FontDisplayView::Layout() { - font_text_label_->SetBounds(0, 0, GetWidth(), GetHeight()); + font_text_label_->SetBounds(0, 0, width(), height()); } void FontDisplayView::GetPreferredSize(CSize* out) { diff --git a/chrome/browser/views/options/languages_page_view.cc b/chrome/browser/views/options/languages_page_view.cc index aa0e3b3..27a00e5 100644 --- a/chrome/browser/views/options/languages_page_view.cc +++ b/chrome/browser/views/options/languages_page_view.cc @@ -293,7 +293,7 @@ void AddLanguageWindowView::Layout() { CSize sz; accept_language_combobox_->GetPreferredSize(&sz); accept_language_combobox_->SetBounds(kDialogPadding, kDialogPadding, - GetWidth() - 2*kDialogPadding, sz.cy); + width() - 2*kDialogPadding, sz.cy); } void AddLanguageWindowView::GetPreferredSize(CSize* out) { diff --git a/chrome/browser/views/options/options_group_view.cc b/chrome/browser/views/options/options_group_view.cc index d905d2b..5dbe96a 100644 --- a/chrome/browser/views/options/options_group_view.cc +++ b/chrome/browser/views/options/options_group_view.cc @@ -56,7 +56,7 @@ void OptionsGroupView::SetHighlighted(bool highlighted) { } int OptionsGroupView::GetContentsWidth() const { - return contents_->GetWidth(); + return contents_->width(); } /////////////////////////////////////////////////////////////////////////////// @@ -69,8 +69,8 @@ void OptionsGroupView::Paint(ChromeCanvas* canvas) { GetGValue(infocolor), GetBValue(infocolor)); int y_offset = kUnrelatedControlVerticalSpacing / 2; - canvas->FillRectInt(background_color, 0, 0, GetWidth(), - GetHeight() - y_offset); + canvas->FillRectInt(background_color, 0, 0, width(), + height() - y_offset); } } diff --git a/chrome/browser/views/options/options_window_view.cc b/chrome/browser/views/options/options_window_view.cc index 97dfc7e..cb8bb50 100644 --- a/chrome/browser/views/options/options_window_view.cc +++ b/chrome/browser/views/options/options_window_view.cc @@ -159,8 +159,8 @@ void OptionsWindowView::TabSelectedAt(int index) { void OptionsWindowView::Layout() { tabs_->SetBounds(kDialogPadding, kDialogPadding, - GetWidth() - (2 * kDialogPadding), - GetHeight() - (2 * kDialogPadding)); + width() - (2 * kDialogPadding), + height() - (2 * kDialogPadding)); } void OptionsWindowView::GetPreferredSize(CSize* out) { diff --git a/chrome/browser/views/page_info_window.cc b/chrome/browser/views/page_info_window.cc index 2d80ded..8116110 100644 --- a/chrome/browser/views/page_info_window.cc +++ b/chrome/browser/views/page_info_window.cc @@ -198,15 +198,15 @@ void SecurityTabView::Section::Layout() { title_label_->SetBounds(x, y, size.cx, size.cy); x += size.cx + kHGapTitleToSeparator; separator_->SetBounds(x + kHExtraSeparatorPadding, y, - GetWidth() - x - 2 * kHExtraSeparatorPadding, size.cy); + width() - x - 2 * kHExtraSeparatorPadding, size.cy); // Then the image, head-line and description. x = kHGapToBorder; - y += title_label_->GetHeight() + kVGapTitleToImage; + y += title_label_->height() + kVGapTitleToImage; status_image_->GetPreferredSize(&size); status_image_->SetBounds(x, y, size.cx, size.cy); x += size.cx + kHGapImageToDescription; - int w = GetWidth() - x; + int w = width() - x; if (!head_line_label_->GetText().empty()) { head_line_label_->GetPreferredSize(&size); head_line_label_->SetBounds(x, y, w > 0 ? w : 0, size.cy); @@ -368,14 +368,14 @@ void SecurityTabView::AddSection(const std::wstring& title, } void SecurityTabView::Layout() { - int width = GetWidth() - 2 * kHGapToBorder; + int tab_width = width() - 2 * kHGapToBorder; int x = kHGapToBorder; int y = kVGapToBorder; for (std::vector<Section*>::const_iterator iter = sections_.begin(); iter != sections_.end(); ++iter) { Section* section = *iter; - int h = section->GetHeightForWidth(width); - section->SetBounds(x, y, width, h); + int h = section->GetHeightForWidth(tab_width); + section->SetBounds(x, y, tab_width, h); section->Layout(); y += h + kVGapBetweenSections; } diff --git a/chrome/browser/views/sad_tab_view.cc b/chrome/browser/views/sad_tab_view.cc index 938be10..dbcfbfe 100644 --- a/chrome/browser/views/sad_tab_view.cc +++ b/chrome/browser/views/sad_tab_view.cc @@ -44,13 +44,13 @@ static SkShader* CreateGradientShader(int end_point) { } void SadTabView::Paint(ChromeCanvas* canvas) { - SkShader* background_shader = CreateGradientShader(GetHeight()); + SkShader* background_shader = CreateGradientShader(height()); SkPaint paint; paint.setShader(background_shader); background_shader->unref(); paint.setStyle(SkPaint::kFill_Style); canvas->drawRectCoords(0, 0, - SkIntToScalar(GetWidth()), SkIntToScalar(GetHeight()), + SkIntToScalar(width()), SkIntToScalar(height()), paint); canvas->DrawBitmapInt(*sad_tab_bitmap_, icon_bounds_.x(), icon_bounds_.y()); @@ -69,21 +69,21 @@ void SadTabView::Paint(ChromeCanvas* canvas) { void SadTabView::Layout() { int icon_width = sad_tab_bitmap_->width(); int icon_height = sad_tab_bitmap_->height(); - int icon_x = (GetWidth() - icon_width) / 2; - int icon_y = ((GetHeight() - icon_height) / 2) + kSadTabOffset; + int icon_x = (width() - icon_width) / 2; + int icon_y = ((height() - icon_height) / 2) + kSadTabOffset; icon_bounds_.SetRect(icon_x, icon_y, icon_width, icon_height); - int title_x = (GetWidth() - title_width_) / 2; + int title_x = (width() - title_width_) / 2; int title_y = icon_bounds_.bottom() + kIconTitleSpacing; int title_height = title_font_.height(); title_bounds_.SetRect(title_x, title_y, title_width_, title_height); ChromeCanvas cc(0, 0, true); - int message_width = static_cast<int>(GetWidth() * kMessageSize); + int message_width = static_cast<int>(width() * kMessageSize); int message_height = 0; cc.SizeStringInt(message_, message_font_, &message_width, &message_height, ChromeCanvas::MULTI_LINE); - int message_x = (GetWidth() - message_width) / 2; + int message_x = (width() - message_width) / 2; int message_y = title_bounds_.bottom() + kTitleMessageSpacing; message_bounds_.SetRect(message_x, message_y, message_width, message_height); } diff --git a/chrome/browser/views/star_toggle.cc b/chrome/browser/views/star_toggle.cc index 1fc6736..8e34d61 100644 --- a/chrome/browser/views/star_toggle.cc +++ b/chrome/browser/views/star_toggle.cc @@ -36,8 +36,8 @@ bool StarToggle::GetState() const { void StarToggle::Paint(ChromeCanvas* canvas) { PaintFocusBorder(canvas); canvas->DrawBitmapInt(state_ ? *state_on_ : *state_off_, - (GetWidth() - state_off_->width()) / 2, - (GetHeight() - state_off_->height()) / 2); + (width() - state_off_->width()) / 2, + (height() - state_off_->height()) / 2); } void StarToggle::GetPreferredSize(CSize* out) { @@ -50,7 +50,7 @@ bool StarToggle::OnMouseDragged(const ChromeViews::MouseEvent& e) { } bool StarToggle::OnMousePressed(const ChromeViews::MouseEvent& e) { - if (e.IsLeftMouseButton() && HitTest(WTL::CPoint(e.GetX(), e.GetY()))) { + if (e.IsLeftMouseButton() && HitTest(WTL::CPoint(e.x(), e.y()))) { RequestFocus(); return true; } @@ -59,7 +59,7 @@ bool StarToggle::OnMousePressed(const ChromeViews::MouseEvent& e) { void StarToggle::OnMouseReleased(const ChromeViews::MouseEvent& e, bool canceled) { - if (e.IsLeftMouseButton() && HitTest(WTL::CPoint(e.GetX(), e.GetY()))) + if (e.IsLeftMouseButton() && HitTest(WTL::CPoint(e.x(), e.y()))) SwitchState(); } diff --git a/chrome/browser/views/tab_icon_view.cc b/chrome/browser/views/tab_icon_view.cc index b6358dd..fb2caae 100644 --- a/chrome/browser/views/tab_icon_view.cc +++ b/chrome/browser/views/tab_icon_view.cc @@ -97,10 +97,10 @@ void TabIconView::PaintFavIcon(ChromeCanvas* canvas, const SkBitmap& bitmap) { int bw = bitmap.width(); int bh = bitmap.height(); if (bw <= kFavIconSize && bh <= kFavIconSize) { - canvas->DrawBitmapInt(bitmap, (GetWidth() - kFavIconSize) / 2, - (GetHeight() - kFavIconSize) / 2); + canvas->DrawBitmapInt(bitmap, (width() - kFavIconSize) / 2, + (height() - kFavIconSize) / 2); } else { - canvas->DrawBitmapInt(bitmap, 0, 0, bw, bh, 0, 0, GetWidth(), GetHeight(), + canvas->DrawBitmapInt(bitmap, 0, 0, bw, bh, 0, 0, width(), height(), true); } } diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc index ec2ec29..82bb795 100644 --- a/chrome/browser/views/tabs/tab.cc +++ b/chrome/browser/views/tabs/tab.cc @@ -218,8 +218,8 @@ void Tab::ButtonPressed(ChromeViews::BaseButton* sender) { void Tab::MakePathForTab(gfx::Path* path) const { DCHECK(path); - SkScalar h = SkIntToScalar(GetHeight()); - SkScalar w = SkIntToScalar(GetWidth()); + SkScalar h = SkIntToScalar(height()); + SkScalar w = SkIntToScalar(width()); path->moveTo(0, h); diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc index d7509ab..2dd430d 100644 --- a/chrome/browser/views/tabs/tab_renderer.cc +++ b/chrome/browser/views/tabs/tab_renderer.cc @@ -368,7 +368,7 @@ std::wstring TabRenderer::GetTitle() const { void TabRenderer::Paint(ChromeCanvas* canvas) { // Don't paint if we're narrower than we can render correctly. (This should // only happen during animations). - if (GetWidth() < GetMinimumSize().width()) + if (width() < GetMinimumSize().width()) return; // See if the model changes whether the icons should be painted. @@ -389,7 +389,7 @@ void TabRenderer::Paint(ChromeCanvas* canvas) { PaintLoadingAnimation(canvas); } else { canvas->save(); - canvas->ClipRectInt(0, 0, GetWidth(), GetHeight() - 4); + canvas->ClipRectInt(0, 0, width(), height() - 4); if (should_display_crashed_favicon_) { canvas->DrawBitmapInt(*crashed_fav_icon, 0, 0, crashed_fav_icon->width(), @@ -498,7 +498,7 @@ void TabRenderer::Layout() { int title_width; if (close_button_->IsVisible()) { - title_width = std::max(close_button_->GetX() - + title_width = std::max(close_button_->x() - kTitleCloseButtonSpacing - title_left, 0); } else { title_width = std::max(lb.Width() - title_left, 0); @@ -580,17 +580,17 @@ void TabRenderer::PaintInactiveTabBackground(ChromeCanvas* canvas) { canvas->DrawBitmapInt(is_otr ? *tab_inactive_otr_l : *tab_inactive_l, 0, 0); canvas->TileImageInt(is_otr ? *tab_inactive_otr_c : *tab_inactive_c, tab_inactive_l_width, 0, - GetWidth() - tab_inactive_l_width - tab_inactive_r_width, - GetHeight()); + width() - tab_inactive_l_width - tab_inactive_r_width, + height()); canvas->DrawBitmapInt(is_otr ? *tab_inactive_otr_r : *tab_inactive_r, - GetWidth() - tab_inactive_r_width, 0); + width() - tab_inactive_r_width, 0); } void TabRenderer::PaintActiveTabBackground(ChromeCanvas* canvas) { canvas->DrawBitmapInt(*tab_active_l, 0, 0); canvas->TileImageInt(*tab_active_c, tab_active_l_width, 0, - GetWidth() - tab_active_l_width - tab_active_r_width, GetHeight()); - canvas->DrawBitmapInt(*tab_active_r, GetWidth() - tab_active_r_width, 0); + width() - tab_active_l_width - tab_active_r_width, height()); + canvas->DrawBitmapInt(*tab_active_r, width() - tab_active_r_width, 0); } void TabRenderer::PaintHoverTabBackground(ChromeCanvas* canvas, @@ -608,8 +608,8 @@ void TabRenderer::PaintHoverTabBackground(ChromeCanvas* canvas, canvas->DrawBitmapInt(left, 0, 0); canvas->TileImageInt(center, tab_active_l_width, 0, - GetWidth() - tab_active_l_width - tab_active_r_width, GetHeight()); - canvas->DrawBitmapInt(right, GetWidth() - tab_active_r_width, 0); + width() - tab_active_l_width - tab_active_r_width, height()); + canvas->DrawBitmapInt(right, width() - tab_active_r_width, 0); } void TabRenderer::PaintLoadingAnimation(ChromeCanvas* canvas) { @@ -617,14 +617,14 @@ void TabRenderer::PaintLoadingAnimation(ChromeCanvas* canvas) { waiting_animation_frames : loading_animation_frames; int image_size = frames->height(); int image_offset = animation_frame_ * image_size; - int dst_y = (GetHeight() - image_size) / 2; + int dst_y = (height() - image_size) / 2; // Just like with the Tab's title and favicon, the position for the page // loading animation also needs to be mirrored if the View's UI layout is // right-to-left. int dst_x; if (UILayoutIsRightToLeft()) { - dst_x = GetWidth() - kLeftPadding - image_size; + dst_x = width() - kLeftPadding - image_size; } else { dst_x = kLeftPadding; } @@ -634,10 +634,10 @@ void TabRenderer::PaintLoadingAnimation(ChromeCanvas* canvas) { } int TabRenderer::IconCapacity() const { - if (GetHeight() < GetMinimumSize().height()) { + if (height() < GetMinimumSize().height()) { return 0; } - return (GetWidth() - kLeftPadding - kRightPadding) / kFaviconSize; + return (width() - kLeftPadding - kRightPadding) / kFaviconSize; } bool TabRenderer::ShouldShowIcon() const { diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index 6182e9b..768604c 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -73,8 +73,8 @@ class NewTabButton : public ChromeViews::Button { virtual void GetHitTestMask(gfx::Path* path) const { DCHECK(path); - SkScalar h = SkIntToScalar(GetHeight()); - SkScalar w = SkIntToScalar(GetWidth()); + SkScalar h = SkIntToScalar(height()); + SkScalar w = SkIntToScalar(width()); // These values are defined by the shape of the new tab bitmap. Should that // bitmap ever change, these values will need to be updated. They're so @@ -396,15 +396,15 @@ class MoveTabAnimation : public TabStrip::TabAnimation { double distance = start_tab_b_bounds_.x() - start_tab_a_bounds_.x(); double delta = distance * animation_.GetCurrentValue(); double new_x = start_tab_a_bounds_.x() + delta; - tab_a_->SetBounds(Round(new_x), tab_a_->GetY(), tab_a_->GetWidth(), - tab_a_->GetHeight()); + tab_a_->SetBounds(Round(new_x), tab_a_->y(), tab_a_->width(), + tab_a_->height()); // Position Tab B distance = start_tab_a_bounds_.x() - start_tab_b_bounds_.x(); delta = distance * animation_.GetCurrentValue(); new_x = start_tab_b_bounds_.x() + delta; - tab_b_->SetBounds(Round(new_x), tab_b_->GetY(), tab_b_->GetWidth(), - tab_b_->GetHeight()); + tab_b_->SetBounds(Round(new_x), tab_b_->y(), tab_b_->width(), + tab_b_->height()); tabstrip_->SchedulePaint(); } @@ -470,9 +470,9 @@ class ResizeLayoutAnimation : public TabStrip::TabAnimation { for (int i = 0; i < tabstrip_->GetTabCount(); ++i) { Tab* current_tab = tabstrip_->GetTabAt(i); if (current_tab->IsSelected()) { - start_selected_width_ = current_tab->GetWidth(); + start_selected_width_ = current_tab->width(); } else { - start_unselected_width_ = current_tab->GetWidth(); + start_unselected_width_ = current_tab->width(); } } } @@ -624,8 +624,8 @@ void TabStrip::PaintChildren(ChromeCanvas* canvas) { paint.setPorterDuffXfermode(SkPorterDuff::kDstIn_Mode); paint.setStyle(SkPaint::kFill_Style); canvas->FillRectInt( - 0, 0, GetWidth(), - GetHeight() - 2, // Visible region that overlaps the toolbar. + 0, 0, width(), + height() - 2, // Visible region that overlaps the toolbar. paint); } @@ -1022,7 +1022,7 @@ void TabStrip::MaybeStartDrag(Tab* tab, const ChromeViews::MouseEvent& event) { if (IsAnimating() || tab->closing()) return; drag_controller_.reset(new DraggedTabController(tab, this)); - drag_controller_->CaptureDragInfo(gfx::Point(event.GetX(), event.GetY())); + drag_controller_->CaptureDragInfo(gfx::Point(event.x(), event.y())); } void TabStrip::ContinueDrag(const ChromeViews::MouseEvent& event) { @@ -1171,7 +1171,7 @@ void TabStrip::GetDesiredTabWidths(int tab_count, // Determine how much space we can actually allocate to tabs. int available_width; if (available_width_for_tabs_ < 0) { - available_width = GetWidth(); + available_width = width(); available_width -= (kNewTabButtonHOffset + newtab_button_size_.width()); } else { // Interesting corner case: if |available_width_for_tabs_| > the result @@ -1236,7 +1236,7 @@ void TabStrip::ResizeLayoutTabs() { // We only want to run the animation if we're not already at the desired // size. - if (abs(first_tab->GetWidth() - w) > 1) + if (abs(first_tab->width() - w) > 1) StartResizeLayoutAnimation(); } @@ -1299,12 +1299,12 @@ gfx::Rect TabStrip::GetDropBounds(int drop_index, if (drop_index < GetTabCount()) { Tab* tab = GetTabAt(drop_index); if (drop_before) - center_x = tab->GetX() - (kTabHOffset / 2); + center_x = tab->x() - (kTabHOffset / 2); else - center_x = tab->GetX() + (tab->GetWidth() / 2); + center_x = tab->x() + (tab->width() / 2); } else { Tab* last_tab = GetTabAt(drop_index - 1); - center_x = last_tab->GetX() + last_tab->GetWidth() + (kTabHOffset / 2); + center_x = last_tab->x() + last_tab->width() + (kTabHOffset / 2); } // Mirror the center point if necessary. @@ -1321,7 +1321,7 @@ gfx::Rect TabStrip::GetDropBounds(int drop_index, *is_beneath = (monitor_bounds.IsEmpty() || !monitor_bounds.Contains(drop_bounds)); if (*is_beneath) - drop_bounds.Offset(0, drop_bounds.height() + GetHeight()); + drop_bounds.Offset(0, drop_bounds.height() + height()); return drop_bounds; } @@ -1330,13 +1330,13 @@ void TabStrip::UpdateDropIndex(const DropTargetEvent& event) { // If the UI layout is right-to-left, we need to mirror the mouse // coordinates since we calculate the drop index based on the // original (and therefore non-mirrored) positions of the tabs. - const int x = MirroredXCoordinateInsideView(event.GetX()); + const int x = MirroredXCoordinateInsideView(event.x()); for (int i = 0; i < GetTabCount(); ++i) { Tab* tab = GetTabAt(i); - const int tab_max_x = tab->GetX() + tab->GetWidth(); - const int hot_width = tab->GetWidth() / 3; + const int tab_max_x = tab->x() + tab->width(); + const int hot_width = tab->width() / 3; if (x < tab_max_x) { - if (x < tab->GetX() + hot_width) + if (x < tab->x() + hot_width) SetDropIndex(i, true); else if (x >= tab_max_x - hot_width) SetDropIndex(i + 1, true); @@ -1465,7 +1465,7 @@ void TabStrip::LayoutNewTabButton(double last_tab_right, // We're shrinking tabs, so we need to anchor the New Tab button to the // right edge of the TabStrip's bounds, rather than the right edge of the // right-most Tab, otherwise it'll bounce when animating. - newtab_button_->SetBounds(GetWidth() - newtab_button_size_.width(), + newtab_button_->SetBounds(width() - newtab_button_size_.width(), kNewTabButtonVOffset, newtab_button_size_.width(), newtab_button_size_.height()); @@ -1564,7 +1564,7 @@ int TabStrip::GetIndexOfTab(const Tab* tab) const { } int TabStrip::GetAvailableWidthForTabs(Tab* last_tab) const { - return last_tab->GetX() + last_tab->GetWidth(); + return last_tab->x() + last_tab->width(); } bool TabStrip::IsPointInTab(Tab* tab, const CPoint& point_in_tabstrip_coords) { diff --git a/chrome/browser/views/toolbar_star_toggle.cc b/chrome/browser/views/toolbar_star_toggle.cc index 101d319..d6b1740 100644 --- a/chrome/browser/views/toolbar_star_toggle.cc +++ b/chrome/browser/views/toolbar_star_toggle.cc @@ -42,8 +42,8 @@ void ToolbarStarToggle::ShowStarBubble(const GURL& url, bool newly_bookmarked) { // Shift the x location by 1 as visually the center of the star appears 1 // pixel to the right. By doing this bubble arrow points to the center // of the star. - gfx::Rect star_bounds(star_location.x + 1, star_location.y, GetWidth(), - GetHeight()); + gfx::Rect star_bounds(star_location.x + 1, star_location.y, width(), + height()); BookmarkBubbleView::Show(host_->browser()->GetTopLevelHWND(), star_bounds, this, host_->profile(), url, newly_bookmarked); is_bubble_showing_ = true; diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index e2c772f..abbad21 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -277,11 +277,11 @@ void BrowserToolbarView::Layout() { back_->SetBounds(kControlIndent, kControlVertOffset, sz.cx, sz.cy); forward_->GetPreferredSize(&sz); - forward_->SetBounds(back_->GetX() + back_->GetWidth(), kControlVertOffset, + forward_->SetBounds(back_->x() + back_->width(), kControlVertOffset, sz.cx, sz.cy); reload_->GetPreferredSize(&sz); - reload_->SetBounds(forward_->GetX() + forward_->GetWidth() + + reload_->SetBounds(forward_->x() + forward_->width() + kControlHorizOffset, kControlVertOffset, sz.cx, sz.cy); @@ -294,11 +294,11 @@ void BrowserToolbarView::Layout() { sz = CSize(0, 0); home_->SetVisible(false); } - home_->SetBounds(reload_->GetX() + reload_->GetWidth() + offset, + home_->SetBounds(reload_->x() + reload_->width() + offset, kControlVertOffset, sz.cx, sz.cy); star_->GetPreferredSize(&sz); - star_->SetBounds(home_->GetX() + home_->GetWidth() + kControlHorizOffset, + star_->SetBounds(home_->x() + home_->width() + kControlHorizOffset, kControlVertOffset, sz.cx, sz.cy); page_menu_->GetPreferredSize(&sz); @@ -311,7 +311,7 @@ void BrowserToolbarView::Layout() { location_bar_height = sz.cy; right_side_width += sz.cx; - left_side_width = star_->GetX() + star_->GetWidth(); + left_side_width = star_->x() + star_->width(); } else { CSize temp; location_bar_->GetPreferredSize(&temp); @@ -322,20 +322,20 @@ void BrowserToolbarView::Layout() { } location_bar_->SetBounds(left_side_width, location_bar_y, - GetWidth() - left_side_width - right_side_width, + width() - left_side_width - right_side_width, location_bar_height); if (IsDisplayModeNormal()) { - go_->SetBounds(location_bar_->GetX() + location_bar_->GetWidth(), + go_->SetBounds(location_bar_->x() + location_bar_->width(), kControlVertOffset, sz.cx, sz.cy); // Make sure the Page menu never overlaps the location bar. - int page_x = go_->GetX() + go_->GetWidth() + kMenuButtonOffset; + int page_x = go_->x() + go_->width() + kMenuButtonOffset; page_menu_->GetPreferredSize(&sz); - page_menu_->SetBounds(page_x, kControlVertOffset, sz.cx, go_->GetHeight()); + page_menu_->SetBounds(page_x, kControlVertOffset, sz.cx, go_->height()); app_menu_->GetPreferredSize(&sz); - app_menu_->SetBounds(page_menu_->GetX() + page_menu_->GetWidth(), - page_menu_->GetY(), sz.cx, go_->GetHeight()); + app_menu_->SetBounds(page_menu_->x() + page_menu_->width(), + page_menu_->y(), sz.cx, go_->height()); } } diff --git a/chrome/test/memory_test/memory_test.cc b/chrome/test/memory_test/memory_test.cc index f3b6892..d31c1e5 100644 --- a/chrome/test/memory_test/memory_test.cc +++ b/chrome/test/memory_test/memory_test.cc @@ -1,426 +1,426 @@ -// Copyright (c) 2006-2008 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.
-
-#include "base/basictypes.h"
-#include "base/command_line.h"
-#include "base/file_util.h"
-#include "base/path_service.h"
-#include "base/process_util.h"
-#include "base/string_util.h"
-#include "chrome/browser/url_fixer_upper.h"
-#include "chrome/common/chrome_constants.h"
-#include "chrome/common/chrome_paths.h"
-#include "chrome/common/chrome_process_filter.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/test/automation/browser_proxy.h"
-#include "chrome/test/automation/tab_proxy.h"
-#include "chrome/test/automation/window_proxy.h"
-#include "chrome/test/ui/ui_test.h"
-#include "chrome/test/perf/mem_usage.h"
-#include "googleurl/src/gurl.h"
-#include "net/base/net_util.h"
-
-namespace {
-
-static const wchar_t kTempDirName[] = L"memory_test_profile";
-
-class MemoryTest : public UITest {
- public:
- MemoryTest() {
- show_window_ = true;
-
- // For now, turn off plugins because they crash like crazy.
- // TODO(mbelshe): Fix Chrome to not crash with plugins.
- CommandLine::AppendSwitch(&launch_arguments_, switches::kDisablePlugins);
-
- CommandLine::AppendSwitch(&launch_arguments_, switches::kEnableLogging);
-
- // Use the playback cache, but don't use playback events.
- CommandLine::AppendSwitch(&launch_arguments_, switches::kPlaybackMode);
- CommandLine::AppendSwitch(&launch_arguments_, switches::kNoEvents);
-
- // Get the specified user data dir (optional)
- std::wstring profile_dir =
- CommandLine().GetSwitchValue(switches::kUserDataDir);
-
- if (profile_dir.length() == 0) {
- // Compute the user-data-dir which contains our test cache.
- PathService::Get(base::DIR_EXE, &profile_dir);
- file_util::UpOneDirectory(&profile_dir);
- file_util::UpOneDirectory(&profile_dir);
- file_util::AppendToPath(&profile_dir, L"data");
- file_util::AppendToPath(&profile_dir, L"memory_test");
- file_util::AppendToPath(&profile_dir, L"general_mix");
- }
-
- if (!SetupTempDirectory(profile_dir)) {
- // There isn't really a way to fail gracefully here.
- // Neither this constuctor nor the SetUp() method return
- // status to the caller. So, just fall through using the
- // default profile and log this. The failure will be
- // obvious.
- LOG(ERROR) << "Error preparing temp directory for test";
- }
-
- CommandLine::AppendSwitchWithValue(&launch_arguments_,
- switches::kUserDataDir,
- user_data_dir_);
- }
-
- ~MemoryTest() {
- // Cleanup our temporary directory.
- if (user_data_dir_.length() > 0)
- file_util::Delete(user_data_dir_, true);
- }
-
- // TODO(mbelshe): Separate this data to an external file.
- // This memory test loads a set of URLs across a set of tabs, maintaining the
- // number of concurrent open tabs at num_target_tabs.
- // <NEWTAB> is a special URL which informs the loop when we should create a
- // new tab.
- // <PAUSE> is a special URL that informs the loop to pause before proceeding
- // to the next URL.
- void RunTest(const wchar_t* test_name, int num_target_tabs) {
- std::string urls[] = {
- "http://www.yahoo.com/",
- "http://hotjobs.yahoo.com/career-articles-the_biggest_resume_mistake_you_can_make-436",
- "http://news.yahoo.com/s/ap/20080804/ap_on_re_mi_ea/odd_israel_home_alone",
- "http://news.yahoo.com/s/nm/20080729/od_nm/subway_dc",
- "http://search.yahoo.com/search?p=new+york+subway&ygmasrchbtn=web+search&fr=ush-news",
- "<NEWTAB>",
- "http://www.cnn.com/",
- "http://www.cnn.com/2008/SHOWBIZ/TV/08/03/applegate.cancer.ap/index.html",
- "http://www.cnn.com/2008/HEALTH/conditions/07/29/black.aids.report/index.html",
- "http://www.cnn.com/POLITICS/",
- "http://search.cnn.com/search.jsp?query=obama&type=web&sortBy=date&intl=false",
- "<NEWTAB>",
- "http://mail.google.com/",
- "http://mail.google.com/mail/?shva=1",
- "http://mail.google.com/mail/?shva=1#search/ipsec",
- "http://mail.google.com/mail/?shva=1#search/ipsec/ee29ae66165d417",
- "http://mail.google.com/mail/?shva=1#compose",
- "<NEWTAB>",
- "http://docs.google.com/",
- "<NEWTAB>",
- "http://calendar.google.com/",
- "<NEWTAB>",
- "http://maps.google.com/",
- "http://maps.google.com/maps/mpl?moduleurl=http://earthquake.usgs.gov/eqcenter/mapplets/earthquakes.xml&ie=UTF8&ll=20,170&spn=140.625336,73.828125&t=k&z=2",
- "http://maps.google.com/maps?f=q&hl=en&geocode=&q=1600+amphitheater+parkway,+mountain+view,+ca&ie=UTF8&z=13",
- "<NEWTAB>",
- "http://www.google.com/",
- "http://www.google.com/search?hl=en&q=food&btnG=Google+Search",
- "http://books.google.com/books?hl=en&q=food&um=1&ie=UTF-8&sa=N&tab=wp",
- "http://images.google.com/images?hl=en&q=food&um=1&ie=UTF-8&sa=N&tab=pi",
- "http://news.google.com/news?hl=en&q=food&um=1&ie=UTF-8&sa=N&tab=in",
- "http://www.google.com/products?sa=N&tab=nf&q=food",
- "<NEWTAB>",
- "http://www.scoundrelspoint.com/polyhedra/shuttle/index.html",
- "<PAUSE>",
- "<NEWTAB>",
- "http://ctho.ath.cx/toys/3d.html",
- "<PAUSE>",
- "<NEWTAB>",
- "http://www.youtube.com/",
- "http://www.youtube.com/results?search_query=funny&search_type=&aq=f",
- "http://www.youtube.com/watch?v=GuMMfgWhm3g",
- "<NEWTAB>",
- "http://www.craigslist.com/",
- "http://sfbay.craigslist.org/",
- "http://sfbay.craigslist.org/apa/",
- "http://sfbay.craigslist.org/sfc/apa/782398209.html",
- "http://sfbay.craigslist.org/sfc/apa/782347795.html",
- "http://sfbay.craigslist.org/sby/apa/782342791.html",
- "http://sfbay.craigslist.org/sfc/apa/782344396.html",
- "<NEWTAB>",
- "http://www.whitehouse.gov/",
- "http://www.whitehouse.gov/news/releases/2008/07/20080729.html",
- "http://www.whitehouse.gov/infocus/afghanistan/",
- "http://www.whitehouse.gov/infocus/africa/",
- "<NEWTAB>",
- "http://www.msn.com/",
- "http://msn.foxsports.com/horseracing/story/8409670/Big-Brown-rebounds-in-Haskell-Invitational?MSNHPHMA",
- "http://articles.moneycentral.msn.com/Investing/StockInvestingTrading/TheBiggestRiskToYourRetirement_SeriesHome.aspx",
- "http://articles.moneycentral.msn.com/Investing/StockInvestingTrading/TheSmartWayToGetRich.aspx",
- "http://articles.moneycentral.msn.com/Investing/ContrarianChronicles/TheFictionOfCorporateTransparency.aspx",
- "<NEWTAB>",
- "http://flickr.com/",
- "http://flickr.com/explore/interesting/2008/03/18/",
- "http://flickr.com/photos/chavals/2344906748/",
- "http://flickr.com/photos/rosemary/2343058024/",
- "http://flickr.com/photos/arbaa/2343235019/",
- "<NEWTAB>",
- "http://zh.wikipedia.org/wiki/%E6%B1%B6%E5%B7%9D%E5%A4%A7%E5%9C%B0%E9%9C%87",
- "http://zh.wikipedia.org/wiki/5%E6%9C%8812%E6%97%A5",
- "http://zh.wikipedia.org/wiki/5%E6%9C%8820%E6%97%A5",
- "http://zh.wikipedia.org/wiki/%E9%A6%96%E9%A1%B5",
- "<NEWTAB>",
- "http://www.nytimes.com/pages/technology/index.html",
- "http://pogue.blogs.nytimes.com/2008/07/17/a-candy-store-for-the-iphone/",
- "http://www.nytimes.com/2008/07/21/technology/21pc.html?_r=1&ref=technology&oref=slogin",
- "http://bits.blogs.nytimes.com/2008/07/19/a-wikipedian-challenge-convincing-arabic-speakers-to-write-in-arabic/",
- "<NEWTAB>",
- "http://www.amazon.com/exec/obidos/tg/browse/-/502394/ref=topnav_storetab_p",
- "http://www.amazon.com/Panasonic-DMC-TZ5K-Digital-Optical-Stabilized/dp/B0011Z8CCG/ref=pd_ts_p_17?ie=UTF8&s=photo",
- "http://www.amazon.com/Nikon-Coolpix-Digital-Vibration-Reduction/dp/B0012OI6HW/ref=pd_ts_p_24?ie=UTF8&s=photo",
- "http://www.amazon.com/Digital-SLRs-Cameras-Photo/b/ref=sv_p_2?ie=UTF8&node=3017941",
- "<NEWTAB>",
- "http://www.boston.com/bigpicture/2008/07/californias_continuing_fires.html",
- "http://www.boston.com/business/",
- "http://www.boston.com/business/articles/2008/07/29/staples_has_a_games_plan/",
- "http://www.boston.com/business/personalfinance/articles/2008/08/04/a_grim_forecast_for_heating_costs/",
- "<NEWTAB>",
- "http://arstechnica.com/",
- "http://arstechnica.com/news.ars/post/20080721-this-years-e3-substance-over-styleand-far-from-dead.html",
- "http://arstechnica.com/news.ars/post/20080729-ifpi-italian-police-take-down-italian-bittorrent-tracker.html",
- "http://arstechnica.com/news.ars/post/20080804-congress-wants-privacy-answers-from-google-ms-aol.html",
- "<NEWTAB>",
- "http://finance.google.com/finance?q=NASDAQ:AAPL",
- "http://finance.google.com/finance?q=GOOG&hl=en",
- "<NEWTAB>",
- "http://blog.wired.com/underwire/2008/07/futurama-gets-m.html",
- "http://blog.wired.com/cars/2008/07/gas-prices-hit.html",
- "<NEWTAB>",
- "http://del.icio.us/popular/programming",
- "http://del.icio.us/popular/",
- "http://del.icio.us/tag/",
- "<NEWTAB>",
- "http://gadgets.boingboing.net/2008/07/21/boom-computing.html",
- "http://3533.spreadshirt.com/us/US/Shop/",
- "<NEWTAB>",
- "http://www.autoblog.com/",
- "http://www.autoblog.com/2008/07/21/audi-introduces-the-next-mmi/",
- "http://www.autoblog.com/categories/auto-types/",
- "http://www.autoblog.com/category/sports/",
- "<NEWTAB>",
- "http://www.wikipedia.org/",
- "http://en.wikipedia.org/wiki/Main_Page",
- "http://fr.wikipedia.org/wiki/Accueil",
- "http://de.wikipedia.org/wiki/Hauptseite",
- "http://ja.wikipedia.org/wiki/%E3%83%A1%E3%82%A4%E3%83%B3%E3%83%9A%E3%83%BC%E3%82%B8",
- "http://it.wikipedia.org/wiki/Pagina_principale",
- "http://nl.wikipedia.org/wiki/Hoofdpagina",
- "http://pt.wikipedia.org/wiki/P%C3%A1gina_principal",
- "http://es.wikipedia.org/wiki/Portada",
- "http://ru.wikipedia.org/wiki/%D0%97%D0%B0%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D0%B0%D1%8F_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0",
- "<NEWTAB>",
- "http://www.google.com/translate_t?hl=en&text=This%20Is%20A%20Test%20Of%20missspellingsdfdf&sl=en&tl=ja",
- };
-
- // Record the initial CommitCharge. This is a system-wide measurement,
- // so if other applications are running, they can create variance in this
- // test.
- size_t start_size = GetSystemCommitCharge();
-
- // Cycle through the URLs.
- scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
- scoped_ptr<TabProxy> tab(window->GetActiveTab());
- int expected_tab_count = 1;
- for (unsigned counter = 0; counter < arraysize(urls); ++counter) {
- std::string url = urls[counter];
-
- if (url == "<PAUSE>") { // Special command to delay on this page
- Sleep(2000);
- continue;
- }
-
- if (url == "<NEWTAB>") { // Special command to create a new tab
- if (++counter >= arraysize(urls))
- continue; // Newtab was specified at end of list. ignore.
-
- url = urls[counter];
- if (GetTabCount() < num_target_tabs) {
- EXPECT_TRUE(window->AppendTab(GURL(url)));
- expected_tab_count++;
- WaitUntilTabCount(expected_tab_count);
- tab.reset(window->GetActiveTab());
- continue;
- }
-
- int tab_index = counter % num_target_tabs; // A pseudo-random tab.
- tab.reset(window->GetTab(tab_index));
- }
-
- const int kMaxWaitTime = 5000;
- bool timed_out = false;
- tab->NavigateToURLWithTimeout(GURL(urls[counter]), kMaxWaitTime,
- &timed_out);
- if (timed_out)
- printf("warning: %s timed out!\n", urls[counter].c_str());
- }
- size_t stop_size = GetSystemCommitCharge();
-
- PrintResults(test_name, stop_size - start_size);
- }
-
- void PrintResults(const wchar_t* test_name, size_t commit_size) {
- PrintMemoryUsageInfo(test_name);
- std::wstring trace_name(test_name);
- trace_name.append(L"_cc");
-
- PrintResult(L"commit_charge", L"", trace_name,
- commit_size / 1024, L"kb", true /* important */);
- }
-
- void PrintIOPerfInfo(const wchar_t* test_name) {
- printf("\n");
- BrowserProcessFilter chrome_filter(user_data_dir_);
- process_util::NamedProcessIterator
- chrome_process_itr(chrome::kBrowserProcessExecutableName,
- &chrome_filter);
-
- const PROCESSENTRY32* chrome_entry;
- while (chrome_entry = chrome_process_itr.NextProcessEntry()) {
- uint32 pid = chrome_entry->th32ProcessID;
- HANDLE process_handle = OpenProcess(PROCESS_QUERY_INFORMATION,
- false,
- pid);
- if (process_handle == NULL) {
- wprintf(L"Error opening process %d: %d\n", pid, GetLastError());
- continue;
- }
-
- scoped_ptr<process_util::ProcessMetrics> process_metrics;
- IO_COUNTERS io_counters;
- process_metrics.reset(
- process_util::ProcessMetrics::CreateProcessMetrics(process_handle));
- ZeroMemory(&io_counters, sizeof(io_counters));
-
- if (process_metrics.get()->GetIOCounters(&io_counters)) {
- std::wstring chrome_name =
- (pid == chrome_filter.browser_process_id()) ? L"_b" : L"_r";
-
- // Print out IO performance. We assume that the values can be
- // converted to size_t (they're reported as ULONGLONG, 64-bit numbers).
- PrintResult(L"read_op", chrome_name, test_name + chrome_name,
- static_cast<size_t>(io_counters.ReadOperationCount), L"",
- false /* not important */);
- PrintResult(L"write_op", chrome_name, test_name + chrome_name,
- static_cast<size_t>(io_counters.WriteOperationCount), L"",
- false /* not important */);
- PrintResult(L"other_op", chrome_name, test_name + chrome_name,
- static_cast<size_t>(io_counters.OtherOperationCount), L"",
- false /* not important */);
- PrintResult(L"read_byte", chrome_name, test_name + chrome_name,
- static_cast<size_t>(io_counters.ReadTransferCount / 1024),
- L"kb", false /* not important */);
- PrintResult(L"write_byte", chrome_name, test_name + chrome_name,
- static_cast<size_t>(io_counters.WriteTransferCount / 1024),
- L"kb", false /* not important */);
- PrintResult(L"other_byte", chrome_name, test_name + chrome_name,
- static_cast<size_t>(io_counters.OtherTransferCount / 1024),
- L"kb", false /* not important */);
- }
- }
- }
-
- void PrintMemoryUsageInfo(const wchar_t* test_name) {
- printf("\n");
- BrowserProcessFilter chrome_filter(user_data_dir_);
- process_util::NamedProcessIterator
- chrome_process_itr(chrome::kBrowserProcessExecutableName,
- &chrome_filter);
-
- size_t browser_virtual_size = 0;
- size_t browser_working_set_size = 0;
- size_t virtual_size = 0;
- size_t working_set_size = 0;
- size_t num_chrome_processes = 0;
- const PROCESSENTRY32* chrome_entry;
- while (chrome_entry = chrome_process_itr.NextProcessEntry()) {
- uint32 pid = chrome_entry->th32ProcessID;
- size_t peak_virtual_size;
- size_t current_virtual_size;
- size_t peak_working_set_size;
- size_t current_working_set_size;
- if (GetMemoryInfo(pid, &peak_virtual_size, ¤t_virtual_size,
- &peak_working_set_size, ¤t_working_set_size)) {
- if (pid == chrome_filter.browser_process_id()) {
- browser_virtual_size = current_virtual_size;
- browser_working_set_size = current_working_set_size;
- }
- virtual_size += current_virtual_size;
- working_set_size += current_working_set_size;
- num_chrome_processes++;
- }
- }
-
- std::wstring trace_name(test_name);
- PrintResult(L"vm_final_browser", L"", trace_name + L"_vm_b",
- browser_virtual_size / 1024, L"kb",
- false /* not important */);
- PrintResult(L"ws_final_browser", L"", trace_name + L"_ws_b",
- browser_working_set_size / 1024, L"kb",
- false /* not important */);
- PrintResult(L"vm_final_total", L"", trace_name + L"_vm",
- virtual_size / 1024, L"kb",
- false /* not important */);
- PrintResult(L"ws_final_total", L"", trace_name + L"_ws",
- working_set_size / 1024, L"kb",
- true /* important */);
- PrintResult(L"processes", L"", trace_name + L"_proc",
- num_chrome_processes, L"",
- false /* not important */);
- }
-
- private:
- // Setup a temporary directory to store the profile to use
- // with these tests.
- // Input:
- // src_dir is set to the source directory
- // Output:
- // On success, modifies user_data_dir_ to be a new profile directory
- bool SetupTempDirectory(std::wstring src_dir) {
- // We create a copy of the test dir and use it so that each
- // run of this test starts with the same data. Running this
- // test has the side effect that it will change the profile.
- std::wstring temp_dir;
- if (!file_util::CreateNewTempDirectory(kTempDirName, &temp_dir))
- return false;
-
- src_dir.append(L"\\*");
-
- if (!file_util::CopyDirectory(src_dir, temp_dir, true))
- return false;
-
- user_data_dir_ = temp_dir;
- return true;
- }
-
- std::wstring user_data_dir_;
-};
-
-class MemoryReferenceTest : public MemoryTest {
- public:
- // override the browser directory that is used by UITest::SetUp to cause it
- // to use the reference build instead.
- void SetUp() {
- std::wstring dir;
- PathService::Get(chrome::DIR_TEST_TOOLS, &dir);
- file_util::AppendToPath(&dir, L"reference_build");
- file_util::AppendToPath(&dir, L"chrome");
- browser_directory_ = dir;
- UITest::SetUp();
- }
-
- void RunTest(const wchar_t* test_name, int num_target_tabs) {
- std::wstring pages, timings;
- MemoryTest::RunTest(test_name, num_target_tabs);
- }
-};
-
-} // namespace
-
-TEST_F(MemoryTest, SingleTabTest) {
- RunTest(L"1t", 1);
-}
-
-TEST_F(MemoryTest, FiveTabTest) {
- RunTest(L"5t", 5);
-}
-
-TEST_F(MemoryTest, TwelveTabTest) {
- RunTest(L"12t", 12);
-}
-
+// Copyright (c) 2006-2008 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. + +#include "base/basictypes.h" +#include "base/command_line.h" +#include "base/file_util.h" +#include "base/path_service.h" +#include "base/process_util.h" +#include "base/string_util.h" +#include "chrome/browser/url_fixer_upper.h" +#include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_paths.h" +#include "chrome/common/chrome_process_filter.h" +#include "chrome/common/chrome_switches.h" +#include "chrome/test/automation/browser_proxy.h" +#include "chrome/test/automation/tab_proxy.h" +#include "chrome/test/automation/window_proxy.h" +#include "chrome/test/ui/ui_test.h" +#include "chrome/test/perf/mem_usage.h" +#include "googleurl/src/gurl.h" +#include "net/base/net_util.h" + +namespace { + +static const wchar_t kTempDirName[] = L"memory_test_profile"; + +class MemoryTest : public UITest { + public: + MemoryTest() { + show_window_ = true; + + // For now, turn off plugins because they crash like crazy. + // TODO(mbelshe): Fix Chrome to not crash with plugins. + CommandLine::AppendSwitch(&launch_arguments_, switches::kDisablePlugins); + + CommandLine::AppendSwitch(&launch_arguments_, switches::kEnableLogging); + + // Use the playback cache, but don't use playback events. + CommandLine::AppendSwitch(&launch_arguments_, switches::kPlaybackMode); + CommandLine::AppendSwitch(&launch_arguments_, switches::kNoEvents); + + // Get the specified user data dir (optional) + std::wstring profile_dir = + CommandLine().GetSwitchValue(switches::kUserDataDir); + + if (profile_dir.length() == 0) { + // Compute the user-data-dir which contains our test cache. + PathService::Get(base::DIR_EXE, &profile_dir); + file_util::UpOneDirectory(&profile_dir); + file_util::UpOneDirectory(&profile_dir); + file_util::AppendToPath(&profile_dir, L"data"); + file_util::AppendToPath(&profile_dir, L"memory_test"); + file_util::AppendToPath(&profile_dir, L"general_mix"); + } + + if (!SetupTempDirectory(profile_dir)) { + // There isn't really a way to fail gracefully here. + // Neither this constuctor nor the SetUp() method return + // status to the caller. So, just fall through using the + // default profile and log this. The failure will be + // obvious. + LOG(ERROR) << "Error preparing temp directory for test"; + } + + CommandLine::AppendSwitchWithValue(&launch_arguments_, + switches::kUserDataDir, + user_data_dir_); + } + + ~MemoryTest() { + // Cleanup our temporary directory. + if (user_data_dir_.length() > 0) + file_util::Delete(user_data_dir_, true); + } + + // TODO(mbelshe): Separate this data to an external file. + // This memory test loads a set of URLs across a set of tabs, maintaining the + // number of concurrent open tabs at num_target_tabs. + // <NEWTAB> is a special URL which informs the loop when we should create a + // new tab. + // <PAUSE> is a special URL that informs the loop to pause before proceeding + // to the next URL. + void RunTest(const wchar_t* test_name, int num_target_tabs) { + std::string urls[] = { + "http://www.yahoo.com/", + "http://hotjobs.yahoo.com/career-articles-the_biggest_resume_mistake_you_can_make-436", + "http://news.yahoo.com/s/ap/20080804/ap_on_re_mi_ea/odd_israel_home_alone", + "http://news.yahoo.com/s/nm/20080729/od_nm/subway_dc", + "http://search.yahoo.com/search?p=new+york+subway&ygmasrchbtn=web+search&fr=ush-news", + "<NEWTAB>", + "http://www.cnn.com/", + "http://www.cnn.com/2008/SHOWBIZ/TV/08/03/applegate.cancer.ap/index.html", + "http://www.cnn.com/2008/HEALTH/conditions/07/29/black.aids.report/index.html", + "http://www.cnn.com/POLITICS/", + "http://search.cnn.com/search.jsp?query=obama&type=web&sortBy=date&intl=false", + "<NEWTAB>", + "http://mail.google.com/", + "http://mail.google.com/mail/?shva=1", + "http://mail.google.com/mail/?shva=1#search/ipsec", + "http://mail.google.com/mail/?shva=1#search/ipsec/ee29ae66165d417", + "http://mail.google.com/mail/?shva=1#compose", + "<NEWTAB>", + "http://docs.google.com/", + "<NEWTAB>", + "http://calendar.google.com/", + "<NEWTAB>", + "http://maps.google.com/", + "http://maps.google.com/maps/mpl?moduleurl=http://earthquake.usgs.gov/eqcenter/mapplets/earthquakes.xml&ie=UTF8&ll=20,170&spn=140.625336,73.828125&t=k&z=2", + "http://maps.google.com/maps?f=q&hl=en&geocode=&q=1600+amphitheater+parkway,+mountain+view,+ca&ie=UTF8&z=13", + "<NEWTAB>", + "http://www.google.com/", + "http://www.google.com/search?hl=en&q=food&btnG=Google+Search", + "http://books.google.com/books?hl=en&q=food&um=1&ie=UTF-8&sa=N&tab=wp", + "http://images.google.com/images?hl=en&q=food&um=1&ie=UTF-8&sa=N&tab=pi", + "http://news.google.com/news?hl=en&q=food&um=1&ie=UTF-8&sa=N&tab=in", + "http://www.google.com/products?sa=N&tab=nf&q=food", + "<NEWTAB>", + "http://www.scoundrelspoint.com/polyhedra/shuttle/index.html", + "<PAUSE>", + "<NEWTAB>", + "http://ctho.ath.cx/toys/3d.html", + "<PAUSE>", + "<NEWTAB>", + "http://www.youtube.com/", + "http://www.youtube.com/results?search_query=funny&search_type=&aq=f", + "http://www.youtube.com/watch?v=GuMMfgWhm3g", + "<NEWTAB>", + "http://www.craigslist.com/", + "http://sfbay.craigslist.org/", + "http://sfbay.craigslist.org/apa/", + "http://sfbay.craigslist.org/sfc/apa/782398209.html", + "http://sfbay.craigslist.org/sfc/apa/782347795.html", + "http://sfbay.craigslist.org/sby/apa/782342791.html", + "http://sfbay.craigslist.org/sfc/apa/782344396.html", + "<NEWTAB>", + "http://www.whitehouse.gov/", + "http://www.whitehouse.gov/news/releases/2008/07/20080729.html", + "http://www.whitehouse.gov/infocus/afghanistan/", + "http://www.whitehouse.gov/infocus/africa/", + "<NEWTAB>", + "http://www.msn.com/", + "http://msn.foxsports.com/horseracing/story/8409670/Big-Brown-rebounds-in-Haskell-Invitational?MSNHPHMA", + "http://articles.moneycentral.msn.com/Investing/StockInvestingTrading/TheBiggestRiskToYourRetirement_SeriesHome.aspx", + "http://articles.moneycentral.msn.com/Investing/StockInvestingTrading/TheSmartWayToGetRich.aspx", + "http://articles.moneycentral.msn.com/Investing/ContrarianChronicles/TheFictionOfCorporateTransparency.aspx", + "<NEWTAB>", + "http://flickr.com/", + "http://flickr.com/explore/interesting/2008/03/18/", + "http://flickr.com/photos/chavals/2344906748/", + "http://flickr.com/photos/rosemary/2343058024/", + "http://flickr.com/photos/arbaa/2343235019/", + "<NEWTAB>", + "http://zh.wikipedia.org/wiki/%E6%B1%B6%E5%B7%9D%E5%A4%A7%E5%9C%B0%E9%9C%87", + "http://zh.wikipedia.org/wiki/5%E6%9C%8812%E6%97%A5", + "http://zh.wikipedia.org/wiki/5%E6%9C%8820%E6%97%A5", + "http://zh.wikipedia.org/wiki/%E9%A6%96%E9%A1%B5", + "<NEWTAB>", + "http://www.nytimes.com/pages/technology/index.html", + "http://pogue.blogs.nytimes.com/2008/07/17/a-candy-store-for-the-iphone/", + "http://www.nytimes.com/2008/07/21/technology/21pc.html?_r=1&ref=technology&oref=slogin", + "http://bits.blogs.nytimes.com/2008/07/19/a-wikipedian-challenge-convincing-arabic-speakers-to-write-in-arabic/", + "<NEWTAB>", + "http://www.amazon.com/exec/obidos/tg/browse/-/502394/ref=topnav_storetab_p", + "http://www.amazon.com/Panasonic-DMC-TZ5K-Digital-Optical-Stabilized/dp/B0011Z8CCG/ref=pd_ts_p_17?ie=UTF8&s=photo", + "http://www.amazon.com/Nikon-Coolpix-Digital-Vibration-Reduction/dp/B0012OI6HW/ref=pd_ts_p_24?ie=UTF8&s=photo", + "http://www.amazon.com/Digital-SLRs-Cameras-Photo/b/ref=sv_p_2?ie=UTF8&node=3017941", + "<NEWTAB>", + "http://www.boston.com/bigpicture/2008/07/californias_continuing_fires.html", + "http://www.boston.com/business/", + "http://www.boston.com/business/articles/2008/07/29/staples_has_a_games_plan/", + "http://www.boston.com/business/personalfinance/articles/2008/08/04/a_grim_forecast_for_heating_costs/", + "<NEWTAB>", + "http://arstechnica.com/", + "http://arstechnica.com/news.ars/post/20080721-this-years-e3-substance-over-styleand-far-from-dead.html", + "http://arstechnica.com/news.ars/post/20080729-ifpi-italian-police-take-down-italian-bittorrent-tracker.html", + "http://arstechnica.com/news.ars/post/20080804-congress-wants-privacy-answers-from-google-ms-aol.html", + "<NEWTAB>", + "http://finance.google.com/finance?q=NASDAQ:AAPL", + "http://finance.google.com/finance?q=GOOG&hl=en", + "<NEWTAB>", + "http://blog.wired.com/underwire/2008/07/futurama-gets-m.html", + "http://blog.wired.com/cars/2008/07/gas-prices-hit.html", + "<NEWTAB>", + "http://del.icio.us/popular/programming", + "http://del.icio.us/popular/", + "http://del.icio.us/tag/", + "<NEWTAB>", + "http://gadgets.boingboing.net/2008/07/21/boom-computing.html", + "http://3533.spreadshirt.com/us/US/Shop/", + "<NEWTAB>", + "http://www.autoblog.com/", + "http://www.autoblog.com/2008/07/21/audi-introduces-the-next-mmi/", + "http://www.autoblog.com/categories/auto-types/", + "http://www.autoblog.com/category/sports/", + "<NEWTAB>", + "http://www.wikipedia.org/", + "http://en.wikipedia.org/wiki/Main_Page", + "http://fr.wikipedia.org/wiki/Accueil", + "http://de.wikipedia.org/wiki/Hauptseite", + "http://ja.wikipedia.org/wiki/%E3%83%A1%E3%82%A4%E3%83%B3%E3%83%9A%E3%83%BC%E3%82%B8", + "http://it.wikipedia.org/wiki/Pagina_principale", + "http://nl.wikipedia.org/wiki/Hoofdpagina", + "http://pt.wikipedia.org/wiki/P%C3%A1gina_principal", + "http://es.wikipedia.org/wiki/Portada", + "http://ru.wikipedia.org/wiki/%D0%97%D0%B0%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D0%B0%D1%8F_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0", + "<NEWTAB>", + "http://www.google.com/translate_t?hl=en&text=This%20Is%20A%20Test%20Of%20missspellingsdfdf&sl=en&tl=ja", + }; + + // Record the initial CommitCharge. This is a system-wide measurement, + // so if other applications are running, they can create variance in this + // test. + size_t start_size = GetSystemCommitCharge(); + + // Cycle through the URLs. + scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); + scoped_ptr<TabProxy> tab(window->GetActiveTab()); + int expected_tab_count = 1; + for (unsigned counter = 0; counter < arraysize(urls); ++counter) { + std::string url = urls[counter]; + + if (url == "<PAUSE>") { // Special command to delay on this page + Sleep(2000); + continue; + } + + if (url == "<NEWTAB>") { // Special command to create a new tab + if (++counter >= arraysize(urls)) + continue; // Newtab was specified at end of list. ignore. + + url = urls[counter]; + if (GetTabCount() < num_target_tabs) { + EXPECT_TRUE(window->AppendTab(GURL(url))); + expected_tab_count++; + WaitUntilTabCount(expected_tab_count); + tab.reset(window->GetActiveTab()); + continue; + } + + int tab_index = counter % num_target_tabs; // A pseudo-random tab. + tab.reset(window->GetTab(tab_index)); + } + + const int kMaxWaitTime = 5000; + bool timed_out = false; + tab->NavigateToURLWithTimeout(GURL(urls[counter]), kMaxWaitTime, + &timed_out); + if (timed_out) + printf("warning: %s timed out!\n", urls[counter].c_str()); + } + size_t stop_size = GetSystemCommitCharge(); + + PrintResults(test_name, stop_size - start_size); + } + + void PrintResults(const wchar_t* test_name, size_t commit_size) { + PrintMemoryUsageInfo(test_name); + std::wstring trace_name(test_name); + trace_name.append(L"_cc"); + + PrintResult(L"commit_charge", L"", trace_name, + commit_size / 1024, L"kb", true /* important */); + } + + void PrintIOPerfInfo(const wchar_t* test_name) { + printf("\n"); + BrowserProcessFilter chrome_filter(user_data_dir_); + process_util::NamedProcessIterator + chrome_process_itr(chrome::kBrowserProcessExecutableName, + &chrome_filter); + + const PROCESSENTRY32* chrome_entry; + while (chrome_entry = chrome_process_itr.NextProcessEntry()) { + uint32 pid = chrome_entry->th32ProcessID; + HANDLE process_handle = OpenProcess(PROCESS_QUERY_INFORMATION, + false, + pid); + if (process_handle == NULL) { + wprintf(L"Error opening process %d: %d\n", pid, GetLastError()); + continue; + } + + scoped_ptr<process_util::ProcessMetrics> process_metrics; + IO_COUNTERS io_counters; + process_metrics.reset( + process_util::ProcessMetrics::CreateProcessMetrics(process_handle)); + ZeroMemory(&io_counters, sizeof(io_counters)); + + if (process_metrics.get()->GetIOCounters(&io_counters)) { + std::wstring chrome_name = + (pid == chrome_filter.browser_process_id()) ? L"_b" : L"_r"; + + // Print out IO performance. We assume that the values can be + // converted to size_t (they're reported as ULONGLONG, 64-bit numbers). + PrintResult(L"read_op", chrome_name, test_name + chrome_name, + static_cast<size_t>(io_counters.ReadOperationCount), L"", + false /* not important */); + PrintResult(L"write_op", chrome_name, test_name + chrome_name, + static_cast<size_t>(io_counters.WriteOperationCount), L"", + false /* not important */); + PrintResult(L"other_op", chrome_name, test_name + chrome_name, + static_cast<size_t>(io_counters.OtherOperationCount), L"", + false /* not important */); + PrintResult(L"read_byte", chrome_name, test_name + chrome_name, + static_cast<size_t>(io_counters.ReadTransferCount / 1024), + L"kb", false /* not important */); + PrintResult(L"write_byte", chrome_name, test_name + chrome_name, + static_cast<size_t>(io_counters.WriteTransferCount / 1024), + L"kb", false /* not important */); + PrintResult(L"other_byte", chrome_name, test_name + chrome_name, + static_cast<size_t>(io_counters.OtherTransferCount / 1024), + L"kb", false /* not important */); + } + } + } + + void PrintMemoryUsageInfo(const wchar_t* test_name) { + printf("\n"); + BrowserProcessFilter chrome_filter(user_data_dir_); + process_util::NamedProcessIterator + chrome_process_itr(chrome::kBrowserProcessExecutableName, + &chrome_filter); + + size_t browser_virtual_size = 0; + size_t browser_working_set_size = 0; + size_t virtual_size = 0; + size_t working_set_size = 0; + size_t num_chrome_processes = 0; + const PROCESSENTRY32* chrome_entry; + while (chrome_entry = chrome_process_itr.NextProcessEntry()) { + uint32 pid = chrome_entry->th32ProcessID; + size_t peak_virtual_size; + size_t current_virtual_size; + size_t peak_working_set_size; + size_t current_working_set_size; + if (GetMemoryInfo(pid, &peak_virtual_size, ¤t_virtual_size, + &peak_working_set_size, ¤t_working_set_size)) { + if (pid == chrome_filter.browser_process_id()) { + browser_virtual_size = current_virtual_size; + browser_working_set_size = current_working_set_size; + } + virtual_size += current_virtual_size; + working_set_size += current_working_set_size; + num_chrome_processes++; + } + } + + std::wstring trace_name(test_name); + PrintResult(L"vm_final_browser", L"", trace_name + L"_vm_b", + browser_virtual_size / 1024, L"kb", + false /* not important */); + PrintResult(L"ws_final_browser", L"", trace_name + L"_ws_b", + browser_working_set_size / 1024, L"kb", + false /* not important */); + PrintResult(L"vm_final_total", L"", trace_name + L"_vm", + virtual_size / 1024, L"kb", + false /* not important */); + PrintResult(L"ws_final_total", L"", trace_name + L"_ws", + working_set_size / 1024, L"kb", + true /* important */); + PrintResult(L"processes", L"", trace_name + L"_proc", + num_chrome_processes, L"", + false /* not important */); + } + + private: + // Setup a temporary directory to store the profile to use + // with these tests. + // Input: + // src_dir is set to the source directory + // Output: + // On success, modifies user_data_dir_ to be a new profile directory + bool SetupTempDirectory(std::wstring src_dir) { + // We create a copy of the test dir and use it so that each + // run of this test starts with the same data. Running this + // test has the side effect that it will change the profile. + std::wstring temp_dir; + if (!file_util::CreateNewTempDirectory(kTempDirName, &temp_dir)) + return false; + + src_dir.append(L"\\*"); + + if (!file_util::CopyDirectory(src_dir, temp_dir, true)) + return false; + + user_data_dir_ = temp_dir; + return true; + } + + std::wstring user_data_dir_; +}; + +class MemoryReferenceTest : public MemoryTest { + public: + // override the browser directory that is used by UITest::SetUp to cause it + // to use the reference build instead. + void SetUp() { + std::wstring dir; + PathService::Get(chrome::DIR_TEST_TOOLS, &dir); + file_util::AppendToPath(&dir, L"reference_build"); + file_util::AppendToPath(&dir, L"chrome"); + browser_directory_ = dir; + UITest::SetUp(); + } + + void RunTest(const wchar_t* test_name, int num_target_tabs) { + std::wstring pages, timings; + MemoryTest::RunTest(test_name, num_target_tabs); + } +}; + +} // namespace + +TEST_F(MemoryTest, SingleTabTest) { + RunTest(L"1t", 1); +} + +TEST_F(MemoryTest, FiveTabTest) { + RunTest(L"5t", 5); +} + +TEST_F(MemoryTest, TwelveTabTest) { + RunTest(L"12t", 12); +} + diff --git a/chrome/views/background.cc b/chrome/views/background.cc index 3371670..3734a6e 100644 --- a/chrome/views/background.cc +++ b/chrome/views/background.cc @@ -48,7 +48,7 @@ class BackgroundPainter : public ChromeViews::Background { void Paint(ChromeCanvas* canvas, View* view) const { - Painter::PaintPainterAt(0, 0, view->GetWidth(), view->GetHeight(), canvas, + Painter::PaintPainterAt(0, 0, view->width(), view->height(), canvas, painter_); } diff --git a/chrome/views/base_button.cc b/chrome/views/base_button.cc index 59b49ef..e9ab838 100644 --- a/chrome/views/base_button.cc +++ b/chrome/views/base_button.cc @@ -144,7 +144,7 @@ void BaseButton::SetTooltipText(const std::wstring& tooltip) { bool BaseButton::OnMousePressed(const ChromeViews::MouseEvent& e) { if (state_ != BS_DISABLED) { - if (IsTriggerableEvent(e) && HitTest(WTL::CPoint(e.GetX(), e.GetY()))) { + if (IsTriggerableEvent(e) && HitTest(WTL::CPoint(e.x(), e.y()))) { SetState(BS_PUSHED); } if (IsFocusable()) @@ -155,7 +155,7 @@ bool BaseButton::OnMousePressed(const ChromeViews::MouseEvent& e) { bool BaseButton::OnMouseDragged(const ChromeViews::MouseEvent& e) { if (state_ != BS_DISABLED) { - if (!HitTest(WTL::CPoint(e.GetX(), e.GetY()))) + if (!HitTest(WTL::CPoint(e.x(), e.y()))) SetState(BS_NORMAL); else if (IsTriggerableEvent(e)) SetState(BS_PUSHED); @@ -173,7 +173,7 @@ void BaseButton::OnMouseReleased(const ChromeViews::MouseEvent& e, } if (state_ != BS_DISABLED) { - if (canceled || !HitTest(WTL::CPoint(e.GetX(), e.GetY()))) { + if (canceled || !HitTest(WTL::CPoint(e.x(), e.y()))) { SetState(BS_NORMAL); } else { SetState(BS_HOT); @@ -198,7 +198,7 @@ void BaseButton::OnMouseMoved(const ChromeViews::MouseEvent& e) { using namespace ChromeViews; if (state_ != BS_DISABLED) { - if (HitTest(WTL::CPoint(e.GetX(), e.GetY()))) { + if (HitTest(WTL::CPoint(e.x(), e.y()))) { SetState(BS_HOT); } else { SetState(BS_NORMAL); diff --git a/chrome/views/bitmap_scroll_bar.cc b/chrome/views/bitmap_scroll_bar.cc index a0656e7..7dcf18e 100644 --- a/chrome/views/bitmap_scroll_bar.cc +++ b/chrome/views/bitmap_scroll_bar.cc @@ -146,14 +146,14 @@ class BitmapScrollBarThumb : public View { canvas->DrawBitmapInt(*start_cap_bitmap(), 0, 0); int top_cap_height = start_cap_bitmap()->height(); int bottom_cap_height = end_cap_bitmap()->height(); - int thumb_body_height = GetHeight() - top_cap_height - bottom_cap_height; + int thumb_body_height = height() - top_cap_height - bottom_cap_height; canvas->TileImageInt(*background_bitmap(), 0, top_cap_height, background_bitmap()->width(), thumb_body_height); canvas->DrawBitmapInt(*end_cap_bitmap(), 0, - GetHeight() - bottom_cap_height); + height() - bottom_cap_height); // Paint the grippy over the track. - int grippy_x = (GetWidth() - grippy_bitmap()->width()) / 2; + int grippy_x = (width() - grippy_bitmap()->width()) / 2; int grippy_y = (thumb_body_height - grippy_bitmap()->height()) / 2; canvas->DrawBitmapInt(*grippy_bitmap(), grippy_x, grippy_y); } @@ -167,7 +167,7 @@ class BitmapScrollBarThumb : public View { } virtual bool OnMousePressed(const MouseEvent& event) { - mouse_offset_ = scroll_bar_->IsHorizontal() ? event.GetX() : event.GetY(); + mouse_offset_ = scroll_bar_->IsHorizontal() ? event.x() : event.y(); drag_start_position_ = GetPosition(); SetState(BaseButton::BS_PUSHED); return true; @@ -178,24 +178,24 @@ class BitmapScrollBarThumb : public View { // the bounds of the thumb, the scrollbar will snap the scroll back to the // point it was at before the drag began. if (scroll_bar_->IsHorizontal()) { - if ((event.GetY() < GetY() - kScrollThumbDragOutSnap) || - (event.GetY() > (GetY() + GetHeight() + kScrollThumbDragOutSnap))) { + if ((event.y() < y() - kScrollThumbDragOutSnap) || + (event.y() > (y() + height() + kScrollThumbDragOutSnap))) { scroll_bar_->ScrollToThumbPosition(drag_start_position_, false); return true; } } else { - if ((event.GetX() < GetX() - kScrollThumbDragOutSnap) || - (event.GetX() > (GetX() + GetWidth() + kScrollThumbDragOutSnap))) { + if ((event.x() < x() - kScrollThumbDragOutSnap) || + (event.x() > (x() + width() + kScrollThumbDragOutSnap))) { scroll_bar_->ScrollToThumbPosition(drag_start_position_, false); return true; } } if (scroll_bar_->IsHorizontal()) { - int thumb_x = event.GetX() - mouse_offset_; - scroll_bar_->ScrollToThumbPosition(GetX() + thumb_x, false); + int thumb_x = event.x() - mouse_offset_; + scroll_bar_->ScrollToThumbPosition(x() + thumb_x, false); } else { - int thumb_y = event.GetY() - mouse_offset_; - scroll_bar_->ScrollToThumbPosition(GetY() + thumb_y, false); + int thumb_y = event.y() - mouse_offset_; + scroll_bar_->ScrollToThumbPosition(y() + thumb_y, false); } return true; } @@ -292,14 +292,14 @@ gfx::Rect BitmapScrollBar::GetTrackBounds() const { if (!show_scroll_buttons_) prefsize.cx = 0; int new_width = std::max(0, - static_cast<int>(GetWidth() - (prefsize.cx * 2))); + static_cast<int>(width() - (prefsize.cx * 2))); gfx::Rect track_bounds(prefsize.cx, 0, new_width, prefsize.cy); return track_bounds; } if (!show_scroll_buttons_) prefsize.cy = 0; gfx::Rect track_bounds(0, prefsize.cy, prefsize.cx, - std::max(0l, GetHeight() - (prefsize.cy * 2))); + std::max(0l, height() - (prefsize.cy * 2))); return track_bounds; } @@ -417,10 +417,10 @@ void BitmapScrollBar::Layout() { prev_button_->SetBounds(0, 0, prefsize.cx, prefsize.cy); next_button_->GetPreferredSize(&prefsize); if (IsHorizontal()) { - next_button_->SetBounds(GetWidth() - prefsize.cx, 0, prefsize.cx, + next_button_->SetBounds(width() - prefsize.cx, 0, prefsize.cx, prefsize.cy); } else { - next_button_->SetBounds(0, GetHeight() - prefsize.cy, prefsize.cx, + next_button_->SetBounds(0, height() - prefsize.cy, prefsize.cx, prefsize.cy); } } else { @@ -468,15 +468,15 @@ bool BitmapScrollBar::OnMousePressed(const MouseEvent& event) { CRect thumb_bounds; thumb_->GetBounds(&thumb_bounds); if (IsHorizontal()) { - if (event.GetX() < thumb_bounds.left) { + if (event.x() < thumb_bounds.left) { last_scroll_amount_ = SCROLL_PREV_PAGE; - } else if (event.GetX() > thumb_bounds.right) { + } else if (event.x() > thumb_bounds.right) { last_scroll_amount_ = SCROLL_NEXT_PAGE; } } else { - if (event.GetY() < thumb_bounds.top) { + if (event.y() < thumb_bounds.top) { last_scroll_amount_ = SCROLL_PREV_PAGE; - } else if (event.GetY() > thumb_bounds.bottom) { + } else if (event.y() > thumb_bounds.bottom) { last_scroll_amount_ = SCROLL_NEXT_PAGE; } } diff --git a/chrome/views/border.cc b/chrome/views/border.cc index 4b71707..7298583 100644 --- a/chrome/views/border.cc +++ b/chrome/views/border.cc @@ -39,25 +39,25 @@ void SolidBorder::Paint(const View& view, ChromeCanvas* canvas) const { return; // Empty clip rectangle, nothing to paint. // Top border. - gfx::Rect border_bounds(0, 0, view.GetWidth(), insets_.top()); + gfx::Rect border_bounds(0, 0, view.width(), insets_.top()); if (clip_rect.Intersects(border_bounds)) - canvas->FillRectInt(color_, 0, 0, view.GetWidth(), insets_.top()); + canvas->FillRectInt(color_, 0, 0, view.width(), insets_.top()); // Left border. - border_bounds.SetRect(0, 0, insets_.left(), view.GetHeight()); + border_bounds.SetRect(0, 0, insets_.left(), view.height()); if (clip_rect.Intersects(border_bounds)) - canvas->FillRectInt(color_, 0, 0, insets_.left(), view.GetHeight()); + canvas->FillRectInt(color_, 0, 0, insets_.left(), view.height()); // Bottom border. - border_bounds.SetRect(0, view.GetHeight() - insets_.bottom(), - view.GetWidth(), insets_.bottom()); + border_bounds.SetRect(0, view.height() - insets_.bottom(), + view.width(), insets_.bottom()); if (clip_rect.Intersects(border_bounds)) - canvas->FillRectInt(color_, 0, view.GetHeight() - insets_.bottom(), - view.GetWidth(), insets_.bottom()); + canvas->FillRectInt(color_, 0, view.height() - insets_.bottom(), + view.width(), insets_.bottom()); // Right border. - border_bounds.SetRect(view.GetWidth() - insets_.right(), 0, - insets_.right(), view.GetHeight()); + border_bounds.SetRect(view.width() - insets_.right(), 0, + insets_.right(), view.height()); if (clip_rect.Intersects(border_bounds)) - canvas->FillRectInt(color_, view.GetWidth() - insets_.right(), 0, - insets_.right(), view.GetHeight()); + canvas->FillRectInt(color_, view.width() - insets_.right(), 0, + insets_.right(), view.height()); } void SolidBorder::GetInsets(gfx::Insets* insets) const { diff --git a/chrome/views/button.cc b/chrome/views/button.cc index 2476652..5489841 100644 --- a/chrome/views/button.cc +++ b/chrome/views/button.cc @@ -92,14 +92,14 @@ void Button::Paint(ChromeCanvas* canvas) { int x = 0, y = 0; if (h_alignment_ == ALIGN_CENTER) - x = (GetWidth() - img.width()) / 2; + x = (width() - img.width()) / 2; else if (h_alignment_ == ALIGN_RIGHT) - x = GetWidth() - img.width(); + x = width() - img.width(); if (v_alignment_ == ALIGN_MIDDLE) - y = (GetHeight() - img.height()) / 2; + y = (height() - img.height()) / 2; else if (v_alignment_ == ALIGN_BOTTOM) - y = GetHeight() - img.height(); + y = height() - img.height(); canvas->DrawBitmapInt(img, x, y); } diff --git a/chrome/views/button_dropdown.cc b/chrome/views/button_dropdown.cc index bec2e88..aef0e1d 100644 --- a/chrome/views/button_dropdown.cc +++ b/chrome/views/button_dropdown.cc @@ -40,11 +40,11 @@ ButtonDropDown::~ButtonDropDown() { //////////////////////////////////////////////////////////////////////////////// bool ButtonDropDown::OnMousePressed(const ChromeViews::MouseEvent& e) { - if (IsEnabled() && e.IsLeftMouseButton() && HitTest(WTL::CPoint(e.GetX(), e.GetY()))) { + if (IsEnabled() && e.IsLeftMouseButton() && HitTest(WTL::CPoint(e.x(), e.y()))) { // Store the y pos of the mouse coordinates so we can use them later to // determine if the user dragged the mouse down (which should pop up the // drag down menu immediately, instead of waiting for the timer) - y_position_on_lbuttondown_ = e.GetY(); + y_position_on_lbuttondown_ = e.y(); // Schedule a task that will show the menu. MessageLoop::current()->PostDelayedTask(FROM_HERE, @@ -66,7 +66,7 @@ void ButtonDropDown::OnMouseReleased(const ChromeViews::MouseEvent& e, if (e.IsLeftMouseButton()) show_menu_factory_.RevokeAll(); - if (IsEnabled() && e.IsRightMouseButton() && HitTest(WTL::CPoint(e.GetX(), e.GetY()))) { + if (IsEnabled() && e.IsRightMouseButton() && HitTest(WTL::CPoint(e.x(), e.y()))) { show_menu_factory_.RevokeAll(); // Make the button look depressed while the menu is open. // NOTE: SetState() schedules a paint, but it won't occur until after the @@ -90,7 +90,7 @@ bool ButtonDropDown::OnMouseDragged(const ChromeViews::MouseEvent& e) { // If the mouse is dragged to a y position lower than where it was when // clicked then we should not wait for the menu to appear but show // it immediately. - if (e.GetY() > y_position_on_lbuttondown_ + dragging_threshold) { + if (e.y() > y_position_on_lbuttondown_ + dragging_threshold) { show_menu_factory_.RevokeAll(); ShowDropDownMenu(GetViewContainer()->GetHWND()); } diff --git a/chrome/views/checkbox.cc b/chrome/views/checkbox.cc index ee9f1af..0b59e9c 100644 --- a/chrome/views/checkbox.cc +++ b/chrome/views/checkbox.cc @@ -61,7 +61,7 @@ std::string CheckBox::GetClassName() const { void CheckBox::Layout() { int label_x = GetTextIndent(); - label_->SetBounds(label_x, 0, GetWidth() - label_x, GetHeight()); + label_->SetBounds(label_x, 0, width() - label_x, height()); if (hwnd_view_) { int first_line_height = label_->GetFont().height(); hwnd_view_->SetBounds(0, ((first_line_height - kCheckBoxHeight) / 2) + 1, @@ -75,7 +75,7 @@ void CheckBox::ComputeTextRect(gfx::Rect* out) { label_->GetPreferredSize(&s); out->set_x(GetTextIndent()); out->set_y(kFocusPaddingVertical); - int new_width = std::min(GetWidth() - (kCheckBoxWidth + kCheckBoxToLabel), + int new_width = std::min(width() - (kCheckBoxWidth + kCheckBoxToLabel), static_cast<int>(s.cx)); out->set_width(std::max(0, new_width)); out->set_height(s.cy); @@ -105,7 +105,7 @@ HWND CheckBox::CreateNativeControl(HWND parent_container) { L"BUTTON", L"", WS_CHILD | BS_CHECKBOX | WS_VISIBLE, - 0, 0, GetWidth(), GetHeight(), + 0, 0, width(), height(), parent_container, NULL, NULL, NULL); ConfigureNativeButton(r); return r; @@ -141,10 +141,10 @@ void CheckBox::HighlightButton(bool f) { } bool CheckBox::LabelHitTest(const MouseEvent& event) { - CPoint p(event.GetX(), event.GetY()); + CPoint p(event.x(), event.y()); gfx::Rect r; ComputeTextRect(&r); - return r.Contains(event.GetX(), event.GetY()); + return r.Contains(event.x(), event.y()); } void CheckBox::OnMouseEntered(const MouseEvent& event) { diff --git a/chrome/views/chrome_menu.cc b/chrome/views/chrome_menu.cc index 33452cd..360f8c4 100644 --- a/chrome/views/chrome_menu.cc +++ b/chrome/views/chrome_menu.cc @@ -175,7 +175,7 @@ namespace { // Convenience for scrolling the view such that the origin is visible. static void ScrollToVisible(View* view) { - view->ScrollRectToVisible(0, 0, view->GetWidth(), view->GetHeight()); + view->ScrollRectToVisible(0, 0, view->width(), view->height()); } // MenuScrollTask -------------------------------------------------------------- @@ -234,7 +234,7 @@ public: if (is_scrolling_up_) target_y = std::max(0, target_y - delta_y); else - target_y = std::min(submenu_->GetHeight() - vis_rect.height(), + target_y = std::min(submenu_->height() - vis_rect.height(), target_y + delta_y); submenu_->ScrollRectToVisible(vis_rect.x(), target_y, vis_rect.width(), vis_rect.height()); @@ -309,14 +309,14 @@ class MenuScrollButton : public View { HDC dc = canvas->beginPlatformPaint(); // The background. - RECT item_bounds = { 0, 0, GetWidth(), GetHeight() }; + RECT item_bounds = { 0, 0, width(), height() }; NativeTheme::instance()->PaintMenuItemBackground( NativeTheme::MENU, dc, MENU_POPUPITEM, MPI_NORMAL, false, &item_bounds); // Then the arrow. - int x = GetWidth() / 2; - int y = (GetHeight() - kScrollArrowHeight) / 2; + int x = width() / 2; + int y = (height() - kScrollArrowHeight) / 2; int delta_y = 1; if (!is_up_) { delta_y = -1; @@ -363,11 +363,11 @@ class MenuScrollView : public View { View* child = GetContents(); // Convert y to view's coordinates. - y -= child->GetY(); + y -= child->y(); CSize pref; child->GetPreferredSize(&pref); // Constrain y to make sure we don't show past the bottom of the view. - y = std::max(0, std::min(static_cast<int>(pref.cy) - GetHeight(), y)); + y = std::max(0, std::min(static_cast<int>(pref.cy) - this->height(), y)); child->SetY(-y); } @@ -403,7 +403,7 @@ class MenuScrollViewContainer : public View { virtual void Paint(ChromeCanvas* canvas) { HDC dc = canvas->beginPlatformPaint(); - CRect bounds(0, 0, GetWidth(), GetHeight()); + CRect bounds(0, 0, width(), height()); NativeTheme::instance()->PaintMenuBackground( NativeTheme::MENU, dc, MENU_POPUPBACKGROUND, 0, &bounds); canvas->endPlatformPaint(); @@ -417,8 +417,8 @@ class MenuScrollViewContainer : public View { gfx::Insets insets = GetInsets(); int x = insets.left(); int y = insets.top(); - int width = GetWidth() - insets.width(); - int content_height = GetHeight() - insets.height(); + int width = View::width() - insets.width(); + int content_height = height() - insets.height(); if (!scroll_up_button_->IsVisible()) { scroll_view_->SetBounds(x, y, width, content_height); scroll_view_->Layout(); @@ -433,7 +433,7 @@ class MenuScrollViewContainer : public View { const int scroll_view_y = y + pref.cy; scroll_down_button_->GetPreferredSize(&pref); - scroll_down_button_->SetBounds(x, GetHeight() - pref.cy - insets.top(), + scroll_down_button_->SetBounds(x, height() - pref.cy - insets.top(), width, pref.cy); content_height -= pref.cy; @@ -444,8 +444,8 @@ class MenuScrollViewContainer : public View { virtual void DidChangeBounds(const CRect& previous, const CRect& current) { CSize content_pref; scroll_view_->GetContents()->GetPreferredSize(&content_pref); - scroll_up_button_->SetVisible(content_pref.cy > GetHeight()); - scroll_down_button_->SetVisible(content_pref.cy > GetHeight()); + scroll_up_button_->SetVisible(content_pref.cy > height()); + scroll_down_button_->SetVisible(content_pref.cy > height()); } virtual void GetPreferredSize(CSize* out) { @@ -478,20 +478,20 @@ class MenuSeparator : public View { void Paint(ChromeCanvas* canvas) { // The gutter is rendered before the background. int start_x = 0; - int start_y = GetHeight() / 3; + int start_y = height() / 3; HDC dc = canvas->beginPlatformPaint(); if (render_gutter) { // If render_gutter is true, we're on Vista and need to render the // gutter, then indent the separator from the gutter. RECT gutter_bounds = { label_start - kGutterToLabel - gutter_width, 0, 0, - GetHeight() }; + height() }; gutter_bounds.right = gutter_bounds.left + gutter_width; NativeTheme::instance()->PaintMenuGutter(dc, MENU_POPUPGUTTER, MPI_NORMAL, &gutter_bounds); start_x = gutter_bounds.left + gutter_width; start_y = 0; } - RECT separator_bounds = { start_x, start_y, GetWidth(), GetHeight() }; + RECT separator_bounds = { start_x, start_y, width(), height() }; NativeTheme::instance()->PaintMenuSeparator(dc, MENU_POPUPSEPARATOR, MPI_NORMAL, &separator_bounds); canvas->endPlatformPaint(); @@ -533,8 +533,8 @@ class MenuHostRootView : public RootView { return true; forward_drag_to_menu_controller_ = - ((event.GetX() < 0 || event.GetY() < 0 || event.GetX() >= GetWidth() || - event.GetY() >= GetHeight()) || + ((event.x() < 0 || event.y() < 0 || event.x() >= width() || + event.y() >= height()) || !RootView::OnMousePressed(event)); if (forward_drag_to_menu_controller_) GetMenuController()->OnMousePressed(submenu_, event); @@ -801,12 +801,12 @@ void SubmenuView::Layout() { return; CSize pref; GetPreferredSize(&pref); - SetBounds(GetX(), GetY(), parent->GetWidth(), pref.cy); + SetBounds(x(), y(), parent->width(), pref.cy); gfx::Insets insets = GetInsets(); int x = insets.left(); int y = insets.top(); - int menu_item_width = GetWidth() - insets.width(); + int menu_item_width = width() - insets.width(); for (int i = 0; i < GetChildViewCount(); ++i) { View* child = GetChildViewAt(i); CSize child_pref_size; @@ -874,7 +874,7 @@ int SubmenuView::OnPerformDrop(const DropTargetEvent& event) { bool SubmenuView::OnMouseWheel(const MouseWheelEvent& e) { gfx::Rect vis_bounds = GetVisibleBounds(); int menu_item_count = GetMenuItemCount(); - if (vis_bounds.height() == GetHeight() || !menu_item_count) { + if (vis_bounds.height() == height() || !menu_item_count) { // All menu items are visible, nothing to scroll. return true; } @@ -884,10 +884,10 @@ bool SubmenuView::OnMouseWheel(const MouseWheelEvent& e) { int first_vis_index = -1; for (int i = 0; i < menu_item_count; ++i) { MenuItemView* menu_item = GetMenuItemAt(i); - if (menu_item->GetY() == vis_bounds.y()) { + if (menu_item->y() == vis_bounds.y()) { first_vis_index = i; break; - } else if (menu_item->GetY() > vis_bounds.y()) { + } else if (menu_item->y() > vis_bounds.y()) { first_vis_index = std::max(0, i - 1); break; } @@ -902,23 +902,23 @@ bool SubmenuView::OnMouseWheel(const MouseWheelEvent& e) { while (delta-- > 0) { int scroll_amount = 0; if (scroll_up) { - if (GetMenuItemAt(first_vis_index)->GetY() == vis_bounds.y()) { + if (GetMenuItemAt(first_vis_index)->y() == vis_bounds.y()) { if (first_vis_index != 0) { - scroll_amount = GetMenuItemAt(first_vis_index - 1)->GetY() - + scroll_amount = GetMenuItemAt(first_vis_index - 1)->y() - vis_bounds.y(); first_vis_index--; } else { break; } } else { - scroll_amount = GetMenuItemAt(first_vis_index)->GetY() - vis_bounds.y(); + scroll_amount = GetMenuItemAt(first_vis_index)->y() - vis_bounds.y(); } } else { if (first_vis_index + 1 == GetMenuItemCount()) break; - scroll_amount = GetMenuItemAt(first_vis_index + 1)->GetY() - + scroll_amount = GetMenuItemAt(first_vis_index + 1)->y() - vis_bounds.y(); - if (GetMenuItemAt(first_vis_index)->GetY() == vis_bounds.y()) + if (GetMenuItemAt(first_vis_index)->y() == vis_bounds.y()) first_vis_index++; } ScrollRectToVisible(0, vis_bounds.y() + scroll_amount, vis_bounds.width(), @@ -1362,7 +1362,7 @@ void MenuItemView::Paint(ChromeCanvas* canvas, bool for_drag) { // The gutter is rendered before the background. if (render_gutter && !for_drag) { RECT gutter_bounds = { label_start - kGutterToLabel - gutter_width, 0, 0, - GetHeight() }; + height() }; gutter_bounds.right = gutter_bounds.left + gutter_width; AdjustBoundsForRTLUI(&gutter_bounds); NativeTheme::instance()->PaintMenuGutter(dc, MENU_POPUPGUTTER, MPI_NORMAL, &gutter_bounds); @@ -1370,7 +1370,7 @@ void MenuItemView::Paint(ChromeCanvas* canvas, bool for_drag) { // Render the background. if (!for_drag) { - RECT item_bounds = { 0, 0, GetWidth(), GetHeight() }; + RECT item_bounds = { 0, 0, width(), height() }; AdjustBoundsForRTLUI(&item_bounds); NativeTheme::instance()->PaintMenuItemBackground( NativeTheme::MENU, dc, MENU_POPUPITEM, state, render_selection, @@ -1378,14 +1378,14 @@ void MenuItemView::Paint(ChromeCanvas* canvas, bool for_drag) { } int icon_x = kItemLeftMargin; - int icon_y = kItemTopMargin + (GetHeight() - kItemTopMargin - + int icon_y = kItemTopMargin + (height() - kItemTopMargin - kItemBottomMargin - check_height) / 2; int icon_height = check_height; int icon_width = check_width; if (type_ == CHECKBOX && GetDelegate()->IsItemChecked(GetCommand())) { // Draw the check background. - RECT check_bg_bounds = { 0, 0, icon_x + icon_width, GetHeight() }; + RECT check_bg_bounds = { 0, 0, icon_x + icon_width, height() }; const int bg_state = IsEnabled() ? MCB_NORMAL : MCB_DISABLED; AdjustBoundsForRTLUI(&check_bg_bounds); NativeTheme::instance()->PaintMenuCheckBackground( @@ -1410,7 +1410,7 @@ void MenuItemView::Paint(ChromeCanvas* canvas, bool for_drag) { (IsEnabled() ? COLOR_MENUTEXT : COLOR_GRAYTEXT); SkColor fg_color = NativeTheme::instance()->GetThemeColorWithDefault( NativeTheme::MENU, MENU_POPUPITEM, state, TMT_TEXTCOLOR, default_sys_color); - int width = GetWidth() - item_right_margin - label_start; + int width = this->width() - item_right_margin - label_start; gfx::Rect text_bounds(label_start, kItemTopMargin, width, font_.height()); text_bounds.set_x(MirroredLeftPointForRect(text_bounds)); canvas->DrawStringInt(GetTitle(), font_, fg_color, text_bounds.x(), @@ -1420,7 +1420,7 @@ void MenuItemView::Paint(ChromeCanvas* canvas, bool for_drag) { if (icon_.width() > 0) { gfx::Rect icon_bounds(kItemLeftMargin, - kItemTopMargin + (GetHeight() - kItemTopMargin - + kItemTopMargin + (height() - kItemTopMargin - kItemBottomMargin - icon_.height()) / 2, icon_.width(), icon_.height()); @@ -1430,8 +1430,8 @@ void MenuItemView::Paint(ChromeCanvas* canvas, bool for_drag) { if (HasSubmenu()) { int state_id = IsEnabled() ? MSM_NORMAL : MSM_DISABLED; - RECT arrow_bounds = { GetWidth() - item_right_margin + kLabelToArrowPadding, - 0, 0, GetHeight() }; + RECT arrow_bounds = { this->width() - item_right_margin + kLabelToArrowPadding, + 0, 0, height() }; arrow_bounds.right = arrow_bounds.left + arrow_width; AdjustBoundsForRTLUI(&arrow_bounds); @@ -1662,7 +1662,7 @@ void MenuController::OnMousePressed(SubmenuView* source, return; MenuPart part = - GetMenuPartByScreenCoordinate(source, event.GetX(), event.GetY()); + GetMenuPartByScreenCoordinate(source, event.x(), event.y()); if (part.is_scroll()) return; // Ignore presses on scroll buttons. @@ -1690,8 +1690,8 @@ void MenuController::OnMousePressed(SubmenuView* source, } else { if (part.menu->GetDelegate()->CanDrag(part.menu)) { possible_drag_ = true; - press_x_ = event.GetX(); - press_y_ = event.GetY(); + press_x_ = event.x(); + press_y_ = event.y(); } if (part.menu->HasSubmenu()) open_submenu = true; @@ -1707,15 +1707,15 @@ void MenuController::OnMouseDragged(SubmenuView* source, DLOG(INFO) << "OnMouseDragged source=" << source; #endif MenuPart part = - GetMenuPartByScreenCoordinate(source, event.GetX(), event.GetY()); + GetMenuPartByScreenCoordinate(source, event.x(), event.y()); UpdateScrolling(part); if (!blocking_run_) return; if (possible_drag_) { - if (ChromeViews::View::ExceededDragThreshold(event.GetX() - press_x_, - event.GetY() - press_y_)) { + if (ChromeViews::View::ExceededDragThreshold(event.x() - press_x_, + event.y() - press_y_)) { MenuItemView* item = state_.item; DCHECK(item); // Points are in the coordinates of the submenu, need to map to that of @@ -1724,17 +1724,17 @@ void MenuController::OnMouseDragged(SubmenuView* source, CPoint press_loc(press_x_, press_y_); View::ConvertPointToScreen(source->GetScrollViewContainer(), &press_loc); View::ConvertPointToView(NULL, item, &press_loc); - CPoint drag_loc(event.GetX(), event.GetY()); + CPoint drag_loc(event.x(), event.y()); View::ConvertPointToScreen(source->GetScrollViewContainer(), &drag_loc); View::ConvertPointToView(NULL, item, &drag_loc); in_drag_ = true; - ChromeCanvas canvas(item->GetWidth(), item->GetHeight(), false); + ChromeCanvas canvas(item->width(), item->height(), false); item->Paint(&canvas, true); scoped_refptr<OSExchangeData> data(new OSExchangeData); item->GetDelegate()->WriteDragData(item, data.get()); - drag_utils::SetDragImageOnDataObject(canvas, item->GetWidth(), - item->GetHeight(), press_loc.x, + drag_utils::SetDragImageOnDataObject(canvas, item->width(), + item->height(), press_loc.x, press_loc.y, data); scoped_refptr<BaseDragSource> drag_source(new BaseDragSource); @@ -1774,7 +1774,7 @@ void MenuController::OnMouseReleased(SubmenuView* source, possible_drag_ = false; DCHECK(blocking_run_); MenuPart part = - GetMenuPartByScreenCoordinate(source, event.GetX(), event.GetY()); + GetMenuPartByScreenCoordinate(source, event.x(), event.y()); any_menu_contains_mouse_ = (part.type == MenuPart::MENU_ITEM); if (event.IsRightMouseButton() && (part.type == MenuPart::MENU_ITEM && part.menu)) { @@ -1783,7 +1783,7 @@ void MenuController::OnMouseReleased(SubmenuView* source, bool open_submenu = (state_.item == pending_state_.item && state_.submenu_open); SetSelection(pending_state_.item, open_submenu, true); - CPoint loc(event.GetX(), event.GetY()); + CPoint loc(event.x(), event.y()); View::ConvertPointToScreen(source->GetScrollViewContainer(), &loc); // If we open a context menu just return now @@ -1812,7 +1812,7 @@ void MenuController::OnMouseMoved(SubmenuView* source, return; MenuPart part = - GetMenuPartByScreenCoordinate(source, event.GetX(), event.GetY()); + GetMenuPartByScreenCoordinate(source, event.x(), event.y()); UpdateScrolling(part); @@ -1853,7 +1853,7 @@ int MenuController::OnDragUpdated(SubmenuView* source, const DropTargetEvent& event) { StopCancelAllTimer(); - CPoint screen_loc(event.GetX(), event.GetY()); + CPoint screen_loc(event.x(), event.y()); View::ConvertPointToScreen(source, &screen_loc); if (valid_drop_coordinates_ && screen_loc.x == drop_x_ && screen_loc.y == drop_y_) { @@ -1863,22 +1863,22 @@ int MenuController::OnDragUpdated(SubmenuView* source, drop_y_ = screen_loc.y; valid_drop_coordinates_ = true; - MenuItemView* menu_item = GetMenuItemAt(source, event.GetX(), event.GetY()); + MenuItemView* menu_item = GetMenuItemAt(source, event.x(), event.y()); bool over_empty_menu = false; if (!menu_item) { // See if we're over an empty menu. - menu_item = GetEmptyMenuItemAt(source, event.GetX(), event.GetY()); + menu_item = GetEmptyMenuItemAt(source, event.x(), event.y()); if (menu_item) over_empty_menu = true; } MenuDelegate::DropPosition drop_position = MenuDelegate::DROP_NONE; int drop_operation = DragDropTypes::DRAG_NONE; if (menu_item) { - CPoint menu_item_loc(event.GetX(), event.GetY()); + CPoint menu_item_loc(event.x(), event.y()); View::ConvertPointToView(source, menu_item, &menu_item_loc); MenuItemView* query_menu_item; if (!over_empty_menu) { - int menu_item_height = menu_item->GetHeight(); + int menu_item_height = menu_item->height(); if (menu_item->HasSubmenu() && (menu_item_loc.y > MenuItemView::kDropBetweenPixels && menu_item_loc.y < (menu_item_height - @@ -2201,9 +2201,9 @@ bool MenuController::GetMenuPartByScreenCoordinateImpl( View* scroll_view_container = menu->GetScrollViewContainer(); View::ConvertPointToView(NULL, scroll_view_container, &scroll_view_loc); if (scroll_view_loc.x < 0 || - scroll_view_loc.x >= scroll_view_container->GetWidth() || + scroll_view_loc.x >= scroll_view_container->width() || scroll_view_loc.y < 0 || - scroll_view_loc.y >= scroll_view_container->GetHeight()) { + scroll_view_loc.y >= scroll_view_container->height()) { // Point isn't contained in menu. return false; } @@ -2452,7 +2452,7 @@ gfx::Rect MenuController::CalculateMenuBounds(MenuItemView* item, (!prefer_leading && layout_is_rtl); if (create_on_the_right) { - x = item_loc.x + item->GetWidth() - kSubmenuHorizontalInset; + x = item_loc.x + item->width() - kSubmenuHorizontalInset; if (state_.monitor_bounds.width() != 0 && x + pref.cx > state_.monitor_bounds.right()) { if (layout_is_rtl) @@ -2468,7 +2468,7 @@ gfx::Rect MenuController::CalculateMenuBounds(MenuItemView* item, *is_leading = false; else *is_leading = true; - x = item_loc.x + item->GetWidth() - kSubmenuHorizontalInset; + x = item_loc.x + item->width() - kSubmenuHorizontalInset; } } y = item_loc.y - kSubmenuBorderSize; @@ -2622,7 +2622,7 @@ bool MenuController::SelectByChar(wchar_t character) { void MenuController::RepostEvent(SubmenuView* source, const MouseEvent& event) { - CPoint screen_loc(event.GetX(), event.GetY()); + CPoint screen_loc(event.x(), event.y()); View::ConvertPointToScreen(source->GetScrollViewContainer(), &screen_loc); HWND window = WindowFromPoint(screen_loc); if (window) { diff --git a/chrome/views/client_view.cc b/chrome/views/client_view.cc index eeff7f4..bf66d90 100644 --- a/chrome/views/client_view.cc +++ b/chrome/views/client_view.cc @@ -1,56 +1,56 @@ -// Copyright (c) 2006-2008 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.
-
-#include "base/logging.h"
-#include "chrome/views/client_view.h"
-
-namespace ChromeViews {
-
-///////////////////////////////////////////////////////////////////////////////
-// ClientView, public:
-
-ClientView::ClientView(Window* window, View* contents_view)
- : window_(window),
- contents_view_(contents_view) {
-}
-
-int ClientView::NonClientHitTest(const gfx::Point& point) {
- CRect bounds;
- GetBounds(&bounds, APPLY_MIRRORING_TRANSFORMATION);
- if (gfx::Rect(bounds).Contains(point.x(), point.y()))
- return HTCLIENT;
- return HTNOWHERE;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// ClientView, View overrides:
-
-void ClientView::GetPreferredSize(CSize* out) {
- DCHECK(out);
- // |contents_view_| is allowed to be NULL up until the point where this view
- // is attached to a ViewContainer.
- if (contents_view_)
- contents_view_->GetPreferredSize(out);
-}
-
-void ClientView::ViewHierarchyChanged(bool is_add, View* parent, View* child) {
- if (is_add && child == this) {
- DCHECK(GetViewContainer());
- DCHECK(contents_view_); // |contents_view_| must be valid now!
- AddChildView(contents_view_);
- }
-}
-
-void ClientView::DidChangeBounds(const CRect& previous, const CRect& current) {
- Layout();
-}
-
-void ClientView::Layout() {
- // |contents_view_| is allowed to be NULL up until the point where this view
- // is attached to a ViewContainer.
- if (contents_view_)
- contents_view_->SetBounds(0, 0, GetWidth(), GetHeight());
-}
-
-}; // namespace ChromeViews
+// Copyright (c) 2006-2008 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. + +#include "base/logging.h" +#include "chrome/views/client_view.h" + +namespace ChromeViews { + +/////////////////////////////////////////////////////////////////////////////// +// ClientView, public: + +ClientView::ClientView(Window* window, View* contents_view) + : window_(window), + contents_view_(contents_view) { +} + +int ClientView::NonClientHitTest(const gfx::Point& point) { + CRect bounds; + GetBounds(&bounds, APPLY_MIRRORING_TRANSFORMATION); + if (gfx::Rect(bounds).Contains(point.x(), point.y())) + return HTCLIENT; + return HTNOWHERE; +} + +/////////////////////////////////////////////////////////////////////////////// +// ClientView, View overrides: + +void ClientView::GetPreferredSize(CSize* out) { + DCHECK(out); + // |contents_view_| is allowed to be NULL up until the point where this view + // is attached to a ViewContainer. + if (contents_view_) + contents_view_->GetPreferredSize(out); +} + +void ClientView::ViewHierarchyChanged(bool is_add, View* parent, View* child) { + if (is_add && child == this) { + DCHECK(GetViewContainer()); + DCHECK(contents_view_); // |contents_view_| must be valid now! + AddChildView(contents_view_); + } +} + +void ClientView::DidChangeBounds(const CRect& previous, const CRect& current) { + Layout(); +} + +void ClientView::Layout() { + // |contents_view_| is allowed to be NULL up until the point where this view + // is attached to a ViewContainer. + if (contents_view_) + contents_view_->SetBounds(0, 0, width(), height()); +} + +}; // namespace ChromeViews diff --git a/chrome/views/client_view.h b/chrome/views/client_view.h index 80feb43..ad086f5 100644 --- a/chrome/views/client_view.h +++ b/chrome/views/client_view.h @@ -1,79 +1,79 @@ -// Copyright (c) 2006-2008 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.
-
-#ifndef CHROME_VIEWS_CLIENT_VIEW_H_
-#define CHROME_VIEWS_CLIENT_VIEW_H_
-
-#include "chrome/views/view.h"
-
-namespace ChromeViews {
-
-class DialogClientView;
-class Window;
-
-///////////////////////////////////////////////////////////////////////////////
-// ClientView
-//
-// A ClientView is a View subclass that is used to occupy the "client area"
-// of a window. It provides basic information to the window that contains it
-// such as non-client hit testing information, sizing etc. Sub-classes of
-// ClientView are used to create more elaborate contents, e.g.
-// "DialogClientView".
-class ClientView : public View {
- public:
- // Constructs a ClientView object for the specified window with the specified
- // contents. Since this object is created during the process of creating
- // |window|, |contents_view| must be valid if you want the initial size of
- // the window to be based on |contents_view|'s preferred size.
- ClientView(Window* window, View* contents_view);
- virtual ~ClientView() {}
-
- // Manual RTTI ftw.
- virtual DialogClientView* AsDialogClientView() { return NULL; }
-
- // Returns true to signal that the Window can be closed. Specialized
- // ClientView subclasses can override this default behavior to allow the
- // close to be blocked until the user corrects mistakes, accepts a warning
- // dialog, etc.
- virtual bool CanClose() const { return true; }
-
- // Tests to see if the specified point (in view coordinates) is within the
- // bounds of this view. If so, it returns HTCLIENT in this default
- // implementation. If it is outside the bounds of this view, this must return
- // HTNOWHERE to tell the caller to do further processing to determine where
- // in the non-client area it is (if it is).
- // Subclasses of ClientView can extend this logic by overriding this method
- // to detect if regions within the client area count as parts of the "non-
- // client" area. A good example of this is the size box at the bottom right
- // corner of resizable dialog boxes.
- virtual int NonClientHitTest(const gfx::Point& point);
-
- // Overridden from View:
- virtual void GetPreferredSize(CSize* out);
-
- protected:
- // Overridden from View:
- virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child);
- virtual void DidChangeBounds(const CRect& previous, const CRect& current);
- virtual void Layout();
-
- // Accessors for private data members.
- Window* window() const { return window_; }
- void set_window(Window* window) { window_ = window; }
- View* contents_view() const { return contents_view_; }
- void set_contents_view(View* contents_view) {
- contents_view_ = contents_view;
- }
-
- private:
- // The Window that hosts this ClientView.
- Window* window_;
-
- // The View that this ClientView contains.
- View* contents_view_;
-};
-
-} // namespace ChromeViews
-
-#endif // #ifndef CHROME_VIEWS_CLIENT_VIEW_H_
+// Copyright (c) 2006-2008 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. + +#ifndef CHROME_VIEWS_CLIENT_VIEW_H_ +#define CHROME_VIEWS_CLIENT_VIEW_H_ + +#include "chrome/views/view.h" + +namespace ChromeViews { + +class DialogClientView; +class Window; + +/////////////////////////////////////////////////////////////////////////////// +// ClientView +// +// A ClientView is a View subclass that is used to occupy the "client area" +// of a window. It provides basic information to the window that contains it +// such as non-client hit testing information, sizing etc. Sub-classes of +// ClientView are used to create more elaborate contents, e.g. +// "DialogClientView". +class ClientView : public View { + public: + // Constructs a ClientView object for the specified window with the specified + // contents. Since this object is created during the process of creating + // |window|, |contents_view| must be valid if you want the initial size of + // the window to be based on |contents_view|'s preferred size. + ClientView(Window* window, View* contents_view); + virtual ~ClientView() {} + + // Manual RTTI ftw. + virtual DialogClientView* AsDialogClientView() { return NULL; } + + // Returns true to signal that the Window can be closed. Specialized + // ClientView subclasses can override this default behavior to allow the + // close to be blocked until the user corrects mistakes, accepts a warning + // dialog, etc. + virtual bool CanClose() const { return true; } + + // Tests to see if the specified point (in view coordinates) is within the + // bounds of this view. If so, it returns HTCLIENT in this default + // implementation. If it is outside the bounds of this view, this must return + // HTNOWHERE to tell the caller to do further processing to determine where + // in the non-client area it is (if it is). + // Subclasses of ClientView can extend this logic by overriding this method + // to detect if regions within the client area count as parts of the "non- + // client" area. A good example of this is the size box at the bottom right + // corner of resizable dialog boxes. + virtual int NonClientHitTest(const gfx::Point& point); + + // Overridden from View: + virtual void GetPreferredSize(CSize* out); + + protected: + // Overridden from View: + virtual void ViewHierarchyChanged(bool is_add, View* parent, View* child); + virtual void DidChangeBounds(const CRect& previous, const CRect& current); + virtual void Layout(); + + // Accessors for private data members. + Window* window() const { return window_; } + void set_window(Window* window) { window_ = window; } + View* contents_view() const { return contents_view_; } + void set_contents_view(View* contents_view) { + contents_view_ = contents_view; + } + + private: + // The Window that hosts this ClientView. + Window* window_; + + // The View that this ClientView contains. + View* contents_view_; +}; + +} // namespace ChromeViews + +#endif // #ifndef CHROME_VIEWS_CLIENT_VIEW_H_ diff --git a/chrome/views/combo_box.cc b/chrome/views/combo_box.cc index 148cf19..f1010a5 100644 --- a/chrome/views/combo_box.cc +++ b/chrome/views/combo_box.cc @@ -65,7 +65,7 @@ void ComboBox::GetPreferredSize(CSize* out) { HWND ComboBox::CreateNativeControl(HWND parent_container) { HWND r = ::CreateWindowEx(GetAdditionalExStyle(), L"COMBOBOX", L"", WS_CHILD | WS_VSCROLL | CBS_DROPDOWNLIST, - 0, 0, GetWidth(), GetHeight(), + 0, 0, width(), height(), parent_container, NULL, NULL, NULL); HFONT font = ResourceBundle::GetSharedInstance(). GetFont(ResourceBundle::BaseFont).hfont(); diff --git a/chrome/views/custom_frame_window.cc b/chrome/views/custom_frame_window.cc index a60355c..9a1a079 100644 --- a/chrome/views/custom_frame_window.cc +++ b/chrome/views/custom_frame_window.cc @@ -364,8 +364,8 @@ gfx::Size DefaultNonClientView::CalculateWindowSizeForClientSize( CPoint DefaultNonClientView::GetSystemMenuPoint() const { CPoint system_menu_point( - system_menu_button_->GetX(), - system_menu_button_->GetY() + system_menu_button_->GetHeight()); + system_menu_button_->x(), + system_menu_button_->y() + system_menu_button_->height()); MapWindowPoints(container_->GetHWND(), HWND_DESKTOP, &system_menu_point, 1); return system_menu_point; } @@ -523,9 +523,6 @@ int DefaultNonClientView::CalculateContentsTop() const { } void DefaultNonClientView::PaintFrameBorder(ChromeCanvas* canvas) { - int width = GetWidth(); - int height = GetHeight(); - SkBitmap* top_left_corner = resources()->GetPartBitmap(FRAME_TOP_LEFT_CORNER); SkBitmap* top_right_corner = @@ -542,33 +539,33 @@ void DefaultNonClientView::PaintFrameBorder(ChromeCanvas* canvas) { // Top. canvas->DrawBitmapInt(*top_left_corner, 0, 0); canvas->TileImageInt(*top_edge, top_left_corner->width(), 0, - width - top_right_corner->width(), top_edge->height()); + width() - top_right_corner->width(), top_edge->height()); canvas->DrawBitmapInt(*top_right_corner, - width - top_right_corner->width(), 0); + width() - top_right_corner->width(), 0); // Right. int top_stack_height = top_right_corner->height(); - canvas->TileImageInt(*right_edge, width - right_edge->width(), + canvas->TileImageInt(*right_edge, width() - right_edge->width(), top_stack_height, right_edge->width(), - height - top_stack_height - + height() - top_stack_height - bottom_right_corner->height()); // Bottom. canvas->DrawBitmapInt(*bottom_right_corner, - width - bottom_right_corner->width(), - height - bottom_right_corner->height()); + width() - bottom_right_corner->width(), + height() - bottom_right_corner->height()); canvas->TileImageInt(*bottom_edge, bottom_left_corner->width(), - height - bottom_edge->height(), - width - bottom_left_corner->width() - + height() - bottom_edge->height(), + width() - bottom_left_corner->width() - bottom_right_corner->width(), bottom_edge->height()); canvas->DrawBitmapInt(*bottom_left_corner, 0, - height - bottom_left_corner->height()); + height() - bottom_left_corner->height()); // Left. top_stack_height = top_left_corner->height(); canvas->TileImageInt(*left_edge, 0, top_stack_height, left_edge->width(), - height - top_stack_height - + height() - top_stack_height - bottom_left_corner->height()); } @@ -577,9 +574,9 @@ void DefaultNonClientView::PaintMaximizedFrameBorder( SkBitmap* top_edge = resources()->GetPartBitmap(FRAME_TOP_EDGE); SkBitmap* bottom_edge = resources()->GetPartBitmap(FRAME_BOTTOM_EDGE); - canvas->TileImageInt(*top_edge, 0, 0, GetWidth(), top_edge->height()); - canvas->TileImageInt(*bottom_edge, 0, GetHeight() - bottom_edge->height(), - GetWidth(), bottom_edge->height()); + canvas->TileImageInt(*top_edge, 0, 0, width(), top_edge->height()); + canvas->TileImageInt(*bottom_edge, 0, height() - bottom_edge->height(), + width(), bottom_edge->height()); } void DefaultNonClientView::PaintClientEdge(ChromeCanvas* canvas) { @@ -633,7 +630,7 @@ void DefaultNonClientView::LayoutWindowControls() { close_button_->GetPreferredSize(&ps); close_button_->SetImageAlignment(Button::ALIGN_LEFT, Button::ALIGN_BOTTOM); close_button_->SetBounds( - GetWidth() - ps.cx - kWindowControlsRightZoomedOffset, + width() - ps.cx - kWindowControlsRightZoomedOffset, 0, ps.cx + kWindowControlsRightZoomedOffset, ps.cy + kWindowControlsTopZoomedOffset); @@ -641,20 +638,20 @@ void DefaultNonClientView::LayoutWindowControls() { restore_button_->GetPreferredSize(&ps); restore_button_->SetImageAlignment(Button::ALIGN_LEFT, Button::ALIGN_BOTTOM); - restore_button_->SetBounds(close_button_->GetX() - ps.cx, 0, ps.cx, + restore_button_->SetBounds(close_button_->x() - ps.cx, 0, ps.cx, ps.cy + kWindowControlsTopZoomedOffset); minimize_button_->GetPreferredSize(&ps); minimize_button_->SetImageAlignment(Button::ALIGN_LEFT, Button::ALIGN_BOTTOM); - minimize_button_->SetBounds(restore_button_->GetX() - ps.cx, 0, ps.cx, + minimize_button_->SetBounds(restore_button_->x() - ps.cx, 0, ps.cx, ps.cy + kWindowControlsTopZoomedOffset); } } else if (container_->IsMinimized()) { close_button_->GetPreferredSize(&ps); close_button_->SetImageAlignment(Button::ALIGN_LEFT, Button::ALIGN_BOTTOM); close_button_->SetBounds( - GetWidth() - ps.cx - kWindowControlsRightZoomedOffset, + width() - ps.cx - kWindowControlsRightZoomedOffset, 0, ps.cx + kWindowControlsRightZoomedOffset, ps.cy + kWindowControlsTopZoomedOffset); @@ -662,19 +659,19 @@ void DefaultNonClientView::LayoutWindowControls() { restore_button_->GetPreferredSize(&ps); restore_button_->SetImageAlignment(Button::ALIGN_LEFT, Button::ALIGN_BOTTOM); - restore_button_->SetBounds(close_button_->GetX() - ps.cx, 0, ps.cx, + restore_button_->SetBounds(close_button_->x() - ps.cx, 0, ps.cx, ps.cy + kWindowControlsTopZoomedOffset); minimize_button_->GetPreferredSize(&ps); minimize_button_->SetImageAlignment(Button::ALIGN_LEFT, Button::ALIGN_BOTTOM); - minimize_button_->SetBounds(restore_button_->GetX() - ps.cx, 0, ps.cx, + minimize_button_->SetBounds(restore_button_->x() - ps.cx, 0, ps.cx, ps.cy + kWindowControlsTopZoomedOffset); } } else { close_button_->GetPreferredSize(&ps); close_button_->SetImageAlignment(Button::ALIGN_LEFT, Button::ALIGN_TOP); - close_button_->SetBounds(GetWidth() - kWindowControlsRightOffset - ps.cx, + close_button_->SetBounds(width() - kWindowControlsRightOffset - ps.cx, kWindowControlsTopOffset, ps.cx, ps.cy); if (should_show_minmax_buttons_) { @@ -694,13 +691,13 @@ void DefaultNonClientView::LayoutWindowControls() { maximize_button_->GetPreferredSize(&ps); maximize_button_->SetImageAlignment(Button::ALIGN_LEFT, Button::ALIGN_TOP); - maximize_button_->SetBounds(close_button_->GetX() - ps.cx, + maximize_button_->SetBounds(close_button_->x() - ps.cx, kWindowControlsTopOffset, ps.cx, ps.cy); minimize_button_->GetPreferredSize(&ps); minimize_button_->SetImageAlignment(Button::ALIGN_LEFT, Button::ALIGN_TOP); - minimize_button_->SetBounds(maximize_button_->GetX() - ps.cx, + minimize_button_->SetBounds(maximize_button_->x() - ps.cx, kWindowControlsTopOffset, ps.cx, ps.cy); } } @@ -745,7 +742,7 @@ void DefaultNonClientView::LayoutTitleBar() { system_menu_button_->GetBounds(&system_menu_bounds); int spacing = d->ShouldShowWindowIcon() ? kWindowIconTitleSpacing : 0; int title_right = should_show_minmax_buttons_ ? - minimize_button_->GetX() : close_button_->GetX(); + minimize_button_->x() : close_button_->x(); int title_left = system_menu_bounds.right + spacing; title_bounds_.SetRect(title_left, kTitleTopOffset + top_offset, std::max(0, static_cast<int>(title_right - system_menu_bounds.right)), @@ -768,7 +765,7 @@ void DefaultNonClientView::LayoutTitleBar() { void DefaultNonClientView::LayoutClientView() { gfx::Rect client_bounds( - CalculateClientAreaBounds(GetWidth(), GetHeight())); + CalculateClientAreaBounds(width(), height())); container_->client_view()->SetBounds(client_bounds.ToRECT()); } @@ -993,8 +990,8 @@ void CustomFrameWindow::OnNCPaint(HRGN rgn) { CRect window_rect; GetWindowRect(&window_rect); - if (window_rect.Width() != root_view_->GetWidth() || - window_rect.Height() != root_view_->GetHeight()) { + if (window_rect.Width() != root_view_->width() || + window_rect.Height() != root_view_->height()) { // If the size of the window differs from the size of the root view it // means we're being asked to paint before we've gotten a WM_SIZE. This can // happen when the user is interactively resizing the window. To avoid diff --git a/chrome/views/dialog_client_view.cc b/chrome/views/dialog_client_view.cc index b996dca..be30759 100644 --- a/chrome/views/dialog_client_view.cc +++ b/chrome/views/dialog_client_view.cc @@ -37,7 +37,7 @@ void UpdateButtonHelper(ChromeViews::NativeButton* button_view, void FillViewWithSysColor(ChromeCanvas* canvas, View* view, COLORREF color) { SkColor sk_color = SkColorSetRGB(GetRValue(color), GetGValue(color), GetBValue(color)); - canvas->FillRectInt(sk_color, 0, 0, view->GetWidth(), view->GetHeight()); + canvas->FillRectInt(sk_color, 0, 0, view->width(), view->height()); } // DialogButton ---------------------------------------------------------------- @@ -198,7 +198,7 @@ bool DialogClientView::CanClose() const { } int DialogClientView::NonClientHitTest(const gfx::Point& point) { - if (size_box_bounds_.Contains(point.x() - GetX(), point.y() - GetY())) + if (size_box_bounds_.Contains(point.x() - x(), point.y() - y())) return HTBOTTOMRIGHT; return ClientView::NonClientHitTest(point); } @@ -244,9 +244,9 @@ void DialogClientView::GetPreferredSize(CSize* out) { int button_height = 0; if (has_dialog_buttons()) { if (cancel_button_) - button_height = cancel_button_->GetHeight(); + button_height = cancel_button_->height(); else - button_height = ok_button_->GetHeight(); + button_height = ok_button_->height(); // Account for padding above and below the button. button_height += kDialogButtonContentSpacing + kButtonVEdgeMargin; } @@ -311,8 +311,8 @@ int DialogClientView::GetButtonWidth(int button) const { int DialogClientView::GetButtonsHeight() const { if (has_dialog_buttons()) { if (cancel_button_) - return cancel_button_->GetHeight() + kDialogButtonContentSpacing; - return ok_button_->GetHeight() + kDialogButtonContentSpacing; + return cancel_button_->height() + kDialogButtonContentSpacing; + return ok_button_->height() + kDialogButtonContentSpacing; } return 0; } @@ -343,7 +343,7 @@ void DialogClientView::LayoutDialogButtons() { int button_width = GetButtonWidth(DialogDelegate::DIALOGBUTTON_OK); int ok_button_right = lb.right - kButtonHEdgeMargin; if (cancel_button_) - ok_button_right = cancel_button_->GetX() - kRelatedButtonHSpacing; + ok_button_right = cancel_button_->x() - kRelatedButtonHSpacing; CRect bounds; bounds.left = ok_button_right - button_width; bounds.top = lb.bottom - ps.cy - kButtonVEdgeMargin; diff --git a/chrome/views/event.h b/chrome/views/event.h index 074e046..17cbe60 100644 --- a/chrome/views/event.h +++ b/chrome/views/event.h @@ -128,12 +128,12 @@ class LocatedEvent : public Event { LocatedEvent(const LocatedEvent& model, View* from, View* to); // Returns the X location. - int GetX() const { + int x() const { return location_.x(); } // Returns the Y location. - int GetY() const { + int y() const { return location_.y(); } diff --git a/chrome/views/focus_manager_unittest.cc b/chrome/views/focus_manager_unittest.cc index dd3405c..8f0040f 100644 --- a/chrome/views/focus_manager_unittest.cc +++ b/chrome/views/focus_manager_unittest.cc @@ -111,7 +111,7 @@ class BorderView : public ChromeViews::NativeControl { WC_TABCONTROL, L"", WS_CHILD, - 0, 0, GetWidth(), GetHeight(), + 0, 0, width(), height(), parent_container, NULL, NULL, NULL); // Create the view container which is a child of the TabControl. view_container_ = new ChromeViews::HWNDViewContainer(); diff --git a/chrome/views/grid_layout.cc b/chrome/views/grid_layout.cc index 18f7ba0..e0c7257 100644 --- a/chrome/views/grid_layout.cc +++ b/chrome/views/grid_layout.cc @@ -765,7 +765,7 @@ void GridLayout::Layout(View* host) { // SizeRowsAndColumns sets the size and location of each row/column, but // not of the views. CSize pref; - SizeRowsAndColumns(true, host_->GetWidth(), host_->GetHeight(), &pref); + SizeRowsAndColumns(true, host_->width(), host_->height(), &pref); // Size each view. for (std::vector<ViewState*>::iterator i = view_states_.begin(); diff --git a/chrome/views/grid_layout_unittest.cc b/chrome/views/grid_layout_unittest.cc index 2f92c71..080cddb 100644 --- a/chrome/views/grid_layout_unittest.cc +++ b/chrome/views/grid_layout_unittest.cc @@ -13,10 +13,10 @@ using ChromeViews::View; static void ExpectViewBoundsEquals(int x, int y, int w, int h, const View* view) { - EXPECT_EQ(x, view->GetX()); - EXPECT_EQ(y, view->GetY()); - EXPECT_EQ(w, view->GetWidth()); - EXPECT_EQ(h, view->GetHeight()); + EXPECT_EQ(x, view->x()); + EXPECT_EQ(y, view->y()); + EXPECT_EQ(w, view->width()); + EXPECT_EQ(h, view->height()); } class SettableSizeView : public View { diff --git a/chrome/views/image_view.cc b/chrome/views/image_view.cc index bde1b6b..00c771d 100644 --- a/chrome/views/image_view.cc +++ b/chrome/views/image_view.cc @@ -80,10 +80,10 @@ void ImageView::ComputeImageOrigin(int image_width, int image_height, *x = 0; break; case TRAILING: - *x = GetWidth() - image_width; + *x = width() - image_width; break; case CENTER: - *x = (GetWidth() - image_width) / 2; + *x = (width() - image_width) / 2; break; default: NOTREACHED(); @@ -94,10 +94,10 @@ void ImageView::ComputeImageOrigin(int image_width, int image_height, *y = 0; break; case TRAILING: - *y = GetHeight() - image_height; + *y = height() - image_height; break; case CENTER: - *y = (GetHeight() - image_height) / 2; + *y = (height() - image_height) / 2; break; default: NOTREACHED(); diff --git a/chrome/views/label.cc b/chrome/views/label.cc index a87e400..31053ac 100644 --- a/chrome/views/label.cc +++ b/chrome/views/label.cc @@ -54,7 +54,7 @@ void Label::GetPreferredSize(CSize* out) { DCHECK(out); if (is_multi_line_) { ChromeCanvas cc(0, 0, true); - int w = GetWidth(), h = 0; + int w = width(), h = 0; cc.SizeStringInt(text_, font_, &w, &h, ComputeMultiLineFlags()); out->cx = w; out->cy = h; @@ -110,8 +110,8 @@ void Label::Paint(ChromeCanvas* canvas) { } if (is_multi_line_) { - canvas->DrawStringInt(paint_text, font_, color_, 0, 0, GetWidth(), - GetHeight(), ComputeMultiLineFlags()); + canvas->DrawStringInt(paint_text, font_, color_, 0, 0, width(), + height(), ComputeMultiLineFlags()); PaintFocusBorder(canvas); } else { gfx::Rect text_bounds = GetTextBounds(); @@ -262,7 +262,7 @@ bool Label::GetTooltipText(int x, int y, std::wstring* tooltip) { } // Show the full text if the text does not fit. - if (!is_multi_line_ && font_.GetStringWidth(text_) > GetWidth()) { + if (!is_multi_line_ && font_.GetStringWidth(text_) > width()) { *tooltip = text_; return true; } @@ -302,7 +302,7 @@ ChromeFont Label::GetDefaultFont() { } void Label::UpdateContainsMouse(const MouseEvent& event) { - SetContainsMouse(GetTextBounds().Contains(event.GetX(), event.GetY())); + SetContainsMouse(GetTextBounds().Contains(event.x(), event.y())); } void Label::SetContainsMouse(bool contains_mouse) { @@ -317,12 +317,12 @@ gfx::Rect Label::GetTextBounds() { CSize text_size; GetTextSize(&text_size); gfx::Insets insets = GetInsets(); - int avail_width = GetWidth() - insets.left() - insets.right(); + int avail_width = width() - insets.left() - insets.right(); // Respect the size set by the owner view text_size.cx = std::min(avail_width, static_cast<int>(text_size.cx)); int text_y = insets.top() + - (GetHeight() - text_size.cy - insets.top() - insets.bottom()) / 2; + (height() - text_size.cy - insets.top() - insets.bottom()) / 2; int text_x; switch (horiz_alignment_) { case ALIGN_LEFT: @@ -334,7 +334,7 @@ gfx::Rect Label::GetTextBounds() { text_x = insets.left() + (avail_width + 1 - text_size.cx) / 2; break; case ALIGN_RIGHT: - text_x = GetWidth() - insets.right() - text_size.cx; + text_x = width() - insets.right() - text_size.cx; break; } return gfx::Rect(text_x, text_y, text_size.cx, text_size.cy); diff --git a/chrome/views/link.cc b/chrome/views/link.cc index a8d0f4f..8350a7b 100644 --- a/chrome/views/link.cc +++ b/chrome/views/link.cc @@ -84,7 +84,7 @@ bool Link::OnMousePressed(const MouseEvent& e) { bool Link::OnMouseDragged(const MouseEvent& e) { SetHighlighted(enabled_ && (e.IsLeftMouseButton() || e.IsMiddleMouseButton()) && - HitTest(WTL::CPoint(e.GetX(), e.GetY()))); + HitTest(WTL::CPoint(e.x(), e.y()))); return true; } @@ -94,7 +94,7 @@ void Link::OnMouseReleased(const MouseEvent& e, bool canceled) { SetHighlighted(false); if (enabled_ && !canceled && (e.IsLeftMouseButton() || e.IsMiddleMouseButton()) && - HitTest(WTL::CPoint(e.GetX(), e.GetY()))) { + HitTest(WTL::CPoint(e.x(), e.y()))) { // Focus the link on click. RequestFocus(); diff --git a/chrome/views/menu_button.cc b/chrome/views/menu_button.cc index 91f6d55..b2bdbea 100644 --- a/chrome/views/menu_button.cc +++ b/chrome/views/menu_button.cc @@ -83,9 +83,9 @@ void MenuButton::Paint(ChromeCanvas* canvas, bool for_drag) { // a MenuButton control (see TextButton::Paint() for a detailed // explanation regarding why we can not flip the canvas). Therefore, we // need to manually mirror the position of the down arrow. - gfx::Rect arrow_bounds(GetWidth() - insets.right() - + gfx::Rect arrow_bounds(width() - insets.right() - kMenuMarker->width() - kMenuMarkerPaddingRight, - GetHeight() / 2, + height() / 2, kMenuMarker->width(), kMenuMarker->height()); arrow_bounds.set_x(MirroredLeftPointForRect(arrow_bounds)); @@ -182,8 +182,8 @@ bool MenuButton::OnMousePressed(const ChromeViews::MouseEvent& e) { if (GetState() != BS_DISABLED) { // If we're draggable (GetDragOperations returns a non-zero value), then // don't pop on press, instead wait for release. - if (e.IsOnlyLeftMouseButton() && HitTest(WTL::CPoint(e.GetX(), e.GetY())) && - GetDragOperations(e.GetX(), e.GetY()) == DragDropTypes::DRAG_NONE) { + if (e.IsOnlyLeftMouseButton() && HitTest(WTL::CPoint(e.x(), e.y())) && + GetDragOperations(e.x(), e.y()) == DragDropTypes::DRAG_NONE) { TimeDelta delta = Time::Now() - menu_closed_time_; int64 delta_in_milliseconds = delta.InMilliseconds(); if (delta_in_milliseconds > kMinimumTimeBetweenButtonClicks) { @@ -196,9 +196,9 @@ bool MenuButton::OnMousePressed(const ChromeViews::MouseEvent& e) { void MenuButton::OnMouseReleased(const ChromeViews::MouseEvent& e, bool canceled) { - if (GetDragOperations(e.GetX(), e.GetY()) != DragDropTypes::DRAG_NONE && + if (GetDragOperations(e.x(), e.y()) != DragDropTypes::DRAG_NONE && GetState() != BS_DISABLED && !canceled && !InDrag() && - e.IsOnlyLeftMouseButton() && HitTest(WTL::CPoint(e.GetX(), e.GetY()))) { + e.IsOnlyLeftMouseButton() && HitTest(WTL::CPoint(e.x(), e.y()))) { Activate(); } else { TextButton::OnMouseReleased(e, canceled); diff --git a/chrome/views/native_button.cc b/chrome/views/native_button.cc index fc7f409..2db380b 100644 --- a/chrome/views/native_button.cc +++ b/chrome/views/native_button.cc @@ -82,7 +82,7 @@ HWND NativeButton::CreateNativeControl(HWND parent_container) { if (is_default_) flags |= BS_DEFPUSHBUTTON; HWND r = ::CreateWindowEx(GetAdditionalExStyle(), L"BUTTON", L"", flags, 0, 0, - GetWidth(), GetHeight(), parent_container, NULL, + width(), height(), parent_container, NULL, NULL, NULL); SendMessage(r, WM_SETFONT, reinterpret_cast<WPARAM>(font_.hfont()), FALSE); ConfigureNativeButton(r); diff --git a/chrome/views/native_scroll_bar.cc b/chrome/views/native_scroll_bar.cc index 00e442c..0f36834 100644 --- a/chrome/views/native_scroll_bar.cc +++ b/chrome/views/native_scroll_bar.cc @@ -81,8 +81,8 @@ class ScrollBarContainer : public CWindowImpl<ScrollBarContainer, SBS_HORZ : SBS_VERT), 0, 0, - parent_->GetWidth(), - parent_->GetHeight(), + parent_->width(), + parent_->height(), m_hWnd, NULL, NULL, diff --git a/chrome/views/non_client_view.cc b/chrome/views/non_client_view.cc index 661367a..ff91dff 100644 --- a/chrome/views/non_client_view.cc +++ b/chrome/views/non_client_view.cc @@ -11,13 +11,11 @@ int NonClientView::GetHTComponentForFrame(const gfx::Point& point, int resize_area_corner_size, int top_resize_area_size, bool can_resize) { - int width = GetWidth(); - int height = GetHeight(); int component = HTNOWHERE; if (point.x() < resize_area_size) { if (point.y() < resize_area_corner_size) { component = HTTOPLEFT; - } else if (point.y() >= (height - resize_area_corner_size)) { + } else if (point.y() >= (height() - resize_area_corner_size)) { component = HTBOTTOMLEFT; } else { component = HTLEFT; @@ -25,26 +23,26 @@ int NonClientView::GetHTComponentForFrame(const gfx::Point& point, } else if (point.x() < resize_area_corner_size) { if (point.y() < top_resize_area_size) { component = HTTOPLEFT; - } else if (point.y() >= (height - resize_area_size)) { + } else if (point.y() >= (height() - resize_area_size)) { component = HTBOTTOMLEFT; } - } else if (point.x() >= (width - resize_area_size)) { + } else if (point.x() >= (width() - resize_area_size)) { if (point.y() < resize_area_corner_size) { component = HTTOPRIGHT; - } else if (point.y() >= (height - resize_area_corner_size)) { + } else if (point.y() >= (height() - resize_area_corner_size)) { component = HTBOTTOMRIGHT; - } else if (point.x() >= (width - resize_area_size)) { + } else if (point.x() >= (width() - resize_area_size)) { component = HTRIGHT; } - } else if (point.x() >= (width - resize_area_corner_size)) { + } else if (point.x() >= (width() - resize_area_corner_size)) { if (point.y() < top_resize_area_size) { component = HTTOPRIGHT; - } else if (point.y() >= (height - resize_area_size)) { + } else if (point.y() >= (height() - resize_area_size)) { component = HTBOTTOMRIGHT; } } else if (point.y() < top_resize_area_size) { component = HTTOP; - } else if (point.y() >= (height - resize_area_size)) { + } else if (point.y() >= (height() - resize_area_size)) { component = HTBOTTOM; } diff --git a/chrome/views/painter.h b/chrome/views/painter.h index d9516e7..e0e3519 100644 --- a/chrome/views/painter.h +++ b/chrome/views/painter.h @@ -97,7 +97,7 @@ class HorizontalPainter : public Painter { virtual void Paint(int w, int h, ChromeCanvas* canvas); // Height of the images. - int GetHeight() const { return height_; } + int height() const { return height_; } private: // The image chunks. diff --git a/chrome/views/radio_button.cc b/chrome/views/radio_button.cc index 44a1935..1e860e7 100644 --- a/chrome/views/radio_button.cc +++ b/chrome/views/radio_button.cc @@ -30,7 +30,7 @@ HWND RadioButton::CreateNativeControl(HWND parent_container) { L"BUTTON", L"", WS_CHILD | BS_RADIOBUTTON , - 0, 0, GetWidth(), GetHeight(), + 0, 0, width(), height(), parent_container, NULL, NULL, NULL); ConfigureNativeButton(r); return r; @@ -69,7 +69,7 @@ void RadioButton::GetPreferredSize(CSize *out) { void RadioButton::Layout() { int label_x = GetTextIndent(); - label_->SetBounds(label_x, 0, GetWidth() - label_x, GetHeight()); + label_->SetBounds(label_x, 0, width() - label_x, height()); if (hwnd_view_) { int first_line_height = label_->GetFont().height(); hwnd_view_->SetBounds(0, ((first_line_height - kRadioHeight) / 2) + 1, diff --git a/chrome/views/resize_corner.cc b/chrome/views/resize_corner.cc index 9ac6586..d1a91b4 100644 --- a/chrome/views/resize_corner.cc +++ b/chrome/views/resize_corner.cc @@ -19,7 +19,7 @@ ResizeCorner::~ResizeCorner() { void ResizeCorner::Paint(ChromeCanvas* canvas) { // Paint the little handle. - RECT widgetRect = { 0, 0, GetWidth(), GetHeight() }; + RECT widgetRect = { 0, 0, width(), height() }; HDC hdc = canvas->beginPlatformPaint(); gfx::NativeTheme::instance()->PaintStatusGripper(hdc, SP_GRIPPER, diff --git a/chrome/views/root_view.cc b/chrome/views/root_view.cc index d1c21c7..d3d1e96 100644 --- a/chrome/views/root_view.cc +++ b/chrome/views/root_view.cc @@ -158,9 +158,9 @@ void RootView::ProcessPaint(ChromeCanvas* canvas) { canvas->save(); // Set the clip rect according to the invalid rect. - int x = invalid_rect_.left + GetX(); - int y = invalid_rect_.top + GetY(); - canvas->ClipRectInt(x, y, invalid_rect_.Width(), invalid_rect_.Height()); + int clip_x = invalid_rect_.left + x(); + int clip_y = invalid_rect_.top + y(); + canvas->ClipRectInt(clip_x, clip_y, invalid_rect_.Width(), invalid_rect_.Height()); // Paint the tree View::ProcessPaint(canvas); @@ -278,7 +278,7 @@ bool RootView::OnMousePressed(const MouseEvent& e) { bool hit_disabled_view = false; // Walk up the tree until we find a view that wants the mouse event. - for (mouse_pressed_handler_ = GetViewForPoint(WTL::CPoint(e.GetX(), e.GetY())); + for (mouse_pressed_handler_ = GetViewForPoint(WTL::CPoint(e.x(), e.y())); mouse_pressed_handler_ && (mouse_pressed_handler_ != this); mouse_pressed_handler_ = mouse_pressed_handler_->GetParent()) { if (!mouse_pressed_handler_->IsEnabled()) { @@ -355,7 +355,7 @@ bool RootView::OnMouseDragged(const MouseEvent& e) { SetMouseLocationAndFlags(e); CPoint p; - ConvertPointToMouseHandler(WTL::CPoint(e.GetX(), e.GetY()), &p); + ConvertPointToMouseHandler(WTL::CPoint(e.x(), e.y()), &p); MouseEvent mouse_event(e.GetType(), p.x, p.y, e.GetFlags()); if (!mouse_pressed_handler_->ProcessMouseDragged(mouse_event, &drag_info)) { @@ -373,7 +373,7 @@ void RootView::OnMouseReleased(const MouseEvent& e, bool canceled) { if (mouse_pressed_handler_) { CPoint p; - ConvertPointToMouseHandler(WTL::CPoint(e.GetX(), e.GetY()), &p); + ConvertPointToMouseHandler(WTL::CPoint(e.x(), e.y()), &p); MouseEvent mouse_released(e.GetType(), p.x, p.y, e.GetFlags()); // We allow the view to delete us from ProcessMouseReleased. As such, // configure state such that we're done first, then call View. @@ -386,10 +386,10 @@ void RootView::OnMouseReleased(const MouseEvent& e, bool canceled) { } void RootView::UpdateCursor(const MouseEvent& e) { - View *v = GetViewForPoint(WTL::CPoint(e.GetX(), e.GetY())); + View *v = GetViewForPoint(WTL::CPoint(e.x(), e.y())); if (v && v != this) { - CPoint l(e.GetX(), e.GetY()); + CPoint l(e.x(), e.y()); View::ConvertPointToView(this, v, &l); HCURSOR cursor = v->GetCursorForPoint(e.GetType(), l.x, l.y); if (cursor) { @@ -403,7 +403,7 @@ void RootView::UpdateCursor(const MouseEvent& e) { } void RootView::OnMouseMoved(const MouseEvent& e) { - View *v = GetViewForPoint(WTL::CPoint(e.GetX(), e.GetY())); + View *v = GetViewForPoint(WTL::CPoint(e.x(), e.y())); // Find the first enabled view. while (v && !v->IsEnabled()) v = v->GetParent(); @@ -431,7 +431,7 @@ void RootView::OnMouseMoved(const MouseEvent& e) { mouse_move_handler_->OnMouseMoved(moved_event); HCURSOR cursor = mouse_move_handler_->GetCursorForPoint( - moved_event.GetType(), moved_event.GetX(), moved_event.GetY()); + moved_event.GetType(), moved_event.x(), moved_event.y()); if (cursor) { previous_cursor_ = ::SetCursor(cursor); } else if (previous_cursor_) { @@ -880,8 +880,8 @@ void RootView::UnregisterViewForVisibleBoundsNotification(View* view) { void RootView::SetMouseLocationAndFlags(const MouseEvent& e) { last_mouse_event_flags_ = e.GetFlags(); - last_mouse_event_x_ = e.GetX(); - last_mouse_event_y_ = e.GetY(); + last_mouse_event_x_ = e.x(); + last_mouse_event_y_ = e.y(); } std::string RootView::GetClassName() const { diff --git a/chrome/views/scroll_view.cc b/chrome/views/scroll_view.cc index 9f7f0e3..6b43fb4 100644 --- a/chrome/views/scroll_view.cc +++ b/chrome/views/scroll_view.cc @@ -25,8 +25,8 @@ class Viewport : public View { return; View* contents = GetChildViewAt(0); - x -= contents->GetX(); - y -= contents->GetY(); + x -= contents->x(); + y -= contents->y(); static_cast<ScrollView*>(GetParent())->ScrollContentsRegionToBeVisible( x, y, width, height); } @@ -177,7 +177,7 @@ void ScrollView::Layout() { bool horiz_sb_required = false; bool vert_sb_required = false; if (contents_) { - WTL::CSize content_size(contents_->GetWidth(), contents_->GetHeight()); + WTL::CSize content_size(contents_->width(), contents_->height()); ComputeScrollBarsVisibility(viewport_size, content_size, &horiz_sb_required, @@ -246,15 +246,15 @@ void ScrollView::CheckScrollBounds() { if (contents_) { int x, y; - x = CheckScrollBounds(viewport_->GetWidth(), - contents_->GetWidth(), - -contents_->GetX()); - y = CheckScrollBounds(viewport_->GetHeight(), - contents_->GetHeight(), - -contents_->GetY()); + x = CheckScrollBounds(viewport_->width(), + contents_->width(), + -contents_->x()); + y = CheckScrollBounds(viewport_->height(), + contents_->height(), + -contents_->y()); // This is no op if bounds are the same - contents_->SetBounds(-x, -y, contents_->GetWidth(), contents_->GetHeight()); + contents_->SetBounds(-x, -y, contents_->width(), contents_->height()); } } @@ -270,7 +270,7 @@ gfx::Rect ScrollView::GetVisibleRect() const { (horiz_sb_ && horiz_sb_->IsVisible()) ? horiz_sb_->GetPosition() : 0; const int y = (vert_sb_ && vert_sb_->IsVisible()) ? vert_sb_->GetPosition() : 0; - return gfx::Rect(x, y, viewport_->GetWidth(), viewport_->GetHeight()); + return gfx::Rect(x, y, viewport_->width(), viewport_->height()); } void ScrollView::ScrollContentsRegionToBeVisible(int x, @@ -283,24 +283,24 @@ void ScrollView::ScrollContentsRegionToBeVisible(int x, } const int contents_max_x = - std::max(viewport_->GetWidth(), contents_->GetWidth()); + std::max(viewport_->width(), contents_->width()); const int contents_max_y = - std::max(viewport_->GetHeight(), contents_->GetHeight()); + std::max(viewport_->height(), contents_->height()); x = std::max(0, std::min(contents_max_x, x)); y = std::max(0, std::min(contents_max_y, y)); const int max_x = std::min(contents_max_x, - x + std::min(width, viewport_->GetWidth())); + x + std::min(width, viewport_->width())); const int max_y = std::min(contents_max_y, y + std::min(height, - viewport_->GetHeight())); + viewport_->height())); const gfx::Rect vis_rect = GetVisibleRect(); if (vis_rect.Contains(gfx::Rect(x, y, max_x, max_y))) return; const int new_x = - (vis_rect.x() < x) ? x : std::max(0, max_x - viewport_->GetWidth()); + (vis_rect.x() < x) ? x : std::max(0, max_x - viewport_->width()); const int new_y = - (vis_rect.y() < y) ? y : std::max(0, max_x - viewport_->GetHeight()); + (vis_rect.y() < y) ? y : std::max(0, max_x - viewport_->height()); contents_->SetX(-new_x); contents_->SetY(-new_y); @@ -313,15 +313,15 @@ void ScrollView::UpdateScrollBarPositions() { } if (horiz_sb_->IsVisible()) { - int vw = viewport_->GetWidth(); - int cw = contents_->GetWidth(); - int origin = contents_->GetX(); + int vw = viewport_->width(); + int cw = contents_->width(); + int origin = contents_->x(); horiz_sb_->Update(vw, cw, -origin); } if (vert_sb_->IsVisible()) { - int vh = viewport_->GetHeight(); - int ch = contents_->GetHeight(); - int origin = contents_->GetY(); + int vh = viewport_->height(); + int ch = contents_->height(); + int origin = contents_->y(); vert_sb_->Update(vh, ch, -origin); } } @@ -332,9 +332,9 @@ void ScrollView::ScrollToPosition(ScrollBar* source, int position) { return; if (source == horiz_sb_ && horiz_sb_->IsVisible()) { - int vw = viewport_->GetWidth(); - int cw = contents_->GetWidth(); - int origin = contents_->GetX(); + int vw = viewport_->width(); + int cw = contents_->width(); + int origin = contents_->x(); if (-origin != position) { int max_pos = std::max(0, cw - vw); if (position < 0) @@ -347,9 +347,9 @@ void ScrollView::ScrollToPosition(ScrollBar* source, int position) { contents_->SchedulePaint(bounds, true); } } else if (source == vert_sb_ && vert_sb_->IsVisible()) { - int vh = viewport_->GetHeight(); - int ch = contents_->GetHeight(); - int origin = contents_->GetY(); + int vh = viewport_->height(); + int ch = contents_->height(); + int origin = contents_->y(); if (-origin != position) { int max_pos = std::max(0, ch - vh); if (position < 0) @@ -379,8 +379,8 @@ int ScrollView::GetScrollIncrement(ScrollBar* source, bool is_page, } // No view, or the view didn't return a valid amount. if (is_page) - return is_horizontal ? viewport_->GetWidth() : viewport_->GetHeight(); - return is_horizontal ? viewport_->GetWidth() / 5 : viewport_->GetHeight() / 5; + return is_horizontal ? viewport_->width() : viewport_->height(); + return is_horizontal ? viewport_->width() / 5 : viewport_->height() / 5; } void ScrollView::ViewHierarchyChanged(bool is_add, View *parent, View *child) { @@ -447,11 +447,11 @@ int VariableRowHeightScrollHelper::GetPageScrollIncrement( if (is_horizontal) return 0; // y coordinate is most likely negative. - int y = abs(scroll_view->GetContents()->GetY()); - int vis_height = scroll_view->GetContents()->GetParent()->GetHeight(); + int y = abs(scroll_view->GetContents()->y()); + int vis_height = scroll_view->GetContents()->GetParent()->height(); if (is_positive) { // Align the bottom most row to the top of the view. - int bottom = std::min(scroll_view->GetContents()->GetHeight() - 1, + int bottom = std::min(scroll_view->GetContents()->height() - 1, y + vis_height); RowInfo bottom_row_info = GetRowInfo(bottom); // If 0, ScrollView will provide a default value. @@ -471,7 +471,7 @@ int VariableRowHeightScrollHelper::GetLineScrollIncrement( if (is_horizontal) return 0; // y coordinate is most likely negative. - int y = abs(scroll_view->GetContents()->GetY()); + int y = abs(scroll_view->GetContents()->y()); RowInfo row = GetRowInfo(y); if (is_positive) { return row.height - (y - row.origin); diff --git a/chrome/views/separator.cc b/chrome/views/separator.cc index fc34705..0c9c6fa 100644 --- a/chrome/views/separator.cc +++ b/chrome/views/separator.cc @@ -23,7 +23,7 @@ HWND Separator::CreateNativeControl(HWND parent_container) { return ::CreateWindowEx(GetAdditionalExStyle(), L"STATIC", L"", WS_CHILD | SS_ETCHEDHORZ | SS_SUNKEN, - 0, 0, GetWidth(), GetHeight(), + 0, 0, width(), height(), parent_container, NULL, NULL, NULL); } @@ -33,7 +33,7 @@ LRESULT Separator::OnNotify(int w_param, LPNMHDR l_param) { void Separator::GetPreferredSize(CSize* out) { DCHECK(out); - out->cx = GetWidth(); + out->cx = width(); out->cy = fixed_height_; } diff --git a/chrome/views/tabbed_pane.cc b/chrome/views/tabbed_pane.cc index 421edc3..473f1db 100644 --- a/chrome/views/tabbed_pane.cc +++ b/chrome/views/tabbed_pane.cc @@ -39,7 +39,7 @@ class TabBackground : public Background { virtual void Paint(ChromeCanvas* canvas, View* view) const { HDC dc = canvas->beginPlatformPaint(); - RECT r = {0, 0, view->GetWidth(), view->GetHeight()}; + RECT r = {0, 0, view->width(), view->height()}; gfx::NativeTheme::instance()->PaintTabPanelBackground(dc, &r); canvas->endPlatformPaint(); } @@ -158,7 +158,7 @@ HWND TabbedPane::CreateNativeControl(HWND parent_container) { WC_TABCONTROL, L"", WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE, - 0, 0, GetWidth(), GetHeight(), + 0, 0, width(), height(), parent_container, NULL, NULL, NULL); HFONT font = ResourceBundle::GetSharedInstance(). diff --git a/chrome/views/table_view.cc b/chrome/views/table_view.cc index 6d1bc60..ab4d717 100644 --- a/chrome/views/table_view.cc +++ b/chrome/views/table_view.cc @@ -83,7 +83,7 @@ void TableView::DidChangeBounds(const CRect& previous, return; SendMessage(list_view_, WM_SETREDRAW, static_cast<WPARAM>(FALSE), 0); Layout(); - if ((!sized_columns_ || autosize_columns_) && GetWidth() > 0) { + if ((!sized_columns_ || autosize_columns_) && width() > 0) { sized_columns_ = true; ResetColumnSizes(); } @@ -458,7 +458,7 @@ HWND TableView::CreateNativeControl(HWND parent_container) { WC_LISTVIEW, L"", style, - 0, 0, GetWidth(), GetHeight(), + 0, 0, width(), height(), parent_container, NULL, NULL, NULL); model_->SetObserver(this); diff --git a/chrome/views/text_button.cc b/chrome/views/text_button.cc index 5c694b4e..e4e7225 100644 --- a/chrome/views/text_button.cc +++ b/chrome/views/text_button.cc @@ -225,8 +225,8 @@ void TextButton::Paint(ChromeCanvas* canvas, bool for_drag) { } gfx::Insets insets = GetInsets(); - int available_width = GetWidth() - insets.width(); - int available_height = GetHeight() - insets.height(); + int available_width = width() - insets.width(); + int available_height = height() - insets.height(); // Use the actual text (not max) size to properly center the text. int content_width = text_size_.cx; if (icon_.width() > 0) { @@ -248,7 +248,7 @@ void TextButton::Paint(ChromeCanvas* canvas, bool for_drag) { if (icon_.width() > 0) text_x += icon_.width() + kIconTextPadding; const int text_width = std::min(static_cast<int>(text_size_.cx), - GetWidth() - insets.right() - text_x); + width() - insets.right() - text_x); int text_y = (available_height - text_size_.cy) / 2 + insets.top(); if (text_width > 0) { diff --git a/chrome/views/text_field.cc b/chrome/views/text_field.cc index 7d0cd93..8d61868 100644 --- a/chrome/views/text_field.cc +++ b/chrome/views/text_field.cc @@ -247,7 +247,7 @@ TextField::Edit::Edit(TextField* parent, bool draw_border) // Make sure we apply RTL related extended window styles if necessary. DWORD ex_style = l10n_util::GetExtendedStyles(); - RECT r = {0, 0, parent_->GetWidth(), parent_->GetHeight()}; + RECT r = {0, 0, parent_->width(), parent_->height()}; Create(parent_->GetViewContainer()->GetHWND(), r, NULL, style, ex_style); // Set up the text_object_model_. diff --git a/chrome/views/throbber.cc b/chrome/views/throbber.cc index eee8a02..754ea6c 100644 --- a/chrome/views/throbber.cc +++ b/chrome/views/throbber.cc @@ -161,8 +161,8 @@ void CheckmarkThrobber::Paint(ChromeCanvas* canvas) { } // Otherwise we paint our tick mark or nothing depending on our state. if (checked_) { - int checkmark_x = (GetWidth() - checkmark_->width()) / 2; - int checkmark_y = (GetHeight() - checkmark_->height()) / 2; + int checkmark_x = (width() - checkmark_->width()) / 2; + int checkmark_y = (height() - checkmark_->height()) / 2; canvas->DrawBitmapInt(*checkmark_, checkmark_x, checkmark_y); } } diff --git a/chrome/views/tree_view.cc b/chrome/views/tree_view.cc index 0294788..3952ec0 100644 --- a/chrome/views/tree_view.cc +++ b/chrome/views/tree_view.cc @@ -290,7 +290,7 @@ HWND TreeView::CreateNativeControl(HWND parent_container) { WC_TREEVIEW, L"", style, - 0, 0, GetWidth(), GetHeight(), + 0, 0, width(), height(), parent_container, NULL, NULL, NULL); SetWindowLongPtr(tree_view_, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(&wrapper_)); @@ -444,8 +444,8 @@ void TreeView::OnContextMenu(const CPoint& location) { return; } if (!valid_loc) { - x = GetWidth() / 2; - y = GetHeight() / 2; + x = width() / 2; + y = height() / 2; } CPoint screen_loc(x, y); ConvertPointToScreen(this, &screen_loc); diff --git a/chrome/views/view.cc b/chrome/views/view.cc index 18dfd65..8230e58 100644 --- a/chrome/views/view.cc +++ b/chrome/views/view.cc @@ -125,8 +125,8 @@ void View::GetBounds(CRect* out, PositionMirroringSettings settings) const { } } -// GetY(), GetWidth() and GetHeight() are agnostic to the RTL UI layout of the -// parent view. GetX(), on the other hand, is not. +// y(), width() and height() are agnostic to the RTL UI layout of the +// parent view. x(), on the other hand, is not. int View::GetX(PositionMirroringSettings settings) const { if (settings == IGNORE_MIRRORING_TRANSFORMATION) { return bounds_.left; @@ -172,26 +172,26 @@ void View::GetLocalBounds(CRect* out, bool include_border) const { if (include_border || border_ == NULL) { out->left = 0; out->top = 0; - out->right = GetWidth(); - out->bottom = GetHeight(); + out->right = width(); + out->bottom = height(); } else { gfx::Insets insets; border_->GetInsets(&insets); out->left = insets.left(); out->top = insets.top(); - out->right = GetWidth() - insets.left(); - out->bottom = GetHeight() - insets.top(); + out->right = width() - insets.left(); + out->bottom = height() - insets.top(); } } void View::GetSize(CSize* sz) const { - sz->cx = GetWidth(); - sz->cy = GetHeight(); + sz->cx = width(); + sz->cy = height(); } void View::GetPosition(CPoint* p) const { p->x = GetX(APPLY_MIRRORING_TRANSFORMATION); - p->y = GetY(); + p->y = y(); } void View::GetPreferredSize(CSize* out) { @@ -205,8 +205,8 @@ void View::GetPreferredSize(CSize* out) { void View::SizeToPreferredSize() { CSize size; GetPreferredSize(&size); - if ((size.cx != GetWidth()) || (size.cy != GetHeight())) - SetBounds(GetX(), GetY(), size.cx, size.cy); + if ((size.cx != width()) || (size.cy != height())) + SetBounds(x(), y(), size.cx, size.cy); } void View::GetMinimumSize(CSize* out) { @@ -232,7 +232,7 @@ void View::ScrollRectToVisible(int x, int y, int width, int height) { // the region. if (parent) parent->ScrollRectToVisible( - GetX(APPLY_MIRRORING_TRANSFORMATION) + x, GetY() + y, width, height); + GetX(APPLY_MIRRORING_TRANSFORMATION) + x, View::y() + y, width, height); } ///////////////////////////////////////////////////////////////////////////// @@ -284,7 +284,7 @@ bool View::UILayoutIsRightToLeft() const { inline int View::MirroredX() const { View* parent = GetParent(); if (parent && parent->UILayoutIsRightToLeft()) { - return parent->GetWidth() - bounds_.left - GetWidth(); + return parent->width() - bounds_.left - width(); } return bounds_.left; } @@ -293,7 +293,7 @@ int View::MirroredLeftPointForRect(const gfx::Rect& bounds) const { if (!UILayoutIsRightToLeft()) { return bounds.x(); } - return GetWidth() - bounds.x() - bounds.width(); + return width() - bounds.x() - bounds.width(); } //////////////////////////////////////////////////////////////////////////////// @@ -395,7 +395,7 @@ void View::PaintBorder(ChromeCanvas* canvas) { void View::PaintFocusBorder(ChromeCanvas* canvas) { if (HasFocus() && IsFocusable()) - canvas->DrawFocusRect(0, 0, GetWidth(), GetHeight()); + canvas->DrawFocusRect(0, 0, width(), height()); } void View::PaintChildren(ChromeCanvas* canvas) { @@ -438,7 +438,7 @@ void View::ProcessPaint(ChromeCanvas* canvas) { // should change the transform appropriately. bool flip_canvas = FlipCanvasOnPaintForRTLUI(); if (flip_canvas) { - canvas->TranslateInt(GetWidth(), 0); + canvas->TranslateInt(width(), 0); canvas->ScaleInt(-1, 1); canvas->save(); } @@ -527,8 +527,8 @@ void View::SetContextMenuController(ContextMenuController* menu_controller) { bool View::ProcessMousePressed(const MouseEvent& e, DragInfo* drag_info) { const bool enabled = enabled_; int drag_operations; - if (enabled && e.IsOnlyLeftMouseButton() && HitTest(WTL::CPoint(e.GetX(), e.GetY()))) - drag_operations = GetDragOperations(e.GetX(), e.GetY()); + if (enabled && e.IsOnlyLeftMouseButton() && HitTest(WTL::CPoint(e.x(), e.y()))) + drag_operations = GetDragOperations(e.x(), e.y()); else drag_operations = 0; ContextMenuController* context_menu_controller = context_menu_controller_; @@ -540,7 +540,7 @@ bool View::ProcessMousePressed(const MouseEvent& e, DragInfo* drag_info) { return result; if (drag_operations != DragDropTypes::DRAG_NONE) { - drag_info->PossibleDrag(e.GetX(), e.GetY()); + drag_info->PossibleDrag(e.x(), e.y()); return true; } return !!context_menu_controller || result; @@ -551,8 +551,8 @@ bool View::ProcessMouseDragged(const MouseEvent& e, DragInfo* drag_info) { // done. ContextMenuController* context_menu_controller = context_menu_controller_; const bool possible_drag = drag_info->possible_drag; - if (possible_drag && ExceededDragThreshold(drag_info->start_x - e.GetX(), - drag_info->start_y - e.GetY())) { + if (possible_drag && ExceededDragThreshold(drag_info->start_x - e.x(), + drag_info->start_y - e.y())) { DoDrag(e, drag_info->start_x, drag_info->start_y); } else { if (OnMouseDragged(e)) @@ -567,7 +567,7 @@ void View::ProcessMouseReleased(const MouseEvent& e, bool canceled) { if (!canceled && context_menu_controller_ && e.IsOnlyRightMouseButton()) { // Assume that if there is a context menu controller we won't be deleted // from mouse released. - CPoint location(e.GetX(), e.GetY()); + CPoint location(e.x(), e.y()); ConvertPointToScreen(this, &location); ContextMenuController* context_menu_controller = context_menu_controller_; OnMouseReleased(e, canceled); @@ -1159,8 +1159,8 @@ bool View::HasFloatingViewForPoint(int x, int y) { for (i = 0, c = static_cast<int>(floating_views_.size()); i < c; ++i) { v = floating_views_[i]; - r.SetRect(v->GetX(APPLY_MIRRORING_TRANSFORMATION), v->GetY(), - v->GetWidth(), v->GetHeight()); + r.SetRect(v->GetX(APPLY_MIRRORING_TRANSFORMATION), v->y(), + v->width(), v->height()); if (r.Contains(x, y)) return true; } @@ -1312,7 +1312,7 @@ void View::ConvertPointToView(View* src, for (v = dst; v && v != src; v = v->GetParent()) { offset.SetPoint(offset.x() + v->GetX(APPLY_MIRRORING_TRANSFORMATION), - offset.y() + v->GetY()); + offset.y() + v->y()); } // The source was not found. The caller wants a conversion @@ -1349,7 +1349,7 @@ void View::ConvertPointToViewContainer(View* src, CPoint* p) { for (v = src; v; v = v->GetParent()) { offset.x += v->GetX(APPLY_MIRRORING_TRANSFORMATION); - offset.y += v->GetY(); + offset.y += v->y(); } p->x += offset.x; p->y += offset.y; @@ -1445,7 +1445,7 @@ bool View::IsVisibleInRootView() const { } bool View::HitTest(const CPoint& l) const { - if (l.x >= 0 && l.x < GetWidth() && l.y >= 0 && l.y < GetHeight()) { + if (l.x >= 0 && l.x < width() && l.y >= 0 && l.y < height()) { if (HasHitTestMask()) { gfx::Path mask; GetHitTestMask(&mask); @@ -1589,7 +1589,7 @@ std::string View::GetClassName() const { } gfx::Rect View::GetVisibleBounds() { - gfx::Rect vis_bounds(0, 0, GetWidth(), GetHeight()); + gfx::Rect vis_bounds(0, 0, width(), height()); gfx::Rect ancestor_bounds; View* view = this; int root_x = 0; @@ -1597,12 +1597,12 @@ gfx::Rect View::GetVisibleBounds() { bool has_view_container = false; while (view != NULL && !vis_bounds.IsEmpty()) { root_x += view->GetX(APPLY_MIRRORING_TRANSFORMATION); - root_y += view->GetY(); - vis_bounds.Offset(view->GetX(APPLY_MIRRORING_TRANSFORMATION), view->GetY()); + root_y += view->y(); + vis_bounds.Offset(view->GetX(APPLY_MIRRORING_TRANSFORMATION), view->y()); View* ancestor = view->GetParent(); if (ancestor != NULL) { - ancestor_bounds.SetRect(0, 0, ancestor->GetWidth(), - ancestor->GetHeight()); + ancestor_bounds.SetRect(0, 0, ancestor->width(), + ancestor->height()); vis_bounds = vis_bounds.Intersect(ancestor_bounds); } else if (!view->GetViewContainer()) { // If the view has no ViewContainer, we're not visible. Return an empty diff --git a/chrome/views/view.h b/chrome/views/view.h index a4ae692..cd9a89f 100644 --- a/chrome/views/view.h +++ b/chrome/views/view.h @@ -118,7 +118,7 @@ class View : public AcceleratorTarget { CURRENT }; - // Used in the versions of GetBounds() and GetX() that take a transformation + // Used in the versions of GetBounds() and x() that take a transformation // parameter in order to determine whether or not to take into account the // mirroring setting of the View when returning bounds positions. enum PositionMirroringSettings { @@ -160,17 +160,19 @@ class View : public AcceleratorTarget { // Set the bounds in the parent's coordinate system. void SetBounds(const CRect& bounds); void SetBounds(int x, int y, int width, int height); - void SetX(int x) { SetBounds(x, GetY(), GetWidth(), GetHeight()); } - void SetY(int y) { SetBounds(GetX(), y, GetWidth(), GetHeight()); } + void SetX(int x) { SetBounds(x, y(), width(), height()); } + void SetY(int y) { SetBounds(x(), y, width(), height()); } // Returns the left coordinate of the View, relative to the parent View, - // which is essentially the value of bounds_.left. + // which is the value of bounds_.left. // // This is the function subclasses should use whenever they need to obtain // the left position of one of their child views (for example, when // implementing View::Layout()). - int GetX() const { - return GetX(IGNORE_MIRRORING_TRANSFORMATION); + int x() const { + // This is equivalent to GetX(IGNORE_MIRRORING_TRANSFORMATION), but + // inlinable. + return bounds_.left; }; // Return the left coordinate of the View, relative to the parent. If @@ -181,22 +183,22 @@ class View : public AcceleratorTarget { // // NOTE: in the vast majority of the cases, the mirroring implementation is // transparent to the View subclasses and therefore you should use the - // paremeterless version of GetX() when you need to get the X + // paremeterless version of x() when you need to get the X // coordinate of a child View. int GetX(PositionMirroringSettings settings) const; - int GetY() const { + int y() const { return bounds_.top; }; - int GetWidth() const { + int width() const { return bounds_.Width(); }; - int GetHeight() const { + int height() const { return bounds_.Height(); }; // Return this control local bounds. If include_border is true, local bounds - // is the rectangle {0, 0, GetWidth(), GetHeight()}, otherwise, it does not + // is the rectangle {0, 0, width(), height()}, otherwise, it does not // include the area where the border (if any) is painted. void GetLocalBounds(CRect* out, bool include_border) const; @@ -206,7 +208,7 @@ class View : public AcceleratorTarget { // Get the position of the View, relative to the parent. // // Note that if the parent uses right-to-left UI layout, then the mirrored - // position of this View is returned. Use GetX()/GetY() if you want to ignore + // position of this View is returned. Use x()/y() if you want to ignore // mirroring. void GetPosition(CPoint* out) const; @@ -352,7 +354,7 @@ class View : public AcceleratorTarget { // MirroredXCoordinateInsideView(20) -> 80 // MirroredXCoordinateInsideView(99) -> 1 int MirroredXCoordinateInsideView(int x) const { - return UILayoutIsRightToLeft() ? GetWidth() - x : x; + return UILayoutIsRightToLeft() ? width() - x : x; } // Painting functions diff --git a/chrome/views/view_unittest.cc b/chrome/views/view_unittest.cc index c4faf75..4894525 100644 --- a/chrome/views/view_unittest.cc +++ b/chrome/views/view_unittest.cc @@ -258,22 +258,22 @@ TEST_F(ViewTest, AddRemoveNotifications) { bool TestView::OnMousePressed(const MouseEvent& event) { last_mouse_event_type_ = event.GetType(); - location_.x = event.GetX(); - location_.y = event.GetY(); + location_.x = event.x(); + location_.y = event.y(); return true; } bool TestView::OnMouseDragged(const MouseEvent& event) { last_mouse_event_type_ = event.GetType(); - location_.x = event.GetX(); - location_.y = event.GetY(); + location_.x = event.x(); + location_.y = event.y(); return true; } void TestView::OnMouseReleased(const MouseEvent& event, bool canceled) { last_mouse_event_type_ = event.GetType(); - location_.x = event.GetX(); - location_.y = event.GetY(); + location_.x = event.x(); + location_.y = event.y(); } TEST_F(ViewTest, MouseEvent) { @@ -524,8 +524,8 @@ class HitTestView : public ChromeViews::View { DCHECK(has_hittest_mask_); DCHECK(mask); - SkScalar w = SkIntToScalar(GetWidth()); - SkScalar h = SkIntToScalar(GetHeight()); + SkScalar w = SkIntToScalar(width()); + SkScalar h = SkIntToScalar(height()); // Create a triangular mask within the bounds of this View. mask->moveTo(w / 2, 0); diff --git a/chrome/views/window.cc b/chrome/views/window.cc index d75ea9e..1729598 100644 --- a/chrome/views/window.cc +++ b/chrome/views/window.cc @@ -435,8 +435,8 @@ LRESULT Window::OnSetCursor(HWND window, UINT hittest_code, UINT message) { } void Window::OnSize(UINT size_param, const CSize& new_size) { - if (root_view_->GetWidth() == new_size.cx && - root_view_->GetHeight() == new_size.cy) + if (root_view_->width() == new_size.cx && + root_view_->height() == new_size.cy) return; SaveWindowPosition(); |