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

Unified Diff: chrome/browser/ui/views/autofill/autofill_dialog_views.cc

Issue 23526021: rAc: reduce number of redundant layouts of DetailsContainerView (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/autofill/autofill_dialog_views.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/autofill/autofill_dialog_views.cc
diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
index d216e8f8932a2536f532d317d80ca6cf060e7b31..c25c8cfdf2808417f990ce3e579712205a7fde42 100644
--- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
+++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
@@ -240,24 +240,6 @@ class ErrorBubbleContents : public views::View {
DISALLOW_COPY_AND_ASSIGN(ErrorBubbleContents);
};
-// A view that runs a callback whenever its bounds change.
-class DetailsContainerView : public views::View {
- public:
- explicit DetailsContainerView(const base::Closure& callback)
- : bounds_changed_callback_(callback) {}
- virtual ~DetailsContainerView() {}
-
- // views::View implementation.
- virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE {
- bounds_changed_callback_.Run();
- }
-
- private:
- base::Closure bounds_changed_callback_;
-
- DISALLOW_COPY_AND_ASSIGN(DetailsContainerView);
-};
-
// A view that propagates visibility and preferred size changes.
class LayoutPropagationView : public views::View {
public:
@@ -1067,6 +1049,25 @@ int AutofillDialogViews::SuggestedButton::ResourceIDForState() const {
return IDR_AUTOFILL_DIALOG_MENU_BUTTON;
}
+// AutofillDialogViews::DetailsContainerView -----------------------------------
+
+AutofillDialogViews::DetailsContainerView::DetailsContainerView(
+ const base::Closure& callback)
+ : bounds_changed_callback_(callback),
+ ignore_layouts_(false) {}
+
+AutofillDialogViews::DetailsContainerView::~DetailsContainerView() {}
+
+void AutofillDialogViews::DetailsContainerView::OnBoundsChanged(
+ const gfx::Rect& previous_bounds) {
+ bounds_changed_callback_.Run();
+}
+
+void AutofillDialogViews::DetailsContainerView::Layout() {
+ if (!ignore_layouts_)
+ views::View::Layout();
+}
+
// AutofillDialogViews::SuggestionView -----------------------------------------
AutofillDialogViews::SuggestionView::SuggestionView(
@@ -1558,8 +1559,12 @@ void AutofillDialogViews::Layout() {
scroll_y += notification_height + views::kRelatedControlVerticalSpacing;
int scroll_bottom = content_bounds.bottom();
- scrollable_area_->contents()->SizeToPreferredSize();
+ DCHECK_EQ(scrollable_area_->contents(), details_container_);
+ details_container_->SizeToPreferredSize();
+ // TODO(estade): remove this hack. See crbug.com/285996
+ details_container_->set_ignore_layouts(true);
scrollable_area_->SetBounds(x, scroll_y, width, scroll_bottom - scroll_y);
+ details_container_->set_ignore_layouts(false);
}
if (loading_shield_->visible())
« no previous file with comments | « chrome/browser/ui/views/autofill/autofill_dialog_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698