| Index: mojo/services/public/cpp/view_manager/lib/node.cc
|
| diff --git a/mojo/services/public/cpp/view_manager/lib/node.cc b/mojo/services/public/cpp/view_manager/lib/node.cc
|
| index c85c0e52265f131f6b9ba11d1d540c2c137973af..6cb9feb458a01f2f84ed69d7d2c2a83cf2c88106 100644
|
| --- a/mojo/services/public/cpp/view_manager/lib/node.cc
|
| +++ b/mojo/services/public/cpp/view_manager/lib/node.cc
|
| @@ -17,37 +17,47 @@ namespace {
|
|
|
| void NotifyViewTreeChangeAtReceiver(
|
| Node* receiver,
|
| - const NodeObserver::TreeChangeParams& params) {
|
| + const NodeObserver::TreeChangeParams& params,
|
| + bool change_applied) {
|
| NodeObserver::TreeChangeParams local_params = params;
|
| local_params.receiver = receiver;
|
| - FOR_EACH_OBSERVER(NodeObserver,
|
| - *NodePrivate(receiver).observers(),
|
| - OnTreeChange(local_params));
|
| + if (change_applied) {
|
| + FOR_EACH_OBSERVER(NodeObserver,
|
| + *NodePrivate(receiver).observers(),
|
| + OnTreeChanged(local_params));
|
| + } else {
|
| + FOR_EACH_OBSERVER(NodeObserver,
|
| + *NodePrivate(receiver).observers(),
|
| + OnTreeChanging(local_params));
|
| + }
|
| }
|
|
|
| void NotifyViewTreeChangeUp(
|
| Node* start_at,
|
| - const NodeObserver::TreeChangeParams& params) {
|
| + const NodeObserver::TreeChangeParams& params,
|
| + bool change_applied) {
|
| for (Node* current = start_at; current; current = current->parent())
|
| - NotifyViewTreeChangeAtReceiver(current, params);
|
| + NotifyViewTreeChangeAtReceiver(current, params, change_applied);
|
| }
|
|
|
| void NotifyViewTreeChangeDown(
|
| Node* start_at,
|
| - const NodeObserver::TreeChangeParams& params) {
|
| - NotifyViewTreeChangeAtReceiver(start_at, params);
|
| + const NodeObserver::TreeChangeParams& params,
|
| + bool change_applied) {
|
| + NotifyViewTreeChangeAtReceiver(start_at, params, change_applied);
|
| Node::Children::const_iterator it = start_at->children().begin();
|
| for (; it != start_at->children().end(); ++it)
|
| - NotifyViewTreeChangeDown(*it, params);
|
| + NotifyViewTreeChangeDown(*it, params, change_applied);
|
| }
|
|
|
| void NotifyViewTreeChange(
|
| - const NodeObserver::TreeChangeParams& params) {
|
| - NotifyViewTreeChangeDown(params.target, params);
|
| + const NodeObserver::TreeChangeParams& params,
|
| + bool change_applied) {
|
| + NotifyViewTreeChangeDown(params.target, params, change_applied);
|
| if (params.old_parent)
|
| - NotifyViewTreeChangeUp(params.old_parent, params);
|
| + NotifyViewTreeChangeUp(params.old_parent, params, change_applied);
|
| if (params.new_parent)
|
| - NotifyViewTreeChangeUp(params.new_parent, params);
|
| + NotifyViewTreeChangeUp(params.new_parent, params, change_applied);
|
| }
|
|
|
| class ScopedTreeNotifier {
|
| @@ -56,11 +66,10 @@ class ScopedTreeNotifier {
|
| params_.target = target;
|
| params_.old_parent = old_parent;
|
| params_.new_parent = new_parent;
|
| - NotifyViewTreeChange(params_);
|
| + NotifyViewTreeChange(params_, false);
|
| }
|
| ~ScopedTreeNotifier() {
|
| - params_.phase = NodeObserver::DISPOSITION_CHANGED;
|
| - NotifyViewTreeChange(params_);
|
| + NotifyViewTreeChange(params_, true);
|
| }
|
|
|
| private:
|
| @@ -86,23 +95,14 @@ class ScopedOrderChangedNotifier {
|
| : node_(node),
|
| relative_node_(relative_node),
|
| direction_(direction) {
|
| - FOR_EACH_OBSERVER(
|
| - NodeObserver,
|
| - *NodePrivate(node_).observers(),
|
| - OnNodeReordered(node_,
|
| - relative_node_,
|
| - direction_,
|
| - NodeObserver::DISPOSITION_CHANGING));
|
| -
|
| + FOR_EACH_OBSERVER(NodeObserver,
|
| + *NodePrivate(node_).observers(),
|
| + OnNodeReordering(node_, relative_node_, direction_));
|
| }
|
| ~ScopedOrderChangedNotifier() {
|
| - FOR_EACH_OBSERVER(
|
| - NodeObserver,
|
| - *NodePrivate(node_).observers(),
|
| - OnNodeReordered(node_,
|
| - relative_node_,
|
| - direction_,
|
| - NodeObserver::DISPOSITION_CHANGED));
|
| + FOR_EACH_OBSERVER(NodeObserver,
|
| + *NodePrivate(node_).observers(),
|
| + OnNodeReordered(node_, relative_node_, direction_));
|
| }
|
|
|
| private:
|
| @@ -150,22 +150,14 @@ class ScopedSetActiveViewNotifier {
|
| : node_(node),
|
| old_view_(old_view),
|
| new_view_(new_view) {
|
| - FOR_EACH_OBSERVER(
|
| - NodeObserver,
|
| - *NodePrivate(node).observers(),
|
| - OnNodeActiveViewChange(node_,
|
| - old_view_,
|
| - new_view_,
|
| - NodeObserver::DISPOSITION_CHANGING));
|
| + FOR_EACH_OBSERVER(NodeObserver,
|
| + *NodePrivate(node).observers(),
|
| + OnNodeActiveViewChanging(node_, old_view_, new_view_));
|
| }
|
| ~ScopedSetActiveViewNotifier() {
|
| - FOR_EACH_OBSERVER(
|
| - NodeObserver,
|
| - *NodePrivate(node_).observers(),
|
| - OnNodeActiveViewChange(node_,
|
| - old_view_,
|
| - new_view_,
|
| - NodeObserver::DISPOSITION_CHANGED));
|
| + FOR_EACH_OBSERVER(NodeObserver,
|
| + *NodePrivate(node_).observers(),
|
| + OnNodeActiveViewChanged(node_, old_view_, new_view_));
|
| }
|
|
|
| private:
|
| @@ -184,22 +176,14 @@ class ScopedSetBoundsNotifier {
|
| : node_(node),
|
| old_bounds_(old_bounds),
|
| new_bounds_(new_bounds) {
|
| - FOR_EACH_OBSERVER(
|
| - NodeObserver,
|
| - *NodePrivate(node_).observers(),
|
| - OnNodeBoundsChange(node_,
|
| - old_bounds_,
|
| - new_bounds_,
|
| - NodeObserver::DISPOSITION_CHANGING));
|
| + FOR_EACH_OBSERVER(NodeObserver,
|
| + *NodePrivate(node_).observers(),
|
| + OnNodeBoundsChanging(node_, old_bounds_, new_bounds_));
|
| }
|
| ~ScopedSetBoundsNotifier() {
|
| - FOR_EACH_OBSERVER(
|
| - NodeObserver,
|
| - *NodePrivate(node_).observers(),
|
| - OnNodeBoundsChange(node_,
|
| - old_bounds_,
|
| - new_bounds_,
|
| - NodeObserver::DISPOSITION_CHANGED));
|
| + FOR_EACH_OBSERVER(NodeObserver,
|
| + *NodePrivate(node_).observers(),
|
| + OnNodeBoundsChanged(node_, old_bounds_, new_bounds_));
|
| }
|
|
|
| private:
|
| @@ -214,16 +198,14 @@ class ScopedDestructionNotifier {
|
| public:
|
| explicit ScopedDestructionNotifier(Node* node)
|
| : node_(node) {
|
| - FOR_EACH_OBSERVER(
|
| - NodeObserver,
|
| - *NodePrivate(node_).observers(),
|
| - OnNodeDestroy(node_, NodeObserver::DISPOSITION_CHANGING));
|
| + FOR_EACH_OBSERVER(NodeObserver,
|
| + *NodePrivate(node_).observers(),
|
| + OnNodeDestroying(node_));
|
| }
|
| ~ScopedDestructionNotifier() {
|
| - FOR_EACH_OBSERVER(
|
| - NodeObserver,
|
| - *NodePrivate(node_).observers(),
|
| - OnNodeDestroy(node_, NodeObserver::DISPOSITION_CHANGED));
|
| + FOR_EACH_OBSERVER(NodeObserver,
|
| + *NodePrivate(node_).observers(),
|
| + OnNodeDestroyed(node_));
|
| }
|
|
|
| private:
|
|
|