https://bugs.webkit.org/show_bug.cgi?id=129354
Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-02-25
Reviewed by Sam Weinig.
During scaling, the scale and rect of UIScrollView, WebPageProxy, DrawingAreaProxy,
DrawingArea and WebPage were in completely inconsistent states.
Some of those disconnect were temporary (like when setting the rect and scale in two different
messages), some were lasting the time of a tile update (like the UIProcess view of the scale).
This was causing various visual glitches.
To fix this, all the updates from the UIProcess are funneled through a single path and the values
are split into 3 different groups/types.
When updating the scale/rects, the UIProcess sends the new information to the WebProcess on a queue
through ViewUpdateDispatcher. There, the updates are accumulated until the MainThread is available.
Once the main thread is "unblocked" from the previous frame, all the data are updated at once from
the last known state in ViewUpdateDispatcher. The new tiles are created for the new converage information
and they are sent to the UIProcess.
At any point, there are 3 types of scale and rects used for different purpose:
-In the UIProcess, there is the UIScrollView scale and rects which represent the "true" state or what
is currently on screen.
That information is mirrored into WebPageProxy for the other classes needing it like DrawingAreaProxy.
-In the WebProcess, there is the last known state. That state is always lagging a little behind the "true"
state.
-Back in the UIProcess, we have the tile states that is attached to RemoteLayerTreeTransaction. It is used
to setup the rendering.
With this change, there are two paths for updating the page scale factor:
-The UI drives the change, the updates goes WKWebView->WKContentView->WebPageProxy->ViewUpdateDispatcher
->WebPage->RemoteLayerTreeDrawingArea->RemoteLayerTreeDrawingAreaProxy->WKContentView->WKWebView.
-If changes in the content force scaling parameters, the updates goes: WebPage->RemoteLayerTreeDrawingArea
->RemoteLayerTreeDrawingAreaProxy->WKContentView->WKWebView.
The two kind of updates frequently conflicts during loading. We differentiate those through the flag
scaleWasSetByUIProcess passed with the updates. In cases of conflicts, the user always wins.
* DerivedSources.make:
* Scripts/webkit2/messages.py:
(struct_or_class):
* Shared/VisibleContentRectUpdateInfo.cpp: Added.
(WebKit::VisibleContentRectUpdateInfo::encode):
(WebKit::VisibleContentRectUpdateInfo::decode):
* Shared/VisibleContentRectUpdateInfo.h: Added.
(WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
(WebKit::VisibleContentRectUpdateInfo::exposedRect):
(WebKit::VisibleContentRectUpdateInfo::unobscuredRect):
(WebKit::VisibleContentRectUpdateInfo::scale):
(WebKit::operator==):
* Shared/mac/RemoteLayerTreeTransaction.h:
(WebKit::RemoteLayerTreeTransaction::scaleWasSetByUIProcess):
(WebKit::RemoteLayerTreeTransaction::setScaleWasSetByUIProcess):
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::encode):
(WebKit::RemoteLayerTreeTransaction::decode):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView contentView:didCommitLayerTree:WebKit::]):
(-[WKWebView _didFinishScrolling]):
(-[WKWebView scrollViewDidScroll:]):
(-[WKWebView scrollViewDidZoom:]):
(-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
(-[WKWebView _frameOrBoundsChanged]):
(-[WKWebView _updateVisibleContentRectsWithStableState:]):
(-[WKWebView _setObscuredInsets:]):
(-[WKWebView _endInteractiveObscuredInsetsChange]):
* UIProcess/API/ios/WKViewIOS.mm:
(-[WKView _updateVisibleContentRects]):
* UIProcess/DrawingAreaProxy.cpp:
(WebKit::DrawingAreaProxy::DrawingAreaProxy):
(WebKit::DrawingAreaProxy::setCustomFixedPositionRect):
* UIProcess/DrawingAreaProxy.h:
(WebKit::DrawingAreaProxy::updateDebugIndicator):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::displayedContentScale):
(WebKit::WebPageProxy::exposedContentRect):
(WebKit::WebPageProxy::unobscuredContentRect):
* UIProcess/ios/WKContentView.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView didUpdateVisibleRect:unobscuredRect:scale:inStableState:]):
(-[WKContentView didFinishScrolling]):
(-[WKContentView didZoomToScale:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::updateVisibleContentRects):
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::scaledExposedRect):
(WebKit::RemoteLayerTreeDrawingAreaProxy::indicatorLocation):
(WebKit::RemoteLayerTreeDrawingAreaProxy::indicatorScale):
(WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebPage/ViewUpdateDispatcher.cpp: Added.
(WebKit::ViewUpdateDispatcher::create):
(WebKit::ViewUpdateDispatcher::ViewUpdateDispatcher):
(WebKit::ViewUpdateDispatcher::~ViewUpdateDispatcher):
(WebKit::ViewUpdateDispatcher::initializeConnection):
(WebKit::ViewUpdateDispatcher::visibleContentRectUpdate):
(WebKit::ViewUpdateDispatcher::dispatchVisibleContentRectUpdate):
* WebProcess/WebPage/ViewUpdateDispatcher.h: Added.
* WebProcess/WebPage/ViewUpdateDispatcher.messages.in: Added.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::scalePage):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::scaleWasSetByUIProcess):
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::tapHighlightAtPosition):
(WebKit::WebPage::updateVisibleContentRects):
(WebKit::WebPage::willStartUserTriggeredZooming):
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::flushLayers):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::WebProcess):
(WebKit::WebProcess::initializeConnection):
* WebProcess/WebProcess.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@164702
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-02-25 Benjamin Poulain <bpoulain@apple.com>
+
+ [iOS][WK2] Split the rects/scale updates in 3 internally consistent groups
+ https://bugs.webkit.org/show_bug.cgi?id=129354
+
+ Reviewed by Sam Weinig.
+
+ During scaling, the scale and rect of UIScrollView, WebPageProxy, DrawingAreaProxy,
+ DrawingArea and WebPage were in completely inconsistent states.
+
+ Some of those disconnect were temporary (like when setting the rect and scale in two different
+ messages), some were lasting the time of a tile update (like the UIProcess view of the scale).
+ This was causing various visual glitches.
+
+ To fix this, all the updates from the UIProcess are funneled through a single path and the values
+ are split into 3 different groups/types.
+ When updating the scale/rects, the UIProcess sends the new information to the WebProcess on a queue
+ through ViewUpdateDispatcher. There, the updates are accumulated until the MainThread is available.
+ Once the main thread is "unblocked" from the previous frame, all the data are updated at once from
+ the last known state in ViewUpdateDispatcher. The new tiles are created for the new converage information
+ and they are sent to the UIProcess.
+
+ At any point, there are 3 types of scale and rects used for different purpose:
+ -In the UIProcess, there is the UIScrollView scale and rects which represent the "true" state or what
+ is currently on screen.
+ That information is mirrored into WebPageProxy for the other classes needing it like DrawingAreaProxy.
+ -In the WebProcess, there is the last known state. That state is always lagging a little behind the "true"
+ state.
+ -Back in the UIProcess, we have the tile states that is attached to RemoteLayerTreeTransaction. It is used
+ to setup the rendering.
+
+ With this change, there are two paths for updating the page scale factor:
+ -The UI drives the change, the updates goes WKWebView->WKContentView->WebPageProxy->ViewUpdateDispatcher
+ ->WebPage->RemoteLayerTreeDrawingArea->RemoteLayerTreeDrawingAreaProxy->WKContentView->WKWebView.
+ -If changes in the content force scaling parameters, the updates goes: WebPage->RemoteLayerTreeDrawingArea
+ ->RemoteLayerTreeDrawingAreaProxy->WKContentView->WKWebView.
+ The two kind of updates frequently conflicts during loading. We differentiate those through the flag
+ scaleWasSetByUIProcess passed with the updates. In cases of conflicts, the user always wins.
+
+ * DerivedSources.make:
+ * Scripts/webkit2/messages.py:
+ (struct_or_class):
+ * Shared/VisibleContentRectUpdateInfo.cpp: Added.
+ (WebKit::VisibleContentRectUpdateInfo::encode):
+ (WebKit::VisibleContentRectUpdateInfo::decode):
+ * Shared/VisibleContentRectUpdateInfo.h: Added.
+ (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
+ (WebKit::VisibleContentRectUpdateInfo::exposedRect):
+ (WebKit::VisibleContentRectUpdateInfo::unobscuredRect):
+ (WebKit::VisibleContentRectUpdateInfo::scale):
+ (WebKit::operator==):
+ * Shared/mac/RemoteLayerTreeTransaction.h:
+ (WebKit::RemoteLayerTreeTransaction::scaleWasSetByUIProcess):
+ (WebKit::RemoteLayerTreeTransaction::setScaleWasSetByUIProcess):
+ * Shared/mac/RemoteLayerTreeTransaction.mm:
+ (WebKit::RemoteLayerTreeTransaction::encode):
+ (WebKit::RemoteLayerTreeTransaction::decode):
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView contentView:didCommitLayerTree:WebKit::]):
+ (-[WKWebView _didFinishScrolling]):
+ (-[WKWebView scrollViewDidScroll:]):
+ (-[WKWebView scrollViewDidZoom:]):
+ (-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
+ (-[WKWebView _frameOrBoundsChanged]):
+ (-[WKWebView _updateVisibleContentRectsWithStableState:]):
+ (-[WKWebView _setObscuredInsets:]):
+ (-[WKWebView _endInteractiveObscuredInsetsChange]):
+ * UIProcess/API/ios/WKViewIOS.mm:
+ (-[WKView _updateVisibleContentRects]):
+ * UIProcess/DrawingAreaProxy.cpp:
+ (WebKit::DrawingAreaProxy::DrawingAreaProxy):
+ (WebKit::DrawingAreaProxy::setCustomFixedPositionRect):
+ * UIProcess/DrawingAreaProxy.h:
+ (WebKit::DrawingAreaProxy::updateDebugIndicator):
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::displayedContentScale):
+ (WebKit::WebPageProxy::exposedContentRect):
+ (WebKit::WebPageProxy::unobscuredContentRect):
+ * UIProcess/ios/WKContentView.h:
+ * UIProcess/ios/WKContentView.mm:
+ (-[WKContentView didUpdateVisibleRect:unobscuredRect:scale:inStableState:]):
+ (-[WKContentView didFinishScrolling]):
+ (-[WKContentView didZoomToScale:]):
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::updateVisibleContentRects):
+ * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
+ * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
+ (WebKit::RemoteLayerTreeDrawingAreaProxy::scaledExposedRect):
+ (WebKit::RemoteLayerTreeDrawingAreaProxy::indicatorLocation):
+ (WebKit::RemoteLayerTreeDrawingAreaProxy::indicatorScale):
+ (WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator):
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/WebPage/ViewUpdateDispatcher.cpp: Added.
+ (WebKit::ViewUpdateDispatcher::create):
+ (WebKit::ViewUpdateDispatcher::ViewUpdateDispatcher):
+ (WebKit::ViewUpdateDispatcher::~ViewUpdateDispatcher):
+ (WebKit::ViewUpdateDispatcher::initializeConnection):
+ (WebKit::ViewUpdateDispatcher::visibleContentRectUpdate):
+ (WebKit::ViewUpdateDispatcher::dispatchVisibleContentRectUpdate):
+ * WebProcess/WebPage/ViewUpdateDispatcher.h: Added.
+ * WebProcess/WebPage/ViewUpdateDispatcher.messages.in: Added.
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage):
+ (WebKit::WebPage::scalePage):
+ * WebProcess/WebPage/WebPage.h:
+ (WebKit::WebPage::scaleWasSetByUIProcess):
+ * WebProcess/WebPage/WebPage.messages.in:
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::tapHighlightAtPosition):
+ (WebKit::WebPage::updateVisibleContentRects):
+ (WebKit::WebPage::willStartUserTriggeredZooming):
+ * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
+ (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::WebProcess):
+ (WebKit::WebProcess::initializeConnection):
+ * WebProcess/WebProcess.h:
+
2014-02-25 Anders Carlsson <andersca@apple.com>
Rename WebCore::VisitedLinkProvider to WebCore::VisitedLinkStore
StorageManager \
ViewGestureController \
ViewGestureGeometryCollector \
+ ViewUpdateDispatcher \
WebApplicationCacheManager \
WebApplicationCacheManagerProxy \
WebConnection \
--- /dev/null
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "VisibleContentRectUpdateInfo.h"
+
+#include "WebCoreArgumentCoders.h"
+
+namespace WebKit {
+
+void VisibleContentRectUpdateInfo::encode(IPC::ArgumentEncoder& encoder) const
+{
+ encoder << m_exposedRect;
+ encoder << m_unobscuredRect;
+ encoder << m_scale;
+}
+
+bool VisibleContentRectUpdateInfo::decode(IPC::ArgumentDecoder& decoder, VisibleContentRectUpdateInfo& result)
+{
+ if (!decoder.decode(result.m_exposedRect))
+ return false;
+ if (!decoder.decode(result.m_unobscuredRect))
+ return false;
+ if (!decoder.decode(result.m_scale))
+ return false;
+ return true;
+}
+
+} // namespace WebKit
--- /dev/null
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef VisibleContentRectUpdateInfo_h
+#define VisibleContentRectUpdateInfo_h
+
+#include <WebCore/FloatRect.h>
+
+namespace IPC {
+class ArgumentDecoder;
+class ArgumentEncoder;
+}
+
+namespace WebKit {
+
+class VisibleContentRectUpdateInfo {
+public:
+ VisibleContentRectUpdateInfo()
+ : m_scale(-1)
+ {
+ }
+
+ VisibleContentRectUpdateInfo(const WebCore::FloatRect& exposedRect, const WebCore::FloatRect& unobscuredRect, double scale)
+ : m_exposedRect(exposedRect)
+ , m_unobscuredRect(unobscuredRect)
+ , m_scale(scale)
+ {
+ }
+
+ const WebCore::FloatRect& exposedRect() const { return m_exposedRect; }
+ const WebCore::FloatRect& unobscuredRect() const { return m_unobscuredRect; }
+ double scale() const { return m_scale; }
+
+ void encode(IPC::ArgumentEncoder&) const;
+ static bool decode(IPC::ArgumentDecoder&, VisibleContentRectUpdateInfo&);
+
+private:
+ WebCore::FloatRect m_exposedRect;
+ WebCore::FloatRect m_unobscuredRect;
+ double m_scale;
+};
+
+inline bool operator==(const VisibleContentRectUpdateInfo& a, const VisibleContentRectUpdateInfo& b)
+{
+ return a.scale() == b.scale() && a.exposedRect() == b.exposedRect() && a.unobscuredRect() == b.unobscuredRect();
+}
+
+} // namespace WebKit
+
+#endif // VisibleContentRectUpdateInfo_h
double pageScaleFactor() const { return m_pageScaleFactor; }
void setPageScaleFactor(double pageScaleFactor) { m_pageScaleFactor = pageScaleFactor; }
+
+ bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; }
+ void setScaleWasSetByUIProcess(bool scaleWasSetByUIProcess) { m_scaleWasSetByUIProcess = scaleWasSetByUIProcess; }
uint64_t renderTreeSize() const { return m_renderTreeSize; }
void setRenderTreeSize(uint64_t renderTreeSize) { m_renderTreeSize = renderTreeSize; }
Vector<WebCore::GraphicsLayer::PlatformLayerID> m_destroyedLayerIDs;
WebCore::IntSize m_contentsSize;
double m_pageScaleFactor;
+ bool m_scaleWasSetByUIProcess;
uint64_t m_renderTreeSize;
double m_minimumScaleFactor;
double m_maximumScaleFactor;
encoder << m_destroyedLayerIDs;
encoder << m_contentsSize;
encoder << m_pageScaleFactor;
+ encoder << m_scaleWasSetByUIProcess;
encoder << m_minimumScaleFactor;
encoder << m_maximumScaleFactor;
encoder << m_allowsUserScaling;
if (!decoder.decode(result.m_pageScaleFactor))
return false;
+ if (!decoder.decode(result.m_scaleWasSetByUIProcess))
+ return false;
+
if (!decoder.decode(result.m_minimumScaleFactor))
return false;
[_scrollView setMinimumZoomScale:layerTreeTransaction.minimumScaleFactor()];
[_scrollView setMaximumZoomScale:layerTreeTransaction.maximumScaleFactor()];
[_scrollView setZoomEnabled:layerTreeTransaction.allowsUserScaling()];
- if (![_scrollView isZooming] && ![_scrollView isZoomBouncing])
+ if (!layerTreeTransaction.scaleWasSetByUIProcess() && ![_scrollView isZooming] && ![_scrollView isZoomBouncing])
[_scrollView setZoomScale:layerTreeTransaction.pageScaleFactor()];
if (_gestureController)
- (void)_didFinishScrolling
{
- [self _updateVisibleContentRects];
+ [self _updateVisibleContentRectsWithStableState:YES];
[_contentView didFinishScrolling];
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
- [self _updateVisibleContentRects];
+ [self _updateVisibleContentRectsWithStableState:NO];
}
- (void)scrollViewDidZoom:(UIScrollView *)scrollView
{
- [self _updateVisibleContentRects];
+ [self _updateVisibleContentRectsWithStableState:NO];
}
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale
{
ASSERT(scrollView == _scrollView);
- [self _updateVisibleContentRects];
+ [self _updateVisibleContentRectsWithStableState:YES];
[_contentView didZoomToScale:scale];
}
[_contentView setMinimumLayoutSize:bounds.size];
[_scrollView setFrame:bounds];
[_contentView setMinimumSize:bounds.size];
- [self _updateVisibleContentRects];
+ [self _updateVisibleContentRectsWithStableState:YES];
}
-- (void)_updateVisibleContentRects
+- (void)_updateVisibleContentRectsWithStableState:(BOOL)isStateStable
{
CGRect fullViewRect = self.bounds;
CGRect visibleRectInContentCoordinates = [self convertRect:fullViewRect toView:_contentView.get()];
CGFloat scaleFactor = [_scrollView zoomScale];
- [_contentView didUpdateVisibleRect:visibleRectInContentCoordinates unobscuredRect:unobscuredRectInContentCoordinates scale:scaleFactor];
+ [_contentView didUpdateVisibleRect:visibleRectInContentCoordinates unobscuredRect:unobscuredRectInContentCoordinates scale:scaleFactor inStableState:isStateStable];
}
- (void)_keyboardChangedWithInfo:(NSDictionary *)keyboardInfo adjustScrollView:(BOOL)adjustScrollView
ASSERT(obscuredInsets.bottom >= 0);
ASSERT(obscuredInsets.right >= 0);
_obscuredInsets = obscuredInsets;
- [self _updateVisibleContentRects];
+ [self _updateVisibleContentRectsWithStableState:!_isChangingObscuredInsetsInteractively];
}
- (UIColor *)_pageExtendedBackgroundColor
{
ASSERT(_isChangingObscuredInsetsInteractively);
_isChangingObscuredInsetsInteractively = NO;
+ [self _updateVisibleContentRectsWithStableState:YES];
}
#endif
CGFloat scaleFactor = [_scrollView zoomScale];
- [_contentView didUpdateVisibleRect:visibleRectInContentCoordinates unobscuredRect:unobscuredRectInContentCoordinates scale:scaleFactor];
+ [_contentView didUpdateVisibleRect:visibleRectInContentCoordinates unobscuredRect:unobscuredRectInContentCoordinates scale:scaleFactor inStableState:YES];
}
- (void)_keyboardChangedWithInfo:(NSDictionary *)keyboardInfo adjustScrollView:(BOOL)adjustScrollView
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
: m_type(type)
, m_webPageProxy(webPageProxy)
, m_size(webPageProxy->viewSize())
-#if PLATFORM(COCOA)
+#if PLATFORM(MAC)
, m_exposedRectChangedTimer(RunLoop::main(), this, &DrawingAreaProxy::exposedRectChangedTimerFired)
#endif
{
sizeDidChange();
}
-#if PLATFORM(COCOA)
+#if PLATFORM(MAC)
void DrawingAreaProxy::setExposedRect(const FloatRect& exposedRect)
{
if (!m_webPageProxy->isValid())
m_webPageProxy->process().send(Messages::DrawingArea::SetExposedRect(m_exposedRect), m_webPageProxy->pageID());
m_lastSentExposedRect = m_exposedRect;
}
+#endif // PLATFORM(MAC)
void DrawingAreaProxy::setCustomFixedPositionRect(const FloatRect& fixedPositionRect)
{
m_webPageProxy->process().send(Messages::DrawingArea::SetCustomFixedPositionRect(fixedPositionRect), m_webPageProxy->pageID());
}
-#endif
} // namespace WebKit
virtual void adjustTransientZoom(double, WebCore::FloatPoint) { }
virtual void commitTransientZoom(double, WebCore::FloatPoint) { }
-#if PLATFORM(COCOA)
+#if PLATFORM(MAC)
virtual void setExposedRect(const WebCore::FloatRect&);
WebCore::FloatRect exposedRect() const { return m_exposedRect; }
+#endif
+#if PLATFORM(COCOA)
void exposedRectChangedTimerFired();
void setCustomFixedPositionRect(const WebCore::FloatRect&);
#endif
+ virtual void updateDebugIndicator() { }
virtual void showDebugIndicator(bool) { }
virtual bool isShowingDebugIndicator() const { return false; }
virtual void didUpdateGeometry() { }
virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& newIntrinsicContentSize) { }
+#if PLATFORM(MAC)
RunLoop::Timer<DrawingAreaProxy> m_exposedRectChangedTimer;
WebCore::FloatRect m_exposedRect;
WebCore::FloatRect m_lastSentExposedRect;
+#endif // PLATFORM(MAC)
#endif
};
/*
- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#include "PlatformProcessIdentifier.h"
#include "SandboxExtension.h"
#include "ShareableBitmap.h"
+#include "VisibleContentRectUpdateInfo.h"
#include "WKBase.h"
#include "WKPagePrivate.h"
#include "WebColorPicker.h"
void executeEditCommand(const String& commandName);
void validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback>);
#if PLATFORM(IOS)
- const WebCore::FloatRect& unobscuredContentRect() const;
- void setUnobscuredContentRect(const WebCore::FloatRect& unobscuredRect);
+ double displayedContentScale() const { return m_lastVisibleContentRectUpdate.scale(); }
+ const WebCore::FloatRect& exposedContentRect() const { return m_lastVisibleContentRectUpdate.exposedRect(); }
+ const WebCore::FloatRect& unobscuredContentRect() const { return m_lastVisibleContentRectUpdate.unobscuredRect(); }
+
+ void updateVisibleContentRects(const VisibleContentRectUpdateInfo&);
void setViewportConfigurationMinimumLayoutSize(const WebCore::IntSize&);
void didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction&);
#if PLATFORM(IOS)
void willStartUserTriggeredZooming();
- void didFinishZooming(float newScale);
void tapHighlightAtPosition(const WebCore::FloatPoint&, uint64_t& requestID);
#endif
#if PLATFORM(IOS)
RefPtr<WebVideoFullscreenManagerProxy> m_videoFullscreenManager;
- WebCore::FloatRect m_unobscuredRect;
+ VisibleContentRectUpdateInfo m_lastVisibleContentRectUpdate;
#endif
#if ENABLE(VIBRATION)
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
- (void)setMinimumSize:(CGSize)size;
- (void)setMinimumLayoutSize:(CGSize)size;
-- (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect scale:(CGFloat)scale;
+- (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect scale:(CGFloat)scale inStableState:(BOOL)isStableState;
- (void)didFinishScrolling;
- (void)didZoomToScale:(CGFloat)scale;
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
return [self isEditable];
}
-- (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect scale:(CGFloat)scale
+- (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect scale:(CGFloat)scale inStableState:(BOOL)isStableState
{
- _page->setUnobscuredContentRect(unobscuredRect);
- _page->scrollingCoordinatorProxy()->scrollPositionChangedViaDelegatedScrolling(_page->scrollingCoordinatorProxy()->rootScrollingNodeID(), roundedIntPoint(unobscuredRect.origin));
+ double scaleNoiseThreshold = 0.0005;
+ if (!isStableState && abs(scale - _page->displayedContentScale()) < scaleNoiseThreshold) {
+ // Tiny changes of scale during interactive zoom cause content to jump by one pixel, creating
+ // visual noise. We filter those useless updates.
+ scale = _page->displayedContentScale();
+ }
+ _page->updateVisibleContentRects(VisibleContentRectUpdateInfo(visibleRect, unobscuredRect, scale));
if (auto drawingArea = _page->drawingArea()) {
- FloatRect exposedRect = visibleRect;
- exposedRect.scale(scale);
- drawingArea->setExposedRect(exposedRect);
+ FloatRect fixedPosRect = [self fixedPositionRectFromExposedRect:unobscuredRect scale:scale];
+ drawingArea->setCustomFixedPositionRect(fixedPosRect);
+ drawingArea->updateDebugIndicator();
}
-
- [self _updateFixedPositionRect];
}
- (void)setMinimumSize:(CGSize)size
return exposedRect;
}
-- (void)_updateFixedPositionRect
-{
- auto drawingArea = _page->drawingArea();
- if (!drawingArea)
- return;
- FloatRect fixedPosRect = [self fixedPositionRectFromExposedRect:_page->unobscuredContentRect() scale:_page->pageScaleFactor()];
- drawingArea->setCustomFixedPositionRect(fixedPosRect);
-}
-
- (void)setMinimumLayoutSize:(CGSize)size
{
_page->setViewportConfigurationMinimumLayoutSize(IntSize(CGCeiling(size.width), CGCeiling(size.height)));
- (void)didFinishScrolling
{
- [self _updateFixedPositionRect];
[self _didEndScrollingOrZooming];
}
- (void)didZoomToScale:(CGFloat)scale
{
- _page->didFinishZooming(scale);
[self _didEndScrollingOrZooming];
}
#import "NativeWebKeyboardEvent.h"
#import "PageClient.h"
+#import "ViewUpdateDispatcherMessages.h"
#import "WKBrowsingContextControllerInternal.h"
#import "WebKitSystemInterfaceIOS.h"
#import "WebPageMessages.h"
callback->performCallbackWithReturnValue(beforeText, markedText, selectedText, afterText, location, length);
}
-const FloatRect& WebPageProxy::unobscuredContentRect() const
+void WebPageProxy::updateVisibleContentRects(const VisibleContentRectUpdateInfo& visibleContentRectUpdateInfo)
{
- return m_unobscuredRect;
-}
-
-void WebPageProxy::setUnobscuredContentRect(const FloatRect& unobscuredRect)
-{
- m_unobscuredRect = unobscuredRect;
+ if (visibleContentRectUpdateInfo == m_lastVisibleContentRectUpdate)
+ return;
+ m_lastVisibleContentRectUpdate = visibleContentRectUpdateInfo;
+ m_process->send(Messages::ViewUpdateDispatcher::VisibleContentRectUpdate(m_pageID, visibleContentRectUpdateInfo), 0);
}
void WebPageProxy::setViewportConfigurationMinimumLayoutSize(const WebCore::IntSize& size)
process().send(Messages::WebPage::WillStartUserTriggeredZooming(), m_pageID);
}
-void WebPageProxy::didFinishZooming(float newScale)
-{
- m_pageScaleFactor = newScale;
- process().send(Messages::WebPage::DidFinishZooming(newScale), m_pageID);
-}
-
void WebPageProxy::tapHighlightAtPosition(const WebCore::FloatPoint& position, uint64_t& requestID)
{
static uint64_t uniqueRequestID = 0;
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
virtual void deviceScaleFactorDidChange() override;
virtual void didUpdateGeometry() override;
+ WebCore::FloatRect scaledExposedRect() const;
void showDebugIndicator(bool);
+#if PLATFORM(MAC)
virtual void setExposedRect(const WebCore::FloatRect&) override;
+#endif
float indicatorScale(WebCore::IntSize contentsSize) const;
+ virtual void updateDebugIndicator() override;
void updateDebugIndicator(WebCore::IntSize contentsSize, bool rootLayerChanged, float scale);
void updateDebugIndicatorPosition();
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
sendUpdateGeometry();
}
+FloatRect RemoteLayerTreeDrawingAreaProxy::scaledExposedRect() const
+{
+#if PLATFORM(IOS)
+ return m_webPageProxy->exposedContentRect();
+#else
+ FloatRect scaledExposedRect = exposedRect();
+ float scale = 1 / m_webPageProxy->pageScaleFactor();
+ scaledExposedRect.scale(scale, scale);
+ return scaledExposedRect;
+#endif
+}
+
void RemoteLayerTreeDrawingAreaProxy::sendUpdateGeometry()
{
m_lastSentSize = m_size;
}
static const float indicatorInset = 10;
-static const float indicatorTopInset = 100;
+#if PLATFORM(MAC)
void RemoteLayerTreeDrawingAreaProxy::setExposedRect(const WebCore::FloatRect& r)
{
DrawingAreaProxy::setExposedRect(r);
updateDebugIndicatorPosition();
}
+#endif
FloatPoint RemoteLayerTreeDrawingAreaProxy::indicatorLocation() const
{
if (m_webPageProxy->delegatesScrolling()) {
+#if PLATFORM(IOS)
+ FloatPoint tiledMapLocation = m_webPageProxy->unobscuredContentRect().location();
+ float absoluteInset = indicatorInset / m_webPageProxy->displayedContentScale();
+ tiledMapLocation += FloatSize(absoluteInset, absoluteInset);
+#else
FloatPoint tiledMapLocation = exposedRect().location();
- tiledMapLocation += FloatSize(indicatorInset, indicatorTopInset);
- float scale = 1 / m_webPageProxy->pageScaleFactor();
+ tiledMapLocation += FloatSize(indicatorInset, indicatorInset);
+ float scale = 1 / m_webPageProxy->pageScaleFactor();;
tiledMapLocation.scale(scale, scale);
+#endif
return tiledMapLocation;
}
float scale = 1;
if (!contentsSize.isEmpty()) {
float widthScale = std::min<float>((viewSize.width() - 2 * indicatorInset) / contentsSize.width(), 0.05);
- scale = std::min(widthScale, static_cast<float>(viewSize.height() - indicatorTopInset - indicatorInset) / contentsSize.height());
+ scale = std::min(widthScale, static_cast<float>(viewSize.height() - 2 * indicatorInset) / contentsSize.height());
}
return scale;
}
+void RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator()
+{
+ // FIXME: we should also update live information during scale.
+ updateDebugIndicatorPosition();
+}
+
void RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator(IntSize contentsSize, bool rootLayerChanged, float scale)
{
// Make sure we're the last sublayer.
[m_exposedRectIndicatorLayer setBorderWidth:counterScaledBorder];
if (m_webPageProxy->delegatesScrolling()) {
- FloatRect scaledExposedRect = exposedRect();
- float scale = 1 / m_webPageProxy->pageScaleFactor();
- scaledExposedRect.scale(scale, scale);
-
+ FloatRect scaledExposedRect = this->scaledExposedRect();
[m_exposedRectIndicatorLayer setPosition:scaledExposedRect.location()];
[m_exposedRectIndicatorLayer setBounds:FloatRect(FloatPoint(), scaledExposedRect.size())];
} else {
1QQ417CB12C00CCA002BE67B /* TextCheckerCompletion.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CC417C912C00CCA002BE67B /* TextCheckerCompletion.h */; };
1ZZ417EF12C00D87002BE67B /* TextCheckerCompletion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1BB417C912C00CCA002BE67B /* TextCheckerCompletion.cpp */; };
263172CF18B469490065B9C3 /* NativeWebTouchEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 263172CE18B469490065B9C3 /* NativeWebTouchEvent.h */; };
+ 2684054418B85A630022C38B /* VisibleContentRectUpdateInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 2684054218B85A630022C38B /* VisibleContentRectUpdateInfo.h */; };
+ 2684054918B85FF70022C38B /* ViewUpdateDispatcher.messages.in in Resources */ = {isa = PBXBuildFile; fileRef = 2684054818B85FF70022C38B /* ViewUpdateDispatcher.messages.in */; };
+ 2684054C18B86C350022C38B /* VisibleContentRectUpdateInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2684054A18B866FF0022C38B /* VisibleContentRectUpdateInfo.cpp */; };
+ 2684054F18B86C8E0022C38B /* ViewUpdateDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2684054518B85E7E0022C38B /* ViewUpdateDispatcher.cpp */; };
+ 2684055218B86ED60022C38B /* ViewUpdateDispatcherMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2684055018B86ED60022C38B /* ViewUpdateDispatcherMessageReceiver.cpp */; };
+ 2684055318B86ED60022C38B /* ViewUpdateDispatcherMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 2684055118B86ED60022C38B /* ViewUpdateDispatcherMessages.h */; };
26F9A83B18A3468100AEB88A /* WKWebViewPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F9A83A18A3463F00AEB88A /* WKWebViewPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
290F4272172A0C7400939FF0 /* ChildProcessSupplement.h in Headers */ = {isa = PBXBuildFile; fileRef = 290F4271172A0C7400939FF0 /* ChildProcessSupplement.h */; };
293EBEAB1627D9C9005F89F1 /* WKDOMText.h in Headers */ = {isa = PBXBuildFile; fileRef = 293EBEA91627D9C9005F89F1 /* WKDOMText.h */; settings = {ATTRIBUTES = (Private, ); }; };
1FB00AC6185F76460019142E /* WKWebProcessPlugInPageGroupInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessPlugInPageGroupInternal.h; sourceTree = "<group>"; };
263172CE18B469490065B9C3 /* NativeWebTouchEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeWebTouchEvent.h; sourceTree = "<group>"; };
26659AA0185FAAED004303DD /* Info-iOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-iOS.plist"; sourceTree = "<group>"; };
+ 2684054218B85A630022C38B /* VisibleContentRectUpdateInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisibleContentRectUpdateInfo.h; sourceTree = "<group>"; };
+ 2684054518B85E7E0022C38B /* ViewUpdateDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ViewUpdateDispatcher.cpp; sourceTree = "<group>"; };
+ 2684054618B85E7E0022C38B /* ViewUpdateDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewUpdateDispatcher.h; sourceTree = "<group>"; };
+ 2684054818B85FF70022C38B /* ViewUpdateDispatcher.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ViewUpdateDispatcher.messages.in; sourceTree = "<group>"; };
+ 2684054A18B866FF0022C38B /* VisibleContentRectUpdateInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisibleContentRectUpdateInfo.cpp; sourceTree = "<group>"; };
+ 2684055018B86ED60022C38B /* ViewUpdateDispatcherMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ViewUpdateDispatcherMessageReceiver.cpp; path = "ViewUpdateDispatcherMessageReceiver.cpp"; sourceTree = "<group>"; };
+ 2684055118B86ED60022C38B /* ViewUpdateDispatcherMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ViewUpdateDispatcherMessages.h; path = "ViewUpdateDispatcherMessages.h"; sourceTree = "<group>"; };
26F9A83A18A3463F00AEB88A /* WKWebViewPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKWebViewPrivate.h; sourceTree = "<group>"; };
290F4271172A0C7400939FF0 /* ChildProcessSupplement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChildProcessSupplement.h; sourceTree = "<group>"; };
293EBEA91627D9C9005F89F1 /* WKDOMText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDOMText.h; sourceTree = "<group>"; };
1AC1336518565B5700F3EC05 /* UserData.cpp */,
1AC1336618565B5700F3EC05 /* UserData.h */,
BCB0B0DF12305AB100B1341E /* UserMessageCoders.h */,
+ 2684054A18B866FF0022C38B /* VisibleContentRectUpdateInfo.cpp */,
+ 2684054218B85A630022C38B /* VisibleContentRectUpdateInfo.h */,
1A0F29C9120B37160053D1B9 /* VisitedLinkTable.cpp */,
1A0F29CA120B37160053D1B9 /* VisitedLinkTable.h */,
BC329D9916ACCE9900316DE2 /* WebArchive.cpp */,
2D819B99186275B3001F03D1 /* ViewGestureGeometryCollector.cpp */,
2D819B9A186275B3001F03D1 /* ViewGestureGeometryCollector.h */,
2D819B9B186275B3001F03D1 /* ViewGestureGeometryCollector.messages.in */,
+ 2684054518B85E7E0022C38B /* ViewUpdateDispatcher.cpp */,
+ 2684054618B85E7E0022C38B /* ViewUpdateDispatcher.h */,
+ 2684054818B85FF70022C38B /* ViewUpdateDispatcher.messages.in */,
BC72B9F811E6476B001EB4EA /* WebBackForwardListProxy.cpp */,
BC72B9F911E6476B001EB4EA /* WebBackForwardListProxy.h */,
51871B59127CB89D00F76232 /* WebContextMenu.cpp */,
1AB31A9516BC688100F6DBC9 /* StorageManagerMessages.h */,
2D1B5D5B185869C8006C6596 /* ViewGestureControllerMessageReceiver.cpp */,
2D1B5D5C185869C8006C6596 /* ViewGestureControllerMessages.h */,
+ 2684055018B86ED60022C38B /* ViewUpdateDispatcherMessageReceiver.cpp */,
+ 2684055118B86ED60022C38B /* ViewUpdateDispatcherMessages.h */,
512E3568130B57F000ABD19A /* WebApplicationCacheManagerMessageReceiver.cpp */,
512E3569130B57F000ABD19A /* WebApplicationCacheManagerMessages.h */,
512E35F6130B642E00ABD19A /* WebApplicationCacheManagerProxyMessageReceiver.cpp */,
51064D36189781C4004B2FEB /* SQLiteIDBCursor.h in Headers */,
BC032D7D10F4378D0058C15A /* WebEditorClient.h in Headers */,
0F5947A8187B517600437857 /* RemoteScrollingCoordinatorMessages.h in Headers */,
+ 2684055318B86ED60022C38B /* ViewUpdateDispatcherMessages.h in Headers */,
516A4A5D120A2CCD00C05B7F /* APIError.h in Headers */,
1A433F0D113C53DD00FACDE9 /* WebErrors.h in Headers */,
BC032DB910F4380F0058C15A /* WebEvent.h in Headers */,
BCE0E425168B7A280057E66A /* WebProcessSupplement.h in Headers */,
512F589D12A8838800629530 /* WebProtectionSpace.h in Headers */,
1AC1337218566C7C00F3EC05 /* APIFrameHandle.h in Headers */,
+ 2684054418B85A630022C38B /* VisibleContentRectUpdateInfo.h in Headers */,
37948404150C350600E52CE9 /* WebRenderLayer.h in Headers */,
51E351F6180F5C7500E53BE9 /* WebIDBFactoryBackend.h in Headers */,
3760881F150413E900FC82C7 /* WebRenderObject.h in Headers */,
buildActionMask = 2147483647;
files = (
E1D26A51175964D70095BFD1 /* WebContentProcess.xib in Resources */,
+ 2684054918B85FF70022C38B /* ViewUpdateDispatcher.messages.in in Resources */,
E133FD8A1423DD7F00FC7BFB /* WebKit.icns in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
75E749E9180DBB9800088BA6 /* WebOriginDataManagerMessageReceiver.cpp in Sources */,
BC204EE611C83EA9008F3375 /* InjectedBundleMac.mm in Sources */,
BC8147D612F66D31007B2C32 /* InjectedBundleNavigationAction.cpp in Sources */,
+ 2684054C18B86C350022C38B /* VisibleContentRectUpdateInfo.cpp in Sources */,
BC4BEEAC120A0A5F00FBA0C7 /* InjectedBundleNodeHandle.cpp in Sources */,
512935E31288D97800A4B695 /* InjectedBundlePageContextMenuClient.cpp in Sources */,
CD67D30E15C08F9A00843ADF /* InjectedBundlePageDiagnosticLoggingClient.cpp in Sources */,
BC82836516B354F600A278FE /* WebContentProcessMain.mm in Sources */,
2D125C5F1857EA05003BA3CB /* ViewGestureControllerMac.mm in Sources */,
BC82839916B48DC000A278FE /* WebContentServiceEntryPoint.mm in Sources */,
+ 2684054F18B86C8E0022C38B /* ViewUpdateDispatcher.cpp in Sources */,
BCB9E2441120DACA00A137E0 /* WebContext.cpp in Sources */,
31A505F91680025500A930EB /* WebContextClient.cpp in Sources */,
BC09B8F8147460F7005F5625 /* WebContextConnectionClient.cpp in Sources */,
BC0E607412D6BC200012A72A /* WebGeolocationPosition.cpp in Sources */,
BC1BE1F312D54DBD0004A228 /* WebGeolocationProvider.cpp in Sources */,
7801C099142290C400FAF9AF /* WebHitTestResult.cpp in Sources */,
+ 2684055218B86ED60022C38B /* ViewUpdateDispatcherMessageReceiver.cpp in Sources */,
511B24AA132E097200065A0C /* WebIconDatabase.cpp in Sources */,
51834592134532E90092B696 /* WebIconDatabaseClient.cpp in Sources */,
51D02F64132EC5B900BEAA96 /* WebIconDatabaseMessageReceiver.cpp in Sources */,
--- /dev/null
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ViewUpdateDispatcher.h"
+
+#if PLATFORM(IOS)
+
+#include "ViewUpdateDispatcherMessages.h"
+#include "WebPage.h"
+#include "WebProcess.h"
+#include <wtf/RunLoop.h>
+
+namespace WebKit {
+
+PassRef<ViewUpdateDispatcher> ViewUpdateDispatcher::create()
+{
+ return adoptRef(*new ViewUpdateDispatcher);
+}
+
+ViewUpdateDispatcher::ViewUpdateDispatcher()
+ : m_queue(WorkQueue::create("com.apple.WebKit.ViewUpdateDispatcher"))
+{
+}
+
+ViewUpdateDispatcher::~ViewUpdateDispatcher()
+{
+}
+
+void ViewUpdateDispatcher::initializeConnection(IPC::Connection* connection)
+{
+ connection->addWorkQueueMessageReceiver(Messages::ViewUpdateDispatcher::messageReceiverName(), m_queue.get(), this);
+}
+
+void ViewUpdateDispatcher::visibleContentRectUpdate(uint64_t pageID, const VisibleContentRectUpdateInfo& visibleContentRectUpdateInfo)
+{
+ {
+ MutexLocker locker(m_dataMutex);
+ m_latestUpdate.set(pageID, visibleContentRectUpdateInfo);
+ }
+ RunLoop::main()->dispatch(bind(&ViewUpdateDispatcher::dispatchVisibleContentRectUpdate, this));
+}
+
+void ViewUpdateDispatcher::dispatchVisibleContentRectUpdate()
+{
+ HashMap<uint64_t, VisibleContentRectUpdateInfo> localCopy;
+ {
+ MutexLocker locker(m_dataMutex);
+ localCopy.swap(m_latestUpdate);
+ }
+
+ for (auto& iterator : localCopy) {
+ if (WebPage* webPage = WebProcess::shared().webPage(iterator.key))
+ webPage->updateVisibleContentRects(iterator.value);
+ }
+}
+
+} // namespace WebKit
+
+#endif // PLATFORM(IOS)
--- /dev/null
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ViewUpdateDispatcher_h
+#define ViewUpdateDispatcher_h
+
+#include "Connection.h"
+
+#include "VisibleContentRectUpdateInfo.h"
+#include <wtf/HashMap.h>
+#include <wtf/PassRef.h>
+
+namespace WebKit {
+
+class ViewUpdateDispatcher : public IPC::Connection::WorkQueueMessageReceiver {
+public:
+ static PassRef<ViewUpdateDispatcher> create();
+ ~ViewUpdateDispatcher();
+
+ void initializeConnection(IPC::Connection*);
+
+private:
+ ViewUpdateDispatcher();
+ // IPC::Connection::WorkQueueMessageReceiver.
+ virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override;
+
+ void visibleContentRectUpdate(uint64_t pageID, const VisibleContentRectUpdateInfo&);
+
+ void dispatchVisibleContentRectUpdate();
+
+ RefPtr<WorkQueue> m_queue;
+ Mutex m_dataMutex;
+ HashMap<uint64_t, VisibleContentRectUpdateInfo> m_latestUpdate;
+};
+
+} // namespace WebKit
+
+#endif // ViewportUpdateDispatcher_h
--- /dev/null
+# Copyright (C) 2014 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+messages -> ViewUpdateDispatcher {
+ VisibleContentRectUpdate(uint64_t pageID, WebKit::VisibleContentRectUpdateInfo visibleContentRectUpdateInfo)
+}
#endif
#if PLATFORM(IOS)
, m_shouldReturnWordAtSelection(false)
+ , m_scaleWasSetByUIProcess(false)
, m_userHasChangedPageScaleFactor(false)
#endif
, m_inspectorClient(0)
void WebPage::scalePage(double scale, const IntPoint& origin)
{
+ if (scale == pageScaleFactor())
+ return;
+
+#if PLATFORM(IOS)
+ m_scaleWasSetByUIProcess = false;
+#endif
PluginView* pluginView = pluginViewForFrame(&m_page->mainFrame());
if (pluginView && pluginView->handlesPageScaleFactor()) {
pluginView->setPageScaleFactor(scale, origin);
layerTransaction.setPageScaleFactor(corePage()->pageScaleFactor());
layerTransaction.setRenderTreeSize(corePage()->renderTreeSize());
#if PLATFORM(IOS)
+ layerTransaction.setScaleWasSetByUIProcess(scaleWasSetByUIProcess());
layerTransaction.setMinimumScaleFactor(minimumPageScaleFactor());
layerTransaction.setMaximumScaleFactor(maximumPageScaleFactor());
layerTransaction.setAllowsUserScaling(allowsUserScaling());
class PageOverlay;
class PluginView;
class SessionState;
+class VisibleContentRectUpdateInfo;
class WebColorChooser;
class WebContextMenu;
class WebContextMenuItemData;
#if PLATFORM(IOS)
void setViewportConfigurationMinimumLayoutSize(const WebCore::IntSize&);
void viewportConfigurationChanged();
+ void updateVisibleContentRects(const VisibleContentRectUpdateInfo&);
+ bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; }
void willStartUserTriggeredZooming();
- void didFinishScrolling(const WebCore::FloatPoint& contentOffset);
- void didFinishZooming(float);
#endif
#if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
bool m_shouldReturnWordAtSelection;
WebCore::ViewportConfiguration m_viewportConfiguration;
+ bool m_scaleWasSetByUIProcess;
bool m_userHasChangedPageScaleFactor;
WebCore::IntSize m_blockSelectionDesiredSize;
#endif
#if PLATFORM(IOS)
WillStartUserTriggeredZooming();
- DidFinishZooming(float scale);
#endif
#if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#import "AssistedNodeInformation.h"
#import "EditorState.h"
#import "InteractionInformationAtPosition.h"
+#import "LayerTreeHost.h"
+#import "VisibleContentRectUpdateInfo.h"
#import "WebChromeClient.h"
#import "WebCoreArgumentCoders.h"
#import "WebFrame.h"
scalePage(scale, m_page->mainFrame().view()->scrollPosition());
}
-void WebPage::willStartUserTriggeredZooming()
+void WebPage::updateVisibleContentRects(const VisibleContentRectUpdateInfo& visibleContentRectUpdateInfo)
{
- m_userHasChangedPageScaleFactor = true;
+ double boundedScale = std::min(m_viewportConfiguration.maximumScale(), std::max(m_viewportConfiguration.minimumScale(), visibleContentRectUpdateInfo.scale()));
+
+ IntPoint scrollPosition = roundedIntPoint(visibleContentRectUpdateInfo.unobscuredRect().location());
+
+ FloatRect exposedRect = visibleContentRectUpdateInfo.exposedRect();
+ exposedRect.scale(boundedScale);
+ m_drawingArea->setExposedRect(exposedRect);
+
+ if (boundedScale != m_page->pageScaleFactor()) {
+ m_scaleWasSetByUIProcess = true;
+ m_page->setPageScaleFactor(boundedScale, scrollPosition);
+ if (m_drawingArea->layerTreeHost())
+ m_drawingArea->layerTreeHost()->deviceOrPageScaleFactorChanged();
+ send(Messages::WebPageProxy::PageScaleFactorDidChange(boundedScale));
+ }
+
+ // FIXME: we should also update the frame view from unobscured rect. Altenatively, we can have it pull the values from ScrollView.
}
-void WebPage::didFinishZooming(float newScale)
+void WebPage::willStartUserTriggeredZooming()
{
- m_page->setPageScaleFactor(newScale, m_page->mainFrame().view()->scrollPosition());
+ m_userHasChangedPageScaleFactor = true;
}
} // namespace WebKit
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2014 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
WebProcess::WebProcess()
: m_eventDispatcher(EventDispatcher::create())
+#if PLATFORM(IOS)
+ , m_viewUpdateDispatcher(ViewUpdateDispatcher::create())
+#endif // PLATFORM(IOS)
, m_inDidClose(false)
, m_shouldTrackVisitedLinks(true)
, m_hasSetCacheModel(false)
connection->setShouldExitOnSyncMessageSendFailure(true);
m_eventDispatcher->initializeConnection(connection);
+#if PLATFORM(IOS)
+ m_viewUpdateDispatcher->initializeConnection(connection);
+#endif // PLATFORM(IOS)
#if ENABLE(NETSCAPE_PLUGIN_API)
m_pluginProcessConnectionManager->initializeConnection(connection);
#include "SandboxExtension.h"
#include "SharedMemory.h"
#include "TextCheckerState.h"
+#include "ViewUpdateDispatcher.h"
#include "VisitedLinkTable.h"
#include <WebCore/LinkHash.h>
#include <WebCore/Timer.h>
RefPtr<InjectedBundle> m_injectedBundle;
RefPtr<EventDispatcher> m_eventDispatcher;
+#if PLATFORM(IOS)
+ RefPtr<ViewUpdateDispatcher> m_viewUpdateDispatcher;
+#endif
bool m_inDidClose;