Modified: trunk/Source/WebCore/ChangeLog (170513 => 170514)
--- trunk/Source/WebCore/ChangeLog 2014-06-27 01:10:48 UTC (rev 170513)
+++ trunk/Source/WebCore/ChangeLog 2014-06-27 02:05:15 UTC (rev 170514)
@@ -1,3 +1,18 @@
+2014-06-26 Tim Horton <[email protected]>
+
+ [WK2] Pinch-zoom shadows can overlap headers and footers
+ https://bugs.webkit.org/show_bug.cgi?id=134372
+ <rdar://problem/16004095>
+
+ Reviewed by Simon Fraser.
+
+ * WebCore.exp.in:
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::updateLayerForHeader):
+ (WebCore::RenderLayerCompositor::updateLayerForFooter):
+ Put header/footer layers in front of the root content layer instead of behind.
+ Ideally nothing would ever overlap them, but this will give them precedence regardless.
+
2014-06-26 David Kilzer <[email protected]>
[Win] Always NULL-terminate the string in createUTF8String()
Modified: trunk/Source/WebCore/WebCore.exp.in (170513 => 170514)
--- trunk/Source/WebCore/WebCore.exp.in 2014-06-27 01:10:48 UTC (rev 170513)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-06-27 02:05:15 UTC (rev 170514)
@@ -1405,6 +1405,7 @@
__ZN7WebCore9FrameView24setScrollPinningBehaviorENS_21ScrollPinningBehaviorE
__ZN7WebCore9FrameView26adjustPageHeightDeprecatedEPffff
__ZN7WebCore9FrameView26adjustTiledBackingCoverageEv
+__ZN7WebCore9FrameView28yPositionForRootContentLayerERKNS_10FloatPointEff
__ZN7WebCore9FrameView29setAutoSizeFixedMinimumHeightEi
__ZN7WebCore9FrameView29setShouldUpdateWhileOffscreenEb
__ZN7WebCore9FrameView31setVisualUpdatesAllowedByClientEb
@@ -1998,6 +1999,7 @@
__ZNK7WebCore9FrameView13isTransparentEv
__ZNK7WebCore9FrameView13paintBehaviorEv
__ZNK7WebCore9FrameView14didFirstLayoutEv
+__ZNK7WebCore9FrameView15topContentInsetEv
__ZNK7WebCore9FrameView17convertToRendererEPKNS_13RenderElementERKNS_7IntRectE
__ZNK7WebCore9FrameView17convertToRendererEPKNS_13RenderElementERKNS_8IntPointE
__ZNK7WebCore9FrameView19baseBackgroundColorEv
@@ -2408,6 +2410,11 @@
__ZNK7WebCore7IntSizecv7_NSSizeEv
#endif
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100
+__ZN7WebCore32shouldRegisterInsertionUndoGroupEP18NSAttributedString
+__ZN7WebCore44registerInsertionUndoGroupingWithUndoManagerEP13NSUndoManager
+#endif
+
#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
__ZN7WebCore24TextAlternativeWithRangeC1EP18NSTextAlternatives8_NSRange
__ZN7WebCore27AlternativeTextUIController15addAlternativesERKN3WTF9RetainPtrI18NSTextAlternativesEE
@@ -2427,11 +2434,6 @@
_wkCreateMemoryStatusPressureCriticalDispatchOnMainQueue
#endif
-#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100
-__ZN7WebCore32shouldRegisterInsertionUndoGroupEP18NSAttributedString
-__ZN7WebCore44registerInsertionUndoGroupingWithUndoManagerEP13NSUndoManager
-#endif
-
#if PLATFORM(MAC) || PLATFORM(IOS_SIMULATOR)
_wkSetCrashReportApplicationSpecificInformation
#endif
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (170513 => 170514)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2014-06-27 01:10:48 UTC (rev 170513)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2014-06-27 02:05:15 UTC (rev 170514)
@@ -3001,7 +3001,7 @@
#ifndef NDEBUG
m_layerForHeader->setName("header");
#endif
- m_scrollLayer->addChildBelow(m_layerForHeader.get(), m_rootContentLayer.get());
+ m_scrollLayer->addChildAbove(m_layerForHeader.get(), m_rootContentLayer.get());
m_renderView.frameView().addPaintPendingMilestones(DidFirstFlushForHeaderLayer);
}
@@ -3042,7 +3042,7 @@
#ifndef NDEBUG
m_layerForFooter->setName("footer");
#endif
- m_scrollLayer->addChildBelow(m_layerForFooter.get(), m_rootContentLayer.get());
+ m_scrollLayer->addChildAbove(m_layerForFooter.get(), m_rootContentLayer.get());
}
float totalContentHeight = m_rootContentLayer->size().height() + m_renderView.frameView().headerHeight() + m_renderView.frameView().footerHeight();
Modified: trunk/Source/WebKit2/ChangeLog (170513 => 170514)
--- trunk/Source/WebKit2/ChangeLog 2014-06-27 01:10:48 UTC (rev 170513)
+++ trunk/Source/WebKit2/ChangeLog 2014-06-27 02:05:15 UTC (rev 170514)
@@ -1,5 +1,30 @@
2014-06-26 Tim Horton <[email protected]>
+ [WK2] Pinch-zoom shadows can overlap headers and footers
+ https://bugs.webkit.org/show_bug.cgi?id=134372
+ <rdar://problem/16004095>
+
+ Reviewed by Simon Fraser.
+
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+ (WebKit::shadowLayerPositionForFrame):
+ (WebKit::shadowLayerBoundsForFrame):
+ Compute the initial shadow layer and shadow bounds exactly as RenderLayerCompositor does
+ (in updateRootLayerPosition and friends). Also, clip the shadow layer to the old document rect,
+ otherwise it can extend over top of the header/footers. The content is automatically clipped to
+ this rect by the root content layer, but the shadow is outside of that.
+
+ (WebKit::TiledCoreAnimationDrawingArea::applyTransientZoomToLayers):
+ (WebKit::TiledCoreAnimationDrawingArea::commitTransientZoom):
+ Pass all of the arguments to constrainScrollPositionForOverhang, not just half of them.
+ There's still a bug where we constrain incorrectly with header/footer layers, but that
+ will be addressed elsewhere.
+
+ (WebKit::TiledCoreAnimationDrawingArea::applyTransientZoomToPage):
+ Make use of the new helpers.
+
+2014-06-26 Tim Horton <[email protected]>
+
Don't leak WKBrowsingContextControllers
https://bugs.webkit.org/show_bug.cgi?id=134368
<rdar://problem/17476582>
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (170513 => 170514)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2014-06-27 01:10:48 UTC (rev 170513)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2014-06-27 02:05:15 UTC (rev 170514)
@@ -524,7 +524,25 @@
return nullptr;
}
+
+static FloatPoint shadowLayerPositionForFrame(FrameView& frameView, FloatPoint origin)
+{
+ FloatPoint position = frameView.renderView()->documentRect().location() + FloatPoint(0, FrameView::yPositionForRootContentLayer(frameView.scrollPosition(), frameView.topContentInset(), frameView.headerHeight()));
+ return position + origin.expandedTo(FloatPoint());
+}
+
+static FloatRect shadowLayerBoundsForFrame(FrameView& frameView, float transientScale)
+{
+ FloatRect clipLayerFrame(frameView.renderView()->documentRect());
+ FloatRect shadowLayerFrame = clipLayerFrame;
+
+ shadowLayerFrame.scale(transientScale / frameView.frame().page()->pageScaleFactor());
+ shadowLayerFrame.intersect(clipLayerFrame);
+
+ return shadowLayerFrame;
+}
+
void TiledCoreAnimationDrawingArea::applyTransientZoomToLayers(double scale, FloatPoint origin)
{
// FIXME: Scrollbars should stay in-place and change height while zooming.
@@ -540,14 +558,11 @@
zoomLayer->setTransform(transform);
zoomLayer->setAnchorPoint(FloatPoint3D());
zoomLayer->setPosition(FloatPoint3D());
-
+
if (PlatformCALayer* shadowLayer = shadowLayerForTransientZoom()) {
- RenderView* renderView = m_webPage.mainFrameView()->renderView();
- FloatRect shadowBounds = FloatRect(FloatPoint(), toFloatSize(renderView->layoutOverflowRect().maxXMaxYCorner()));
- shadowBounds.scale(scale);
-
- shadowLayer->setBounds(shadowBounds);
- shadowLayer->setPosition(origin);
+ FrameView& frameView = *m_webPage.mainFrameView();
+ shadowLayer->setBounds(shadowLayerBoundsForFrame(frameView, scale));
+ shadowLayer->setPosition(shadowLayerPositionForFrame(frameView, origin));
}
m_transientZoomScale = scale;
@@ -584,20 +599,19 @@
void TiledCoreAnimationDrawingArea::commitTransientZoom(double scale, FloatPoint origin)
{
- FrameView* frameView = m_webPage.mainFrameView();
- FloatRect visibleContentRect = frameView->visibleContentRectIncludingScrollbars();
+ FrameView& frameView = *m_webPage.mainFrameView();
+ FloatRect visibleContentRect = frameView.visibleContentRectIncludingScrollbars();
FloatPoint constrainedOrigin = visibleContentRect.location();
constrainedOrigin.moveBy(-origin);
- RenderView* renderView = frameView->renderView();
- IntRect documentRect = renderView->unscaledDocumentRect();
- documentRect.scale(scale);
+ IntSize scaledTotalContentsSize = frameView.totalContentsSize();
+ scaledTotalContentsSize.scale(scale / m_webPage.pageScaleFactor());
// Scaling may have exposed the overhang area, so we need to constrain the final
// layer position exactly like scrolling will once it's committed, to ensure that
// scrolling doesn't make the view jump.
- constrainedOrigin = ScrollableArea::constrainScrollPositionForOverhang(roundedIntRect(visibleContentRect), documentRect.size(), roundedIntPoint(constrainedOrigin), IntPoint(), 0, 0);
+ constrainedOrigin = ScrollableArea::constrainScrollPositionForOverhang(roundedIntRect(visibleContentRect), scaledTotalContentsSize, roundedIntPoint(constrainedOrigin), frameView.scrollOrigin(), frameView.headerHeight(), frameView.footerHeight());
constrainedOrigin.moveBy(-visibleContentRect.location());
constrainedOrigin = -constrainedOrigin;
@@ -632,14 +646,13 @@
zoomLayer->addAnimationForKey("transientZoomCommit", renderViewAnimation.get());
if (shadowCALayer) {
- FloatRect shadowBounds = FloatRect(FloatPoint(), toFloatSize(renderView->layoutOverflowRect().maxXMaxYCorner()));
- shadowBounds.scale(scale);
+ FloatRect shadowBounds = shadowLayerBoundsForFrame(frameView, scale);
RetainPtr<CGPathRef> shadowPath = adoptCF(CGPathCreateWithRect(shadowBounds, NULL)).get();
RetainPtr<CABasicAnimation> shadowBoundsAnimation = transientZoomSnapAnimationForKeyPath("bounds");
[shadowBoundsAnimation setToValue:[NSValue valueWithRect:shadowBounds]];
RetainPtr<CABasicAnimation> shadowPositionAnimation = transientZoomSnapAnimationForKeyPath("position");
- [shadowPositionAnimation setToValue:[NSValue valueWithPoint:constrainedOrigin]];
+ [shadowPositionAnimation setToValue:[NSValue valueWithPoint:shadowLayerPositionForFrame(frameView, constrainedOrigin)]];
RetainPtr<CABasicAnimation> shadowPathAnimation = transientZoomSnapAnimationForKeyPath("shadowPath");
[shadowPathAnimation setToValue:(id)shadowPath.get()];
@@ -658,16 +671,16 @@
TransformationMatrix finalTransform;
finalTransform.scale(scale);
layerForTransientZoom()->setTransform(finalTransform);
+
+ FrameView& frameView = *m_webPage.mainFrameView();
if (PlatformCALayer* shadowLayer = shadowLayerForTransientZoom()) {
- RenderView* renderView = m_webPage.mainFrameView()->renderView();
- IntRect overflowRect = renderView->pixelSnappedLayoutOverflowRect();
- shadowLayer->setBounds(IntRect(IntPoint(), toIntSize(overflowRect.maxXMaxYCorner())));
- shadowLayer->setPosition(FloatPoint());
+ shadowLayer->setBounds(shadowLayerBoundsForFrame(frameView, 1));
+ shadowLayer->setPosition(shadowLayerPositionForFrame(frameView, FloatPoint()));
}
FloatPoint unscrolledOrigin(origin);
- FloatRect unobscuredContentRect = m_webPage.mainFrameView()->unobscuredContentRectIncludingScrollbars();
+ FloatRect unobscuredContentRect = frameView.unobscuredContentRectIncludingScrollbars();
unscrolledOrigin.moveBy(-unobscuredContentRect.location());
m_webPage.scalePage(scale, roundedIntPoint(-unscrolledOrigin));
m_transientZoomScale = 1;