- Revision
- 202763
- Author
- [email protected]
- Date
- 2016-07-01 16:41:45 -0700 (Fri, 01 Jul 2016)
Log 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:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (202762 => 202763)
--- trunk/Source/WebKit2/ChangeLog 2016-07-01 23:25:04 UTC (rev 202762)
+++ trunk/Source/WebKit2/ChangeLog 2016-07-01 23:41:45 UTC (rev 202763)
@@ -1,3 +1,31 @@
+2016-07-01 Jer Noble <[email protected]>
+
+ 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:
+
2016-07-01 Dan Bernstein <[email protected]>
[Mac] Get rid of support for old SDKs
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (202762 => 202763)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-07-01 23:25:04 UTC (rev 202762)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-07-01 23:41:45 UTC (rev 202763)
@@ -1315,8 +1315,16 @@
m_topContentInset = contentInset;
- if (isValid())
- m_process->send(Messages::WebPage::SetTopContentInset(contentInset), m_pageID);
+ if (!isValid())
+ return;
+#if PLATFORM(COCOA)
+ MachSendRight fence = m_drawingArea->createFence();
+
+ auto fenceAttachment = IPC::Attachment(fence.leakSendRight(), MACH_MSG_TYPE_MOVE_SEND);
+ m_process->send(Messages::WebPage::SetTopContentInsetFenced(contentInset, fenceAttachment), m_pageID);
+#else
+ m_process->send(Messages::WebPage::SetTopContentInset(contentInset), m_pageID);
+#endif
}
void WebPageProxy::setUnderlayColor(const Color& color)
Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h (202762 => 202763)
--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h 2016-07-01 23:25:04 UTC (rev 202762)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.h 2016-07-01 23:41:45 UTC (rev 202763)
@@ -58,6 +58,7 @@
double _savedScale;
RefPtr<WebKit::VoidCallback> _repaintCallback;
+ float _savedTopContentInset;
}
@property (readonly) NSRect initialFrame;
Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm (202762 => 202763)
--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm 2016-07-01 23:25:04 UTC (rev 202762)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm 2016-07-01 23:41:45 UTC (rev 202763)
@@ -220,6 +220,8 @@
NSResponder *webWindowFirstResponder = [[_webView window] firstResponder];
[self _manager]->saveScrollPosition();
+ _savedTopContentInset = _page->topContentInset();
+ _page->setTopContentInset(0);
[[self window] setFrame:screenFrame display:NO];
// Painting is normally suspended when the WKView is removed from the window, but this is
@@ -240,9 +242,7 @@
// Then insert the WebView into the full screen window
NSView *contentView = [[self window] contentView];
[_clipView addSubview:_webView positioned:NSWindowBelow relativeTo:nil];
- NSRect contentViewBounds = contentView.bounds;
- contentViewBounds.size.height += _page->topContentInset();
- _webView.frame = contentViewBounds;
+ _webView.frame = NSInsetRect(contentView.bounds, 0, -_page->topContentInset());
makeResponderFirstResponderIfDescendantOfView(self.window, webWindowFirstResponder, _webView);
@@ -304,6 +304,7 @@
_page->scalePage(_savedScale, IntPoint());
[self _manager]->restoreScrollPosition();
+ _page->setTopContentInset(_savedTopContentInset);
[self _manager]->didExitFullScreen();
[self _manager]->setAnimatingFullScreen(false);
}
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (202762 => 202763)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-07-01 23:25:04 UTC (rev 202762)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-07-01 23:41:45 UTC (rev 202763)
@@ -2457,6 +2457,17 @@
m_drawingArea->setNeedsDisplay();
}
+#if PLATFORM(COCOA)
+void WebPage::setTopContentInsetFenced(float contentInset, IPC::Attachment fencePort)
+{
+ m_drawingArea->addFence(MachSendRight::create(fencePort.port()));
+
+ setTopContentInset(contentInset);
+
+ mach_port_deallocate(mach_task_self(), fencePort.port());
+}
+#endif
+
void WebPage::setTopContentInset(float contentInset)
{
if (contentInset == m_page->topContentInset())
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (202762 => 202763)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2016-07-01 23:25:04 UTC (rev 202762)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2016-07-01 23:41:45 UTC (rev 202763)
@@ -1053,6 +1053,9 @@
void setDrawsBackground(bool);
+#if PLATFORM(COCOA)
+ void setTopContentInsetFenced(float, IPC::Attachment);
+#endif
void setTopContentInset(float);
void viewWillStartLiveResize();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (202762 => 202763)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2016-07-01 23:25:04 UTC (rev 202762)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2016-07-01 23:41:45 UTC (rev 202763)
@@ -29,6 +29,9 @@
SetDrawsBackground(bool drawsBackground)
+#if PLATFORM(COCOA)
+ SetTopContentInsetFenced(float contentInset, IPC::Attachment fencePort)
+#endif
SetTopContentInset(float contentInset)
SetUnderlayColor(WebCore::Color color)