- Revision
- 107237
- Author
- [email protected]
- Date
- 2012-02-09 06:40:47 -0800 (Thu, 09 Feb 2012)
Log Message
[Qt] Fetch the visible rect from LayerTreeHost instead of keeping a copy in each layer.
https://bugs.webkit.org/show_bug.cgi?id=78009
Reviewed by Noam Rosenthal.
Since WebGraphicsLayers are now accessed directly from LayerTreeHost, they don't
need to keep the visible rect to pass it down their child layers anymore.
* WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
(WebCore::WebGraphicsLayer::setContentsScale):
(WebCore::WebGraphicsLayer::tiledBackingStoreVisibleRect):
(WebCore::WebGraphicsLayer::adjustVisibleRect):
(WebCore):
* WebProcess/WebCoreSupport/WebGraphicsLayer.h:
(WebGraphicsLayerClient):
(WebGraphicsLayer):
* WebProcess/WebPage/qt/LayerTreeHostQt.cpp:
(WebKit::LayerTreeHostQt::registerLayer):
(WebKit::LayerTreeHostQt::visibleContentsRect):
(WebKit):
(WebKit::LayerTreeHostQt::setVisibleContentRectAndScale):
* WebProcess/WebPage/qt/LayerTreeHostQt.h:
(LayerTreeHostQt):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (107236 => 107237)
--- trunk/Source/WebKit2/ChangeLog 2012-02-09 14:38:44 UTC (rev 107236)
+++ trunk/Source/WebKit2/ChangeLog 2012-02-09 14:40:47 UTC (rev 107237)
@@ -1,3 +1,29 @@
+2012-02-07 Jocelyn Turcotte <[email protected]>
+
+ [Qt] Fetch the visible rect from LayerTreeHost instead of keeping a copy in each layer.
+ https://bugs.webkit.org/show_bug.cgi?id=78009
+
+ Reviewed by Noam Rosenthal.
+
+ Since WebGraphicsLayers are now accessed directly from LayerTreeHost, they don't
+ need to keep the visible rect to pass it down their child layers anymore.
+
+ * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
+ (WebCore::WebGraphicsLayer::setContentsScale):
+ (WebCore::WebGraphicsLayer::tiledBackingStoreVisibleRect):
+ (WebCore::WebGraphicsLayer::adjustVisibleRect):
+ (WebCore):
+ * WebProcess/WebCoreSupport/WebGraphicsLayer.h:
+ (WebGraphicsLayerClient):
+ (WebGraphicsLayer):
+ * WebProcess/WebPage/qt/LayerTreeHostQt.cpp:
+ (WebKit::LayerTreeHostQt::registerLayer):
+ (WebKit::LayerTreeHostQt::visibleContentsRect):
+ (WebKit):
+ (WebKit::LayerTreeHostQt::setVisibleContentRectAndScale):
+ * WebProcess/WebPage/qt/LayerTreeHostQt.h:
+ (LayerTreeHostQt):
+
2012-02-09 Jocelyn Turcotte <[email protected]>
[Qt] Control the lifetime of TiledBackingStores in WebGraphicsLayer.
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp (107236 => 107237)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp 2012-02-09 14:38:44 UTC (rev 107236)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp 2012-02-09 14:40:47 UTC (rev 107237)
@@ -483,20 +483,14 @@
m_mainBackingStore->setVisibleRectTrajectoryVector(trajectoryVector);
}
-void WebGraphicsLayer::setVisibleContentRectAndScale(const IntRect& pageVisibleRect, float scale)
+void WebGraphicsLayer::setContentsScale(float scale)
{
- if (m_pageVisibleRect == pageVisibleRect && m_contentsScale == scale)
- return;
-
- m_pageVisibleRect = pageVisibleRect;
m_contentsScale = scale;
-
- if (!m_mainBackingStore || m_mainBackingStore->contentsScale() != scale) {
+ if (m_mainBackingStore && m_mainBackingStore->contentsScale() != scale) {
m_previousBackingStore = m_mainBackingStore.release();
m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this)));
m_mainBackingStore->setContentsScale(scale);
- } else
- m_mainBackingStore->adjustVisibleRect();
+ }
}
void WebGraphicsLayer::tiledBackingStorePaint(GraphicsContext* context, const IntRect& rect)
@@ -537,7 +531,7 @@
// Return a projection of the visible rect (surface coordinates) onto the layer's plane (layer coordinates).
// The resulting quad might be squewed and the visible rect is the bounding box of this quad,
// so it might spread further than the real visible area (and then even more amplified by the cover rect multiplier).
- return m_layerTransform.combined().inverse().clampedBoundsOfProjectedQuad(FloatQuad(FloatRect(m_pageVisibleRect)));
+ return m_layerTransform.combined().inverse().clampedBoundsOfProjectedQuad(FloatQuad(FloatRect(m_webGraphicsLayerClient->visibleContentsRect())));
}
Color WebGraphicsLayer::tiledBackingStoreBackgroundColor() const
@@ -625,6 +619,12 @@
client->attachLayer(this);
}
+void WebGraphicsLayer::adjustVisibleRect()
+{
+ if (m_mainBackingStore)
+ m_mainBackingStore->adjustVisibleRect();
+}
+
void WebGraphicsLayer::computeTransformedVisibleRect()
{
// FIXME: Consider transform animations in the visible rect calculation.
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h (107236 => 107237)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h 2012-02-09 14:38:44 UTC (rev 107236)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h 2012-02-09 14:40:47 UTC (rev 107237)
@@ -52,6 +52,7 @@
virtual void updateTile(WebLayerID, int tileID, const UpdateInfo&) = 0;
virtual void removeTile(WebLayerID, int tileID) = 0;
+ virtual WebCore::IntRect visibleContentsRect() const = 0;
virtual bool layerTreeTileUpdatesAllowed() const = 0;
virtual int64_t adoptImageBackingStore(WebCore::Image*) = 0;
virtual void releaseImageBackingStore(int64_t) = 0;
@@ -102,7 +103,7 @@
void setNeedsDisplay();
void setNeedsDisplayInRect(const FloatRect&);
void setContentsNeedsDisplay();
- void setVisibleContentRectAndScale(const IntRect&, float scale);
+ void setContentsScale(float);
void setVisibleContentRectTrajectoryVector(const FloatPoint&);
virtual void syncCompositingState(const FloatRect&);
virtual void syncCompositingStateForThisLayerOnly();
@@ -137,6 +138,7 @@
void setWebGraphicsLayerClient(WebKit::WebGraphicsLayerClient*);
+ void adjustVisibleRect();
bool isReadyForTileBufferSwap() const;
void updateContentBuffers();
void purgeBackingStores();
@@ -147,7 +149,6 @@
RefPtr<Image> m_image;
GraphicsLayer* m_maskTarget;
FloatRect m_needsDisplayRect;
- IntRect m_pageVisibleRect;
LayerTransform m_layerTransform;
bool m_needsDisplay : 1;
bool m_modified : 1;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp (107236 => 107237)
--- trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp 2012-02-09 14:38:44 UTC (rev 107236)
+++ trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp 2012-02-09 14:40:47 UTC (rev 107237)
@@ -240,7 +240,8 @@
ASSERT(!m_registeredLayers.contains(layer));
m_registeredLayers.add(layer);
- layer->setVisibleContentRectAndScale(m_visibleContentsRect, m_contentsScale);
+ layer->setContentsScale(m_contentsScale);
+ layer->adjustVisibleRect();
}
void LayerTreeHostQt::detachLayer(WebGraphicsLayer* layer)
@@ -414,6 +415,11 @@
m_webPage->send(Messages::LayerTreeHostProxy::RemoveTileForLayer(layerID, tileID));
}
+WebCore::IntRect LayerTreeHostQt::visibleContentsRect() const
+{
+ return m_visibleContentsRect;
+}
+
void LayerTreeHostQt::setVisibleContentRectAndScale(const IntRect& rect, float scale)
{
if (rect == m_visibleContentsRect && scale == m_contentsScale)
@@ -422,8 +428,10 @@
m_contentsScale = scale;
HashSet<WebCore::WebGraphicsLayer*>::iterator end = m_registeredLayers.end();
- for (HashSet<WebCore::WebGraphicsLayer*>::iterator it = m_registeredLayers.begin(); it != end; ++it)
- (*it)->setVisibleContentRectAndScale(rect, scale);
+ for (HashSet<WebCore::WebGraphicsLayer*>::iterator it = m_registeredLayers.begin(); it != end; ++it) {
+ (*it)->setContentsScale(scale);
+ (*it)->adjustVisibleRect();
+ }
scheduleLayerFlush();
}
Modified: trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h (107236 => 107237)
--- trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h 2012-02-09 14:38:44 UTC (rev 107236)
+++ trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.h 2012-02-09 14:40:47 UTC (rev 107237)
@@ -69,6 +69,7 @@
virtual void createTile(WebLayerID, int tileID, const UpdateInfo&);
virtual void updateTile(WebLayerID, int tileID, const UpdateInfo&);
virtual void removeTile(WebLayerID, int tileID);
+ virtual WebCore::IntRect visibleContentsRect() const;
virtual void renderNextFrame();
virtual void purgeBackingStores();
virtual bool layerTreeTileUpdatesAllowed() const;