WebKit Bugzilla
Attachment 343244 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-20180621104022.patch (text/plain), 15.94 KB, created by
Jer Noble
on 2018-06-21 10:40:23 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Jer Noble
Created:
2018-06-21 10:40:23 PDT
Size:
15.94 KB
patch
obsolete
>Subversion Revision: 233032 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index cd91df00b26bd848bf7d9adbec9ead7e99361345..48338bbd6f9dc4226407d1d46e0169f8e19befc7 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::setOverrideViewportArguments): >+ (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 8260383d7818215fe18a85ce54817e7a6434e492..1432150d45064bab35777a803156d4a2e1944b5a 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::setOverrideViewportArguments): >+ * 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::setOverrideViewportArguments): >+ > 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..36ddf004c5ea01255b93efea98e1054e9fc8454a 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::setOverrideViewportArguments(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 b007817380ddf64cf0a2adca6fb346a2a8487d02..fdd1b63477eeb2105e1db60aaa2678c5948390eb 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 setOverrideViewportArguments(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..49b21c5ae6b6e5e08fc1812eb71d1d098fd764fe 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 setOverrideViewportArguments(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..f31515cbe8e4fd420675061c717ada3ae6983e12 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::setOverrideViewportArguments(const std::optional<ViewportArguments>& viewportArguments) >+{ >+ if (isValid()) >+ m_process->send(Messages::WebPage::SetOverrideViewportArguments(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..d5c4d4c31081549ebf9cc0dcc0b3d6a0e9e2d0d8 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]->setOverrideViewportArguments(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]->setOverrideViewportArguments(std::nullopt); > > [webView setNeedsLayout]; > [webView layoutIfNeeded]; >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 40d3af8f76728978675434c88bfcd86f51ddfadb..32555c612361402a0071fde79a10386a3971d9b1 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 setOverrideViewportArguments(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..686dafa41655f0441168220f095324795954c6b2 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) >+ SetOverrideViewportArguments(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 72f38113ea23cb10a8f46faca8c283f827f4b0be..c31f592eed71adc2285181951934cf8e72ee6f88 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -2484,6 +2484,12 @@ void WebPage::setDeviceOrientation(int32_t deviceOrientation) > m_page->mainFrame().orientationChanged(); > } > >+void WebPage::setOverrideViewportArguments(const std::optional<WebCore::ViewportArguments>& arguments) >+{ >+ if (auto* document = m_page->mainFrame().document()) >+ document->setOverrideViewportArguments(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