| OLD | NEW |
| 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 #import "ui/views/cocoa/bridged_native_widget.h" | 5 #import "ui/views/cocoa/bridged_native_widget.h" |
| 6 | 6 |
| 7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 // TODO(tapted): Investigate whether we want this for Mac. This is what Aura | 832 // TODO(tapted): Investigate whether we want this for Mac. This is what Aura |
| 833 // does, and it is what tests expect. However, because layer drawing is | 833 // does, and it is what tests expect. However, because layer drawing is |
| 834 // asynchronous (and things like deminiaturize in AppKit are not), it can | 834 // asynchronous (and things like deminiaturize in AppKit are not), it can |
| 835 // result in a CALayer appearing on screen before it has been redrawn in the | 835 // result in a CALayer appearing on screen before it has been redrawn in the |
| 836 // GPU process. This is a general problem. In content, a helper class, | 836 // GPU process. This is a general problem. In content, a helper class, |
| 837 // RenderWidgetResizeHelper, blocks the UI thread in -[NSView setFrameSize:] | 837 // RenderWidgetResizeHelper, blocks the UI thread in -[NSView setFrameSize:] |
| 838 // and RenderWidgetHostView::Show() until a frame is ready. | 838 // and RenderWidgetHostView::Show() until a frame is ready. |
| 839 if (layer()) { | 839 if (layer()) { |
| 840 layer()->SetVisible(window_visible_); | 840 layer()->SetVisible(window_visible_); |
| 841 layer()->SchedulePaint(gfx::Rect(GetClientAreaSize())); | 841 layer()->SchedulePaint(gfx::Rect(GetClientAreaSize())); |
| 842 |
| 843 // For translucent windows which are made visible, recalculate shadow when |
| 844 // the frame from the compositor arrives. |
| 845 if (![window_ isOpaque]) |
| 846 invalidate_shadow_on_frame_swap_ = window_visible_; |
| 842 } | 847 } |
| 843 | 848 |
| 844 NotifyVisibilityChangeDown(); | 849 NotifyVisibilityChangeDown(); |
| 845 | 850 |
| 846 native_widget_mac_->GetWidget()->OnNativeWidgetVisibilityChanged( | 851 native_widget_mac_->GetWidget()->OnNativeWidgetVisibilityChanged( |
| 847 window_visible_); | 852 window_visible_); |
| 848 | 853 |
| 849 // Toolkit-views suppresses redraws while not visible. To prevent Cocoa asking | 854 // Toolkit-views suppresses redraws while not visible. To prevent Cocoa asking |
| 850 // for an "empty" draw, disable auto-display while hidden. For example, this | 855 // for an "empty" draw, disable auto-display while hidden. For example, this |
| 851 // prevents Cocoa drawing just *after* a minimize, resulting in a blank window | 856 // prevents Cocoa drawing just *after* a minimize, resulting in a blank window |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1384 [bridged_view_ setMouseDownCanMoveWindow:draggable]; | 1389 [bridged_view_ setMouseDownCanMoveWindow:draggable]; |
| 1385 // AppKit will not update its cache of mouseDownCanMoveWindow unless something | 1390 // AppKit will not update its cache of mouseDownCanMoveWindow unless something |
| 1386 // changes. Previously we tried adding an NSView and removing it, but for some | 1391 // changes. Previously we tried adding an NSView and removing it, but for some |
| 1387 // reason it required reposting the mouse-down event, and didn't always work. | 1392 // reason it required reposting the mouse-down event, and didn't always work. |
| 1388 // Calling the below seems to be an effective solution. | 1393 // Calling the below seems to be an effective solution. |
| 1389 [window_ setMovableByWindowBackground:NO]; | 1394 [window_ setMovableByWindowBackground:NO]; |
| 1390 [window_ setMovableByWindowBackground:YES]; | 1395 [window_ setMovableByWindowBackground:YES]; |
| 1391 } | 1396 } |
| 1392 | 1397 |
| 1393 } // namespace views | 1398 } // namespace views |
| OLD | NEW |