Diff
Modified: branches/safari-600.1-branch/Source/WebKit2/ChangeLog (172110 => 172111)
--- branches/safari-600.1-branch/Source/WebKit2/ChangeLog 2014-08-05 23:40:24 UTC (rev 172110)
+++ branches/safari-600.1-branch/Source/WebKit2/ChangeLog 2014-08-05 23:44:24 UTC (rev 172111)
@@ -1,5 +1,73 @@
2014-08-05 Lucas Forschler <lforsch...@apple.com>
+ Merge r172104
+
+ 2014-08-05 Tim Horton <timothy_hor...@apple.com>
+
+ REGRESSION (r164337): Pages are sometimes cut off/oriented incorrectly after using WKThumbnailView
+ https://bugs.webkit.org/show_bug.cgi?id=135622
+ <rdar://problem/17202556>
+
+ Reviewed by Dan Bernstein.
+
+ In some cases (when the page changed scroll offset while thumbnailed),
+ when transitioning back to thumbnail scale = 1, we would get the math
+ wrong and end up with a non-identity sublayerTransform on the DrawingArea.
+
+ Luckily, none of this code is necessary anymore, as the only client
+ of WKThumbnailView only uses its snapshotting mode.
+
+ * Shared/ImageOptions.h:
+ Remove SnapshotOptionsRespectDrawingAreaTransform; DrawingArea no longer
+ has a rootLayerTransform().
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::setThumbnailScale): Deleted.
+ * UIProcess/WebPageProxy.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage):
+ (WebKit::WebPage::scaledSnapshotWithOptions):
+ (WebKit::WebPage::snapshotAtSize):
+
+ (WebKit::WebPage::setThumbnailScale): Deleted.
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+ Remove setThumbnailScale and SnapshotOptionsRespectDrawingAreaTransform.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::didCommitLoad):
+ Revert this to its state before r164337, as we no longer have "thumbnail scale".
+
+ * UIProcess/API/Cocoa/_WKThumbnailView.h:
+ * UIProcess/API/Cocoa/_WKThumbnailView.mm:
+ (-[_WKThumbnailView initWithFrame:fromWKView:]):
+ (-[_WKThumbnailView _viewWasUnparented]):
+ (-[_WKThumbnailView _viewWasParented]):
+ (-[_WKThumbnailView _requestSnapshotIfNeeded]):
+ (-[_WKThumbnailView setScale:]):
+ Clean up code assuming _shouldApplyThumbnailScale = NO, _usesSnapshot = YES.
+
+ (-[_WKThumbnailView setUsesSnapshot:]):
+ (-[_WKThumbnailView usesSnapshot]):
+ Always return YES from usesSnapshot; we only support snapshotting WKThumbnailViews.
+ Ignore setUsesSnapshot.
+
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView _setThumbnailView:]):
+ (-[WKView _updateThumbnailViewLayer]):
+ Stop checking usesSnapshot; it's always true.
+
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+ (WebKit::TiledCoreAnimationDrawingArea::setRootLayerTransform): Deleted.
+ * WebProcess/WebPage/DrawingArea.cpp:
+ (WebKit::DrawingArea::rootLayerTransform): Deleted.
+ * WebProcess/WebPage/DrawingArea.h:
+ (WebKit::DrawingArea::setRootLayerTransform): Deleted.
+ Remove rootLayerTransform() and setRootLayerTransform().
+
+2014-08-05 Lucas Forschler <lforsch...@apple.com>
+
Merge r172034
2014-08-05 Alexey Proskuryakov <a...@apple.com>
Modified: branches/safari-600.1-branch/Source/WebKit2/Shared/ImageOptions.h (172110 => 172111)
--- branches/safari-600.1-branch/Source/WebKit2/Shared/ImageOptions.h 2014-08-05 23:40:24 UTC (rev 172110)
+++ branches/safari-600.1-branch/Source/WebKit2/Shared/ImageOptions.h 2014-08-05 23:44:24 UTC (rev 172111)
@@ -37,7 +37,6 @@
SnapshotOptionsExcludeSelectionHighlighting = 1 << 1,
SnapshotOptionsInViewCoordinates = 1 << 2,
SnapshotOptionsPaintSelectionRectangle = 1 << 3,
- SnapshotOptionsRespectDrawingAreaTransform = 1 << 4,
SnapshotOptionsExcludeDeviceScaleFactor = 1 << 5,
};
typedef uint32_t SnapshotOptions;
Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/Cocoa/_WKThumbnailView.h (172110 => 172111)
--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/Cocoa/_WKThumbnailView.h 2014-08-05 23:40:24 UTC (rev 172110)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/Cocoa/_WKThumbnailView.h 2014-08-05 23:44:24 UTC (rev 172111)
@@ -39,6 +39,8 @@
- (instancetype)initWithFrame:(NSRect)frame fromWKView:(WKView *)wkView;
@property (nonatomic) CGFloat scale;
+
+// This should be removed when all clients go away; it is always YES now.
@property (nonatomic) BOOL usesSnapshot;
@end
Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/Cocoa/_WKThumbnailView.mm (172110 => 172111)
--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/Cocoa/_WKThumbnailView.mm 2014-08-05 23:40:24 UTC (rev 172110)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/Cocoa/_WKThumbnailView.mm 2014-08-05 23:44:24 UTC (rev 172111)
@@ -52,8 +52,6 @@
BOOL _originalMayStartMediaWhenInWindow;
BOOL _originalSourceViewIsInWindow;
- BOOL _shouldApplyThumbnailScale;
-
BOOL _snapshotWasDeferred;
double _lastSnapshotScale;
}
@@ -76,16 +74,11 @@
_originalMayStartMediaWhenInWindow = _webPageProxy->mayStartMediaWhenInWindow();
_originalSourceViewIsInWindow = !![_wkView window];
- _shouldApplyThumbnailScale = !_originalSourceViewIsInWindow;
-
return self;
}
- (void)_viewWasUnparented
{
- if (_shouldApplyThumbnailScale)
- _webPageProxy->setThumbnailScale(1);
-
[_wkView _setThumbnailView:nil];
self.layer.contents = nil;
@@ -99,9 +92,6 @@
if ([_wkView _thumbnailView])
return;
- if (_shouldApplyThumbnailScale)
- _webPageProxy->setThumbnailScale(_scale);
-
if (!_originalSourceViewIsInWindow)
_webPageProxy->setMayStartMediaWhenInWindow(false);
@@ -111,9 +101,6 @@
- (void)_requestSnapshotIfNeeded
{
- if (!_usesSnapshot)
- return;
-
if (self.layer.contents && _lastSnapshotScale == _scale)
return;
@@ -126,7 +113,7 @@
RetainPtr<_WKThumbnailView> thumbnailView = self;
IntRect snapshotRect(IntPoint(), _webPageProxy->viewSize() - IntSize(0, _webPageProxy->topContentInset()));
- SnapshotOptions options = SnapshotOptionsRespectDrawingAreaTransform | SnapshotOptionsInViewCoordinates;
+ SnapshotOptions options = SnapshotOptionsInViewCoordinates;
IntSize bitmapSize = snapshotRect.size();
bitmapSize.scale(_scale * _webPageProxy->deviceScaleFactor());
_lastSnapshotScale = _scale;
@@ -166,31 +153,19 @@
_scale = scale;
- if (self.window && _shouldApplyThumbnailScale)
- _webPageProxy->setThumbnailScale(_scale);
+ [self _requestSnapshotIfNeeded];
- if (_usesSnapshot)
- [self _requestSnapshotIfNeeded];
-
self.layer.sublayerTransform = CATransform3DMakeScale(_scale, _scale, 1);
}
+// This should be removed when all clients go away; it is always YES now.
- (void)setUsesSnapshot:(BOOL)usesSnapshot
{
- if (_usesSnapshot == usesSnapshot)
- return;
+}
- _usesSnapshot = usesSnapshot;
-
- if (!self.window)
- return;
-
- if (usesSnapshot)
- [self _requestSnapshotIfNeeded];
- else {
- _webPageProxy->setThumbnailScale(_scale);
- [_wkView _reparentLayerTreeInThumbnailView];
- }
+- (BOOL)usesSnapshot
+{
+ return YES;
}
- (void)_setThumbnailLayer:(CALayer *)layer
Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm (172110 => 172111)
--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm 2014-08-05 23:40:24 UTC (rev 172110)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm 2014-08-05 23:44:24 UTC (rev 172111)
@@ -3547,9 +3547,6 @@
[self _updateThumbnailViewLayer];
else
[self _setAcceleratedCompositingModeRootLayer:_data->_rootLayer.get()];
-
- if (!thumbnailView.usesSnapshot)
- _data->_page->viewStateDidChange(ViewState::WindowIsActive | ViewState::IsInWindow | ViewState::IsVisible);
}
- (_WKThumbnailView *)_thumbnailView
@@ -3562,7 +3559,7 @@
_WKThumbnailView *thumbnailView = _data->_thumbnailView;
ASSERT(thumbnailView);
- if (!thumbnailView.usesSnapshot || (thumbnailView._waitingForSnapshot && self.window))
+ if (thumbnailView._waitingForSnapshot && self.window)
[self _reparentLayerTreeInThumbnailView];
}
Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (172110 => 172111)
--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-08-05 23:40:24 UTC (rev 172110)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp 2014-08-05 23:44:24 UTC (rev 172111)
@@ -5051,14 +5051,6 @@
}
#endif
-void WebPageProxy::setThumbnailScale(double scale)
-{
- if (!isValid())
- return;
-
- m_process->send(Messages::WebPage::SetThumbnailScale(scale), m_pageID);
-}
-
void WebPageProxy::addMIMETypeWithCustomContentProvider(const String& mimeType)
{
m_process->send(Messages::WebPage::AddMIMETypeWithCustomContentProvider(mimeType), m_pageID);
Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/WebPageProxy.h (172110 => 172111)
--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/WebPageProxy.h 2014-08-05 23:40:24 UTC (rev 172110)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/WebPageProxy.h 2014-08-05 23:44:24 UTC (rev 172111)
@@ -901,8 +901,6 @@
void unwrapCryptoKey(const Vector<uint8_t>&, bool& succeeded, Vector<uint8_t>&);
#endif
- void setThumbnailScale(double);
-
void takeSnapshot(WebCore::IntRect, WebCore::IntSize bitmapSize, SnapshotOptions, std::function<void (const ShareableBitmap::Handle&, CallbackBase::Error)>);
void navigationGestureDidBegin();
Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp (172110 => 172111)
--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp 2014-08-05 23:40:24 UTC (rev 172110)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp 2014-08-05 23:44:24 UTC (rev 172111)
@@ -87,11 +87,6 @@
function();
}
-TransformationMatrix DrawingArea::rootLayerTransform() const
-{
- return TransformationMatrix();
-}
-
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
PassRefPtr<WebCore::DisplayRefreshMonitor> DrawingArea::createDisplayRefreshMonitor(PlatformDisplayID)
{
Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (172110 => 172111)
--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/DrawingArea.h 2014-08-05 23:40:24 UTC (rev 172110)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/DrawingArea.h 2014-08-05 23:44:24 UTC (rev 172111)
@@ -107,9 +107,6 @@
virtual PassRefPtr<WebCore::DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID);
#endif
- virtual WebCore::TransformationMatrix rootLayerTransform() const;
- virtual void setRootLayerTransform(const WebCore::TransformationMatrix&) { }
-
#if USE(COORDINATED_GRAPHICS)
virtual void didReceiveCoordinatedLayerTreeHostMessage(IPC::Connection*, IPC::MessageDecoder&) = 0;
#endif
Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (172110 => 172111)
--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2014-08-05 23:40:24 UTC (rev 172110)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2014-08-05 23:44:24 UTC (rev 172111)
@@ -320,8 +320,6 @@
, m_viewState(parameters.viewState)
, m_processSuppressionDisabledByWebPreference("Process suppression is disabled.")
, m_pendingNavigationID(0)
- , m_pageScaleWithoutThumbnailScale(1)
- , m_thumbnailScale(1)
#if ENABLE(WEBGL)
, m_systemWebGLPolicy(WebGLAllowCreation)
#endif
@@ -1631,9 +1629,6 @@
PassRefPtr<WebImage> WebPage::scaledSnapshotWithOptions(const IntRect& rect, double additionalScaleFactor, SnapshotOptions options)
{
IntRect snapshotRect = rect;
- if (options & SnapshotOptionsRespectDrawingAreaTransform)
- snapshotRect = m_drawingArea->rootLayerTransform().inverse().mapRect(snapshotRect);
-
IntSize bitmapSize = snapshotRect.size();
double scaleFactor = additionalScaleFactor;
if (!(options & SnapshotOptionsExcludeDeviceScaleFactor))
@@ -1654,9 +1649,6 @@
return nullptr;
IntRect snapshotRect = rect;
- if (options & SnapshotOptionsRespectDrawingAreaTransform)
- snapshotRect = m_drawingArea->rootLayerTransform().inverse().mapRect(snapshotRect);
-
float horizontalScaleFactor = static_cast<float>(bitmapSize.width()) / rect.width();
float verticalScaleFactor = static_cast<float>(bitmapSize.height()) / rect.height();
float scaleFactor = std::max(horizontalScaleFactor, verticalScaleFactor);
@@ -4456,13 +4448,8 @@
if (frame->coreFrame()->loader().loadType() == FrameLoadType::Standard) {
Page* page = frame->coreFrame()->page();
- if (page) {
- if (m_thumbnailScale != 1) {
- m_pageScaleWithoutThumbnailScale = 1;
- setThumbnailScale(m_thumbnailScale);
- } else if (page->pageScaleFactor() != 1)
- scalePage(1, IntPoint());
- }
+ if (page && page->pageScaleFactor() != 1)
+ scalePage(1, IntPoint());
}
#if PLATFORM(IOS)
m_hasReceivedVisibleContentRectsAfterDidCommitLoad = false;
@@ -4749,40 +4736,6 @@
return documentLoader.release();
}
-void WebPage::setThumbnailScale(double thumbnailScale)
-{
- // FIXME (129014): If the page programmatically scales while thumbnailed, we will restore the wrong scroll position.
-
- ASSERT_ARG(thumbnailScale, thumbnailScale > 0);
-
- double currentPageScaleFactor = pageScaleFactor();
-
- if (thumbnailScale == m_thumbnailScale && currentPageScaleFactor == m_thumbnailScale * m_pageScaleWithoutThumbnailScale)
- return;
-
- if (m_thumbnailScale == 1) {
- m_pageScaleWithoutThumbnailScale = currentPageScaleFactor;
- m_scrollPositionIgnoringThumbnailScale = m_page->mainFrame().view()->scrollPosition();
- }
-
- m_thumbnailScale = thumbnailScale;
-
- // Scale the page, but leave the original page scale intact if there was any.
- scalePage(m_thumbnailScale * m_pageScaleWithoutThumbnailScale, IntPoint());
-
- // Scroll as far as we can towards the original scroll position in the scaled page.
- // This may get constrained; we'll transform the drawing area to expose the right part of the page.
- m_page->mainFrame().view()->setScrollPosition(IntPoint(m_scrollPositionIgnoringThumbnailScale.x() * m_thumbnailScale, m_scrollPositionIgnoringThumbnailScale.y() * m_thumbnailScale));
-
- double inverseScale = 1 / m_thumbnailScale;
- IntPoint newScrollPosition = m_page->mainFrame().view()->scrollPosition();
- TransformationMatrix transform;
- transform.translate((newScrollPosition.x() * inverseScale) - m_scrollPositionIgnoringThumbnailScale.x(), (newScrollPosition.y() * inverseScale) - m_scrollPositionIgnoringThumbnailScale.y());
- transform.scale(inverseScale);
-
- drawingArea()->setRootLayerTransform(transform);
-}
-
void WebPage::getBytecodeProfile(uint64_t callbackID)
{
ASSERT(JSDOMWindow::commonVM().m_perBytecodeProfiler);
Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h (172110 => 172111)
--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h 2014-08-05 23:40:24 UTC (rev 172110)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h 2014-08-05 23:44:24 UTC (rev 172111)
@@ -391,8 +391,6 @@
void addPluginView(PluginView*);
void removePluginView(PluginView*);
- void setThumbnailScale(double);
-
bool isVisible() const { return m_viewState & WebCore::ViewState::IsVisible; }
bool isVisibleOrOccluded() const { return m_viewState & WebCore::ViewState::IsVisibleOrOccluded; }
@@ -1272,10 +1270,6 @@
uint64_t m_pendingNavigationID;
- double m_pageScaleWithoutThumbnailScale;
- WebCore::IntPoint m_scrollPositionIgnoringThumbnailScale;
- double m_thumbnailScale;
-
#if ENABLE(WEBGL)
WebCore::WebGLLoadPolicy m_systemWebGLPolicy;
#endif
Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (172110 => 172111)
--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2014-08-05 23:40:24 UTC (rev 172110)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2014-08-05 23:44:24 UTC (rev 172111)
@@ -379,8 +379,6 @@
SetScrollPinningBehavior(uint32_t pinning)
- SetThumbnailScale(double scale)
-
GetBytecodeProfile(uint64_t callbackID)
TakeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, uint64_t callbackID)
Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h (172110 => 172111)
--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h 2014-08-05 23:40:24 UTC (rev 172110)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h 2014-08-05 23:44:24 UTC (rev 172111)
@@ -103,9 +103,6 @@
void applyTransientZoomToLayers(double scale, WebCore::FloatPoint origin);
- virtual WebCore::TransformationMatrix rootLayerTransform() const override { return m_transform; }
- virtual void setRootLayerTransform(const WebCore::TransformationMatrix&) override;
-
void updateLayerHostingContext();
void setRootCompositingLayer(CALayer *);
Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (172110 => 172111)
--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2014-08-05 23:40:24 UTC (rev 172110)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2014-08-05 23:44:24 UTC (rev 172111)
@@ -691,12 +691,6 @@
flushLayers();
}
-void TiledCoreAnimationDrawingArea::setRootLayerTransform(const TransformationMatrix& transform)
-{
- m_transform = transform;
- [m_rootLayer setSublayerTransform:transform];
-}
-
} // namespace WebKit
#endif // !PLATFORM(IOS)