- Revision
- 165279
- Author
- [email protected]
- Date
- 2014-03-07 12:52:09 -0800 (Fri, 07 Mar 2014)
Log Message
[iOS] Add an updateID to visibleContentRect updates which is passed back in layer transactions, so we know whether transactions are stale
https://bugs.webkit.org/show_bug.cgi?id=129897
Reviewed by Benjamin Poulain.
In WebKit2 on iOS we need to know when layer updates from the web process
are stale with respect to visible rect updates from the UI process. Do so
by adding an updateID to VisibleContentRectUpdateInfo, and storing it
on each side, returning it in RemoteLayerTreeTransaction.
Did some re-ordering of members and encoding order in RemoteLayerTreeTransaction
to group like data members together.
* Shared/VisibleContentRectUpdateInfo.cpp:
(WebKit::VisibleContentRectUpdateInfo::encode):
(WebKit::VisibleContentRectUpdateInfo::decode):
* Shared/VisibleContentRectUpdateInfo.h:
(WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
(WebKit::VisibleContentRectUpdateInfo::updateID):
(WebKit::operator==):
* Shared/mac/RemoteLayerTreeTransaction.h:
(WebKit::RemoteLayerTreeTransaction::setLastVisibleContentRectUpdateID):
(WebKit::RemoteLayerTreeTransaction::lastVisibleContentRectUpdateID):
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::encode):
(WebKit::RemoteLayerTreeTransaction::decode):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::nextVisibleContentRectUpdateID):
(WebKit::WebPageProxy::lastVisibleContentRectUpdateID):
* UIProcess/ios/WKContentView.mm:
(-[WKContentView didUpdateVisibleRect:unobscuredRect:scale:inStableState:]):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::willCommitLayerTree):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateVisibleContentRects):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (165278 => 165279)
--- trunk/Source/WebKit2/ChangeLog 2014-03-07 20:39:13 UTC (rev 165278)
+++ trunk/Source/WebKit2/ChangeLog 2014-03-07 20:52:09 UTC (rev 165279)
@@ -1,3 +1,43 @@
+2014-03-07 Simon Fraser <[email protected]>
+
+ [iOS] Add an updateID to visibleContentRect updates which is passed back in layer transactions, so we know whether transactions are stale
+ https://bugs.webkit.org/show_bug.cgi?id=129897
+
+ Reviewed by Benjamin Poulain.
+
+ In WebKit2 on iOS we need to know when layer updates from the web process
+ are stale with respect to visible rect updates from the UI process. Do so
+ by adding an updateID to VisibleContentRectUpdateInfo, and storing it
+ on each side, returning it in RemoteLayerTreeTransaction.
+
+ Did some re-ordering of members and encoding order in RemoteLayerTreeTransaction
+ to group like data members together.
+
+ * Shared/VisibleContentRectUpdateInfo.cpp:
+ (WebKit::VisibleContentRectUpdateInfo::encode):
+ (WebKit::VisibleContentRectUpdateInfo::decode):
+ * Shared/VisibleContentRectUpdateInfo.h:
+ (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
+ (WebKit::VisibleContentRectUpdateInfo::updateID):
+ (WebKit::operator==):
+ * Shared/mac/RemoteLayerTreeTransaction.h:
+ (WebKit::RemoteLayerTreeTransaction::setLastVisibleContentRectUpdateID):
+ (WebKit::RemoteLayerTreeTransaction::lastVisibleContentRectUpdateID):
+ * Shared/mac/RemoteLayerTreeTransaction.mm:
+ (WebKit::RemoteLayerTreeTransaction::encode):
+ (WebKit::RemoteLayerTreeTransaction::decode):
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::nextVisibleContentRectUpdateID):
+ (WebKit::WebPageProxy::lastVisibleContentRectUpdateID):
+ * UIProcess/ios/WKContentView.mm:
+ (-[WKContentView didUpdateVisibleRect:unobscuredRect:scale:inStableState:]):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage):
+ (WebKit::WebPage::willCommitLayerTree):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::updateVisibleContentRects):
+
2014-03-07 Roger Fong <[email protected]>
Replace setSystemWebGLLoadPolicy API with methods to query for WebGL blocking policy.
Modified: trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.cpp (165278 => 165279)
--- trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.cpp 2014-03-07 20:39:13 UTC (rev 165278)
+++ trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.cpp 2014-03-07 20:52:09 UTC (rev 165279)
@@ -36,6 +36,7 @@
encoder << m_unobscuredRect;
encoder << m_customFixedPositionRect;
encoder << m_scale;
+ encoder << m_updateID;
encoder << m_inStableState;
}
@@ -49,6 +50,8 @@
return false;
if (!decoder.decode(result.m_scale))
return false;
+ if (!decoder.decode(result.m_updateID))
+ return false;
if (!decoder.decode(result.m_inStableState))
return false;
return true;
Modified: trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.h (165278 => 165279)
--- trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.h 2014-03-07 20:39:13 UTC (rev 165278)
+++ trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.h 2014-03-07 20:52:09 UTC (rev 165279)
@@ -39,14 +39,17 @@
public:
VisibleContentRectUpdateInfo()
: m_scale(-1)
+ , m_updateID(0)
+ , m_inStableState(false)
{
}
- VisibleContentRectUpdateInfo(const WebCore::FloatRect& exposedRect, const WebCore::FloatRect& unobscuredRect, const WebCore::FloatRect& customFixedPositionRect, double scale, bool inStableState)
+ VisibleContentRectUpdateInfo(uint64_t updateID, const WebCore::FloatRect& exposedRect, const WebCore::FloatRect& unobscuredRect, const WebCore::FloatRect& customFixedPositionRect, double scale, bool inStableState)
: m_exposedRect(exposedRect)
, m_unobscuredRect(unobscuredRect)
, m_customFixedPositionRect(customFixedPositionRect)
, m_scale(scale)
+ , m_updateID(updateID)
, m_inStableState(inStableState)
{
}
@@ -55,6 +58,7 @@
const WebCore::FloatRect& unobscuredRect() const { return m_unobscuredRect; }
const WebCore::FloatRect& customFixedPositionRect() const { return m_customFixedPositionRect; }
double scale() const { return m_scale; }
+ uint64_t updateID() const { return m_updateID; }
bool inStableState() const { return m_inStableState; }
void encode(IPC::ArgumentEncoder&) const;
@@ -65,11 +69,13 @@
WebCore::FloatRect m_unobscuredRect;
WebCore::FloatRect m_customFixedPositionRect;
double m_scale;
+ uint64_t m_updateID;
bool m_inStableState;
};
inline bool operator==(const VisibleContentRectUpdateInfo& a, const VisibleContentRectUpdateInfo& b)
{
+ // Note: the comparison doesn't include updateID since we care about equality based on the other data.
return a.scale() == b.scale()
&& a.exposedRect() == b.exposedRect()
&& a.unobscuredRect() == b.unobscuredRect()
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (165278 => 165279)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2014-03-07 20:39:13 UTC (rev 165278)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2014-03-07 20:52:09 UTC (rev 165279)
@@ -164,6 +164,9 @@
double pageScaleFactor() const { return m_pageScaleFactor; }
void setPageScaleFactor(double pageScaleFactor) { m_pageScaleFactor = pageScaleFactor; }
+
+ void setLastVisibleContentRectUpdateID(uint64_t lastVisibleContentRectUpdateID) { m_lastVisibleContentRectUpdateID = lastVisibleContentRectUpdateID; }
+ uint64_t lastVisibleContentRectUpdateID() const { return m_lastVisibleContentRectUpdateID; }
bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; }
void setScaleWasSetByUIProcess(bool scaleWasSetByUIProcess) { m_scaleWasSetByUIProcess = scaleWasSetByUIProcess; }
@@ -188,14 +191,16 @@
LayerPropertiesMap m_changedLayerProperties;
Vector<LayerCreationProperties> m_createdLayers;
Vector<WebCore::GraphicsLayer::PlatformLayerID> m_destroyedLayerIDs;
+ Vector<WebCore::GraphicsLayer::PlatformLayerID> m_videoLayerIDsPendingFullscreen;
+
WebCore::IntSize m_contentsSize;
double m_pageScaleFactor;
- bool m_scaleWasSetByUIProcess;
- uint64_t m_renderTreeSize;
double m_minimumScaleFactor;
double m_maximumScaleFactor;
+ uint64_t m_lastVisibleContentRectUpdateID;
+ uint64_t m_renderTreeSize;
+ bool m_scaleWasSetByUIProcess;
bool m_allowsUserScaling;
- Vector<WebCore::GraphicsLayer::PlatformLayerID> m_videoLayerIDsPendingFullscreen;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (165278 => 165279)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2014-03-07 20:39:13 UTC (rev 165278)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2014-03-07 20:52:09 UTC (rev 165279)
@@ -411,14 +411,18 @@
}
encoder << m_destroyedLayerIDs;
+ encoder << m_videoLayerIDsPendingFullscreen;
+
encoder << m_contentsSize;
encoder << m_pageScaleFactor;
- encoder << m_scaleWasSetByUIProcess;
encoder << m_minimumScaleFactor;
encoder << m_maximumScaleFactor;
+
+ encoder << m_lastVisibleContentRectUpdateID;
+ encoder << m_renderTreeSize;
+
+ encoder << m_scaleWasSetByUIProcess;
encoder << m_allowsUserScaling;
- encoder << m_renderTreeSize;
- encoder << m_videoLayerIDsPendingFullscreen;
}
bool RemoteLayerTreeTransaction::decode(IPC::ArgumentDecoder& decoder, RemoteLayerTreeTransaction& result)
@@ -455,30 +459,33 @@
return false;
}
+ if (!decoder.decode(result.m_videoLayerIDsPendingFullscreen))
+ return false;
+
if (!decoder.decode(result.m_contentsSize))
return false;
if (!decoder.decode(result.m_pageScaleFactor))
return false;
- if (!decoder.decode(result.m_scaleWasSetByUIProcess))
- return false;
-
if (!decoder.decode(result.m_minimumScaleFactor))
return false;
if (!decoder.decode(result.m_maximumScaleFactor))
return false;
- if (!decoder.decode(result.m_allowsUserScaling))
+ if (!decoder.decode(result.m_lastVisibleContentRectUpdateID))
return false;
-
+
if (!decoder.decode(result.m_renderTreeSize))
return false;
-
- if (!decoder.decode(result.m_videoLayerIDsPendingFullscreen))
+
+ if (!decoder.decode(result.m_scaleWasSetByUIProcess))
return false;
+ if (!decoder.decode(result.m_allowsUserScaling))
+ return false;
+
return true;
}
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (165278 => 165279)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2014-03-07 20:39:13 UTC (rev 165278)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2014-03-07 20:52:09 UTC (rev 165279)
@@ -459,6 +459,9 @@
const WebCore::FloatRect& unobscuredContentRect() const { return m_lastVisibleContentRectUpdate.unobscuredRect(); }
bool updateVisibleContentRects(const VisibleContentRectUpdateInfo&);
+ uint64_t nextVisibleContentRectUpdateID() const { return m_lastVisibleContentRectUpdate.updateID() + 1; }
+ uint64_t lastVisibleContentRectUpdateID() const { return m_lastVisibleContentRectUpdate.updateID(); }
+
void setViewportConfigurationMinimumLayoutSize(const WebCore::IntSize&);
void didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction&);
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm (165278 => 165279)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm 2014-03-07 20:39:13 UTC (rev 165278)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm 2014-03-07 20:52:09 UTC (rev 165279)
@@ -173,7 +173,7 @@
}
FloatRect fixedPosRect = [self fixedPositionRectFromExposedRect:unobscuredRect scale:scale];
- _page->updateVisibleContentRects(VisibleContentRectUpdateInfo(visibleRect, unobscuredRect, fixedPosRect, scale, isStableState));
+ _page->updateVisibleContentRects(VisibleContentRectUpdateInfo(_page->nextVisibleContentRectUpdateID(), visibleRect, unobscuredRect, fixedPosRect, scale, isStableState));
RemoteScrollingCoordinatorProxy* scrollingCoordinator = _page->scrollingCoordinatorProxy();
scrollingCoordinator->scrollPositionChangedViaDelegatedScrolling(scrollingCoordinator->rootScrollingNodeID(), unobscuredRect.origin);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (165278 => 165279)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2014-03-07 20:39:13 UTC (rev 165278)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2014-03-07 20:52:09 UTC (rev 165279)
@@ -283,6 +283,7 @@
#endif
#if PLATFORM(IOS)
, m_shouldReturnWordAtSelection(false)
+ , m_lastVisibleContentRectUpdateID(0)
, m_scaleWasSetByUIProcess(false)
, m_userHasChangedPageScaleFactor(false)
#endif
@@ -2632,6 +2633,7 @@
layerTransaction.setPageScaleFactor(corePage()->pageScaleFactor());
layerTransaction.setRenderTreeSize(corePage()->renderTreeSize());
#if PLATFORM(IOS)
+ layerTransaction.setLastVisibleContentRectUpdateID(m_lastVisibleContentRectUpdateID);
layerTransaction.setScaleWasSetByUIProcess(scaleWasSetByUIProcess());
layerTransaction.setMinimumScaleFactor(minimumPageScaleFactor());
layerTransaction.setMaximumScaleFactor(maximumPageScaleFactor());
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (165278 => 165279)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2014-03-07 20:39:13 UTC (rev 165278)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2014-03-07 20:52:09 UTC (rev 165279)
@@ -1100,6 +1100,7 @@
bool m_shouldReturnWordAtSelection;
WebCore::ViewportConfiguration m_viewportConfiguration;
+ uint64_t m_lastVisibleContentRectUpdateID;
bool m_scaleWasSetByUIProcess;
bool m_userHasChangedPageScaleFactor;
WebCore::IntSize m_blockSelectionDesiredSize;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (165278 => 165279)
--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2014-03-07 20:39:13 UTC (rev 165278)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2014-03-07 20:52:09 UTC (rev 165279)
@@ -1729,6 +1729,8 @@
void WebPage::updateVisibleContentRects(const VisibleContentRectUpdateInfo& visibleContentRectUpdateInfo)
{
+ m_lastVisibleContentRectUpdateID = visibleContentRectUpdateInfo.updateID();
+
FloatRect exposedRect = visibleContentRectUpdateInfo.exposedRect();
m_drawingArea->setExposedContentRect(enclosingIntRect(exposedRect));