Commit 92cea937 authored by Wei Li's avatar Wei Li Committed by Commit Bot

Use layout manager for ClientView

Use FillLayoutManager for client view; remove the use of Layout()
call.

BUG=1005568

Change-Id: I0692f1e9bfefcca2b1a27bfe1baf1bcf10fe9044
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1842409
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704930}
parent eb050b41
......@@ -8,6 +8,7 @@
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/hit_test.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
......@@ -18,6 +19,7 @@ namespace views {
ClientView::ClientView(Widget* widget, View* contents_view)
: contents_view_(contents_view) {
SetLayoutManager(std::make_unique<views::FillLayout>());
}
int ClientView::NonClientHitTest(const gfx::Point& point) {
......@@ -60,14 +62,6 @@ gfx::Size ClientView::GetMinimumSize() const {
return contents_view_ ? contents_view_->GetMinimumSize() : gfx::Size();
}
void ClientView::Layout() {
// |contents_view_| is allowed to be NULL up until the point where this view
// is attached to a Container.
if (contents_view_)
contents_view_->SetBounds(0, 0, width(), height());
}
void ClientView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
node_data->role = ax::mojom::Role::kClient;
}
......@@ -85,6 +79,8 @@ void ClientView::ViewHierarchyChanged(
DCHECK(contents_view_); // |contents_view_| must be valid now!
// Insert |contents_view_| at index 0 so it is first in the focus chain.
// (the OK/Cancel buttons are inserted before contents_view_)
// TODO(weili): This seems fragile and can be refactored.
// Tracked at https://crbug.com/1012466.
AddChildViewAt(contents_view_, 0);
} else if (!details.is_add && details.child == contents_view_) {
contents_view_ = nullptr;
......
......@@ -59,7 +59,6 @@ class VIEWS_EXPORT ClientView : public View {
gfx::Size CalculatePreferredSize() const override;
gfx::Size GetMinimumSize() const override;
gfx::Size GetMaximumSize() const override;
void Layout() override;
protected:
// Overridden from View:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment