https://bugs.webkit.org/show_bug.cgi?id=170766
<rdar://problem/
31564634>
Reviewed by Beth Dakin.
Tests: tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles.html,
tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles.html,
* dom/ViewportArguments.cpp:
(WebCore::ViewportArguments::resolve):
(WebCore::setViewportFeature):
* dom/ViewportArguments.h:
(WebCore::ViewportArguments::operator==):
* page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::updateConfiguration):
(WebCore::operator<<):
(WebCore::ViewportConfiguration::description):
* page/ViewportConfiguration.h:
(WebCore::ViewportConfiguration::Parameters::Parameters):
(WebCore::ViewportConfiguration::clipToSafeArea):
Add viewport parameter.
* page/ChromeClient.h:
* page/FrameView.h:
* page/FrameView.cpp:
(WebCore::FrameView::enableSpeculativeTilingIfNeeded):
If not clipping to the safe area, enable "speculative" tiling immediately,
because the margin tiles can be visible immediately.
(WebCore::FrameView::hasExtendedBackgroundRectForPainting):
(WebCore::FrameView::updateTilesForExtendedBackgroundMode):
Don't check the setting here; just respect the mode that is computed
by calculateExtendedBackgroundMode.
(WebCore::FrameView::calculateExtendedBackgroundMode):
If the viewport parameter was set, add margin tiles on both axes.
(WebCore::FrameView::setClipToSafeArea):
Notify ChromeClient of the change, and re-compute the margin tile mode.
* rendering/RenderLayerCompositor.h:
* rendering/RenderLayerCompositor.cpp:
Factor out code that decides whether the content layer clips to bounds,
and make it take the new viewport parameter into account.
* rendering/RenderObject.cpp:
Don't clip RenderView repaints to RenderView's GraphicsLayer bounds if
clip-to-safe-area is off, just like we do for slow-repaint objects in
extended background mode.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::resetState):
(WebKit::WebPageProxy::setClipToSafeArea):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::clipToSafeArea):
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::didChangeClipToSafeArea):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/PageClient.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::didChangeClipToSafeArea):
* UIProcess/mac/PageClientImpl.h:
Forward clip-to-safe-area changes from ChromeClient to WKWebView.
Update visible content rects when it changes, which will
result in a call to updateFixedClippingView, as below.
Keep track of the current state in the UI process.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _contentMayDrawInObscuredInsets]):
Expose the current state of the clip-to-safe-area bit as SPI.
* UIProcess/ios/WKContentView.mm:
(-[WKContentView updateFixedClippingView:]):
Disable fixed clipping when clip-to-safe-area is disabled.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::viewportConfigurationChanged):
Push the viewport's clip-to-safe-area bit onto the main frame's FrameView.
* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::setObscuredInsets):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::setObscuredInsets):
* TestRunnerShared/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::setObscuredInsets):
Add a UIScriptController mechanism to install obscured insets
on the web view.
* tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles-expected.txt: Added.
* tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles.html: Added.
* tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles-expected.txt: Added.
* tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215425
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-04-17 Tim Horton <timothy_horton@apple.com>
+
+ Provide a viewport parameter to disable clipping to the safe area
+ https://bugs.webkit.org/show_bug.cgi?id=170766
+ <rdar://problem/31564634>
+
+ Reviewed by Beth Dakin.
+
+ * tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles-expected.txt: Added.
+ * tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles.html: Added.
+ * tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles-expected.txt: Added.
+ * tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles.html: Added.
+
2017-04-14 Jiewen Tan <jiewen_tan@apple.com>
[WebCrypto] Add support for ECDSA
--- /dev/null
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 320.00 548.00)
+ (visible rect 0.00, 0.00 280.00 x 538.00)
+ (coverage rect -40.00, -10.00 320.00 x 548.00)
+ (intersects coverage rect 1)
+ (contentsScale 2.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 320.00 548.00)
+ (contentsOpaque 1)
+ (visible rect 0.00, 0.00 280.00 x 538.00)
+ (coverage rect -40.00, -10.00 576.00 x 804.00)
+ (intersects coverage rect 1)
+ (contentsScale 2.00)
+ (tile cache coverage -512, -512 1344 x 1572)
+ (tile size 512 x 548)
+ (top left tile -1, -1 tiles grid 3 x 3)
+ (in window 1)
+ )
+ )
+)
+
--- /dev/null
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+ <meta name="viewport" content="initial-scale=1, clip-to-safe-area=no">
+ <script>
+ function getUIScript()
+ {
+ return `
+ (function() {
+ uiController.setObscuredInsets(10, 20, 30, 40);
+ uiController.immediateScrollToOffset(-40, -10);
+ uiController.doAfterVisibleContentRectUpdate(function () {
+ uiController.uiScriptComplete();
+ })
+ })();`
+ }
+
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ function doTest()
+ {
+ testRunner.runUIScript(getUIScript(), function(result) {
+ if (window.internals) {
+ document.getElementById('layers').innerText = internals.layerTreeAsText(document,
+ internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS | internals.LAYER_TREE_INCLUDES_TILE_CACHES);
+ }
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+ });
+ }
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+
+<body>
+<pre id="layers">Layer tree goes here</p>
+</body>
+</html>
--- /dev/null
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 320.00 548.00)
+ (visible rect 0.00, 0.00 280.00 x 538.00)
+ (coverage rect 0.00, 0.00 280.00 x 538.00)
+ (intersects coverage rect 1)
+ (contentsScale 2.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 320.00 548.00)
+ (contentsOpaque 1)
+ (visible rect 0.00, 0.00 280.00 x 538.00)
+ (coverage rect 0.00, 0.00 280.00 x 538.00)
+ (intersects coverage rect 1)
+ (contentsScale 2.00)
+ (tile cache coverage 0, 0 320 x 548)
+ (tile size 512 x 548)
+ (top left tile 0, 0 tiles grid 1 x 1)
+ (in window 1)
+ )
+ )
+)
+
--- /dev/null
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+ <meta name="viewport" content="initial-scale=1, clip-to-safe-area=yes">
+ <script>
+ function getUIScript()
+ {
+ return `
+ (function() {
+ uiController.setObscuredInsets(10, 20, 30, 40);
+ uiController.immediateScrollToOffset(-40, -10);
+ uiController.doAfterVisibleContentRectUpdate(function () {
+ uiController.uiScriptComplete();
+ })
+ })();`
+ }
+
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ function doTest()
+ {
+ testRunner.runUIScript(getUIScript(), function(result) {
+ if (window.internals) {
+ document.getElementById('layers').innerText = internals.layerTreeAsText(document,
+ internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS | internals.LAYER_TREE_INCLUDES_TILE_CACHES);
+ }
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+ });
+ }
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+
+<body>
+<pre id="layers">Layer tree goes here</p>
+</body>
+</html>
+2017-04-17 Tim Horton <timothy_horton@apple.com>
+
+ Provide a viewport parameter to disable clipping to the safe area
+ https://bugs.webkit.org/show_bug.cgi?id=170766
+ <rdar://problem/31564634>
+
+ Reviewed by Beth Dakin.
+
+ Tests: tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles.html,
+ tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles.html,
+
+ * dom/ViewportArguments.cpp:
+ (WebCore::ViewportArguments::resolve):
+ (WebCore::setViewportFeature):
+ * dom/ViewportArguments.h:
+ (WebCore::ViewportArguments::operator==):
+ * page/ViewportConfiguration.cpp:
+ (WebCore::ViewportConfiguration::updateConfiguration):
+ (WebCore::operator<<):
+ (WebCore::ViewportConfiguration::description):
+ * page/ViewportConfiguration.h:
+ (WebCore::ViewportConfiguration::Parameters::Parameters):
+ (WebCore::ViewportConfiguration::clipToSafeArea):
+ Add viewport parameter.
+
+ * page/ChromeClient.h:
+ * page/FrameView.h:
+ * page/FrameView.cpp:
+ (WebCore::FrameView::enableSpeculativeTilingIfNeeded):
+ If not clipping to the safe area, enable "speculative" tiling immediately,
+ because the margin tiles can be visible immediately.
+
+ (WebCore::FrameView::hasExtendedBackgroundRectForPainting):
+ (WebCore::FrameView::updateTilesForExtendedBackgroundMode):
+ Don't check the setting here; just respect the mode that is computed
+ by calculateExtendedBackgroundMode.
+
+ (WebCore::FrameView::calculateExtendedBackgroundMode):
+ If the viewport parameter was set, add margin tiles on both axes.
+
+ (WebCore::FrameView::setClipToSafeArea):
+ Notify ChromeClient of the change, and re-compute the margin tile mode.
+
+ * rendering/RenderLayerCompositor.h:
+ * rendering/RenderLayerCompositor.cpp:
+ Factor out code that decides whether the content layer clips to bounds,
+ and make it take the new viewport parameter into account.
+
+ * rendering/RenderObject.cpp:
+ Don't clip RenderView repaints to RenderView's GraphicsLayer bounds if
+ clip-to-safe-area is off, just like we do for slow-repaint objects in
+ extended background mode.
+
2017-04-17 Dan Bernstein <mitz@apple.com>
[Cocoa] Move isNullFunctionPointer down into WTF
result.userScalable = userZoom;
result.orientation = orientation;
result.shrinkToFit = shrinkToFit;
+ result.clipToSafeArea = clipToSafeArea;
return result;
}
return numericValue;
}
-// FIXME: It's kind of bizarre to use floating point values of 1 and 0 to represent true and false.
-static float findBooleanValue(Document& document, StringView key, StringView value)
+static bool findBooleanValue(Document& document, StringView key, StringView value)
{
// yes and no are used as keywords.
// Numbers >= 1, numbers <= -1, device-width and device-height are mapped to yes.
// Numbers in the range <-1, 1>, and unknown values, are mapped to no.
if (equalLettersIgnoringASCIICase(value, "yes"))
- return 1;
+ return true;
if (equalLettersIgnoringASCIICase(value, "no"))
- return 0;
+ return false;
if (equalLettersIgnoringASCIICase(value, "device-width"))
- return 1;
+ return true;
if (equalLettersIgnoringASCIICase(value, "device-height"))
- return 1;
- return std::abs(numericPrefix(document, key, value)) >= 1 ? 1 : 0;
+ return true;
+ return std::abs(numericPrefix(document, key, value)) >= 1;
}
void setViewportFeature(ViewportArguments& arguments, Document& document, StringView key, StringView value)
#endif
else if (equalLettersIgnoringASCIICase(key, "shrink-to-fit"))
arguments.shrinkToFit = findBooleanValue(document, key, value);
+ else if (equalLettersIgnoringASCIICase(key, "clip-to-safe-area"))
+ arguments.clipToSafeArea = findBooleanValue(document, key, value);
else
reportViewportWarning(document, UnrecognizedViewportArgumentKeyError, key);
}
float userScalable;
float orientation;
float shrinkToFit;
+ bool clipToSafeArea;
};
struct ViewportArguments {
float userZoom { ValueAuto };
float orientation { ValueAuto };
float shrinkToFit { ValueAuto };
+ bool clipToSafeArea { true };
bool widthWasExplicit { false };
bool operator==(const ViewportArguments& other) const
&& userZoom == other.userZoom
&& orientation == other.orientation
&& shrinkToFit == other.shrinkToFit
+ && clipToSafeArea == other.clipToSafeArea
&& widthWasExplicit == other.widthWasExplicit;
}
virtual void reportProcessCPUTime(int64_t, ActivityStateForCPUSampling) { }
virtual RefPtr<Icon> createIconForFiles(const Vector<String>& /* filenames */) = 0;
+ virtual void didChangeClipToSafeArea(bool) { }
+
protected:
virtual ~ChromeClient() { }
};
m_speculativeTilingEnabled = true;
return;
}
+ if (!m_clipToSafeArea) {
+ m_speculativeTilingEnabled = true;
+ return;
+ }
if (!shouldEnableSpeculativeTilingDuringLoading(*this))
return;
bool FrameView::hasExtendedBackgroundRectForPainting() const
{
- if (!frame().settings().backgroundShouldExtendBeyondPage())
- return false;
-
TiledBacking* tiledBacking = this->tiledBacking();
if (!tiledBacking)
return false;
FrameView::ExtendedBackgroundMode FrameView::calculateExtendedBackgroundMode() const
{
- // Just because Settings::backgroundShouldExtendBeyondPage() is true does not necessarily mean
- // that the background rect needs to be extended for painting. Simple backgrounds can be extended
- // just with RenderLayerCompositor::setRootExtendedBackgroundColor(). More complicated backgrounds,
- // such as images, require extending the background rect to continue painting into the extended
- // region. This function finds out if it is necessary to extend the background rect for painting.
+ if (!m_clipToSafeArea)
+ return ExtendedBackgroundModeAll;
#if PLATFORM(IOS)
// <rdar://problem/16201373>
if (!frame().settings().backgroundShouldExtendBeyondPage())
return ExtendedBackgroundModeNone;
+ // Just because Settings::backgroundShouldExtendBeyondPage() is true does not necessarily mean
+ // that the background rect needs to be extended for painting. Simple backgrounds can be extended
+ // just with RenderLayerCompositor::setRootExtendedBackgroundColor(). More complicated backgrounds,
+ // such as images, require extending the background rect to continue painting into the extended
+ // region. This function finds out if it is necessary to extend the background rect for painting.
+
if (!frame().isMainFrame())
return ExtendedBackgroundModeNone;
void FrameView::updateTilesForExtendedBackgroundMode(ExtendedBackgroundMode mode)
{
- if (!frame().settings().backgroundShouldExtendBeyondPage())
- return;
-
RenderView* renderView = this->renderView();
if (!renderView)
return;
return snappedIntRect(extendedRect);
}
+void FrameView::setClipToSafeArea(bool clipToSafeArea)
+{
+ if (!frame().isMainFrame())
+ return;
+
+ if (m_clipToSafeArea == clipToSafeArea)
+ return;
+
+ m_clipToSafeArea = clipToSafeArea;
+
+ if (Page* page = frame().page())
+ page->chrome().client().didChangeClipToSafeArea(clipToSafeArea);
+
+ updateExtendBackgroundIfNecessary();
+ adjustTiledBackingCoverage();
+
+ RenderView* renderView = this->renderView();
+ if (!renderView)
+ return;
+
+ RenderLayerCompositor& compositor = renderView->compositor();
+ compositor.updateRootContentLayerClipping();
+}
+
bool FrameView::shouldUpdateWhileOffscreen() const
{
return m_shouldUpdateWhileOffscreen;
bool hasExtendedBackgroundRectForPainting() const;
IntRect extendedBackgroundRectForPainting() const;
+ bool clipToSafeArea() const { return m_clipToSafeArea; }
+ WEBCORE_EXPORT void setClipToSafeArea(bool);
+
bool shouldUpdateWhileOffscreen() const;
WEBCORE_EXPORT void setShouldUpdateWhileOffscreen(bool);
bool shouldUpdate() const;
bool m_needsDeferredScrollbarsUpdate { false };
+ bool m_clipToSafeArea { true };
+
RefPtr<ContainerNode> m_maintainScrollPositionAnchor;
// Renderer to hold our custom scroll corner.
if (booleanViewportArgumentIsSet(m_viewportArguments.shrinkToFit))
m_configuration.allowsShrinkToFit = m_viewportArguments.shrinkToFit != 0.;
+
+ if (booleanViewportArgumentIsSet(m_viewportArguments.clipToSafeArea))
+ m_configuration.clipToSafeArea = m_viewportArguments.clipToSafeArea;
}
double ViewportConfiguration::viewportArgumentsLength(double length) const
ts.dumpProperty("maximumScale", parameters.maximumScale);
ts.dumpProperty("allowsUserScaling", parameters.allowsUserScaling);
ts.dumpProperty("allowsShrinkToFit", parameters.allowsShrinkToFit);
+ ts.dumpProperty("clipToSafeArea", parameters.clipToSafeArea);
return ts;
}
ts.dumpProperty("computed layout size", layoutSize());
ts.dumpProperty("ignoring horizontal scaling constraints", shouldIgnoreHorizontalScalingConstraints() ? "true" : "false");
ts.dumpProperty("ignoring vertical scaling constraints", shouldIgnoreVerticalScalingConstraints() ? "true" : "false");
+ ts.dumpProperty("clip to safe area", clipToSafeArea() ? "true" : "false");
ts.endGroup();
, maximumScale(0)
, allowsUserScaling(false)
, allowsShrinkToFit(false)
+ , clipToSafeArea(true)
, widthIsSet(false)
, heightIsSet(false)
, initialScaleIsSet(false)
double maximumScale;
bool allowsUserScaling;
bool allowsShrinkToFit;
+ bool clipToSafeArea;
bool widthIsSet;
bool heightIsSet;
WEBCORE_EXPORT bool allowsUserScaling() const;
WEBCORE_EXPORT bool allowsUserScalingIgnoringAlwaysScalable() const;
bool allowsShrinkToFit() const;
+ bool clipToSafeArea() const { return m_configuration.clipToSafeArea; }
WEBCORE_EXPORT static Parameters webpageParameters();
WEBCORE_EXPORT static Parameters textDocumentParameters();
return *renderer;
}
+void RenderLayerCompositor::updateRootContentLayerClipping()
+{
+ m_rootContentLayer->setMasksToBounds(!m_renderView.settings().backgroundShouldExtendBeyondPage() && m_renderView.frameView().clipToSafeArea());
+}
+
bool RenderLayerCompositor::updateBacking(RenderLayer& layer, CompositingChangeRepaint shouldRepaint, BackingRequired backingRequired)
{
bool layerChanged = false;
updateLayerForHeader(page().headerHeight());
updateLayerForFooter(page().footerHeight());
#endif
- if (m_renderView.settings().backgroundShouldExtendBeyondPage())
- m_rootContentLayer->setMasksToBounds(false);
+ updateRootContentLayerClipping();
if (TiledBacking* tiledBacking = layer.backing()->tiledBacking())
tiledBacking->setTopContentInset(m_renderView.frameView().topContentInset());
#endif
// Need to clip to prevent transformed content showing outside this frame
- m_rootContentLayer->setMasksToBounds(true);
+ updateRootContentLayerClipping();
}
if (requiresScrollLayer(expectedAttachment)) {
void setRootExtendedBackgroundColor(const Color&);
const Color& rootExtendedBackgroundColor() const { return m_rootExtendedBackgroundColor; }
+ void updateRootContentLayerClipping();
+
#if ENABLE(CSS_SCROLL_SNAP)
void updateScrollSnapPropertiesWithFrameView(const FrameView&);
#endif
view.repaintViewRectangle(rect);
return;
}
+
+ if (!view.frameView().clipToSafeArea())
+ shouldClipToLayer = false;
}
if (view().usesCompositing()) {
+2017-04-17 Tim Horton <timothy_horton@apple.com>
+
+ Provide a viewport parameter to disable clipping to the safe area
+ https://bugs.webkit.org/show_bug.cgi?id=170766
+ <rdar://problem/31564634>
+
+ Reviewed by Beth Dakin.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::resetState):
+ (WebKit::WebPageProxy::setClipToSafeArea):
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::clipToSafeArea):
+ * UIProcess/WebPageProxy.messages.in:
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::didChangeClipToSafeArea):
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+ * UIProcess/API/gtk/PageClientImpl.h:
+ * UIProcess/PageClient.h:
+ * UIProcess/ios/PageClientImplIOS.h:
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::didChangeClipToSafeArea):
+ * UIProcess/mac/PageClientImpl.h:
+ Forward clip-to-safe-area changes from ChromeClient to WKWebView.
+ Update visible content rects when it changes, which will
+ result in a call to updateFixedClippingView, as below.
+ Keep track of the current state in the UI process.
+
+ * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _contentMayDrawInObscuredInsets]):
+ Expose the current state of the clip-to-safe-area bit as SPI.
+
+ * UIProcess/ios/WKContentView.mm:
+ (-[WKContentView updateFixedClippingView:]):
+ Disable fixed clipping when clip-to-safe-area is disabled.
+
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::viewportConfigurationChanged):
+ Push the viewport's clip-to-safe-area bit onto the main frame's FrameView.
+
2017-04-17 Dan Bernstein <mitz@apple.com>
[Cocoa] Move isNullFunctionPointer down into WTF
return _page->isShowingNavigationGestureSnapshot();
}
+- (BOOL)_contentMayDrawInObscuredInsets
+{
+ return !_page->clipToSafeArea();
+}
+
- (_WKLayoutMode)_layoutMode
{
#if PLATFORM(MAC)
// Define the inset of the scrollview unusable by the web page.
@property (nonatomic, setter=_setObscuredInsets:) UIEdgeInsets _obscuredInsets;
+@property (nonatomic, readonly) BOOL _contentMayDrawInObscuredInsets;
+
// Override the interface orientation. Clients using _beginAnimatedResizeWithUpdates: must update the interface orientation
// in the update block.
@property (nonatomic, setter=_setInterfaceOrientationOverride:) UIInterfaceOrientation _interfaceOrientationOverride;
WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override { return WebCore::UserInterfaceLayoutDirection::LTR; }
+ void didChangeClipToSafeArea(bool) override { }
+
// Members of PageClientImpl class
GtkWidget* m_viewWidget;
DefaultUndoController m_undoController;
virtual void didConcludeEditDataInteraction(std::optional<WebCore::TextIndicatorData>) = 0;
virtual void didChangeDataInteractionCaretRect(const WebCore::IntRect& previousCaretRect, const WebCore::IntRect& caretRect) = 0;
#endif
+
+ virtual void didChangeClipToSafeArea(bool clipToSafeArea) = 0;
};
} // namespace WebKit
#if ENABLE(POINTER_LOCK)
requestPointerUnlock();
#endif
+
+ m_clipToSafeArea = true;
}
void WebPageProxy::resetStateAfterProcessExited()
iterator->value->stopTask(*this, resourceIdentifier);
}
+void WebPageProxy::setClipToSafeArea(bool clipToSafeArea)
+{
+ m_clipToSafeArea = clipToSafeArea;
+
+ m_pageClient.didChangeClipToSafeArea(clipToSafeArea);
+}
+
} // namespace WebKit
void createSandboxExtensionsIfNeeded(const Vector<String>& files, SandboxExtension::Handle& fileReadHandle, SandboxExtension::HandleArray& fileUploadHandles);
#endif
+ void setClipToSafeArea(bool);
+ bool clipToSafeArea() const { return m_clipToSafeArea; }
+
private:
WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
void platformInitialize();
#endif
bool m_isUsingHighPerformanceWebGL { false };
-
+
+ bool m_clipToSafeArea { true };
+
WeakPtrFactory<WebPageProxy> m_weakPtrFactory;
HashMap<String, Ref<WebURLSchemeHandler>> m_urlSchemeHandlersByScheme;
StartURLSchemeHandlerTask(uint64_t loaderIdentifier, uint64_t resourceIdentifier, WebCore::ResourceRequest request)
StopURLSchemeHandlerTask(uint64_t loaderIdentifier, uint64_t resourceIdentifier)
+
+ SetClipToSafeArea(bool clipToSafeArea)
}
void handleActiveNowPlayingSessionInfoResponse(bool hasActiveSession, const String& title, double duration, double elapsedTime) override;
+ void didChangeClipToSafeArea(bool clipToSafeArea) override;
+
#if USE(QUICK_LOOK)
void requestPasswordForQuickLookDocument(const String& fileName, std::function<void(const String&)>&&) override;
#endif
}
#endif
+void PageClientImpl::didChangeClipToSafeArea(bool clipToSafeArea)
+{
+ [m_webView _scheduleVisibleContentRectUpdate];
+}
+
} // namespace WebKit
#endif // PLATFORM(IOS)
[_fixedClippingView setCenter:clippingBounds.location()]; // Not really the center since we set an anchor point.
[_fixedClippingView setBounds:clippingBounds];
+ [_fixedClippingView layer].masksToBounds = _page->clipToSafeArea();
}
- (void)_didExitStableState
void didRestoreScrollPosition() override;
bool windowIsFrontWindowUnderMouse(const NativeWebMouseEvent&) override;
+
+ void didChangeClipToSafeArea(bool clipToSafeArea) override { }
};
} // namespace WebKit
m_page.findController().didInvalidateDocumentMarkerRects();
}
+void WebChromeClient::didChangeClipToSafeArea(bool clipToSafeArea)
+{
+ m_page.send(Messages::WebPageProxy::SetClipToSafeArea(clipToSafeArea));
+}
+
} // namespace WebKit
void didInvalidateDocumentMarkerRects() final;
+ void didChangeClipToSafeArea(bool) final;
+
String m_cachedToolTip;
mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame;
mutable bool m_cachedMainFrameHasHorizontalScrollbar { false };
updateViewportSizeForCSSViewportUnits();
FrameView& frameView = *mainFrameView();
+ frameView.setClipToSafeArea(m_viewportConfiguration.clipToSafeArea());
+
IntPoint scrollPosition = frameView.scrollPosition();
if (!m_hasReceivedVisibleContentRectsAfterDidCommitLoad) {
FloatSize minimumLayoutSizeInScrollViewCoordinates = m_viewportConfiguration.minimumLayoutSize();
+2017-04-17 Tim Horton <timothy_horton@apple.com>
+
+ Provide a viewport parameter to disable clipping to the safe area
+ https://bugs.webkit.org/show_bug.cgi?id=170766
+ <rdar://problem/31564634>
+
+ Reviewed by Beth Dakin.
+
+ * DumpRenderTree/ios/UIScriptControllerIOS.mm:
+ (WTR::UIScriptController::setObscuredInsets):
+ * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+ * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
+ (WTR::UIScriptController::setObscuredInsets):
+ * TestRunnerShared/UIScriptContext/UIScriptController.h:
+ * WebKitTestRunner/ios/TestControllerIOS.mm:
+ (WTR::TestController::platformResetStateToConsistentValues):
+ * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+ (WTR::UIScriptController::setObscuredInsets):
+ Add a UIScriptController mechanism to install obscured insets
+ on the web view.
+
2017-04-17 Dan Bernstein <mitz@apple.com>
[Cocoa] Move isNullFunctionPointer down into WTF
{
}
+void UIScriptController::setObscuredInsets(double, double, double, double)
+{
+}
+
}
#endif // PLATFORM(IOS)
void addViewToWindow(object callback);
void overridePreference(DOMString preference, DOMString value);
+
+ void setObscuredInsets(double top, double right, double bottom, double left);
};
return nullptr;
}
+void UIScriptController::setObscuredInsets(double top, double right, double bottom, double left)
+{
+}
+
#endif
#if !PLATFORM(COCOA)
void removeViewFromWindow(JSValueRef);
void addViewToWindow(JSValueRef);
+ void setObscuredInsets(double top, double right, double bottom, double left);
+
private:
UIScriptController(UIScriptContext&);
[scrollView _removeAllAnimations:YES];
[scrollView setZoomScale:1 animated:NO];
[scrollView setContentOffset:CGPointZero];
+
+ scrollView.contentInset = UIEdgeInsetsZero;
+ webView->platformView()._obscuredInsets = UIEdgeInsetsZero;
}
}
webView.didEndScrollingCallback = nil;
}
+void UIScriptController::setObscuredInsets(double top, double right, double bottom, double left)
+{
+ UIEdgeInsets insets = UIEdgeInsetsMake(top, left, bottom, right);
+ TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
+ webView.scrollView.contentInset = insets;
+ webView._obscuredInsets = insets;
+}
+
}
#endif // PLATFORM(IOS)