Changeset 201405 in webkit


Ignore:
Timestamp:
May 25, 2016 3:07:17 PM (8 years ago)
Author:
jer.noble@apple.com
Message:

Flashiness and jumpiness when entering fullscreen
https://bugs.webkit.org/show_bug.cgi?id=158087

Reviewed by Beth Dakin.

Multiple independant sources of jumpiness and flashiness are addressed here:

  • Setting the top content inset on the WKView cause a vertical jump during fullscreen

transition. Instead of setting the content inset to 0, take the existing inset into account
when placing the WKView in the NSWindow.

  • The enter fullscreen transition causes a white flash due to the NSWindow needing

display before ordering onscreen. Ensure the window has a backing by calling -displayIfNeeded
before entering fullscreen mode.

  • The exit fullscreen transition causes a white background color flash for an unknown

reason, but is solved by not making the window's content view layer-backed. Rather than
directly animating the contentView's background color, create a specific background view
and animate it's background color instead.

  • UIProcess/mac/WKFullScreenWindowController.h:
  • UIProcess/mac/WKFullScreenWindowController.mm:

(-[WKFullScreenWindowController initWithWindow:webView:page:]):
(-[WKFullScreenWindowController enterFullScreen:]):
(-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
(-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
(-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
(-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]):

  • WebProcess/FullScreen/WebFullScreenManager.cpp:

(WebKit::WebFullScreenManager::saveScrollPosition): Deleted.
(WebKit::WebFullScreenManager::restoreScrollPosition): Deleted.

Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r201398 r201405  
     12016-05-25  Jer Noble  <jer.noble@apple.com>
     2
     3        Flashiness and jumpiness when entering fullscreen
     4        https://bugs.webkit.org/show_bug.cgi?id=158087
     5
     6        Reviewed by Beth Dakin.
     7
     8        Multiple independant sources of jumpiness and flashiness are addressed here:
     9
     10        - Setting the top content inset on the WKView cause a vertical jump during fullscreen
     11        transition. Instead of setting the content inset to 0, take the existing inset into account
     12        when placing the WKView in the NSWindow.
     13
     14        - The enter fullscreen transition causes a white flash due to the NSWindow needing
     15        display before ordering onscreen. Ensure the window has a backing by calling -displayIfNeeded
     16        before entering fullscreen mode.
     17
     18        - The exit fullscreen transition causes a white background color flash for an unknown
     19        reason, but is solved by not making the window's content view layer-backed. Rather than
     20        directly animating the contentView's background color, create a specific background view
     21        and animate it's background color instead.
     22
     23        * UIProcess/mac/WKFullScreenWindowController.h:
     24        * UIProcess/mac/WKFullScreenWindowController.mm:
     25        (-[WKFullScreenWindowController initWithWindow:webView:page:]):
     26        (-[WKFullScreenWindowController enterFullScreen:]):
     27        (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
     28        (-[WKFullScreenWindowController finishedExitFullScreenAnimation:]):
     29        (-[WKFullScreenWindowController _startEnterFullScreenAnimationWithDuration:]):
     30        (-[WKFullScreenWindowController _startExitFullScreenAnimationWithDuration:]):
     31        * WebProcess/FullScreen/WebFullScreenManager.cpp:
     32        (WebKit::WebFullScreenManager::saveScrollPosition): Deleted.
     33        (WebKit::WebFullScreenManager::restoreScrollPosition): Deleted.
     34
    1352016-05-25  Alex Christensen  <achristensen@webkit.org>
    236
  • trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h

    r191320 r201405  
    5050    RetainPtr<WebCoreFullScreenPlaceholderView> _webViewPlaceholder;
    5151    RetainPtr<NSView> _clipView;
     52    RetainPtr<NSView> _backgroundView;
    5253    NSRect _initialFrame;
    5354    NSRect _finalFrame;
  • trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm

    r200862 r201405  
    9595
    9696    NSView *contentView = [window contentView];
    97     contentView.wantsLayer = YES;
    98     contentView.layer.hidden = YES;
     97    contentView.hidden = YES;
    9998    contentView.autoresizesSubviews = YES;
     99
     100    _backgroundView = adoptNS([[NSView alloc] initWithFrame:contentView.bounds]);
     101    _backgroundView.get().layer = [CALayer layer];
     102    _backgroundView.get().wantsLayer = YES;
     103    _backgroundView.get().autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
     104    [contentView addSubview:_backgroundView.get()];
    100105
    101106    _clipView = adoptNS([[NSView alloc] initWithFrame:contentView.bounds]);
    102107    [_clipView setWantsLayer:YES];
    103108    [_clipView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
    104     [contentView addSubview:_clipView.get()];
     109    [_backgroundView addSubview:_clipView.get()];
    105110
    106111    [self windowDidLoad];
     112    [window displayIfNeeded];
    107113    _webView = webView;
    108114    _page = &page;
     
    235241    NSView *contentView = [[self window] contentView];
    236242    [_clipView addSubview:_webView positioned:NSWindowBelow relativeTo:nil];
    237     [_webView setFrame:[contentView bounds]];
     243    _webView.frame = NSInsetRect(contentView.bounds, 0, -_page->topContentInset());
    238244
    239245    makeResponderFirstResponderIfDescendantOfView(self.window, webWindowFirstResponder, _webView);
     
    273279        [self _manager]->setAnimatingFullScreen(false);
    274280
    275         NSView *contentView = [[self window] contentView];
    276         [contentView.layer removeAllAnimations];
     281        [_backgroundView.get().layer removeAllAnimations];
    277282        [[_clipView layer] removeAllAnimations];
    278283        [[_clipView layer] setMask:nil];
     
    370375    [[self window] orderOut:self];
    371376    NSView *contentView = [[self window] contentView];
    372     contentView.layer.hidden = YES;
     377    contentView.hidden = YES;
     378    [_backgroundView.get().layer removeAllAnimations];
    373379    [[_webViewPlaceholder window] setAutodisplay:NO];
    374380
     
    577583    [_clipView layer].mask = maskLayer;
    578584
    579     contentView.layer.hidden = NO;
    580     [contentView.layer addAnimation:fadeAnimation(duration, AnimateIn) forKey:@"fullscreen"];
     585    contentView.hidden = NO;
     586    [_backgroundView.get().layer addAnimation:fadeAnimation(duration, AnimateIn) forKey:@"fullscreen"];
    581587
    582588    NSWindow* window = [self window];
     
    606612
    607613    NSView* contentView = [[self window] contentView];
    608     contentView.layer.hidden = NO;
    609     [contentView.layer addAnimation:fadeAnimation(duration, AnimateOut) forKey:@"fullscreen"];
     614    contentView.hidden = NO;
     615    [_backgroundView.get().layer addAnimation:fadeAnimation(duration, AnimateOut) forKey:@"fullscreen"];
    610616
    611617    _page->setSuppressVisibilityUpdates(false);
  • trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp

    r185637 r201405  
    158158{
    159159    m_scrollPosition = m_page->corePage()->mainFrame().view()->scrollPosition();
    160     m_topContentInset = m_page->corePage()->topContentInset();
    161     m_page->corePage()->setTopContentInset(0);
    162160}
    163161
    164162void WebFullScreenManager::restoreScrollPosition()
    165163{
    166     m_page->corePage()->setTopContentInset(m_topContentInset);
    167164    m_page->corePage()->mainFrame().view()->setScrollPosition(m_scrollPosition);
    168165}
Note: See TracChangeset for help on using the changeset viewer.