Commit 55388b6f authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Forward Animate Property from BridgedNativeWidget to NSWindow

Scenarios like dragging a window out of the tabstrip disable animations.
This change forwards that request to NSWindow so the animation disable
request is respected.

BUG=863625

Change-Id: Ie25def791d30d35d7df804c4348fbad6cd0ae5ff
Reviewed-on: https://chromium-review.googlesource.com/1138814Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Robert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575652}
parent d581783b
......@@ -212,8 +212,8 @@ class VIEWS_EXPORT BridgedNativeWidget
bool window_visible() const { return window_visible_; }
bool wants_to_be_visible() const { return wants_to_be_visible_; }
bool animate() const { return animate_; }
void set_animate(bool animate) { animate_ = animate; }
bool GetAnimate() const;
void SetAnimate(bool animate);
// ui::CATransactionCoordinator::PreCommitObserver implementation
bool ShouldWaitInPreCommit() override;
......@@ -334,9 +334,6 @@ class VIEWS_EXPORT BridgedNativeWidget
// currently hidden due to having a hidden parent.
bool wants_to_be_visible_;
// Whether to animate the window (when it is appropriate to do so).
bool animate_ = true;
// If true, then ignore interactions with CATransactionCoordinator until the
// first frame arrives.
bool ca_transaction_sync_suppressed_ = false;
......
......@@ -527,7 +527,7 @@ void BridgedNativeWidget::SetVisibilityState(WindowVisibilityState new_state) {
// For non-sheet modal types, use the constrained window animations to make
// the window appear.
if (animate_ && native_widget_mac_->GetWidget()->IsModal()) {
if (GetAnimate() && native_widget_mac_->GetWidget()->IsModal()) {
show_animation_.reset(
[[ModalShowAnimationWithLayer alloc] initWithBridgedNativeWidget:this]);
......@@ -979,6 +979,16 @@ void BridgedNativeWidget::ReparentNativeView(NSView* native_view,
}
}
bool BridgedNativeWidget::GetAnimate() const {
return [window_ animationBehavior] != NSWindowAnimationBehaviorNone;
}
void BridgedNativeWidget::SetAnimate(bool animate) {
[window_
setAnimationBehavior:(animate ? NSWindowAnimationBehaviorDocumentWindow
: NSWindowAnimationBehaviorNone)];
}
////////////////////////////////////////////////////////////////////////////////
// BridgedNativeWidget, ui::CATransactionObserver
......
......@@ -402,7 +402,7 @@ void NativeWidgetMac::Close() {
}
// For other modal types, animate the close.
if (bridge_->animate() && AreModalAnimationsEnabled() &&
if (bridge_->GetAnimate() && AreModalAnimationsEnabled() &&
delegate_->IsModal()) {
[ViewsNSWindowCloseAnimator closeWindowWithAnimation:window];
return;
......@@ -634,7 +634,7 @@ void NativeWidgetMac::EndMoveLoop() {
void NativeWidgetMac::SetVisibilityChangedAnimationsEnabled(bool value) {
if (bridge_)
bridge_->set_animate(value);
bridge_->SetAnimate(value);
}
void NativeWidgetMac::SetVisibilityAnimationDuration(
......
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