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

Side by Side Diff: ui/aura/mus/window_port_mus.cc

Issue 2579883002: Scale bounds in aura-mus client-lib and NativeWidgetMus in hdpi mode. (Closed)
Patch Set: sadrul@'s comments Created 3 years, 12 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 unified diff | Download patch
« no previous file with comments | « ui/aura/mus/window_port_mus.h ('k') | ui/aura/mus/window_tree_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/aura/mus/window_port_mus.h" 5 #include "ui/aura/mus/window_port_mus.h"
6 6
7 #include "ui/aura/client/aura_constants.h" 7 #include "ui/aura/client/aura_constants.h"
8 #include "ui/aura/client/transient_window_client.h" 8 #include "ui/aura/client/transient_window_client.h"
9 #include "ui/aura/mus/property_converter.h" 9 #include "ui/aura/mus/property_converter.h"
10 #include "ui/aura/mus/surface_id_handler.h" 10 #include "ui/aura/mus/surface_id_handler.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 case ServerChangeType::ADD: 140 case ServerChangeType::ADD:
141 case ServerChangeType::ADD_TRANSIENT: 141 case ServerChangeType::ADD_TRANSIENT:
142 case ServerChangeType::REMOVE: 142 case ServerChangeType::REMOVE:
143 case ServerChangeType::REMOVE_TRANSIENT: 143 case ServerChangeType::REMOVE_TRANSIENT:
144 case ServerChangeType::REORDER: 144 case ServerChangeType::REORDER:
145 case ServerChangeType::TRANSIENT_REORDER: 145 case ServerChangeType::TRANSIENT_REORDER:
146 if (iter->data.child_id == data.child_id) 146 if (iter->data.child_id == data.child_id)
147 return iter; 147 return iter;
148 break; 148 break;
149 case ServerChangeType::BOUNDS: 149 case ServerChangeType::BOUNDS:
150 if (iter->data.bounds == data.bounds) 150 if (iter->data.bounds_in_dip == data.bounds_in_dip)
151 return iter; 151 return iter;
152 break; 152 break;
153 case ServerChangeType::DESTROY: 153 case ServerChangeType::DESTROY:
154 // No extra data for delete. 154 // No extra data for delete.
155 return iter; 155 return iter;
156 case ServerChangeType::PROPERTY: 156 case ServerChangeType::PROPERTY:
157 if (iter->data.property_name == data.property_name) 157 if (iter->data.property_name == data.property_name)
158 return iter; 158 return iter;
159 break; 159 break;
160 case ServerChangeType::VISIBLE: 160 case ServerChangeType::VISIBLE:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 data.child_id = child->server_id(); 199 data.child_id = child->server_id();
200 ScopedServerChange change(this, ServerChangeType::REORDER, data); 200 ScopedServerChange change(this, ServerChangeType::REORDER, data);
201 if (direction == ui::mojom::OrderDirection::BELOW) 201 if (direction == ui::mojom::OrderDirection::BELOW)
202 window_->StackChildBelow(child->GetWindow(), relative->GetWindow()); 202 window_->StackChildBelow(child->GetWindow(), relative->GetWindow());
203 else 203 else
204 window_->StackChildAbove(child->GetWindow(), relative->GetWindow()); 204 window_->StackChildAbove(child->GetWindow(), relative->GetWindow());
205 } 205 }
206 206
207 void WindowPortMus::SetBoundsFromServer(const gfx::Rect& bounds) { 207 void WindowPortMus::SetBoundsFromServer(const gfx::Rect& bounds) {
208 ServerChangeData data; 208 ServerChangeData data;
209 data.bounds = bounds; 209 data.bounds_in_dip = bounds;
210 ScopedServerChange change(this, ServerChangeType::BOUNDS, data); 210 ScopedServerChange change(this, ServerChangeType::BOUNDS, data);
211 window_->SetBounds(bounds); 211 window_->SetBounds(bounds);
212 } 212 }
213 213
214 void WindowPortMus::SetVisibleFromServer(bool visible) { 214 void WindowPortMus::SetVisibleFromServer(bool visible) {
215 ServerChangeData data; 215 ServerChangeData data;
216 data.visible = visible; 216 data.visible = visible;
217 ScopedServerChange change(this, ServerChangeType::VISIBLE, data); 217 ScopedServerChange change(this, ServerChangeType::VISIBLE, data);
218 if (visible) 218 if (visible)
219 window_->Show(); 219 window_->Show();
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 change_data) 315 change_data)
316 ? ChangeSource::SERVER 316 ? ChangeSource::SERVER
317 : ChangeSource::LOCAL; 317 : ChangeSource::LOCAL;
318 } 318 }
319 319
320 std::unique_ptr<WindowMusChangeData> 320 std::unique_ptr<WindowMusChangeData>
321 WindowPortMus::PrepareForServerBoundsChange(const gfx::Rect& bounds) { 321 WindowPortMus::PrepareForServerBoundsChange(const gfx::Rect& bounds) {
322 std::unique_ptr<WindowMusChangeDataImpl> data( 322 std::unique_ptr<WindowMusChangeDataImpl> data(
323 base::MakeUnique<WindowMusChangeDataImpl>()); 323 base::MakeUnique<WindowMusChangeDataImpl>());
324 ServerChangeData change_data; 324 ServerChangeData change_data;
325 change_data.bounds = bounds; 325 change_data.bounds_in_dip = bounds;
326 data->change = base::MakeUnique<ScopedServerChange>( 326 data->change = base::MakeUnique<ScopedServerChange>(
327 this, ServerChangeType::BOUNDS, change_data); 327 this, ServerChangeType::BOUNDS, change_data);
328 return std::move(data); 328 return std::move(data);
329 } 329 }
330 330
331 std::unique_ptr<WindowMusChangeData> 331 std::unique_ptr<WindowMusChangeData>
332 WindowPortMus::PrepareForServerVisibilityChange(bool value) { 332 WindowPortMus::PrepareForServerVisibilityChange(bool value) {
333 std::unique_ptr<WindowMusChangeDataImpl> data( 333 std::unique_ptr<WindowMusChangeDataImpl> data(
334 base::MakeUnique<WindowMusChangeDataImpl>()); 334 base::MakeUnique<WindowMusChangeDataImpl>());
335 ServerChangeData change_data; 335 ServerChangeData change_data;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 void WindowPortMus::OnVisibilityChanged(bool visible) { 401 void WindowPortMus::OnVisibilityChanged(bool visible) {
402 ServerChangeData change_data; 402 ServerChangeData change_data;
403 change_data.visible = visible; 403 change_data.visible = visible;
404 if (!RemoveChangeByTypeAndData(ServerChangeType::VISIBLE, change_data)) 404 if (!RemoveChangeByTypeAndData(ServerChangeType::VISIBLE, change_data))
405 window_tree_client_->OnWindowMusSetVisible(this, visible); 405 window_tree_client_->OnWindowMusSetVisible(this, visible);
406 } 406 }
407 407
408 void WindowPortMus::OnDidChangeBounds(const gfx::Rect& old_bounds, 408 void WindowPortMus::OnDidChangeBounds(const gfx::Rect& old_bounds,
409 const gfx::Rect& new_bounds) { 409 const gfx::Rect& new_bounds) {
410 ServerChangeData change_data; 410 ServerChangeData change_data;
411 change_data.bounds = new_bounds; 411 change_data.bounds_in_dip = new_bounds;
412 if (!RemoveChangeByTypeAndData(ServerChangeType::BOUNDS, change_data)) 412 if (!RemoveChangeByTypeAndData(ServerChangeType::BOUNDS, change_data))
413 window_tree_client_->OnWindowMusBoundsChanged(this, old_bounds, new_bounds); 413 window_tree_client_->OnWindowMusBoundsChanged(this, old_bounds, new_bounds);
414 } 414 }
415 415
416 std::unique_ptr<WindowPortPropertyData> WindowPortMus::OnWillChangeProperty( 416 std::unique_ptr<WindowPortPropertyData> WindowPortMus::OnWillChangeProperty(
417 const void* key) { 417 const void* key) {
418 return window_tree_client_->OnWindowMusWillChangeProperty(this, key); 418 return window_tree_client_->OnWindowMusWillChangeProperty(this, key);
419 } 419 }
420 420
421 void WindowPortMus::OnPropertyChanged( 421 void WindowPortMus::OnPropertyChanged(
422 const void* key, 422 const void* key,
423 std::unique_ptr<WindowPortPropertyData> data) { 423 std::unique_ptr<WindowPortPropertyData> data) {
424 ServerChangeData change_data; 424 ServerChangeData change_data;
425 change_data.property_name = 425 change_data.property_name =
426 GetPropertyConverter()->GetTransportNameForPropertyKey(key); 426 GetPropertyConverter()->GetTransportNameForPropertyKey(key);
427 // TODO(sky): investigate to see if we need to compare data. In particular do 427 // TODO(sky): investigate to see if we need to compare data. In particular do
428 // we ever have a case where changing a property cascades into changing the 428 // we ever have a case where changing a property cascades into changing the
429 // same property? 429 // same property?
430 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data)) 430 if (!RemoveChangeByTypeAndData(ServerChangeType::PROPERTY, change_data))
431 window_tree_client_->OnWindowMusPropertyChanged(this, key, std::move(data)); 431 window_tree_client_->OnWindowMusPropertyChanged(this, key, std::move(data));
432 } 432 }
433 433
434 } // namespace aura 434 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/window_port_mus.h ('k') | ui/aura/mus/window_tree_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698