Changeset 141310 in webkit
- Timestamp:
- Jan 30, 2013 2:27:52 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r141287 r141310 1 2013-01-30 Huang Dongsung <luxtella@company100.net> 2 3 [EFL][Qt][WK2] We should consider a page scale factor in WebCore instead of our own scale factor. 4 https://bugs.webkit.org/show_bug.cgi?id=105978 5 6 Reviewed by Simon Fraser. 7 8 Currently, PageViewportController sends a page scale factor to Coordinated 9 Graphics System regardless of the page scale factor in WebCore. This patch makes 10 Coordinated Graphics System use the page scale factor in WebCore to match other 11 ports. 12 13 When it is needed to change a page scale, PageViewportController sends the scale 14 to Page in Web Process via WebPageProxy::scalePage. When the page scale in 15 WebCore is changed, CoordinatedGraphicsLayer gets notified via 16 deviceOrPageScaleFactorChanged callback. CoordinatedGraphicsLayer uses the page 17 scale factor like previous our own scale factor. 18 19 We set true to applyDeviceScaleFactorInCompositor and 20 ApplyPageScaleFactorInCompositor in Settings like chromium, because 21 TiledBackingStore that is a backing store of each GraphicsLayer applies the 22 scale to our raster graphics engines instead of applying the scale to the local 23 transform of each render object. 24 25 Thank Kenneth Rohde Christiansen for implementing the base patch of this patch. 26 27 No new tests. Covered by existing tests. 28 29 * UIProcess/API/qt/qquickwebview.cpp: 30 (QQuickWebViewLegacyPrivate::updateViewportSize): 31 * UIProcess/API/qt/raw/qrawwebview.cpp: 32 (QRawWebView::setSize): 33 * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp: 34 (WebKit::CoordinatedLayerTreeHostProxy::CoordinatedLayerTreeHostProxy): 35 (WebKit::CoordinatedLayerTreeHostProxy::setVisibleContentsRect): 36 Does not receive a pageScaleFactor argument because 37 PageViewportController sends a page scale factor to Page. 38 However, this method still receives a scroll position because we 39 enable delegates scrolling. 40 * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h: 41 (CoordinatedLayerTreeHostProxy): 42 * UIProcess/DrawingAreaProxy.h: 43 (WebKit::DrawingAreaProxy::setVisibleContentsRect): 44 * UIProcess/DrawingAreaProxyImpl.cpp: 45 (WebKit::DrawingAreaProxyImpl::setVisibleContentsRect): 46 * UIProcess/DrawingAreaProxyImpl.h: 47 * UIProcess/PageViewportController.cpp: 48 (WebKit::PageViewportController::didRenderFrame): 49 (WebKit::PageViewportController::didChangeContentsVisibility): 50 (WebKit::PageViewportController::syncVisibleContents): 51 (WebKit::PageViewportController::applyScaleAfterRenderingContents): 52 (WebKit::PageViewportController::applyPositionAfterRenderingContents): 53 * UIProcess/efl/PageClientLegacyImpl.cpp: 54 (WebKit::PageClientLegacyImpl::updateViewportSize): 55 * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp: 56 (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer): 57 (WebCore::CoordinatedGraphicsLayer::deviceOrPageScaleFactorChanged): 58 (WebCore::CoordinatedGraphicsLayer::effectiveContentsScale): 59 * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h: 60 (CoordinatedGraphicsLayer): 61 * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp: 62 (WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost): 63 (WebKit::CoordinatedLayerTreeHost::createGraphicsLayer): 64 (WebKit::CoordinatedLayerTreeHost::deviceScaleFactor): 65 (WebKit): 66 (WebKit::CoordinatedLayerTreeHost::pageScaleFactor): 67 (WebKit::CoordinatedLayerTreeHost::setVisibleContentsRect): 68 (WebKit::CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged): 69 * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h: 70 (CoordinatedLayerTreeHost): 71 * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.messages.in: 72 * WebProcess/WebPage/WebPage.cpp: 73 (WebKit::WebPage::setUseFixedLayout): 74 1 75 2013-01-30 Zoltan Arvai <zarvai@inf.u-szeged.hu> 2 76 -
trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
r141040 r141310 847 847 // The backing store scale factor should already be set to the device pixel ratio 848 848 // of the underlying window, thus we set the effective scale to 1 here. 849 webPageProxy->drawingArea()->setVisibleContentsRect(FloatRect(FloatPoint(), FloatSize(viewportSize)), 1,FloatPoint());849 webPageProxy->drawingArea()->setVisibleContentsRect(FloatRect(FloatPoint(), FloatSize(viewportSize)), FloatPoint()); 850 850 } 851 851 -
trunk/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp
r137358 r141310 356 356 357 357 drawingArea->setSize(d->m_size, WebCore::IntSize()); 358 drawingArea->setVisibleContentsRect(WebCore::IntRect(WebCore::IntPoint(), d->m_size), 1 /*scale*/,WebCore::FloatPoint());358 drawingArea->setVisibleContentsRect(WebCore::IntRect(WebCore::IntPoint(), d->m_size), WebCore::FloatPoint()); 359 359 } 360 360 -
trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp
r141065 r141310 42 42 : m_drawingAreaProxy(drawingAreaProxy) 43 43 , m_renderer(adoptRef(new LayerTreeRenderer(this))) 44 , m_lastSentScale(0)45 44 { 46 45 } … … 54 53 { 55 54 m_drawingAreaProxy->updateViewport(); 56 }57 58 float CoordinatedLayerTreeHostProxy::deviceScaleFactor() const59 {60 return m_drawingAreaProxy->page()->deviceScaleFactor();61 55 } 62 56 … … 186 180 } 187 181 188 void CoordinatedLayerTreeHostProxy::setVisibleContentsRect(const FloatRect& rect, float pageScaleFactor,const FloatPoint& trajectoryVector)182 void CoordinatedLayerTreeHostProxy::setVisibleContentsRect(const FloatRect& rect, const FloatPoint& trajectoryVector) 189 183 { 190 184 // Inform the renderer to adjust viewport-fixed layers. 191 185 dispatchUpdate(bind(&LayerTreeRenderer::setVisibleContentsRect, m_renderer.get(), rect)); 192 186 193 const float effectiveScale = deviceScaleFactor() * pageScaleFactor; 194 195 if (rect == m_lastSentVisibleRect && effectiveScale == m_lastSentScale && trajectoryVector == m_lastSentTrajectoryVector) 187 if (rect == m_lastSentVisibleRect && trajectoryVector == m_lastSentTrajectoryVector) 196 188 return; 197 189 198 m_drawingAreaProxy->page()->process()->send(Messages::CoordinatedLayerTreeHost::SetVisibleContentsRect(rect, effectiveScale,trajectoryVector), m_drawingAreaProxy->page()->pageID());190 m_drawingAreaProxy->page()->process()->send(Messages::CoordinatedLayerTreeHost::SetVisibleContentsRect(rect, trajectoryVector), m_drawingAreaProxy->page()->pageID()); 199 191 m_lastSentVisibleRect = rect; 200 m_lastSentScale = effectiveScale;201 192 m_lastSentTrajectoryVector = trajectoryVector; 202 193 } -
trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h
r141065 r141310 66 66 void setRootCompositingLayer(CoordinatedLayerID); 67 67 void setContentsSize(const WebCore::FloatSize&); 68 void setVisibleContentsRect(const WebCore::FloatRect&, float pageScaleFactor,const WebCore::FloatPoint& trajectoryVector);68 void setVisibleContentsRect(const WebCore::FloatRect&, const WebCore::FloatPoint& trajectoryVector); 69 69 void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect); 70 70 void createTileForLayer(CoordinatedLayerID, uint32_t tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&); … … 97 97 void setBackgroundColor(const WebCore::Color&); 98 98 99 float deviceScaleFactor() const;100 101 99 protected: 102 100 void dispatchUpdate(const Function<void()>&); … … 105 103 RefPtr<LayerTreeRenderer> m_renderer; 106 104 WebCore::FloatRect m_lastSentVisibleRect; 107 float m_lastSentScale;108 105 WebCore::FloatPoint m_lastSentTrajectoryVector; 109 106 typedef HashMap<uint32_t /* atlasID */, RefPtr<CoordinatedSurface> > SurfaceMap; -
trunk/Source/WebKit2/UIProcess/DrawingAreaProxy.h
r137358 r141310 87 87 virtual WebCore::IntRect contentsRect() const; 88 88 CoordinatedLayerTreeHostProxy* coordinatedLayerTreeHostProxy() const { return m_coordinatedLayerTreeHostProxy.get(); } 89 virtual void setVisibleContentsRect(const WebCore::FloatRect& /* visibleContentsRect */, float /* scale */,const WebCore::FloatPoint& /* trajectoryVector */) { }89 virtual void setVisibleContentsRect(const WebCore::FloatRect& /* visibleContentsRect */, const WebCore::FloatPoint& /* trajectoryVector */) { } 90 90 virtual void didReceiveCoordinatedLayerTreeHostProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); 91 91 -
trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
r138973 r141310 377 377 } 378 378 379 void DrawingAreaProxyImpl::setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, float scale,const WebCore::FloatPoint& trajectoryVector)379 void DrawingAreaProxyImpl::setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, const WebCore::FloatPoint& trajectoryVector) 380 380 { 381 381 if (m_coordinatedLayerTreeHostProxy) 382 m_coordinatedLayerTreeHostProxy->setVisibleContentsRect(visibleContentsRect, scale,trajectoryVector);382 m_coordinatedLayerTreeHostProxy->setVisibleContentsRect(visibleContentsRect, trajectoryVector); 383 383 } 384 384 -
trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h
r137358 r141310 84 84 void updateAcceleratedCompositingMode(const LayerTreeContext&); 85 85 #if USE(COORDINATED_GRAPHICS) 86 virtual void setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, float scale, const WebCore::FloatPoint& trajectory);86 virtual void setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, const WebCore::FloatPoint& trajectory) OVERRIDE; 87 87 void didReceiveCoordinatedLayerTreeHostProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); 88 88 #endif -
trunk/Source/WebKit2/UIProcess/PageViewportController.cpp
r139675 r141310 198 198 FloatPoint pixelAlignedPos = pixelAlignedFloatPoint(currentDiscretePos); 199 199 m_contentsPosition = boundContentsPosition(pixelAlignedPos); 200 201 m_webPageProxy->scalePage(m_pageScaleFactor, roundedIntPoint(m_contentsPosition)); 200 202 } 201 203 … … 259 261 m_contentsPosition = position; 260 262 if (!m_pendingScaleChange) 261 m_pageScaleFactor = scale;263 applyScaleAfterRenderingContents(scale); 262 264 263 265 syncVisibleContents(trajectoryVector); … … 272 274 FloatRect visibleContentsRect(boundContentsPosition(m_contentsPosition), visibleContentsSize()); 273 275 visibleContentsRect.intersect(FloatRect(FloatPoint::zero(), m_contentsSize)); 274 drawingArea->setVisibleContentsRect(visibleContentsRect, m_pageScaleFactor,trajectoryVector);276 drawingArea->setVisibleContentsRect(visibleContentsRect, trajectoryVector); 275 277 276 278 m_client->didChangeVisibleContents(); … … 327 329 void PageViewportController::applyScaleAfterRenderingContents(float scale) 328 330 { 331 if (m_pageScaleFactor == scale) 332 return; 333 329 334 m_pageScaleFactor = scale; 330 335 m_pendingScaleChange = true; … … 334 339 void PageViewportController::applyPositionAfterRenderingContents(const FloatPoint& pos) 335 340 { 341 if (m_contentsPosition == pos) 342 return; 343 336 344 m_contentsPosition = pos; 337 345 m_pendingPositionChange = true; -
trunk/Source/WebKit2/UIProcess/efl/PageClientLegacyImpl.cpp
r140686 r141310 51 51 { 52 52 #if USE(TILED_BACKING_STORE) 53 m_view->page()->drawingArea()->setVisibleContentsRect(IntRect(roundedIntPoint(m_view->pagePosition()), m_view->size()), m_view->pageScaleFactor(),FloatPoint());53 m_view->page()->drawingArea()->setVisibleContentsRect(IntRect(roundedIntPoint(m_view->pagePosition()), m_view->size()), FloatPoint()); 54 54 #endif 55 55 } -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp
r141247 r141310 124 124 #endif 125 125 , m_coordinator(0) 126 , m_contentsScale(1)127 126 , m_compositedNativeImagePtr(0) 128 127 , m_canvasPlatformLayer(0) … … 699 698 } 700 699 701 void CoordinatedGraphicsLayer::setContentsScale(float scale) 702 { 703 m_contentsScale = scale; 700 void CoordinatedGraphicsLayer::deviceOrPageScaleFactorChanged() 701 { 704 702 if (shouldHaveBackingStore()) 705 703 m_pendingContentsScaleAdjustment = true; … … 708 706 float CoordinatedGraphicsLayer::effectiveContentsScale() 709 707 { 710 return selfOrAncestorHaveNonAffineTransforms() ? 1 : m_contentsScale;708 return selfOrAncestorHaveNonAffineTransforms() ? 1 : deviceScaleFactor() * pageScaleFactor(); 711 709 } 712 710 -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h
r141247 r141310 124 124 virtual void setNeedsDisplayInRect(const FloatRect&) OVERRIDE; 125 125 virtual void setContentsNeedsDisplay() OVERRIDE; 126 virtual void deviceOrPageScaleFactorChanged() OVERRIDE; 126 127 virtual void flushCompositingState(const FloatRect&) OVERRIDE; 127 128 virtual void flushCompositingStateForThisLayerOnly() OVERRIDE; … … 138 139 void computePixelAlignment(FloatPoint& position, FloatSize&, FloatPoint3D& anchorPoint, FloatSize& alignmentOffset); 139 140 140 void setContentsScale(float);141 141 void setVisibleContentRectTrajectoryVector(const FloatPoint&); 142 142 … … 253 253 OwnPtr<TiledBackingStore> m_mainBackingStore; 254 254 OwnPtr<TiledBackingStore> m_previousBackingStore; 255 float m_contentsScale;256 255 257 256 RefPtr<Image> m_compositedImage; -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
r141065 r141310 88 88 , m_waitingForUIProcess(true) 89 89 , m_isSuspended(false) 90 , m_contentsScale(1)91 90 , m_shouldSendScrollPositionUpdate(true) 92 91 , m_shouldSyncFrame(false) … … 683 682 m_registeredLayers.add(layer); 684 683 m_layersToCreate.append(layer->id()); 685 layer->setContentsScale(m_contentsScale);686 684 layer->setNeedsVisibleRectAdjustment(); 687 685 scheduleLayerFlush(); 688 686 return adoptPtr(layer); 687 } 688 689 float CoordinatedLayerTreeHost::deviceScaleFactor() const 690 { 691 return m_webPage->deviceScaleFactor(); 692 } 693 694 float CoordinatedLayerTreeHost::pageScaleFactor() const 695 { 696 return m_webPage->pageScaleFactor(); 689 697 } 690 698 … … 755 763 } 756 764 757 void CoordinatedLayerTreeHost::setVisibleContentsRect(const FloatRect& rect, float scale, const FloatPoint& trajectoryVector) 758 { 759 bool contentsRectDidChange = rect != m_visibleContentsRect; 760 bool contentsScaleDidChange = scale != m_contentsScale; 761 765 void CoordinatedLayerTreeHost::setVisibleContentsRect(const FloatRect& rect, const FloatPoint& trajectoryVector) 766 { 762 767 // A zero trajectoryVector indicates that tiles all around the viewport are requested. 763 768 toCoordinatedGraphicsLayer(m_nonCompositedContentLayer.get())->setVisibleContentRectTrajectoryVector(trajectoryVector); 764 769 765 if (contentsRectDidChange || contentsScaleDidChange) { 770 bool contentsRectDidChange = rect != m_visibleContentsRect; 771 if (contentsRectDidChange) { 766 772 m_visibleContentsRect = rect; 767 m_contentsScale = scale;768 773 769 774 HashSet<WebCore::CoordinatedGraphicsLayer*>::iterator end = m_registeredLayers.end(); 770 775 for (HashSet<WebCore::CoordinatedGraphicsLayer*>::iterator it = m_registeredLayers.begin(); it != end; ++it) { 771 if (contentsScaleDidChange) 772 (*it)->setContentsScale(scale); 773 if (contentsRectDidChange) 774 (*it)->setNeedsVisibleRectAdjustment(); 776 (*it)->setNeedsVisibleRectAdjustment(); 775 777 } 776 778 } … … 785 787 if (contentsRectDidChange) 786 788 m_shouldSendScrollPositionUpdate = true; 789 } 790 791 void CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged() 792 { 793 m_rootLayer->deviceOrPageScaleFactorChanged(); 794 m_nonCompositedContentLayer->deviceOrPageScaleFactorChanged(); 795 if (m_pageOverlayLayer) 796 m_pageOverlayLayer->deviceOrPageScaleFactorChanged(); 787 797 } 788 798 -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h
r141171 r141310 77 77 virtual void pauseRendering() { m_isSuspended = true; } 78 78 virtual void resumeRendering() { m_isSuspended = false; scheduleLayerFlush(); } 79 virtual void deviceOrPageScaleFactorChanged() { }79 virtual void deviceOrPageScaleFactorChanged() OVERRIDE; 80 80 virtual PassRefPtr<CoordinatedImageBacking> createImageBackingIfNeeded(WebCore::Image*) OVERRIDE; 81 81 … … 87 87 virtual void renderNextFrame(); 88 88 virtual void purgeBackingStores(); 89 virtual void setVisibleContentsRect(const WebCore::FloatRect&, float scale,const WebCore::FloatPoint&);89 virtual void setVisibleContentsRect(const WebCore::FloatRect&, const WebCore::FloatPoint&); 90 90 virtual void didReceiveCoordinatedLayerTreeHostMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&); 91 91 virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() OVERRIDE; … … 125 125 virtual void notifyFlushRequired(const WebCore::GraphicsLayer*); 126 126 virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect); 127 virtual float deviceScaleFactor() const OVERRIDE; 128 virtual float pageScaleFactor() const OVERRIDE; 127 129 128 130 // CoordinatedImageBacking::Coordinator … … 196 198 bool m_isSuspended; 197 199 WebCore::FloatRect m_visibleContentsRect; 198 float m_contentsScale;199 200 bool m_shouldSendScrollPositionUpdate; 200 201 -
trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.messages.in
r140629 r141310 22 22 #if USE(COORDINATED_GRAPHICS) 23 23 messages -> CoordinatedLayerTreeHost LegacyReceiver { 24 SetVisibleContentsRect(WebCore::FloatRect visibleContentsRect, float scale,WebCore::FloatPoint trajectoryVectory)24 SetVisibleContentsRect(WebCore::FloatRect visibleContentsRect, WebCore::FloatPoint trajectoryVectory) 25 25 RenderNextFrame() 26 26 PurgeBackingStores() -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r141203 r141310 1272 1272 m_page->settings()->setAcceleratedCompositingForFixedPositionEnabled(fixed); 1273 1273 m_page->settings()->setFixedPositionCreatesStackingContext(fixed); 1274 m_page->settings()->setApplyDeviceScaleFactorInCompositor(fixed); 1275 m_page->settings()->setApplyPageScaleFactorInCompositor(fixed); 1274 1276 #endif 1275 1277
Note: See TracChangeset
for help on using the changeset viewer.