WebKit Bugzilla
Attachment 357877 Details for
Bug 192774
: Flicker when exiting element fullscreen.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing.
bug-192774-20181220151618.patch (text/plain), 7.63 KB, created by
Jeremy Jones
on 2018-12-20 15:16:19 PST
(
hide
)
Description:
Patch for landing.
Filename:
MIME Type:
Creator:
Jeremy Jones
Created:
2018-12-20 15:16:19 PST
Size:
7.63 KB
patch
obsolete
>Subversion Revision: 238527 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 659f6fd4b4137859088bc260824cc60ca07ff2c0..3f56a8e91a743b8efc9125fb91c2fc214bba7aa3 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,21 @@ >+2018-12-17 Jeremy Jones <jeremyj@apple.com> >+ >+ Flicker when exiting element fullscreen. >+ https://bugs.webkit.org/show_bug.cgi?id=192774 >+ rdar://problem/33088878 >+ >+ Reviewed by Jer Noble. >+ >+ Fixes an issue where the web page would flicker upon exiting element fullscreen. >+ >+ Replace WebView with a snapshot while the WebView is restyled and resized for inline. >+ >+ * UIProcess/mac/WKFullScreenWindowController.h: >+ * UIProcess/mac/WKFullScreenWindowController.mm: >+ (-[WKFullScreenWindowController initWithWindow:webView:page:]): >+ (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]): >+ (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]): >+ > 2018-11-26 Alex Christensen <achristensen@webkit.org> > > Rename WKWebView._safeBrowsingWarningForTesting to _safeBrowsingWarning to use it for more than testing >diff --git a/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.h b/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.h >index 33c58e78d0e5d763aa2eba882fa3fc996987d261..4336c250854a849f6f016a6a1841d07bd264551f 100644 >--- a/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.h >+++ b/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.h >@@ -48,6 +48,7 @@ typedef enum FullScreenState : NSInteger FullScreenState; > NSView *_webView; // Cannot be retained, see <rdar://problem/14884666>. > WebKit::WebPageProxy* _page; > RetainPtr<WebCoreFullScreenPlaceholderView> _webViewPlaceholder; >+ RetainPtr<NSView> _exitPlaceholder; > RetainPtr<NSView> _clipView; > RetainPtr<NSView> _backgroundView; > NSRect _initialFrame; >diff --git a/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm b/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm >index 10668e62623409f1a4605b42d3886423f73c8a1a..0f76b8d1af0f2f5988155a754edd8f7b1e8cb273 100644 >--- a/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm >+++ b/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm >@@ -440,6 +440,26 @@ - (void)beganExitFullScreenWithInitialFrame:(NSRect)initialFrame finalFrame:(NSR > [[self window] exitFullScreenMode:self]; > } > >+WTF_DECLARE_CF_TYPE_TRAIT(CGImage); >+ >+static RetainPtr<CGImageRef> takeWindowSnapshot(CGSWindowID windowID, bool captureAtNominalResolution) >+{ >+ CGSWindowCaptureOptions options = kCGSCaptureIgnoreGlobalClipShape; >+ if (captureAtNominalResolution) >+ options |= kCGSWindowCaptureNominalResolution; >+ RetainPtr<CFArrayRef> windowSnapshotImages = adoptCF(CGSHWCaptureWindowList(CGSMainConnectionID(), &windowID, 1, options)); >+ >+ if (windowSnapshotImages && CFArrayGetCount(windowSnapshotImages.get())) >+ return checked_cf_cast<CGImageRef>(CFArrayGetValueAtIndex(windowSnapshotImages.get(), 0)); >+ >+ // Fall back to the non-hardware capture path if we didn't get a snapshot >+ // (which usually happens if the window is fully off-screen). >+ CGWindowImageOption imageOptions = kCGWindowImageBoundsIgnoreFraming | kCGWindowImageShouldBeOpaque; >+ if (captureAtNominalResolution) >+ imageOptions |= kCGWindowImageNominalResolution; >+ return adoptCF(CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, windowID, imageOptions)); >+} >+ > - (void)finishedExitFullScreenAnimation:(bool)completed > { > if (_fullScreenState == InFullScreen) { >@@ -457,28 +477,42 @@ - (void)finishedExitFullScreenAnimation:(bool)completed > > NSResponder *firstResponder = [[self window] firstResponder]; > >- ALLOW_DEPRECATED_DECLARATIONS_BEGIN >- // Screen updates to be re-enabled in completeFinishExitFullScreenAnimationAfterRepaint. >- NSDisableScreenUpdates(); >- ALLOW_DEPRECATED_DECLARATIONS_END >- _page->setSuppressVisibilityUpdates(true); >- [[self window] orderOut:self]; >- NSView *contentView = [[self window] contentView]; >- contentView.hidden = YES; >+ [CATransaction begin]; >+ [CATransaction setDisableActions:YES]; >+ NSRect exitPlaceholderScreenRect = _initialFrame; >+ exitPlaceholderScreenRect.origin.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - NSMaxY(exitPlaceholderScreenRect); >+ >+ RetainPtr<CGImageRef> webViewContents = takeWindowSnapshot([[_webView window] windowNumber], true); >+ webViewContents = adoptCF(CGImageCreateWithImageInRect(webViewContents.get(), NSRectToCGRect(exitPlaceholderScreenRect))); >+ >+ _exitPlaceholder = adoptNS([[NSView alloc] initWithFrame:[_webView frame]]); >+ [_exitPlaceholder setWantsLayer: YES]; >+ [_exitPlaceholder setAutoresizesSubviews: YES]; >+ [_exitPlaceholder setLayerContentsPlacement: NSViewLayerContentsPlacementScaleProportionallyToFit]; >+ [_exitPlaceholder setLayerContentsRedrawPolicy: NSViewLayerContentsRedrawNever]; >+ [_exitPlaceholder setFrame:[_webView frame]]; >+ [[_exitPlaceholder layer] setContents:(__bridge id)webViewContents.get()]; >+ [[_webView superview] addSubview:_exitPlaceholder.get() positioned:NSWindowAbove relativeTo:_webView]; >+ >+ [CATransaction commit]; >+ [CATransaction flush]; >+ >+ [CATransaction begin]; >+ [CATransaction setDisableActions:YES]; >+ > [_backgroundView.get().layer removeAllAnimations]; >- ALLOW_DEPRECATED_DECLARATIONS_BEGIN >- [[_webViewPlaceholder window] setAutodisplay:NO]; >- ALLOW_DEPRECATED_DECLARATIONS_END >+ _page->setSuppressVisibilityUpdates(true); >+ [_webView removeFromSuperview]; >+ [_webView setFrame:[_webViewPlaceholder frame]]; >+ [_webView setAutoresizingMask:[_webViewPlaceholder autoresizingMask]]; >+ [[_webViewPlaceholder superview] addSubview:_webView positioned:NSWindowBelow relativeTo:_webViewPlaceholder.get()]; > >- [self _replaceView:_webViewPlaceholder.get() with:_webView]; > BEGIN_BLOCK_OBJC_EXCEPTIONS > [NSLayoutConstraint activateConstraints:self.savedConstraints]; > END_BLOCK_OBJC_EXCEPTIONS > self.savedConstraints = nil; > makeResponderFirstResponderIfDescendantOfView(_webView.window, firstResponder, _webView); > >- [[_webView window] makeKeyAndOrderFront:self]; >- > // These messages must be sent after the swap or flashing will occur during forceRepaint: > [self _manager]->didExitFullScreen(); > [self _manager]->setAnimatingFullScreen(false); >@@ -496,19 +530,32 @@ - (void)finishedExitFullScreenAnimation:(bool)completed > [self completeFinishExitFullScreenAnimationAfterRepaint]; > }); > _page->forceRepaint(_repaintCallback.copyRef()); >+ >+ [CATransaction commit]; >+ [CATransaction flush]; > } > > - (void)completeFinishExitFullScreenAnimationAfterRepaint > { >+ [CATransaction begin]; >+ [CATransaction setDisableActions:YES]; >+ >+ [_webViewPlaceholder removeFromSuperview]; >+ [[self window] orderOut:self]; >+ NSView *contentView = [[self window] contentView]; >+ contentView.hidden = YES; >+ [_exitPlaceholder removeFromSuperview]; >+ [[_exitPlaceholder layer] setContents:nil]; >+ _exitPlaceholder = nil; >+ >+ [[_webView window] makeKeyAndOrderFront:self]; >+ _webViewPlaceholder = nil; >+ > _repaintCallback = nullptr; >- ALLOW_DEPRECATED_DECLARATIONS_BEGIN >- [[_webView window] setAutodisplay:YES]; >- ALLOW_DEPRECATED_DECLARATIONS_END >- [[_webView window] displayIfNeeded]; > _page->setSuppressVisibilityUpdates(false); >- ALLOW_DEPRECATED_DECLARATIONS_BEGIN >- NSEnableScreenUpdates(); >- ALLOW_DEPRECATED_DECLARATIONS_END >+ >+ [CATransaction commit]; >+ [CATransaction flush]; > } > > - (void)performClose:(id)sender
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192774
:
357472
|
357835
| 357877