WebKit Bugzilla
Attachment 343106 Details for
Bug 186822
: [Fullscreen] Page sometimes ends up with an incorrect zoom level after entering fullscreen
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186822-20180619150334.patch (text/plain), 16.02 KB, created by
Jer Noble
on 2018-06-19 15:03:35 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2018-06-19 15:03:35 PDT
Size:
16.02 KB
patch
obsolete
>Subversion Revision: 232855 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index b6f42cae0f98f326762f529234bbe268e72a5356..031129ce93fa81a6c4680ac15ac76f31cf8b5854 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,15 @@ >+2018-06-19 Jer Noble <jer.noble@apple.com> >+ >+ [Fullscreen] Page sometimes ends up with an incorrect zoom level after entering fullscreen >+ https://bugs.webkit.org/show_bug.cgi?id=186822 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * dom/Document.cpp: >+ (WebCore::Document::setShouldOverrideViewportArguments): >+ (WebCore::Document::updateViewportArguments): >+ * dom/Document.h: >+ > 2018-06-15 Jer Noble <jer.noble@apple.com> > > Address fullscreen api CSS env feedback >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 72f6f9f7806427cb20bcdd7269176d56a94ddba9..bcf540071583bc5cccb8954ca64b6a31322dcdf6 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,33 @@ >+2018-06-19 Jer Noble <jer.noble@apple.com> >+ >+ [Fullscreen] Page sometimes ends up with an incorrect zoom level after entering fullscreen >+ https://bugs.webkit.org/show_bug.cgi?id=186822 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Set the minimum zoom, maximum zoom, zoom bouncing, and user scalability settings of the >+ WKWebView's UIScrollView upon entering fullscreen, and restore those same settings upon >+ exit. Override the viewport arguments upon entering fullscreen, restore them upon exit. >+ >+ * Platform/IPC/ArgumentCoder.h: >+ * Shared/WebCoreArgumentCoders.cpp: >+ (IPC::ArgumentCoder<ViewportArguments>::decode): >+ * Shared/WebCoreArgumentCoders.h: >+ * UIProcess/WebPageProxy.h: >+ (WebKit::WebPageProxy::forceAlwaysUserScalable const): >+ * UIProcess/ios/WebPageProxyIOS.mm: >+ (WebKit::WebPageProxy::setShouldOverrideViewportArguments): >+ * UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: >+ (WebKit::WKWebViewState::applyTo): >+ (WebKit::WKWebViewState::store): >+ (-[WKFullScreenWindowController enterFullScreen]): >+ (-[WKFullScreenWindowController beganExitFullScreenWithInitialFrame:finalFrame:]): >+ * WebProcess/WebPage/WebPage.h: >+ (WebKit::WebPage::forceAlwaysUserScalable const): >+ * WebProcess/WebPage/WebPage.messages.in: >+ * WebProcess/WebPage/ios/WebPageIOS.mm: >+ (WebKit::WebPage::setShouldOverrideViewportArguments): >+ > 2018-06-15 Jer Noble <jer.noble@apple.com> > > Address fullscreen api CSS env feedback >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index 2cf488e24a76b47656c488fea9697d05dd7858bf..5320719f42aa319cfa2458e1f9e6aa1ffd050cdb 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -3425,6 +3425,15 @@ void Document::dispatchDisabledAdaptationsDidChangeForMainFrame() > page()->chrome().dispatchDisabledAdaptationsDidChange(m_disabledAdaptations); > } > >+void Document::setShouldOverrideViewportArguments(const std::optional<ViewportArguments>& viewportArguments) >+{ >+ if (viewportArguments == m_overrideViewportArguments) >+ return; >+ >+ m_overrideViewportArguments = viewportArguments; >+ updateViewportArguments(); >+} >+ > void Document::processViewport(const String& features, ViewportArguments::Type origin) > { > ASSERT(!features.isNull()); >@@ -3451,7 +3460,7 @@ void Document::updateViewportArguments() > #ifndef NDEBUG > m_didDispatchViewportPropertiesChanged = true; > #endif >- page()->chrome().dispatchViewportPropertiesDidChange(m_viewportArguments); >+ page()->chrome().dispatchViewportPropertiesDidChange(m_overrideViewportArguments ? m_overrideViewportArguments.value() : m_viewportArguments); > page()->chrome().didReceiveDocType(*frame()); > } > } >diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h >index 21b205d66a32ec0ed03546fa37e0eeec8643fec5..36ff18cb2a302e34b4e8061c56cc51311e8e3f9c 100644 >--- a/Source/WebCore/dom/Document.h >+++ b/Source/WebCore/dom/Document.h >@@ -391,6 +391,9 @@ public: > > void setViewportArguments(const ViewportArguments& viewportArguments) { m_viewportArguments = viewportArguments; } > ViewportArguments viewportArguments() const { return m_viewportArguments; } >+ >+ WEBCORE_EXPORT void setShouldOverrideViewportArguments(const std::optional<ViewportArguments>&); >+ > OptionSet<DisabledAdaptations> disabledAdaptations() const { return m_disabledAdaptations; } > #ifndef NDEBUG > bool didDispatchViewportPropertiesChanged() const { return m_didDispatchViewportPropertiesChanged; } >@@ -1719,6 +1722,7 @@ private: > Timer m_loadEventDelayTimer; > > ViewportArguments m_viewportArguments; >+ std::optional<ViewportArguments> m_overrideViewportArguments; > OptionSet<DisabledAdaptations> m_disabledAdaptations; > > DocumentTiming m_documentTiming; >diff --git a/Source/WebKit/Platform/IPC/ArgumentCoder.h b/Source/WebKit/Platform/IPC/ArgumentCoder.h >index 5ab08afca4d1d269ab26e26a7c3bfa92e69f4444..9ecfdae070c4134ddead8c9c237b72d2633717ff 100644 >--- a/Source/WebKit/Platform/IPC/ArgumentCoder.h >+++ b/Source/WebKit/Platform/IPC/ArgumentCoder.h >@@ -31,6 +31,7 @@ namespace WebCore { > class IntConstraint; > class DoubleConstraint; > class ResourceResponse; >+struct ViewportArguments; > } > > namespace IPC { >diff --git a/Source/WebKit/Shared/WebCoreArgumentCoders.cpp b/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >index c926508e47c68817e3d571774f368b490edeb55e..71287ef08c923c6b16c1c933b7b16a68cf2fae52 100644 >--- a/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >+++ b/Source/WebKit/Shared/WebCoreArgumentCoders.cpp >@@ -659,6 +659,14 @@ bool ArgumentCoder<ViewportArguments>::decode(Decoder& decoder, ViewportArgument > { > return SimpleArgumentCoder<ViewportArguments>::decode(decoder, viewportArguments); > } >+ >+std::optional<ViewportArguments> ArgumentCoder<ViewportArguments>::decode(Decoder& decoder) >+{ >+ ViewportArguments viewportArguments; >+ if (!SimpleArgumentCoder<ViewportArguments>::decode(decoder, viewportArguments)) >+ return std::nullopt; >+ return WTFMove(viewportArguments); >+} > #endif // PLATFORM(IOS) > > >diff --git a/Source/WebKit/Shared/WebCoreArgumentCoders.h b/Source/WebKit/Shared/WebCoreArgumentCoders.h >index edabab6625d0839dc13b3564868d33dbadf2e70c..6218b88df54b5bb4da2e35b7c83db0a339d461c4 100644 >--- a/Source/WebKit/Shared/WebCoreArgumentCoders.h >+++ b/Source/WebKit/Shared/WebCoreArgumentCoders.h >@@ -267,6 +267,7 @@ template<> struct ArgumentCoder<WebCore::FloatQuad> { > template<> struct ArgumentCoder<WebCore::ViewportArguments> { > static void encode(Encoder&, const WebCore::ViewportArguments&); > static bool decode(Decoder&, WebCore::ViewportArguments&); >+ static std::optional<WebCore::ViewportArguments> decode(Decoder&); > }; > #endif // PLATFORM(IOS) > >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index b1050c940971a8fe896d1fea0c0f4d54e938148c..56cba4784b0137493c821e53faaddc70d49cac0e 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -560,6 +560,7 @@ public: > void setMaximumUnobscuredSize(const WebCore::FloatSize&); > void setDeviceOrientation(int32_t); > int32_t deviceOrientation() const { return m_deviceOrientation; } >+ void setShouldOverrideViewportArguments(const std::optional<WebCore::ViewportArguments>&); > void willCommitLayerTree(uint64_t transactionID); > > void selectWithGesture(const WebCore::IntPoint, WebCore::TextGranularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithAssistedNode, WTF::Function<void (const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t, CallbackBase::Error)>&&); >@@ -606,6 +607,7 @@ public: > void getSelectionContext(WTF::Function<void(const String&, const String&, const String&, CallbackBase::Error)>&&); > void handleTwoFingerTapAtPoint(const WebCore::IntPoint&, uint64_t requestID); > void setForceAlwaysUserScalable(bool); >+ bool forceAlwaysUserScalable() const { return m_forceAlwaysUserScalable; } > void setIsScrollingOrZooming(bool); > void requestRectsForGranularityWithSelectionOffset(WebCore::TextGranularity, uint32_t offset, WTF::Function<void(const Vector<WebCore::SelectionRect>&, CallbackBase::Error)>&&); > void requestRectsAtSelectionOffsetWithText(int32_t offset, const String&, WTF::Function<void(const Vector<WebCore::SelectionRect>&, CallbackBase::Error)>&&); >diff --git a/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm b/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >index fe0c737d7e5c509174799054db69f8ed7162cf79..7aaa396a938209e9176dda038827c7a83a4e9559 100644 >--- a/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >+++ b/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >@@ -354,6 +354,12 @@ void WebPageProxy::setDeviceOrientation(int32_t deviceOrientation) > } > } > >+void WebPageProxy::setShouldOverrideViewportArguments(const std::optional<ViewportArguments>& viewportArguments) >+{ >+ if (isValid()) >+ m_process->send(Messages::WebPage::SetShouldOverrideViewportArguments(viewportArguments), m_pageID); >+} >+ > static bool exceedsRenderTreeSizeSizeThreshold(uint64_t thresholdSize, uint64_t committedSize) > { > const double thesholdSizeFraction = 0.5; // Empirically-derived. >diff --git a/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm b/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm >index aa4f5cf5a11f943cb745d943e26731803c81a253..f0090a3159ab22f9f341232f8129eba76f0aeaa5 100644 >--- a/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm >+++ b/Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm >@@ -44,6 +44,7 @@ > #import <WebCore/GeometryUtilities.h> > #import <WebCore/IntRect.h> > #import <WebCore/LocalizedStrings.h> >+#import <WebCore/ViewportArguments.h> > #import <WebCore/WebCoreNSURLExtras.h> > #import <pal/spi/cf/CFNetworkSPI.h> > #import <pal/spi/cocoa/NSStringSPI.h> >@@ -95,6 +96,10 @@ struct WKWebViewState { > UIEdgeInsets _savedObscuredInsets = UIEdgeInsetsZero; > UIEdgeInsets _savedScrollIndicatorInsets = UIEdgeInsetsZero; > CGPoint _savedContentOffset = CGPointZero; >+ CGFloat _savedMinimumZoomScale = 1; >+ CGFloat _savedMaximumZoomScale = 1; >+ BOOL _savedBouncesZoom = NO; >+ BOOL _savedForceAlwaysUserScalable = NO; > > void applyTo(WKWebView* webView) > { >@@ -104,8 +109,12 @@ struct WKWebViewState { > [[webView scrollView] setContentOffset:_savedContentOffset]; > [[webView scrollView] setScrollIndicatorInsets:_savedScrollIndicatorInsets]; > [webView _page]->setTopContentInset(_savedTopContentInset); >+ [webView _page]->setForceAlwaysUserScalable(_savedForceAlwaysUserScalable); > [webView _setViewScale:_savedViewScale]; > [[webView scrollView] setZoomScale:_savedZoomScale]; >+ webView.scrollView.minimumZoomScale = _savedMinimumZoomScale; >+ webView.scrollView.maximumZoomScale = _savedMaximumZoomScale; >+ webView.scrollView.bouncesZoom = _savedBouncesZoom; > } > > void store(WKWebView* webView) >@@ -116,8 +125,12 @@ struct WKWebViewState { > _savedContentOffset = [[webView scrollView] contentOffset]; > _savedScrollIndicatorInsets = [[webView scrollView] scrollIndicatorInsets]; > _savedTopContentInset = [webView _page]->topContentInset(); >+ _savedForceAlwaysUserScalable = [webView _page]->forceAlwaysUserScalable(); > _savedViewScale = [webView _viewScale]; > _savedZoomScale = [[webView scrollView] zoomScale]; >+ _savedMinimumZoomScale = webView.scrollView.minimumZoomScale; >+ _savedMaximumZoomScale = webView.scrollView.maximumZoomScale; >+ _savedBouncesZoom = webView.scrollView.bouncesZoom; > } > }; > >@@ -494,6 +507,13 @@ - (void)enterFullScreen > > [self _manager]->setAnimatingFullScreen(true); > >+ ViewportArguments arguments { ViewportArguments::CSSDeviceAdaptation }; >+ arguments.zoom = 1; >+ arguments.minZoom = 1; >+ arguments.maxZoom = 1; >+ arguments.userZoom = 1; >+ [webView _page]->setShouldOverrideViewportArguments(arguments); >+ > _repaintCallback = VoidCallback::create([protectedSelf = retainPtr(self), self](WebKit::CallbackBase::Error) { > _repaintCallback = nullptr; > if (auto* manager = [protectedSelf _manager]) { >@@ -628,6 +648,7 @@ - (void)_completedExitFullScreen > [webView becomeFirstResponder]; > > _viewState.applyTo(webView.get()); >+ [webView _page]->setShouldOverrideViewportArguments(std::nullopt); > > [webView setNeedsLayout]; > [webView layoutIfNeeded]; >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index db22c16979d3c6da22c5f0e8313bb00bb3263da5..c7b5e6c5a8632209bd3bdbe2ace9fdf4d190bf89 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -657,7 +657,8 @@ public: > > void enableInspectorNodeSearch(); > void disableInspectorNodeSearch(); >- >+ >+ bool forceAlwaysUserScalable() const { return m_forceAlwaysUserScalable; } > void setForceAlwaysUserScalable(bool); > #endif > >@@ -890,6 +891,7 @@ public: > void setViewportConfigurationViewLayoutSize(const WebCore::FloatSize&); > void setMaximumUnobscuredSize(const WebCore::FloatSize&); > void setDeviceOrientation(int32_t); >+ void setShouldOverrideViewportArguments(const std::optional<WebCore::ViewportArguments>&); > void dynamicViewportSizeUpdate(const WebCore::FloatSize& viewLayoutSize, const WebCore::FloatSize& maximumUnobscuredSize, const WebCore::FloatRect& targetExposedContentRect, const WebCore::FloatRect& targetUnobscuredRect, const WebCore::FloatRect& targetUnobscuredRectInScrollViewCoordinates, const WebCore::FloatBoxExtent& targetUnobscuredSafeAreaInsets, double scale, int32_t deviceOrientation, DynamicViewportSizeUpdateID); > std::optional<float> scaleFromUIProcess(const VisibleContentRectUpdateInfo&) const; > void updateVisibleContentRects(const VisibleContentRectUpdateInfo&, MonotonicTime oldestTimestamp); >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >index 5e96a7be95fb43623bcf114af6f01e247a969eaa..0397b47f429421f6141ddd507f2615e2a5c422c3 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >@@ -48,6 +48,7 @@ messages -> WebPage LegacyReceiver { > SetViewportConfigurationViewLayoutSize(WebCore::FloatSize size) > SetMaximumUnobscuredSize(WebCore::FloatSize size) > SetDeviceOrientation(int32_t deviceOrientation) >+ SetShouldOverrideViewportArguments(std::optional<WebCore::ViewportArguments> arguments) > DynamicViewportSizeUpdate(WebCore::FloatSize viewLayoutSize, WebCore::FloatSize maximumUnobscuredSize, WebCore::FloatRect targetExposedContentRect, WebCore::FloatRect targetUnobscuredRect, WebCore::FloatRect targetUnobscuredRectInScrollViewCoordinates, WebCore::RectEdges<float> targetUnobscuredSafeAreaInsets, double scale, int32_t deviceOrientation, uint64_t dynamicViewportSizeUpdateID) > > HandleTap(WebCore::IntPoint point, uint64_t lastLayerTreeTransactionId) >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index 8b5d37c4268cf0522d12f7b5eaaafa41df8b7140..a689ead736b3e13dca5aa364bed32053710e7602 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -2478,6 +2478,12 @@ void WebPage::setDeviceOrientation(int32_t deviceOrientation) > m_page->mainFrame().orientationChanged(); > } > >+void WebPage::setShouldOverrideViewportArguments(const std::optional<WebCore::ViewportArguments>& arguments) >+{ >+ if (auto* document = m_page->mainFrame().document()) >+ document->setShouldOverrideViewportArguments(arguments); >+} >+ > // WebCore stores the page scale factor as float instead of double. When we get a scale from WebCore, > // we need to ignore differences that are within a small rounding error on floats. > static inline bool areEssentiallyEqualAsFloat(float a, float b)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186822
:
343106
|
343219
|
343244