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

Side by Side Diff: components/mus/public/cpp/lib/window.cc

Issue 1864113002: Fixes problems with drawn state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: parentdrawn and merge Created 4 years, 8 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 | « no previous file | components/mus/public/cpp/lib/window_private.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/mus/public/cpp/window.h" 5 #include "components/mus/public/cpp/window.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 return; 227 return;
228 228
229 if (connection_) 229 if (connection_)
230 tree_client()->SetPredefinedCursor(id_, cursor_id); 230 tree_client()->SetPredefinedCursor(id_, cursor_id);
231 LocalSetPredefinedCursor(cursor_id); 231 LocalSetPredefinedCursor(cursor_id);
232 } 232 }
233 233
234 bool Window::IsDrawn() const { 234 bool Window::IsDrawn() const {
235 if (!visible_) 235 if (!visible_)
236 return false; 236 return false;
237 return parent_ ? parent_->IsDrawn() : drawn_; 237 return parent_ ? parent_->IsDrawn() : parent_drawn_;
238 } 238 }
239 239
240 scoped_ptr<WindowSurface> Window::RequestSurface(mojom::SurfaceType type) { 240 scoped_ptr<WindowSurface> Window::RequestSurface(mojom::SurfaceType type) {
241 scoped_ptr<WindowSurfaceBinding> surface_binding; 241 scoped_ptr<WindowSurfaceBinding> surface_binding;
242 scoped_ptr<WindowSurface> surface = WindowSurface::Create(&surface_binding); 242 scoped_ptr<WindowSurface> surface = WindowSurface::Create(&surface_binding);
243 AttachSurface(type, std::move(surface_binding)); 243 AttachSurface(type, std::move(surface_binding));
244 return surface; 244 return surface;
245 } 245 }
246 246
247 void Window::AttachSurface(mojom::SurfaceType type, 247 void Window::AttachSurface(mojom::SurfaceType type,
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 : connection_(connection), 498 : connection_(connection),
499 id_(id), 499 id_(id),
500 parent_(nullptr), 500 parent_(nullptr),
501 stacking_target_(nullptr), 501 stacking_target_(nullptr),
502 transient_parent_(nullptr), 502 transient_parent_(nullptr),
503 is_modal_(false), 503 is_modal_(false),
504 input_event_handler_(nullptr), 504 input_event_handler_(nullptr),
505 viewport_metrics_(CreateEmptyViewportMetrics()), 505 viewport_metrics_(CreateEmptyViewportMetrics()),
506 visible_(false), 506 visible_(false),
507 cursor_id_(mojom::Cursor::CURSOR_NULL), 507 cursor_id_(mojom::Cursor::CURSOR_NULL),
508 drawn_(false) {} 508 parent_drawn_(false) {}
509 509
510 WindowTreeClientImpl* Window::tree_client() { 510 WindowTreeClientImpl* Window::tree_client() {
511 return static_cast<WindowTreeClientImpl*>(connection_); 511 return static_cast<WindowTreeClientImpl*>(connection_);
512 } 512 }
513 513
514 void Window::SetSharedPropertyInternal(const std::string& name, 514 void Window::SetSharedPropertyInternal(const std::string& name,
515 const std::vector<uint8_t>* value) { 515 const std::vector<uint8_t>* value) {
516 if (!OwnsWindowOrIsRoot(this)) 516 if (!OwnsWindowOrIsRoot(this))
517 return; 517 return;
518 518
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 void Window::LocalSetViewportMetrics( 630 void Window::LocalSetViewportMetrics(
631 const mojom::ViewportMetrics& old_metrics, 631 const mojom::ViewportMetrics& old_metrics,
632 const mojom::ViewportMetrics& new_metrics) { 632 const mojom::ViewportMetrics& new_metrics) {
633 // TODO(eseidel): We could check old_metrics against viewport_metrics_. 633 // TODO(eseidel): We could check old_metrics against viewport_metrics_.
634 viewport_metrics_ = new_metrics.Clone(); 634 viewport_metrics_ = new_metrics.Clone();
635 FOR_EACH_OBSERVER( 635 FOR_EACH_OBSERVER(
636 WindowObserver, observers_, 636 WindowObserver, observers_,
637 OnWindowViewportMetricsChanged(this, old_metrics, new_metrics)); 637 OnWindowViewportMetricsChanged(this, old_metrics, new_metrics));
638 } 638 }
639 639
640 void Window::LocalSetDrawn(bool value) { 640 void Window::LocalSetParentDrawn(bool value) {
641 if (drawn_ == value) 641 if (parent_drawn_ == value)
642 return; 642 return;
643 643
644 // As IsDrawn() is derived from |visible_| and |drawn_|, only send drawn 644 // As IsDrawn() is derived from |visible_| and |parent_drawn_|, only send
645 // notification is the value of IsDrawn() is really changing. 645 // drawn notification is the value of IsDrawn() is really changing.
646 if (IsDrawn() == value) { 646 if (IsDrawn() == value) {
647 drawn_ = value; 647 parent_drawn_ = value;
648 return; 648 return;
649 } 649 }
650 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDrawnChanging(this)); 650 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDrawnChanging(this));
651 drawn_ = value; 651 parent_drawn_ = value;
652 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDrawnChanged(this)); 652 FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDrawnChanged(this));
653 } 653 }
654 654
655 void Window::LocalSetVisible(bool visible) { 655 void Window::LocalSetVisible(bool visible) {
656 if (visible_ == visible) 656 if (visible_ == visible)
657 return; 657 return;
658 658
659 FOR_EACH_OBSERVER(WindowObserver, observers_, 659 FOR_EACH_OBSERVER(WindowObserver, observers_,
660 OnWindowVisibilityChanging(this)); 660 OnWindowVisibilityChanging(this));
661 visible_ = visible; 661 visible_ = visible;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 notifier->NotifyWindowReordered(); 838 notifier->NotifyWindowReordered();
839 839
840 return true; 840 return true;
841 } 841 }
842 842
843 // static 843 // static
844 Window** Window::GetStackingTarget(Window* window) { 844 Window** Window::GetStackingTarget(Window* window) {
845 return &window->stacking_target_; 845 return &window->stacking_target_;
846 } 846 }
847 } // namespace mus 847 } // namespace mus
OLDNEW
« no previous file with comments | « no previous file | components/mus/public/cpp/lib/window_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698