Changeset 94673 in webkit
- Timestamp:
- Sep 7, 2011, 9:40:36 AM (14 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r94672 r94673 1 2011-08-30 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> 2 3 [Qt][WK2] Make sure that the visible content rect and the content scale get to the web process in one single message. 4 https://bugs.webkit.org/show_bug.cgi?id=67189 5 6 Reviewed by Kenneth Rohde Christiansen. 7 8 The TiledBackingStore needs to know the screen size of the viewport to know how many tiles to 9 create, and since the visible content rect is given in page coordinates, the contents scale is 10 necessary to calculate the viewport size. 11 Both the rect and the scale then need to arrive to the web process at the same time to prevent 12 picking the new visible rect with the old scale or vice-versa which can produce a huge viewport size 13 and create/render an insane amount of tiles. 14 15 Things this patch does: 16 - Merge the visible contents rect and content scale handling together. 17 - Make QTouchWebView responsible for telling those viewport values to the web process instead of QTouchWebPage. 18 - Prevent updating the viewport in ViewportInteractionEngine while a pinch is in progress and update the viewport at the end. 19 20 * UIProcess/API/qt/qtouchwebpage.cpp: 21 * UIProcess/API/qt/qtouchwebpage.h: 22 * UIProcess/API/qt/qtouchwebpage_p.h: 23 * UIProcess/API/qt/qtouchwebview.cpp: 24 (QTouchWebViewPrivate::QTouchWebViewPrivate): 25 (QTouchWebViewPrivate::_q_viewportUpdated): 26 (QTouchWebView::geometryChanged): 27 * UIProcess/API/qt/qtouchwebview.h: 28 * UIProcess/API/qt/qtouchwebview_p.h: 29 * UIProcess/TiledDrawingAreaProxy.cpp: 30 (WebKit::TiledDrawingAreaProxy::setVisibleContentRectAndScale): 31 * UIProcess/TiledDrawingAreaProxy.h: 32 * UIProcess/qt/ViewportInteractionEngine.cpp: 33 (WebKit::ViewportInteractionEngine::ViewportInteractionEngine): 34 (WebKit::ViewportInteractionEngine::~ViewportInteractionEngine): Allows OwnPtr with the forward declaration of ViewportUpdateGuard. 35 (WebKit::ViewportInteractionEngine::setConstraints): 36 (WebKit::ViewportInteractionEngine::pinchGestureStarted): 37 (WebKit::ViewportInteractionEngine::pinchGestureEnded): 38 (WebKit::ViewportInteractionEngine::contentViewportChanged): 39 * UIProcess/qt/ViewportInteractionEngine.h: 40 * UIProcess/qt/qtouchwebpageproxy.cpp: 41 (QTouchWebPageProxy::setVisibleContentRectAndScale): 42 * UIProcess/qt/qtouchwebpageproxy.h: 43 * WebProcess/WebPage/DrawingArea.h: 44 (WebKit::DrawingArea::setVisibleContentRectAndScale): 45 * WebProcess/WebPage/DrawingArea.messages.in: 46 * WebProcess/WebPage/TiledDrawingArea.cpp: 47 (WebKit::TiledDrawingArea::setVisibleContentRectAndScale): 48 * WebProcess/WebPage/TiledDrawingArea.h: 49 1 50 2011-08-29 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> 2 51 -
trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.cpp
r94672 r94673 160 160 } 161 161 162 void QTouchWebPagePrivate::_q_commitScaleChange()163 {164 commitScaleChange();165 }166 167 void QTouchWebPagePrivate::commitScaleChange()168 {169 page->setContentsScale(q->scale());170 }171 172 162 void QTouchWebPagePrivate::setPage(QTouchWebPageProxy* page) 173 163 { … … 177 167 } 178 168 179 void QTouchWebPagePrivate::setViewportRect(const QRectF& viewportRect)180 {181 const QRectF visibleContentRect = q->boundingRect().intersected(viewportRect);182 page->setVisibleContentRect(visibleContentRect);183 }184 185 169 #include "moc_qtouchwebpage.cpp" -
trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage.h
r93407 r94673 79 79 80 80 private: 81 Q_PRIVATE_SLOT(d, void _q_commitScaleChange());82 83 81 QTouchWebPagePrivate* d; 84 82 friend class QTouchWebViewPrivate; -
trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebpage_p.h
r94672 r94673 39 39 void setPage(QTouchWebPageProxy*); 40 40 41 void setViewportRect(const QRectF&);42 void _q_commitScaleChange();43 void commitScaleChange();44 45 41 QTouchWebPage* const q; 46 42 QTouchWebPageProxy* page; -
trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp
r94313 r94673 40 40 pageViewPrivate->setPage(&page); 41 41 42 QObject::connect(&interactionEngine, SIGNAL(viewportUpdateRequested()), q, SLOT(_q_viewportRectUpdated())); 43 QObject::connect(&interactionEngine, SIGNAL(commitScaleChange()), pageView.data(), SLOT(_q_commitScaleChange())); 42 QObject::connect(&interactionEngine, SIGNAL(viewportUpdateRequested()), q, SLOT(_q_viewportUpdated())); 44 43 } 45 44 … … 49 48 } 50 49 51 void QTouchWebViewPrivate::_q_viewport RectUpdated()50 void QTouchWebViewPrivate::_q_viewportUpdated() 52 51 { 53 QTouchWebPagePrivate* const pageViewPrivate = pageView.data()->d;54 const QRectF viewportRectInPageViewCoordinate = q->mapRectToItem(pageView.data(), q->boundingRect());55 page ViewPrivate->setViewportRect(viewportRectInPageViewCoordinate);52 const QRectF visibleRectInPageViewCoordinate = q->mapRectToItem(pageView.data(), q->boundingRect()).intersected(pageView->boundingRect()); 53 float scale = pageView->scale(); 54 page.setVisibleContentRectAndScale(visibleRectInPageViewCoordinate, scale); 56 55 } 57 56 … … 111 110 if (newGeometry.size() != oldGeometry.size()) { 112 111 d->updateViewportConstraints(); 113 d->_q_viewport RectUpdated();112 d->_q_viewportUpdated(); 114 113 } 115 114 } -
trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.h
r93407 r94673 48 48 49 49 private: 50 Q_PRIVATE_SLOT(d, void _q_viewport RectUpdated());50 Q_PRIVATE_SLOT(d, void _q_viewportUpdated()); 51 51 52 52 friend class WebKit::TouchViewInterface; -
trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview_p.h
r93407 r94673 36 36 37 37 void loadDidCommit(); 38 void _q_viewport RectUpdated();38 void _q_viewportUpdated(); 39 39 void updateViewportConstraints(); 40 40 -
trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp
r93780 r94673 57 57 } 58 58 59 void TiledDrawingAreaProxy::setVisibleContentRect (const WebCore::IntRect& visibleContentsRect)59 void TiledDrawingAreaProxy::setVisibleContentRectAndScale(const WebCore::IntRect& visibleContentRect, float scale) 60 60 { 61 // FIXME: Throttle those message enough not to flood the IPC queue and get a good tile creation responsiveness. 62 page()->process()->send(Messages::DrawingArea::SetVisibleContentRect(visibleContentsRect), page()->pageID()); 63 } 64 65 void TiledDrawingAreaProxy::setContentsScale(float scale) 66 { 67 // FIXME: Since the visibleContentRect size depends on the scale, they should get to the web process in 68 // one single message to avoid unecessary tile rendering because of a possibly very 69 // oversized calculated visible rect. 70 page()->process()->send(Messages::DrawingArea::SetContentsScale(scale), page()->pageID()); 61 page()->process()->send(Messages::DrawingArea::SetVisibleContentRectAndScale(visibleContentRect, scale), page()->pageID()); 71 62 } 72 63 -
trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h
r93780 r94673 72 72 virtual ~TiledDrawingAreaProxy(); 73 73 74 void setVisibleContentRect(const WebCore::IntRect&); 75 void setContentsScale(float); 74 void setVisibleContentRectAndScale(const WebCore::IntRect&, float); 76 75 void renderNextFrame(); 77 76 -
trunk/Source/WebKit2/UIProcess/qt/ViewportInteractionEngine.cpp
r93592 r94673 19 19 */ 20 20 21 #include "config.h" 21 22 #include "ViewportInteractionEngine.h" 22 23 24 #include "PassOwnPtr.h" 23 25 #include <QPointF> 24 26 #include <QtDeclarative/qsgitem.h> … … 43 45 // 44 46 // The guard make sure the signal viewportUpdateRequested() is sent if necessary. 47 // When multiple guards are alive, their lifetime must be perfectly imbricated (e.g. if used ouside stack frames). 48 // We rely on the first one to trigger the update at the end since it only uses one bool internally. 45 49 // 46 50 // The public methods should create the guard if they might update content. … … 84 88 { 85 89 reset(); 86 connect(m_content, SIGNAL(xChanged()), this, SLOT(contentGeometryChanged()), Qt::DirectConnection); 87 connect(m_content, SIGNAL(yChanged()), this, SLOT(contentGeometryChanged()), Qt::DirectConnection); 88 connect(m_content, SIGNAL(widthChanged()), this, SLOT(contentGeometryChanged()), Qt::DirectConnection); 89 connect(m_content, SIGNAL(heightChanged()), this, SLOT(contentGeometryChanged()), Qt::DirectConnection); 90 connect(m_content, SIGNAL(scaleChanged()), this, SLOT(contentScaleChanged()), Qt::DirectConnection); 90 connect(m_content, SIGNAL(xChanged()), this, SLOT(contentViewportChanged()), Qt::DirectConnection); 91 connect(m_content, SIGNAL(yChanged()), this, SLOT(contentViewportChanged()), Qt::DirectConnection); 92 connect(m_content, SIGNAL(widthChanged()), this, SLOT(contentViewportChanged()), Qt::DirectConnection); 93 connect(m_content, SIGNAL(heightChanged()), this, SLOT(contentViewportChanged()), Qt::DirectConnection); 94 connect(m_content, SIGNAL(scaleChanged()), this, SLOT(contentViewportChanged()), Qt::DirectConnection); 95 } 96 97 ViewportInteractionEngine::~ViewportInteractionEngine() 98 { 91 99 } 92 100 … … 112 120 // viewport, it does not pan horizontally anymore). 113 121 114 const qreal previousScale = m_content->scale(); 115 { 116 ViewportUpdateGuard guard(this); 117 m_constraints = constraints; 118 updateContentIfNeeded(); 119 } 120 if (m_content->scale() != previousScale) 121 emit commitScaleChange(); 122 ViewportUpdateGuard guard(this); 123 m_constraints = constraints; 124 updateContentIfNeeded(); 122 125 } 123 126 … … 156 159 if (!m_constraints.isUserScalable) 157 160 return; 161 162 m_pinchViewportUpdateDeferrer = adoptPtr(new ViewportUpdateGuard(this)); 158 163 159 164 m_userInteractionFlags |= UserHasScaledContent; … … 188 193 animateContentIntoBoundariesIfNeeded(); 189 194 } 190 if (m_pinchStartScale != m_content->scale()) 191 emit commitScaleChange(); 192 } 193 194 void ViewportInteractionEngine::contentGeometryChanged() 195 m_pinchViewportUpdateDeferrer.clear(); 196 } 197 198 void ViewportInteractionEngine::contentViewportChanged() 195 199 { 196 200 if (m_isUpdatingContent) … … 202 206 // We must notify the change so the client can rely on us for all change of Geometry. 203 207 emit viewportUpdateRequested(); 204 }205 206 void ViewportInteractionEngine::contentScaleChanged()207 {208 if (m_isUpdatingContent)209 return;210 211 ViewportUpdateGuard guard(this);212 updateContentIfNeeded();213 214 // We must notify the change so the client can rely on us for all change of Geometry.215 emit viewportUpdateRequested();216 emit commitScaleChange();217 208 } 218 209 -
trunk/Source/WebKit2/UIProcess/qt/ViewportInteractionEngine.h
r93592 r94673 22 22 #define ViewportInteractionEngine_h 23 23 24 #include "OwnPtr.h" 24 25 #include "qwebkitglobal.h" 25 26 #include <QtCore/QObject> … … 32 33 namespace WebKit { 33 34 35 class ViewportUpdateGuard; 36 34 37 class ViewportInteractionEngine : public QObject { 35 38 Q_OBJECT … … 37 40 public: 38 41 ViewportInteractionEngine(const QSGItem*, QSGItem*); 42 ~ViewportInteractionEngine(); 39 43 40 44 struct Constraints { … … 67 71 void viewportUpdateRequested(); 68 72 69 void commitScaleChange();70 71 73 private Q_SLOTS: 72 74 // Respond to changes of content that are not driven by us, like the page resizing itself. 73 void contentGeometryChanged(); 74 void contentScaleChanged(); 75 void contentViewportChanged(); 75 76 76 77 private: … … 92 93 Constraints m_constraints; 93 94 bool m_isUpdatingContent; 95 OwnPtr<ViewportUpdateGuard> m_pinchViewportUpdateDeferrer; 94 96 enum UserInteractionFlag { 95 97 UserHasNotInteractedWithContent = 0, -
trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.cpp
r93784 r94673 78 78 } 79 79 80 void QTouchWebPageProxy::setVisibleContentRect (const QRectF& visibleContentRect)80 void QTouchWebPageProxy::setVisibleContentRectAndScale(const QRectF& visibleContentRect, float scale) 81 81 { 82 TiledDrawingAreaProxy* tiledDrawingArea = static_cast<TiledDrawingAreaProxy*>(m_webPageProxy->drawingArea());83 82 QRect alignedVisibleContentRect = visibleContentRect.toAlignedRect(); 84 tiledDrawingArea->setVisibleContentRect(alignedVisibleContentRect);83 drawingArea()->setVisibleContentRectAndScale(alignedVisibleContentRect, scale); 85 84 86 85 // FIXME: Once we support suspend and resume, this should be delayed until the page is active if the page is suspended. … … 109 108 } 110 109 111 void QTouchWebPageProxy::setContentsScale(qreal scale)112 {113 drawingArea()->setContentsScale(scale);114 }115 116 110 void QTouchWebPageProxy::renderNextFrame() 117 111 { -
trunk/Source/WebKit2/UIProcess/qt/qtouchwebpageproxy.h
r93784 r94673 44 44 virtual bool handleEvent(QEvent*); 45 45 46 void setVisibleContentRect (const QRectF&);46 void setVisibleContentRectAndScale(const QRectF&, float); 47 47 void setResizesToContentsUsingLayoutSize(const QSize& targetLayoutSize); 48 48 void findZoomableAreaForPoint(const QPoint&); 49 void setContentsScale(qreal);50 49 void renderNextFrame(); 51 50 -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h
r93780 r94673 100 100 #if ENABLE(TILED_BACKING_STORE) 101 101 virtual void setSize(const WebCore::IntSize& viewSize) { } 102 virtual void setVisibleContentRect (const WebCore::IntRect&) { }102 virtual void setVisibleContentRectAndScale(const WebCore::IntRect&, float) { } 103 103 virtual void setContentsScale(float scale) { } 104 104 virtual void renderNextFrame() { } -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in
r93780 r94673 29 29 #if ENABLE(TILED_BACKING_STORE) 30 30 SetSize(WebCore::IntSize viewSize) 31 SetVisibleContentRect(WebCore::IntRect visibleContentRect) 32 SetContentsScale(float scale) 31 SetVisibleContentRectAndScale(WebCore::IntRect visibleContentRect, float scale) 33 32 RenderNextFrame() 34 33 TakeSnapshot(WebCore::IntSize size, WebCore::IntRect contentsRect) -
trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp
r93780 r94673 71 71 } 72 72 73 void TiledDrawingArea::setVisibleContentRect (const WebCore::IntRect& visibleContentsRect)73 void TiledDrawingArea::setVisibleContentRectAndScale(const WebCore::IntRect& visibleContentsRect, float scale) 74 74 { 75 75 m_visibleContentRect = visibleContentsRect; 76 m_mainBackingStore->adjustVisibleRect();77 }78 76 79 void TiledDrawingArea::setContentsScale(float scale) 80 { 81 m_previousBackingStore = m_mainBackingStore.release(); 82 m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this))); 83 m_mainBackingStore->setContentsScale(scale); 77 if (scale != m_mainBackingStore->contentsScale()) { 78 m_previousBackingStore = m_mainBackingStore.release(); 79 m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this))); 80 m_mainBackingStore->setContentsScale(scale); 81 } else 82 m_mainBackingStore->adjustVisibleRect(); 84 83 } 85 84 -
trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h
r93780 r94673 55 55 // CoreIPC message handlers. 56 56 virtual void setSize(const WebCore::IntSize& viewSize); 57 virtual void setVisibleContentRect(const WebCore::IntRect&); 58 virtual void setContentsScale(float); 57 virtual void setVisibleContentRectAndScale(const WebCore::IntRect&, float); 59 58 virtual void renderNextFrame(); 60 59 virtual void suspendPainting();
Note:
See TracChangeset
for help on using the changeset viewer.