Commit f2f1d31b authored by ben@chromium.org's avatar ben@chromium.org

When you moved the native viewport, the contents would move to an incorrect...

When you moved the native viewport, the contents would move to an incorrect position due to an issue with non-client/client adjustment in native_viewport_win.

Also make the browser app open immediately on startup of the window manager, for convenience.

** Not tested as part of the main chrome integration test suite **

R=sky@chromium.org
BUG=none

Review URL: https://codereview.chromium.org/347433003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278244 0039d316-1c4b-4281-b951-d872f2087c98
parent 3c16f0f0
...@@ -87,8 +87,6 @@ class WindowManager : public Application, ...@@ -87,8 +87,6 @@ class WindowManager : public Application,
CreateWindow(kEmbeddedAppURL); CreateWindow(kEmbeddedAppURL);
else if (event->flags & ui::EF_RIGHT_MOUSE_BUTTON) else if (event->flags & ui::EF_RIGHT_MOUSE_BUTTON)
CreateWindow(kNestingAppURL); CreateWindow(kNestingAppURL);
else if (event->flags & ui::EF_MIDDLE_MOUSE_BUTTON)
CreateWindow(kMojoBrowserURL);
} }
} }
...@@ -106,15 +104,18 @@ class WindowManager : public Application, ...@@ -106,15 +104,18 @@ class WindowManager : public Application,
node->SetActiveView(view); node->SetActiveView(view);
view->SetColor(SK_ColorBLUE); view->SetColor(SK_ColorBLUE);
view->AddObserver(this); view->AddObserver(this);
CreateWindow(kMojoBrowserURL);
} }
void CreateWindow(const std::string& url) { void CreateWindow(const std::string& url) {
Node* node = view_manager_->GetNodeById(parent_node_id_); Node* node = view_manager_->GetNodeById(parent_node_id_);
gfx::Rect bounds(50, 50, 400, 400); gfx::Rect bounds(node->bounds().size());
bounds.Inset(25, 25);
if (!node->children().empty()) { if (!node->children().empty()) {
gfx::Point position = node->children().back()->bounds().origin(); gfx::Point position = node->children().back()->bounds().origin();
position.Offset(50, 50); position.Offset(25, 25);
bounds.set_origin(position); bounds.set_origin(position);
} }
......
...@@ -143,8 +143,11 @@ class NativeViewportWin : public gfx::WindowImpl, ...@@ -143,8 +143,11 @@ class NativeViewportWin : public gfx::WindowImpl,
void OnWindowPosChanged(WINDOWPOS* window_pos) { void OnWindowPosChanged(WINDOWPOS* window_pos) {
if (!(window_pos->flags & SWP_NOSIZE) || if (!(window_pos->flags & SWP_NOSIZE) ||
!(window_pos->flags & SWP_NOMOVE)) { !(window_pos->flags & SWP_NOMOVE)) {
delegate_->OnBoundsChanged(gfx::Rect(window_pos->x, window_pos->y, RECT cr;
window_pos->cx, window_pos->cy)); GetClientRect(hwnd(), &cr);
delegate_->OnBoundsChanged(
gfx::Rect(window_pos->x, window_pos->y,
cr.right - cr.left, cr.bottom - cr.top));
} }
} }
......
...@@ -136,7 +136,6 @@ void WindowTreeHostImpl::OnCreated() { ...@@ -136,7 +136,6 @@ void WindowTreeHostImpl::OnCreated() {
void WindowTreeHostImpl::OnBoundsChanged(RectPtr bounds) { void WindowTreeHostImpl::OnBoundsChanged(RectPtr bounds) {
bounds_ = bounds.To<gfx::Rect>(); bounds_ = bounds.To<gfx::Rect>();
window()->SetBounds(gfx::Rect(bounds_.size()));
OnHostResized(bounds_.size()); OnHostResized(bounds_.size());
} }
......
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