- Revision
- 260150
- Author
- [email protected]
- Date
- 2020-04-15 14:07:14 -0700 (Wed, 15 Apr 2020)
Log Message
Video elements don't return to the correct position when exiting fullscreen
https://bugs.webkit.org/show_bug.cgi?id=210529
Reviewed by Jer Noble.
Source/WebCore:
Add WEBCORE_EXPORT to the function setNeedsDOMWindowResizeEvent().
* dom/Document.h:
Source/WebKit:
Some web pages use the "resize" event handler to calculate the element size after
they exit fullscreen, and the calculation is based on the container element size which
might be affected by the fullscreen mode.
We need to call WebPageProxy::setNeedsDOMWindowResizeEvent() to fire the "resize" event
in the repaint callback after the exiting fullscreen process is completed and the
possible layout change due to exiting fullscreen is done. Otherwise the size calculation
might be wrong.
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebPageProxy.h:
* UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
(-[WKFullScreenWindowController _completedExitFullScreen]):
* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setNeedsDOMWindowResizeEvent):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (260149 => 260150)
--- trunk/Source/WebCore/ChangeLog 2020-04-15 20:42:54 UTC (rev 260149)
+++ trunk/Source/WebCore/ChangeLog 2020-04-15 21:07:14 UTC (rev 260150)
@@ -1,3 +1,14 @@
+2020-04-15 Peng Liu <[email protected]>
+
+ Video elements don't return to the correct position when exiting fullscreen
+ https://bugs.webkit.org/show_bug.cgi?id=210529
+
+ Reviewed by Jer Noble.
+
+ Add WEBCORE_EXPORT to the function setNeedsDOMWindowResizeEvent().
+
+ * dom/Document.h:
+
2020-04-15 Wenson Hsieh <[email protected]>
[iPadOS] Some pages indefinitely zoom in and out due to idempotent text autosizing
Modified: trunk/Source/WebCore/dom/Document.h (260149 => 260150)
--- trunk/Source/WebCore/dom/Document.h 2020-04-15 20:42:54 UTC (rev 260149)
+++ trunk/Source/WebCore/dom/Document.h 2020-04-15 21:07:14 UTC (rev 260150)
@@ -1360,7 +1360,7 @@
bool hasStyleWithViewportUnits() const { return m_hasStyleWithViewportUnits; }
void updateViewportUnitsOnResize();
- void setNeedsDOMWindowResizeEvent();
+ WEBCORE_EXPORT void setNeedsDOMWindowResizeEvent();
void setNeedsVisualViewportResize();
void runResizeSteps();
Modified: trunk/Source/WebKit/ChangeLog (260149 => 260150)
--- trunk/Source/WebKit/ChangeLog 2020-04-15 20:42:54 UTC (rev 260149)
+++ trunk/Source/WebKit/ChangeLog 2020-04-15 21:07:14 UTC (rev 260150)
@@ -1,3 +1,30 @@
+2020-04-15 Peng Liu <[email protected]>
+
+ Video elements don't return to the correct position when exiting fullscreen
+ https://bugs.webkit.org/show_bug.cgi?id=210529
+
+ Reviewed by Jer Noble.
+
+ Some web pages use the "resize" event handler to calculate the element size after
+ they exit fullscreen, and the calculation is based on the container element size which
+ might be affected by the fullscreen mode.
+
+ We need to call WebPageProxy::setNeedsDOMWindowResizeEvent() to fire the "resize" event
+ in the repaint callback after the exiting fullscreen process is completed and the
+ possible layout change due to exiting fullscreen is done. Otherwise the size calculation
+ might be wrong.
+
+ * UIProcess/WebPageProxy.cpp:
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
+ (-[WKFullScreenWindowController _completedExitFullScreen]):
+ * UIProcess/mac/WKFullScreenWindowController.mm:
+ (-[WKFullScreenWindowController completeFinishExitFullScreenAnimationAfterRepaint]):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::setNeedsDOMWindowResizeEvent):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
2020-04-15 Wenson Hsieh <[email protected]>
[iPadOS] Some pages indefinitely zoom in and out due to idempotent text autosizing
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (260149 => 260150)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-04-15 20:42:54 UTC (rev 260149)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-04-15 21:07:14 UTC (rev 260150)
@@ -10043,6 +10043,11 @@
send(Messages::WebPage::SetShouldFireResizeEvents(shouldFireResizeEvents));
}
+void WebPageProxy::setNeedsDOMWindowResizeEvent()
+{
+ send(Messages::WebPage::SetNeedsDOMWindowResizeEvent());
+}
+
#if !PLATFORM(IOS_FAMILY)
bool WebPageProxy::shouldForceForegroundPriorityForClientNavigation() const
{
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (260149 => 260150)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-04-15 20:42:54 UTC (rev 260149)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-04-15 21:07:14 UTC (rev 260150)
@@ -1716,6 +1716,7 @@
#endif
void setShouldFireResizeEvents(bool);
+ void setNeedsDOMWindowResizeEvent();
void isNavigatingToAppBoundDomainTesting(CompletionHandler<void(bool)>&&);
Optional<NavigatingToAppBoundDomain> isNavigatingToAppBoundDomain() const { return m_isNavigatingToAppBoundDomain; }
Modified: trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm (260149 => 260150)
--- trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm 2020-04-15 20:42:54 UTC (rev 260149)
+++ trunk/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm 2020-04-15 21:07:14 UTC (rev 260150)
@@ -775,8 +775,10 @@
_webViewPlaceholder.get().parent = nil;
[_webViewPlaceholder removeFromSuperview];
- if (auto page = [self._webView _page])
+ if (auto page = [self._webView _page]) {
page->setSuppressVisibilityUpdates(false);
+ page->setNeedsDOMWindowResizeEvent();
+ }
});
if (auto page = [self._webView _page])
Modified: trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm (260149 => 260150)
--- trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm 2020-04-15 20:42:54 UTC (rev 260149)
+++ trunk/Source/WebKit/UIProcess/mac/WKFullScreenWindowController.mm 2020-04-15 21:07:14 UTC (rev 260150)
@@ -574,6 +574,7 @@
_repaintCallback = nullptr;
_page->setSuppressVisibilityUpdates(false);
+ _page->setNeedsDOMWindowResizeEvent();
[CATransaction commit];
[CATransaction flush];
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (260149 => 260150)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-04-15 20:42:54 UTC (rev 260149)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-04-15 21:07:14 UTC (rev 260150)
@@ -3314,6 +3314,15 @@
m_page->setShouldFireResizeEvents(shouldFireResizeEvents);
}
+void WebPage::setNeedsDOMWindowResizeEvent()
+{
+ if (!m_page)
+ return;
+
+ if (auto* document = m_page->mainFrame().document())
+ document->setNeedsDOMWindowResizeEvent();
+}
+
String WebPage::userAgent(const URL& webCoreURL) const
{
String userAgent = platformUserAgent(webCoreURL);
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (260149 => 260150)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2020-04-15 20:42:54 UTC (rev 260149)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2020-04-15 21:07:14 UTC (rev 260150)
@@ -1685,6 +1685,7 @@
void urlSchemeTaskDidComplete(uint64_t handlerIdentifier, uint64_t taskIdentifier, const WebCore::ResourceError&);
void setShouldFireResizeEvents(bool);
+ void setNeedsDOMWindowResizeEvent();
void setIsSuspended(bool);
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (260149 => 260150)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2020-04-15 20:42:54 UTC (rev 260149)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2020-04-15 21:07:14 UTC (rev 260150)
@@ -601,6 +601,7 @@
GetProcessDisplayName() -> (String displayName) Async
SetShouldFireResizeEvents(bool shouldFireResizeEvents)
+ SetNeedsDOMWindowResizeEvent()
SetHasResourceLoadClient(bool has)
}