From 6298044ee740933a2b90f462f29b07fca8a00c53 Mon Sep 17 00:00:00 2001 From: "simon.fraser@apple.com" Date: Mon, 30 Jan 2017 22:51:52 +0000 Subject: [PATCH] [iOS] position:fixed inside touch-scrollable overflow is mispositioned https://bugs.webkit.org/show_bug.cgi?id=167604 Source/WebCore: rdar://problem/29500273 Reviewed by Zalan Bujtas. For layers inside touch-scrollable overflow, RenderLayerBacking::computeParentGraphicsLayerRect() needs to account for the offset from the ancestor compositing layer's origin, to handle scrollable elements with box-shadow, for example. Also make the compositing log output a little easier to read. Test: compositing/scrolling/fixed-inside-scroll.html * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect): * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::logLayerInfo): Source/WebKit2: rdar://problem/29500273 Reviewed by Zalan Bujtas. Make sure we tell m_webPageProxy.computeCustomFixedPositionRect() when visual viewports are enabled. * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm: (WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect): LayoutTests: Reviewed by Zalan Bujtas. * compositing/scrolling/fixed-inside-scroll-expected.html: Added. * compositing/scrolling/fixed-inside-scroll.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211387 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 10 +++++ .../scrolling/fixed-inside-scroll-expected.html | 52 ++++++++++++++++++++++ .../compositing/scrolling/fixed-inside-scroll.html | 52 ++++++++++++++++++++++ Source/WebCore/ChangeLog | 21 +++++++++ Source/WebCore/rendering/RenderLayerBacking.cpp | 7 ++- Source/WebCore/rendering/RenderLayerCompositor.cpp | 2 +- Source/WebKit2/ChangeLog | 13 ++++++ .../ios/RemoteScrollingCoordinatorProxyIOS.mm | 3 +- 8 files changed, 154 insertions(+), 6 deletions(-) create mode 100644 LayoutTests/compositing/scrolling/fixed-inside-scroll-expected.html create mode 100644 LayoutTests/compositing/scrolling/fixed-inside-scroll.html diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index a9f3566..62dbc9d 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,13 @@ +2017-01-30 Simon Fraser + + [iOS] position:fixed inside touch-scrollable overflow is mispositioned + https://bugs.webkit.org/show_bug.cgi?id=167604 + + Reviewed by Zalan Bujtas. + + * compositing/scrolling/fixed-inside-scroll-expected.html: Added. + * compositing/scrolling/fixed-inside-scroll.html: Added. + 2017-01-30 Matt Baker Web Inspector: Need some limit on Async Call Stacks for async loops (rAF loops) diff --git a/LayoutTests/compositing/scrolling/fixed-inside-scroll-expected.html b/LayoutTests/compositing/scrolling/fixed-inside-scroll-expected.html new file mode 100644 index 0000000..7c0c17c --- /dev/null +++ b/LayoutTests/compositing/scrolling/fixed-inside-scroll-expected.html @@ -0,0 +1,52 @@ + + + + + + + +
+
+
+
+
+
+ + diff --git a/LayoutTests/compositing/scrolling/fixed-inside-scroll.html b/LayoutTests/compositing/scrolling/fixed-inside-scroll.html new file mode 100644 index 0000000..fd04d4b --- /dev/null +++ b/LayoutTests/compositing/scrolling/fixed-inside-scroll.html @@ -0,0 +1,52 @@ + + + + + + + +
+
+
+
+
+
+ + diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index edfa03d..9632c30 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,24 @@ +2017-01-30 Simon Fraser + + [iOS] position:fixed inside touch-scrollable overflow is mispositioned + https://bugs.webkit.org/show_bug.cgi?id=167604 + rdar://problem/29500273 + + Reviewed by Zalan Bujtas. + + For layers inside touch-scrollable overflow, RenderLayerBacking::computeParentGraphicsLayerRect() needs + to account for the offset from the ancestor compositing layer's origin, to handle scrollable elements with + box-shadow, for example. + + Also make the compositing log output a little easier to read. + + Test: compositing/scrolling/fixed-inside-scroll.html + + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect): + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::logLayerInfo): + 2017-01-30 Jer Noble NULL-deref crash at PlatformMediaSession::endInterruption diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp index cd20d44..afcfdd7 100644 --- a/Source/WebCore/rendering/RenderLayerBacking.cpp +++ b/Source/WebCore/rendering/RenderLayerBacking.cpp @@ -813,12 +813,11 @@ LayoutRect RenderLayerBacking::computeParentGraphicsLayerRect(RenderLayer* compo #if PLATFORM(IOS) if (compositedAncestor->hasTouchScrollableOverflow()) { + LayoutRect ancestorCompositedBounds = ancestorBackingLayer->compositedBounds(); auto& renderBox = downcast(compositedAncestor->renderer()); - LayoutRect paddingBox(renderBox.borderLeft(), renderBox.borderTop(), - renderBox.width() - renderBox.borderLeft() - renderBox.borderRight(), - renderBox.height() - renderBox.borderTop() - renderBox.borderBottom()); + LayoutRect paddingBox(renderBox.borderLeft(), renderBox.borderTop(), renderBox.width() - renderBox.borderLeft() - renderBox.borderRight(), renderBox.height() - renderBox.borderTop() - renderBox.borderBottom()); ScrollOffset scrollOffset = compositedAncestor->scrollOffset(); - parentGraphicsLayerRect = LayoutRect((paddingBox.location() - toLayoutSize(scrollOffset)), paddingBox.size()); + parentGraphicsLayerRect = LayoutRect((paddingBox.location() - toLayoutSize(ancestorCompositedBounds.location()) - toLayoutSize(scrollOffset)), paddingBox.size()); } #else if (compositedAncestor->needsCompositedScrolling()) { diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp index e40594f..e2fe115 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.cpp +++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp @@ -809,7 +809,7 @@ void RenderLayerCompositor::logLayerInfo(const RenderLayer& layer, int depth) absoluteBounds.move(layer.offsetFromAncestor(m_renderView.layer())); StringBuilder logString; - logString.append(String::format("%*p (%.6f,%.6f-%.6f,%.6f) %.2fKB", 12 + depth * 2, &layer, + logString.append(String::format("%*p (%.3f,%.3f-%.3f,%.3f) %.2fKB", 12 + depth * 2, &layer, absoluteBounds.x().toFloat(), absoluteBounds.y().toFloat(), absoluteBounds.maxX().toFloat(), absoluteBounds.maxY().toFloat(), backing->backingStoreMemoryEstimate() / 1024)); diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index 85da650..045432e 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,5 +1,18 @@ 2017-01-30 Simon Fraser + [iOS] position:fixed inside touch-scrollable overflow is mispositioned + https://bugs.webkit.org/show_bug.cgi?id=167604 + rdar://problem/29500273 + + Reviewed by Zalan Bujtas. + + Make sure we tell m_webPageProxy.computeCustomFixedPositionRect() when visual viewports are enabled. + + * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm: + (WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect): + +2017-01-30 Simon Fraser + Fixed elements should not rubber-band in WK2, nor remain at negative offsets https://bugs.webkit.org/show_bug.cgi?id=167484 rdar://problem/29453068 diff --git a/Source/WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm b/Source/WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm index dcaa47e..db92f13 100644 --- a/Source/WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm +++ b/Source/WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm @@ -95,7 +95,8 @@ void RemoteScrollingCoordinatorProxy::connectStateNodeLayers(ScrollingStateTree& FloatRect RemoteScrollingCoordinatorProxy::customFixedPositionRect() const { - return m_webPageProxy.computeCustomFixedPositionRect(m_webPageProxy.unobscuredContentRect(), m_webPageProxy.unobscuredContentRectRespectingInputViewBounds(), m_webPageProxy.customFixedPositionRect(), m_webPageProxy.displayedContentScale()); + return m_webPageProxy.computeCustomFixedPositionRect(m_webPageProxy.unobscuredContentRect(), m_webPageProxy.unobscuredContentRectRespectingInputViewBounds(), m_webPageProxy.customFixedPositionRect(), + m_webPageProxy.displayedContentScale(), WebPageProxy::UnobscuredRectConstraint::Unconstrained, visualViewportEnabled()); } void RemoteScrollingCoordinatorProxy::scrollingTreeNodeWillStartPanGesture() -- 1.8.3.1