Commit 4d1f95c1 authored by Trent Apted's avatar Trent Apted Committed by Commit Bot

Mac: Ensure we wait for the first frame for window-modal sheets.

AppKit runs its sheet animation in UI-thread blocking loop. There is no
way to swap in a frame from the compositor while it is running. So
failing to wait means we animate a blank window.

Fix by restoring the wait that regressed in r574771

Test=Bookmark Star -> More...: Ensure the window does not animate in blank.

Bug: 865331
Change-Id: Ifd87944e3ae0d3af5f5b7eb8569e9a7c98e1be0c
Reviewed-on: https://chromium-review.googlesource.com/1146136
Commit-Queue: ccameron <ccameron@chromium.org>
Reviewed-by: default avatarccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577186}
parent cde2cd23
...@@ -903,12 +903,6 @@ void BridgedNativeWidget::CreateLayer(ui::LayerType layer_type, ...@@ -903,12 +903,6 @@ void BridgedNativeWidget::CreateLayer(ui::LayerType layer_type,
: SK_ColorWHITE); : SK_ColorWHITE);
layer()->SetFillsBoundsOpaquely(!translucent); layer()->SetFillsBoundsOpaquely(!translucent);
// Don't block waiting for the initial frame of transparent windows. This
// allows us to avoid blocking on the UI thread e.g, while typing in the
// omnibox.
// https://crbug.com/712268
ca_transaction_sync_suppressed_ = translucent;
// Use the regular window background for window modal sheets. The layer() will // Use the regular window background for window modal sheets. The layer() will
// still paint over most of it, but the native -[NSApp beginSheet:] animation // still paint over most of it, but the native -[NSApp beginSheet:] animation
// blocks the UI thread, so there's no way to invalidate the shadow to match // blocks the UI thread, so there's no way to invalidate the shadow to match
...@@ -917,12 +911,16 @@ void BridgedNativeWidget::CreateLayer(ui::LayerType layer_type, ...@@ -917,12 +911,16 @@ void BridgedNativeWidget::CreateLayer(ui::LayerType layer_type,
// native shape is what's most appropriate for displaying sheets on Mac. // native shape is what's most appropriate for displaying sheets on Mac.
if (translucent && !native_widget_mac_->IsWindowModalSheet()) { if (translucent && !native_widget_mac_->IsWindowModalSheet()) {
[window_ setOpaque:NO]; [window_ setOpaque:NO];
// For Mac OS versions earlier than Yosemite, the Window server isn't able [window_ setBackgroundColor:[NSColor clearColor]];
// to generate a window shadow from the composited CALayer. To get around
// this, let the window background remain opaque and clip the window // Don't block waiting for the initial frame of completely transparent
// boundary in drawRect method of BridgedContentView. See crbug.com/543671. // windows. This allows us to avoid blocking on the UI thread e.g, while
if (base::mac::IsAtLeastOS10_10()) // typing in the omnibox. Note window modal sheets _must_ wait: there is no
[window_ setBackgroundColor:[NSColor clearColor]]; // way for a frame to arrive during AppKit's sheet animation.
// https://crbug.com/712268
ca_transaction_sync_suppressed_ = true;
} else {
DCHECK(!ca_transaction_sync_suppressed_);
} }
UpdateLayerProperties(); UpdateLayerProperties();
......
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