Diff
Modified: branches/safari-604-branch/Source/WebKit/ChangeLog (220787 => 220788)
--- branches/safari-604-branch/Source/WebKit/ChangeLog 2017-08-16 07:34:15 UTC (rev 220787)
+++ branches/safari-604-branch/Source/WebKit/ChangeLog 2017-08-16 07:49:32 UTC (rev 220788)
@@ -1,3 +1,51 @@
+2017-08-15 Jason Marcell <jmarc...@apple.com>
+
+ Cherry-pick r220286. rdar://problem/33904738
+
+ 2017-08-04 Tim Horton <timothy_hor...@apple.com>
+
+ viewport-fit changes during animated resize can cause layout size to get stuck
+ https://bugs.webkit.org/show_bug.cgi?id=175169
+ <rdar://problem/33684697>
+
+ Reviewed by Simon Fraser.
+
+ If we get a commit that changes viewport-fit state while an animated
+ resize is underway, and that change causes the client to push a new
+ minimumLayoutSizeOverride, the new size will be lost forever, and we
+ will get stuck laying out at the wrong size.
+
+ This is because we unconditionally apply avoidsUnsafeArea for every commit,
+ while most other changes that come in from a commit are ignored if we're
+ inside animated resize. To fix, also ignore avoidsUnsafeArea changes during
+ animated resize, by moving the code that keeps track of it into WKWebView
+ like all of the rest, and read it out of the commit in didCommitLayerTree
+ *after* the animated-resize early-return.
+
+ Also, fix the associated layout tests by adding a missing assignment
+ in _computedContentInset, which was broken in r220138.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _initializeWithConfiguration:]):
+ (-[WKWebView _setHasCustomContentView:loadedMIMEType:]):
+ (-[WKWebView _processDidExit]):
+ (-[WKWebView _didCommitLayerTree:]):
+ (-[WKWebView _setAvoidsUnsafeArea:]):
+ (-[WKWebView _safeAreaShouldAffectObscuredInsets]):
+ (-[WKWebView _didChangeAvoidsUnsafeArea:]): Deleted.
+ * UIProcess/API/Cocoa/WKWebViewInternal.h:
+ * UIProcess/PageClient.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::resetState):
+ (WebKit::WebPageProxy::setAvoidsUnsafeArea): Deleted.
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::avoidsUnsafeArea const): Deleted.
+ * UIProcess/ios/PageClientImplIOS.h:
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::didChangeAvoidsUnsafeArea): Deleted.
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::didCommitLayerTree):
+
2017-08-13 Jason Marcell <jmarc...@apple.com>
Cherry-pick r220571. rdar://problem/33829966
Modified: branches/safari-604-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (220787 => 220788)
--- branches/safari-604-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2017-08-16 07:34:15 UTC (rev 220787)
+++ branches/safari-604-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2017-08-16 07:49:32 UTC (rev 220788)
@@ -247,6 +247,7 @@
UIEdgeInsets _unobscuredSafeAreaInsets;
BOOL _haveSetUnobscuredSafeAreaInsets;
+ BOOL _avoidsUnsafeArea;
UIRectEdge _obscuredInsetEdgesAffectedBySafeArea;
UIInterfaceOrientation _interfaceOrientationOverride;
@@ -524,6 +525,7 @@
[_scrollView setInternalDelegate:self];
[_scrollView setBouncesZoom:YES];
+ _avoidsUnsafeArea = YES;
[self _updateScrollViewInsetAdjustmentBehavior];
[self addSubview:_scrollView.get()];
@@ -1269,7 +1271,7 @@
_scrollViewBackgroundColor = WebCore::Color();
[_scrollView setContentOffset:[self _adjustedContentOffset:CGPointZero]];
- [self _didChangeAvoidsUnsafeArea:NO];
+ [self _setAvoidsUnsafeArea:NO];
} else if (_customContentView) {
[_customContentView removeFromSuperview];
_customContentView = nullptr;
@@ -1283,8 +1285,6 @@
[_customContentFixedOverlayView setFrame:self.bounds];
[self addSubview:_customContentFixedOverlayView.get()];
-
- [self _didChangeAvoidsUnsafeArea:_page->avoidsUnsafeArea()];
}
if (self.isFirstResponder) {
@@ -1408,7 +1408,7 @@
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
if (self._safeAreaShouldAffectObscuredInsets)
- UIEdgeInsetsAdd(insets, [_scrollView _systemContentInset], self._effectiveObscuredInsetEdgesAffectedBySafeArea);
+ insets = UIEdgeInsetsAdd(insets, [_scrollView _systemContentInset], self._effectiveObscuredInsetEdgesAffectedBySafeArea);
#endif
return insets;
@@ -1462,6 +1462,8 @@
_firstPaintAfterCommitLoadTransactionID = 0;
_firstTransactionIDAfterPageRestore = 0;
_resizeAnimationTransformTransactionID = std::nullopt;
+
+ _avoidsUnsafeArea = YES;
}
- (void)_didCommitLoadForMainFrame
@@ -1560,6 +1562,7 @@
[_contentView _setDoubleTapGesturesEnabled:self._allowsDoubleTapGestures];
[self _updateScrollViewBackground];
+ [self _setAvoidsUnsafeArea:layerTreeTransaction.avoidsUnsafeArea()];
if (_gestureController)
_gestureController->setRenderTreeSize(layerTreeTransaction.renderTreeSize());
@@ -2718,8 +2721,13 @@
#endif
}
-- (void)_didChangeAvoidsUnsafeArea:(BOOL)avoidsUnsafeArea
+- (void)_setAvoidsUnsafeArea:(BOOL)avoidsUnsafeArea
{
+ if (_avoidsUnsafeArea == avoidsUnsafeArea)
+ return;
+
+ _avoidsUnsafeArea = avoidsUnsafeArea;
+
[self _updateScrollViewInsetAdjustmentBehavior];
[self _scheduleVisibleContentRectUpdate];
@@ -4673,9 +4681,7 @@
{
if (![self usesStandardContentView])
return NO;
- if (!_page)
- return YES;
- return _page->avoidsUnsafeArea();
+ return _avoidsUnsafeArea;
}
- (void)_setInterfaceOrientationOverride:(UIInterfaceOrientation)interfaceOrientation
Modified: branches/safari-604-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h (220787 => 220788)
--- branches/safari-604-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h 2017-08-16 07:34:15 UTC (rev 220787)
+++ branches/safari-604-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h 2017-08-16 07:49:32 UTC (rev 220788)
@@ -119,8 +119,6 @@
- (void)_showPasswordViewWithDocumentName:(NSString *)documentName passwordHandler:(void (^)(NSString *))passwordHandler;
- (void)_hidePasswordView;
-- (void)_didChangeAvoidsUnsafeArea:(BOOL)avoidsUnsafeArea;
-
- (void)_addShortcut:(id)sender;
- (void)_arrowKey:(id)sender;
- (void)_define:(id)sender;
Modified: branches/safari-604-branch/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h (220787 => 220788)
--- branches/safari-604-branch/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h 2017-08-16 07:34:15 UTC (rev 220787)
+++ branches/safari-604-branch/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h 2017-08-16 07:49:32 UTC (rev 220788)
@@ -146,8 +146,6 @@
WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override { return WebCore::UserInterfaceLayoutDirection::LTR; }
- void didChangeAvoidsUnsafeArea(bool) override { }
-
JSGlobalContextRef _javascript_GlobalContext() override;
// Members of PageClientImpl class
Modified: branches/safari-604-branch/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h (220787 => 220788)
--- branches/safari-604-branch/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h 2017-08-16 07:34:15 UTC (rev 220787)
+++ branches/safari-604-branch/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h 2017-08-16 07:49:32 UTC (rev 220788)
@@ -117,8 +117,6 @@
WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override;
- void didChangeAvoidsUnsafeArea(bool) override { }
-
JSGlobalContextRef _javascript_GlobalContext() override;
WKWPE::View& m_view;
Modified: branches/safari-604-branch/Source/WebKit/UIProcess/PageClient.h (220787 => 220788)
--- branches/safari-604-branch/Source/WebKit/UIProcess/PageClient.h 2017-08-16 07:34:15 UTC (rev 220787)
+++ branches/safari-604-branch/Source/WebKit/UIProcess/PageClient.h 2017-08-16 07:49:32 UTC (rev 220788)
@@ -384,8 +384,6 @@
virtual void didChangeDataInteractionCaretRect(const WebCore::IntRect& previousCaretRect, const WebCore::IntRect& caretRect) = 0;
#endif
- virtual void didChangeAvoidsUnsafeArea(bool avoidsUnsafeArea) = 0;
-
#if PLATFORM(GTK) || PLATFORM(WPE)
virtual JSGlobalContextRef _javascript_GlobalContext() { return nullptr; }
#endif
Modified: branches/safari-604-branch/Source/WebKit/UIProcess/WebPageProxy.cpp (220787 => 220788)
--- branches/safari-604-branch/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-08-16 07:34:15 UTC (rev 220787)
+++ branches/safari-604-branch/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-08-16 07:49:32 UTC (rev 220788)
@@ -5498,8 +5498,6 @@
#if ENABLE(POINTER_LOCK)
requestPointerUnlock();
#endif
-
- m_avoidsUnsafeArea = true;
}
void WebPageProxy::resetStateAfterProcessExited()
@@ -6934,14 +6932,4 @@
iterator->value->stopTask(*this, taskIdentifier);
}
-void WebPageProxy::setAvoidsUnsafeArea(bool avoidsUnsafeArea)
-{
- if (m_avoidsUnsafeArea == avoidsUnsafeArea)
- return;
-
- m_avoidsUnsafeArea = avoidsUnsafeArea;
-
- m_pageClient.didChangeAvoidsUnsafeArea(avoidsUnsafeArea);
-}
-
} // namespace WebKit
Modified: branches/safari-604-branch/Source/WebKit/UIProcess/WebPageProxy.h (220787 => 220788)
--- branches/safari-604-branch/Source/WebKit/UIProcess/WebPageProxy.h 2017-08-16 07:34:15 UTC (rev 220787)
+++ branches/safari-604-branch/Source/WebKit/UIProcess/WebPageProxy.h 2017-08-16 07:49:32 UTC (rev 220788)
@@ -1200,9 +1200,6 @@
void createSandboxExtensionsIfNeeded(const Vector<String>& files, SandboxExtension::Handle& fileReadHandle, SandboxExtension::HandleArray& fileUploadHandles);
#endif
- void setAvoidsUnsafeArea(bool);
- bool avoidsUnsafeArea() const { return m_avoidsUnsafeArea; }
-
private:
WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
void platformInitialize();
@@ -1999,8 +1996,6 @@
bool m_isUsingHighPerformanceWebGL { false };
- bool m_avoidsUnsafeArea { true };
-
WeakPtrFactory<WebPageProxy> m_weakPtrFactory;
HashMap<String, Ref<WebURLSchemeHandler>> m_urlSchemeHandlersByScheme;
Modified: branches/safari-604-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.h (220787 => 220788)
--- branches/safari-604-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.h 2017-08-16 07:34:15 UTC (rev 220787)
+++ branches/safari-604-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.h 2017-08-16 07:49:32 UTC (rev 220788)
@@ -199,8 +199,6 @@
void handleActiveNowPlayingSessionInfoResponse(bool hasActiveSession, const String& title, double duration, double elapsedTime) override;
- void didChangeAvoidsUnsafeArea(bool avoidsUnsafeArea) override;
-
#if USE(QUICK_LOOK)
void requestPasswordForQuickLookDocument(const String& fileName, WTF::Function<void(const String&)>&&) override;
#endif
Modified: branches/safari-604-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (220787 => 220788)
--- branches/safari-604-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2017-08-16 07:34:15 UTC (rev 220787)
+++ branches/safari-604-branch/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2017-08-16 07:49:32 UTC (rev 220788)
@@ -826,11 +826,6 @@
}
#endif
-void PageClientImpl::didChangeAvoidsUnsafeArea(bool avoidsUnsafeArea)
-{
- [m_webView _didChangeAvoidsUnsafeArea:avoidsUnsafeArea];
-}
-
} // namespace WebKit
#endif // PLATFORM(IOS)
Modified: branches/safari-604-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (220787 => 220788)
--- branches/safari-604-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2017-08-16 07:34:15 UTC (rev 220787)
+++ branches/safari-604-branch/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2017-08-16 07:49:32 UTC (rev 220788)
@@ -372,7 +372,6 @@
void WebPageProxy::didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction& layerTreeTransaction)
{
m_pageExtendedBackgroundColor = layerTreeTransaction.pageExtendedBackgroundColor();
- setAvoidsUnsafeArea(layerTreeTransaction.avoidsUnsafeArea());
if (!m_hasReceivedLayerTreeTransactionAfterDidCommitLoad) {
if (layerTreeTransaction.transactionID() >= m_firstLayerTreeTransactionIdAfterDidCommitLoad) {
Modified: branches/safari-604-branch/Source/WebKit/UIProcess/mac/PageClientImpl.h (220787 => 220788)
--- branches/safari-604-branch/Source/WebKit/UIProcess/mac/PageClientImpl.h 2017-08-16 07:34:15 UTC (rev 220787)
+++ branches/safari-604-branch/Source/WebKit/UIProcess/mac/PageClientImpl.h 2017-08-16 07:49:32 UTC (rev 220788)
@@ -253,8 +253,6 @@
void didRestoreScrollPosition() override;
bool windowIsFrontWindowUnderMouse(const NativeWebMouseEvent&) override;
-
- void didChangeAvoidsUnsafeArea(bool avoidsUnsafeArea) override { }
};
} // namespace WebKit