Changeset 149292 in webkit
- Timestamp:
- Apr 29, 2013 9:24:18 AM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r149288 r149292 1 2013-04-29 Noam Rosenthal <noam@webkit.org> 2 3 Get rid of "non-composited contents" in CoordinatedLayerTreeHost 4 https://bugs.webkit.org/show_bug.cgi?id=110355 5 6 Reviewed by Jocelyn Turcotte. 7 8 When in force compositing mode, always assume that the main layer needs 9 a backing store. Make setVisibleContentRectTrajectoryVector and accumulatedCoverRect 10 recursive so that they don't rely on a specialized layer. 11 12 No new testable behavior, changes to coverRect and trajectory vector only 13 affect tiling latency in rare cases that are not trivial to test. 14 15 * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: 16 (WebCore::CoordinatedGraphicsLayer:setVisibleContentRectTrajectoryVector): 17 Make the trajectory vector recursive, though limited only to layers with 18 translate/identity. This allows us to keep the trajectory vector while removing 19 the non-composited contents specialization. 20 21 (WebCore::CoordinatedGraphicsLayer::accumulatedCoverRect): 22 Added accumulatedCoverRect, so that the coverRect calculations for the UI process 23 are not bound to the non-composited contents layer. 24 25 (WebCore::CoordinatedGraphicsLayer::findDescendantWithContentsRecursively): 26 Instead of saving a reference to the non-composited contents layer, we assume that 27 the first layer we found recursively which has contents is the one to be used for 28 coverRect/trajectory calculations. 29 30 (WebCore): 31 * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: 32 (CoordinatedGraphicsLayer): 33 * rendering/RenderLayerBacking.cpp: 34 (WebCore::RenderLayerBacking::paintsIntoWindow): 35 Always create a layer for the non-composited contents when in forceCompositing mode. 36 1 37 2013-04-29 Dirk Schulze <krit@webkit.org> 2 38 -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
r148748 r149292 837 837 } 838 838 839 CoordinatedGraphicsLayer* CoordinatedGraphicsLayer::findFirstDescendantWithContentsRecursively() 840 { 841 if (shouldHaveBackingStore()) 842 return this; 843 844 for (size_t i = 0; i < children().size(); ++i) { 845 CoordinatedGraphicsLayer* layer = toCoordinatedGraphicsLayer(children()[i])->findFirstDescendantWithContentsRecursively(); 846 if (layer) 847 return layer; 848 } 849 850 return 0; 851 } 852 839 853 void CoordinatedGraphicsLayer::setVisibleContentRectTrajectoryVector(const FloatPoint& trajectoryVector) 840 854 { -
trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h
r148748 r149292 149 149 150 150 static void setShouldSupportContentsTiling(bool); 151 CoordinatedGraphicsLayer* findFirstDescendantWithContentsRecursively(); 151 152 152 153 private: -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r149105 r149292 1846 1846 1847 1847 if (m_owningLayer->isRootLayer()) { 1848 #if PLATFORM(BLACKBERRY) 1848 #if PLATFORM(BLACKBERRY) || USE(COORDINATED_GRAPHICS) 1849 1849 if (compositor()->inForcedCompositingMode()) 1850 1850 return false; -
trunk/Source/WebKit2/ChangeLog
r149291 r149292 1 2013-04-29 Noam Rosenthal <noam@webkit.org> 2 3 Get rid of "non-composited contents" in CoordinatedLayerTreeHost 4 https://bugs.webkit.org/show_bug.cgi?id=110355 5 6 Reviewed by Jocelyn Turcotte. 7 8 Instead of using a special non-composited contents layer, we let RenderLayerCompositor create 9 a proper GraphicsLayer for that content. 10 CoordinatedLayerTreeHost now needs to find the main contents layer for the purpose of setting 11 the trajectory vector and applying the cover rect. 12 13 * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp: 14 (WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost): 15 (WebKit::CoordinatedLayerTreeHost::setRootCompositingLayer): 16 Don't create the non-composited layer, instead keep a raw pointer to the root 17 compositing layer created by the WebCore compositor. 18 19 (WebKit::CoordinatedLayerTreeHost::setNonCompositedContentsNeedDisplay): 20 (WebKit::CoordinatedLayerTreeHost::setNonCompositedContentsNeedDisplayInRect): 21 (WebKit::CoordinatedLayerTreeHost::scrollNonCompositedContents): 22 (WebKit::CoordinatedLayerTreeHost::sizeDidChange): 23 (WebKit::CoordinatedLayerTreeHost::paintContents): 24 (WebKit::CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged): 25 (WebKit::CoordinatedLayerTreeHost::setVisibleContentsRect): 26 Remove non-composited layer specialization. 27 1 28 2013-04-29 Zoltan Arvai <zarvai@inf.u-szeged.hu> 2 29 -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
r149008 r149292 81 81 CoordinatedLayerTreeHost::CoordinatedLayerTreeHost(WebPage* webPage) 82 82 : LayerTreeHost(webPage) 83 , m_rootCompositingLayer(0) 83 84 , m_notifyAfterScheduledLayerFlush(false) 84 85 , m_isValid(true) … … 100 101 // Create a root layer. 101 102 m_rootLayer = GraphicsLayer::create(this, this); 102 CoordinatedGraphicsLayer* coordinatedRootLayer = toCoordinatedGraphicsLayer(m_rootLayer.get());103 103 #ifndef NDEBUG 104 104 m_rootLayer->setName("CoordinatedLayerTreeHost root layer"); … … 106 106 m_rootLayer->setDrawsContent(false); 107 107 m_rootLayer->setSize(m_webPage->size()); 108 m_layerTreeContext.coordinatedLayerID = toCoordinatedGraphicsLayer(coordinatedRootLayer)->id(); 109 110 m_nonCompositedContentLayer = GraphicsLayer::create(this, this); 111 #ifndef NDEBUG 112 m_nonCompositedContentLayer->setName("CoordinatedLayerTreeHost non-composited content"); 113 #endif 114 m_nonCompositedContentLayer->setDrawsContent(true); 115 m_nonCompositedContentLayer->setSize(m_webPage->size()); 116 117 m_nonCompositedContentLayer->setShowDebugBorder(m_webPage->corePage()->settings()->showDebugBorders()); 118 m_nonCompositedContentLayer->setShowRepaintCounter(m_webPage->corePage()->settings()->showRepaintCounter()); 119 120 m_rootLayer->addChild(m_nonCompositedContentLayer.get()); 108 m_layerTreeContext.coordinatedLayerID = toCoordinatedGraphicsLayer(m_rootLayer.get())->id(); 121 109 122 110 CoordinatedSurface::setFactory(createCoordinatedSurface); … … 168 156 void CoordinatedLayerTreeHost::setRootCompositingLayer(WebCore::GraphicsLayer* graphicsLayer) 169 157 { 170 m_nonCompositedContentLayer->removeAllChildren();171 m_nonCompositedContentLayer->setContentsOpaque(m_webPage->drawsBackground() && !m_webPage->drawsTransparentBackground());172 173 // Add the accelerated layer tree hierarchy.174 if ( graphicsLayer)175 m_ nonCompositedContentLayer->addChild(graphicsLayer);158 if (m_rootCompositingLayer) 159 m_rootCompositingLayer->removeFromParent(); 160 161 m_rootCompositingLayer = graphicsLayer; 162 if (m_rootCompositingLayer) 163 m_rootLayer->addChildAtIndex(m_rootCompositingLayer, 0); 176 164 } 177 165 … … 185 173 } 186 174 187 void CoordinatedLayerTreeHost::setNonCompositedContentsNeedDisplay()188 {189 m_nonCompositedContentLayer->setNeedsDisplay();190 if (m_pageOverlayLayer)191 m_pageOverlayLayer->setNeedsDisplay();192 193 scheduleLayerFlush();194 }195 196 void CoordinatedLayerTreeHost::setNonCompositedContentsNeedDisplayInRect(const WebCore::IntRect& rect)197 {198 m_nonCompositedContentLayer->setNeedsDisplayInRect(rect);199 if (m_pageOverlayLayer)200 m_pageOverlayLayer->setNeedsDisplayInRect(rect);201 202 scheduleLayerFlush();203 }204 205 void CoordinatedLayerTreeHost::scrollNonCompositedContents(const WebCore::IntRect&)206 {207 if (!m_webPage->useFixedLayout())208 setNonCompositedContentsNeedDisplay();209 210 scheduleLayerFlush();211 }212 213 175 void CoordinatedLayerTreeHost::forceRepaint() 214 176 { … … 234 196 void CoordinatedLayerTreeHost::sizeDidChange(const WebCore::IntSize& newSize) 235 197 { 236 if (m_rootLayer->size() == newSize)237 return;238 239 198 m_rootLayer->setSize(newSize); 240 241 // If the newSize exposes new areas of the non-composited content a setNeedsDisplay is needed242 // for those newly exposed areas.243 FloatSize oldSize = m_nonCompositedContentLayer->size();244 m_nonCompositedContentLayer->setSize(newSize);245 246 if (newSize.width() > oldSize.width()) {247 float height = std::min(static_cast<float>(newSize.height()), oldSize.height());248 m_nonCompositedContentLayer->setNeedsDisplayInRect(FloatRect(oldSize.width(), 0, newSize.width() - oldSize.width(), height));249 }250 251 if (newSize.height() > oldSize.height())252 m_nonCompositedContentLayer->setNeedsDisplayInRect(FloatRect(0, oldSize.height(), newSize.width(), newSize.height() - oldSize.height()));253 254 if (m_pageOverlayLayer)255 m_pageOverlayLayer->setSize(newSize);256 257 199 scheduleLayerFlush(); 258 200 } … … 297 239 298 240 createCompositingLayers(); 299 300 241 initializeRootCompositingLayerIfNeeded(); 301 242 302 243 m_rootLayer->flushCompositingStateForThisLayerOnly(); 303 m_nonCompositedContentLayer->flushCompositingStateForThisLayerOnly();304 244 if (m_pageOverlayLayer) 305 245 m_pageOverlayLayer->flushCompositingStateForThisLayerOnly(); … … 308 248 309 249 flushPendingImageBackingChanges(); 310 311 250 deleteCompositingLayers(); 312 251 … … 314 253 didSync = true; 315 254 316 m_state.contentsSize = roundedIntSize(m_nonCompositedContentLayer->size()); 317 m_state.coveredRect = toCoordinatedGraphicsLayer(m_nonCompositedContentLayer.get())->coverRect(); 255 if (m_rootCompositingLayer) { 256 m_state.contentsSize = roundedIntSize(m_rootCompositingLayer->size()); 257 if (CoordinatedGraphicsLayer* contentsLayer = mainContentsLayer()) 258 m_state.coveredRect = contentsLayer->coverRect(); 259 } 260 318 261 m_state.scrollPosition = m_visibleContentsRect.location(); 319 262 … … 595 538 void CoordinatedLayerTreeHost::paintContents(const WebCore::GraphicsLayer* graphicsLayer, WebCore::GraphicsContext& graphicsContext, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect) 596 539 { 597 if (graphicsLayer == m_nonCompositedContentLayer) {598 m_webPage->drawRect(graphicsContext, clipRect);599 return;600 }601 602 540 if (graphicsLayer == m_pageOverlayLayer) { 603 541 // Overlays contain transparent contents and won't clear the context as part of their rendering, so we do it here. … … 661 599 } 662 600 601 CoordinatedGraphicsLayer* CoordinatedLayerTreeHost::mainContentsLayer() 602 { 603 if (!m_rootCompositingLayer) 604 return 0; 605 606 return toCoordinatedGraphicsLayer(m_rootCompositingLayer)->findFirstDescendantWithContentsRecursively(); 607 } 608 663 609 void CoordinatedLayerTreeHost::setVisibleContentsRect(const FloatRect& rect, const FloatPoint& trajectoryVector) 664 610 { 665 611 // A zero trajectoryVector indicates that tiles all around the viewport are requested. 666 toCoordinatedGraphicsLayer(m_nonCompositedContentLayer.get())->setVisibleContentRectTrajectoryVector(trajectoryVector); 612 if (CoordinatedGraphicsLayer* contentsLayer = mainContentsLayer()) 613 contentsLayer->setVisibleContentRectTrajectoryVector(trajectoryVector); 667 614 668 615 bool contentsRectDidChange = rect != m_visibleContentsRect; … … 687 634 { 688 635 m_rootLayer->deviceOrPageScaleFactorChanged(); 689 m_nonCompositedContentLayer->deviceOrPageScaleFactorChanged();690 636 if (m_pageOverlayLayer) 691 637 m_pageOverlayLayer->deviceOrPageScaleFactorChanged(); -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h
r149008 r149292 66 66 virtual void invalidate(); 67 67 68 virtual void setNonCompositedContentsNeedDisplay() OVERRIDE ;69 virtual void setNonCompositedContentsNeedDisplayInRect(const WebCore::IntRect&) OVERRIDE ;70 virtual void scrollNonCompositedContents(const WebCore::IntRect&) OVERRIDE ;68 virtual void setNonCompositedContentsNeedDisplay() OVERRIDE { } 69 virtual void setNonCompositedContentsNeedDisplayInRect(const WebCore::IntRect&) OVERRIDE { } 70 virtual void scrollNonCompositedContents(const WebCore::IntRect&) OVERRIDE { } 71 71 virtual void forceRepaint(); 72 72 virtual bool forceRepaintAsync(uint64_t callbackID); … … 89 89 virtual void didReceiveCoordinatedLayerTreeHostMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&); 90 90 virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() OVERRIDE; 91 WebCore::CoordinatedGraphicsLayer* mainContentsLayer(); 91 92 92 93 #if ENABLE(REQUEST_ANIMATION_FRAME) … … 144 145 void didPerformScheduledLayerFlush(); 145 146 void syncDisplayState(); 146 147 147 void layerFlushTimerFired(WebCore::Timer<CoordinatedLayerTreeHost>*); 148 148 … … 165 165 166 166 OwnPtr<WebCore::GraphicsLayer> m_rootLayer; 167 168 // The layer which contains all non-composited content. 169 OwnPtr<WebCore::GraphicsLayer> m_nonCompositedContentLayer; 167 WebCore::GraphicsLayer* m_rootCompositingLayer; 170 168 171 169 // The page overlay layer. Will be null if there's no page overlay.
Note: See TracChangeset
for help on using the changeset viewer.