Changeset 202763 in webkit


Ignore:
Timestamp:
Jul 1, 2016 4:41:45 PM (8 years ago)
Author:
jer.noble@apple.com
Message:

REGRESSION(r201405): Fullscreen video no longer enters low-power mode
https://bugs.webkit.org/show_bug.cgi?id=159220
<rdar://problem/26701056>

Reviewed by Beth Dakin.

In r201405, we removed the call to setTopContentInset(0) to avoid a flash
during repainting where the WebProcess still thought it had an inset and
the UIProcess did not, but the >0 inset breaks low power video playback
in fullscreen. So, instead, fix the repaint issue by setting a CALayer
fence which makes sure both the UIProcess and WebProcess paint simultaneously
after resizing and changing the top content inset.

This requires a new message from WebPageProxy -> WebPage: setTopContentInsetFenced().

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::setTopContentInset):

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

(-[WKFullScreenWindowController enterFullScreen:]):
(-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::setTopContentInsetFenced):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:
Location:
trunk/Source/WebKit2
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r202758 r202763  
     12016-07-01  Jer Noble  <jer.noble@apple.com>
     2
     3        REGRESSION(r201405): Fullscreen video no longer enters low-power mode
     4        https://bugs.webkit.org/show_bug.cgi?id=159220
     5        <rdar://problem/26701056>
     6
     7        Reviewed by Beth Dakin.
     8
     9        In r201405, we removed the call to setTopContentInset(0) to avoid a flash
     10        during repainting where the WebProcess still thought it had an inset and
     11        the UIProcess did not, but the >0 inset breaks low power video playback
     12        in fullscreen. So, instead, fix the repaint issue by setting a CALayer
     13        fence which makes sure both the UIProcess and WebProcess paint simultaneously
     14        after resizing and changing the top content inset.
     15
     16        This requires a new message from WebPageProxy -> WebPage: setTopContentInsetFenced().
     17
     18        * UIProcess/WebPageProxy.cpp:
     19        (WebKit::WebPageProxy::setTopContentInset):
     20        * UIProcess/mac/WKFullScreenWindowController.h:
     21        * UIProcess/mac/WKFullScreenWindowController.mm:
     22        (-[WKFullScreenWindowController enterFullScreen:]):
     23        (-[WKFullScreenWindowController finishedEnterFullScreenAnimation:]):
     24        * WebProcess/WebPage/WebPage.cpp:
     25        (WebKit::WebPage::setTopContentInsetFenced):
     26        * WebProcess/WebPage/WebPage.h:
     27        * WebProcess/WebPage/WebPage.messages.in:
     28
    1292016-07-01  Dan Bernstein  <mitz@apple.com>
    230
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r202575 r202763  
    13161316    m_topContentInset = contentInset;
    13171317
    1318     if (isValid())
    1319         m_process->send(Messages::WebPage::SetTopContentInset(contentInset), m_pageID);
     1318    if (!isValid())
     1319        return;
     1320#if PLATFORM(COCOA)
     1321    MachSendRight fence = m_drawingArea->createFence();
     1322
     1323    auto fenceAttachment = IPC::Attachment(fence.leakSendRight(), MACH_MSG_TYPE_MOVE_SEND);
     1324    m_process->send(Messages::WebPage::SetTopContentInsetFenced(contentInset, fenceAttachment), m_pageID);
     1325#else
     1326    m_process->send(Messages::WebPage::SetTopContentInset(contentInset), m_pageID);
     1327#endif
    13201328}
    13211329
  • trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h

    r201945 r202763  
    5959    double _savedScale;
    6060    RefPtr<WebKit::VoidCallback> _repaintCallback;
     61    float _savedTopContentInset;
    6162}
    6263
  • trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm

    r201945 r202763  
    221221    NSResponder *webWindowFirstResponder = [[_webView window] firstResponder];
    222222    [self _manager]->saveScrollPosition();
     223    _savedTopContentInset = _page->topContentInset();
     224    _page->setTopContentInset(0);
    223225    [[self window] setFrame:screenFrame display:NO];
    224226
     
    241243    NSView *contentView = [[self window] contentView];
    242244    [_clipView addSubview:_webView positioned:NSWindowBelow relativeTo:nil];
    243     NSRect contentViewBounds = contentView.bounds;
    244     contentViewBounds.size.height += _page->topContentInset();
    245     _webView.frame = contentViewBounds;
     245    _webView.frame = NSInsetRect(contentView.bounds, 0, -_page->topContentInset());
    246246
    247247    makeResponderFirstResponderIfDescendantOfView(self.window, webWindowFirstResponder, _webView);
     
    305305        _page->scalePage(_savedScale, IntPoint());
    306306        [self _manager]->restoreScrollPosition();
     307        _page->setTopContentInset(_savedTopContentInset);
    307308        [self _manager]->didExitFullScreen();
    308309        [self _manager]->setAnimatingFullScreen(false);
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r202728 r202763  
    24582458}
    24592459
     2460#if PLATFORM(COCOA)
     2461void WebPage::setTopContentInsetFenced(float contentInset, IPC::Attachment fencePort)
     2462{
     2463    m_drawingArea->addFence(MachSendRight::create(fencePort.port()));
     2464
     2465    setTopContentInset(contentInset);
     2466
     2467    mach_port_deallocate(mach_task_self(), fencePort.port());
     2468}
     2469#endif
     2470
    24602471void WebPage::setTopContentInset(float contentInset)
    24612472{
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r202611 r202763  
    10541054    void setDrawsBackground(bool);
    10551055
     1056#if PLATFORM(COCOA)
     1057    void setTopContentInsetFenced(float, IPC::Attachment);
     1058#endif
    10561059    void setTopContentInset(float);
    10571060
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

    r202347 r202763  
    3030    SetDrawsBackground(bool drawsBackground)
    3131
     32#if PLATFORM(COCOA)
     33    SetTopContentInsetFenced(float contentInset, IPC::Attachment fencePort)
     34#endif
    3235    SetTopContentInset(float contentInset)
    3336
Note: See TracChangeset for help on using the changeset viewer.