Changeset 56184 in webkit
- Timestamp:
- Mar 18, 2010 1:19:42 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r56182 r56184 1 2010-03-18 Antti Koivisto <koivisto@iki.fi> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 https://bugs.webkit.org/show_bug.cgi?id=36102 6 [Qt] Scaling control API for tiled backing store 7 8 Commit the new scale synchronously after unfreeze to avoid ugliness. 9 10 * platform/graphics/TiledBackingStore.cpp: 11 (WebCore::TiledBackingStore::TiledBackingStore): 12 (WebCore::TiledBackingStore::setContentsScale): 13 (WebCore::TiledBackingStore::commitScaleChange): 14 (WebCore::TiledBackingStore::setContentsFrozen): 15 * platform/graphics/TiledBackingStore.h: 16 1 17 2010-03-18 David Hyatt <hyatt@apple.com> 2 18 -
trunk/WebCore/platform/graphics/TiledBackingStore.cpp
r55976 r56184 37 37 , m_tileSize(defaultTileWidth, defaultTileHeight) 38 38 , m_contentsScale(1.f) 39 , m_pendingScale(0) 39 40 , m_contentsFrozen(false) 40 41 { … … 142 143 void TiledBackingStore::setContentsScale(float scale) 143 144 { 144 if (m_contentsScale == scale) 145 return; 146 m_contentsScale = scale; 147 148 invalidate(m_client->tiledBackingStoreContentsRect()); 149 } 150 145 if (m_pendingScale == m_contentsScale) { 146 m_pendingScale = 0; 147 return; 148 } 149 m_pendingScale = scale; 150 if (m_contentsFrozen) 151 return; 152 commitScaleChange(); 153 } 154 155 void TiledBackingStore::commitScaleChange() 156 { 157 m_contentsScale = m_pendingScale; 158 m_pendingScale = 0; 159 m_tiles.clear(); 160 createTiles(); 161 } 162 151 163 double TiledBackingStore::tileDistance(const IntRect& viewport, const Tile::Coordinate& tileCoordinate) 152 164 { … … 352 364 // were not painted or created because tiles are not created or 353 365 // painted when in frozen state. 354 if (!m_contentsFrozen) { 366 if (m_contentsFrozen) 367 return; 368 if (m_pendingScale) 369 commitScaleChange(); 370 else { 355 371 startTileCreationTimer(); 356 372 startTileBufferUpdateTimer(); 357 373 } 358 // stopping is handled when the timers fire359 374 } 360 375 -
trunk/WebCore/platform/graphics/TiledBackingStore.h
r55976 r56184 64 64 void updateTileBuffers(); 65 65 void createTiles(); 66 67 void commitScaleChange(); 66 68 67 69 void dropOverhangingTiles(); … … 96 98 IntRect m_viewport; 97 99 float m_contentsScale; 100 float m_pendingScale; 98 101 99 102 bool m_contentsFrozen; -
trunk/WebKit/qt/Api/qgraphicswebview.cpp
r56068 r56184 122 122 void updateResizesToContentsForPage(); 123 123 QRectF graphicsItemVisibleRect() const; 124 #if ENABLE(TILED_BACKING_STORE) 125 void updateTiledBackingStoreScale(); 126 #endif 124 127 125 128 void createOrDeleteOverlay(); … … 128 131 void _q_doLoadFinished(bool success); 129 132 void _q_contentsSizeChanged(const QSize&); 133 void _q_scaleChanged(); 130 134 131 135 QGraphicsWebView* q; … … 359 363 } 360 364 365 void QGraphicsWebViewPrivate::_q_scaleChanged() 366 { 367 #if ENABLE(TILED_BACKING_STORE) 368 updateTiledBackingStoreScale(); 369 #endif 370 } 371 361 372 QRectF QGraphicsWebViewPrivate::graphicsItemVisibleRect() const 362 373 { … … 376 387 } 377 388 389 #if ENABLE(TILED_BACKING_STORE) 390 void QGraphicsWebViewPrivate::updateTiledBackingStoreScale() 391 { 392 WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page->mainFrame())->tiledBackingStore(); 393 if (!backingStore) 394 return; 395 backingStore->setContentsScale(q->scale()); 396 } 397 #endif 398 378 399 /*! 379 400 \class QGraphicsWebView … … 469 490 setFocusPolicy(Qt::StrongFocus); 470 491 setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); 492 #if ENABLE(TILED_BACKING_STORE) 493 QObject::connect(this, SIGNAL(scaleChanged()), this, SLOT(_q_scaleChanged())); 494 #endif 471 495 } 472 496 … … 1029 1053 } 1030 1054 1055 /*! 1056 \property QGraphicsWebView::tiledBackingStoreFrozen 1057 \brief whether the tiled backing store updates its contents 1058 \since 4.7 1059 1060 If the tiled backing store is enabled using QWebSettings::TiledBackingStoreEnabled attribute, this property 1061 can be used to disable backing store updates temporarily. This can be useful for example for running 1062 a smooth animation that changes the scale of the QGraphicsWebView. 1063 1064 When the backing store is unfrozen, its contents will be automatically updated to match the current 1065 state of the document. If the QGraphicsWebView scale was changed, the backing store is also 1066 re-rendered using the new scale. 1067 1068 If the tiled backing store is not enabled, this property does nothing. 1069 1070 \sa QWebSettings::TiledBackingStoreEnabled 1071 \sa QGraphicsObject::scale 1072 */ 1073 bool QGraphicsWebView::isTiledBackingStoreFrozen() const 1074 { 1075 #if ENABLE(TILED_BACKING_STORE) 1076 WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page()->mainFrame())->tiledBackingStore(); 1077 if (!backingStore) 1078 return false; 1079 return backingStore->contentsFrozen(); 1080 #else 1081 return false; 1082 #endif 1083 } 1084 1085 void QGraphicsWebView::setTiledBackingStoreFrozen(bool frozen) 1086 { 1087 #if ENABLE(TILED_BACKING_STORE) 1088 WebCore::TiledBackingStore* backingStore = QWebFramePrivate::core(page()->mainFrame())->tiledBackingStore(); 1089 if (!backingStore) 1090 return; 1091 backingStore->setContentsFrozen(frozen); 1092 #else 1093 UNUSED_PARAM(frozen); 1094 #endif 1095 } 1096 1031 1097 /*! \reimp 1032 1098 */ -
trunk/WebKit/qt/Api/qgraphicswebview.h
r54767 r56184 47 47 Q_PROPERTY(bool modified READ isModified) 48 48 Q_PROPERTY(bool resizesToContents READ resizesToContents WRITE setResizesToContents) 49 Q_PROPERTY(bool tiledBackingStoreFrozen READ isTiledBackingStoreFrozen WRITE setTiledBackingStoreFrozen) 49 50 50 51 public: … … 83 84 bool resizesToContents() const; 84 85 void setResizesToContents(bool enabled); 86 87 bool isTiledBackingStoreFrozen() const; 88 void setTiledBackingStoreFrozen(bool frozen); 85 89 86 90 virtual void setGeometry(const QRectF& rect); … … 143 147 Q_PRIVATE_SLOT(d, void syncLayers()) 144 148 Q_PRIVATE_SLOT(d, void _q_contentsSizeChanged(const QSize&)) 149 Q_PRIVATE_SLOT(d, void _q_scaleChanged()) 145 150 146 151 QGraphicsWebViewPrivate* const d; -
trunk/WebKit/qt/ChangeLog
r56141 r56184 1 2010-03-18 Antti Koivisto <koivisto@iki.fi> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 https://bugs.webkit.org/show_bug.cgi?id=36102 6 [Qt] Scaling control API for tiled backing store 7 8 The scale is set by passing the QGraphicsWebView scale to the backing store. The 9 only new API is the tiledBackingStoreFrozen property which allows disabling 10 all updates (for example during zoom animation). 11 12 * Api/qgraphicswebview.cpp: 13 (QGraphicsWebViewPrivate::_q_scaleChanged): 14 (QGraphicsWebViewPrivate::updateTiledBackingStoreScale): 15 (QGraphicsWebView::QGraphicsWebView): 16 (QGraphicsWebView::isTiledBackingStoreFrozen): 17 (QGraphicsWebView::setTiledBackingStoreFrozen): 18 * Api/qgraphicswebview.h: 19 * Api/qwebframe.cpp: 20 * Api/qwebframe_p.h: 21 1 22 2010-03-17 Antti Koivisto <koivisto@iki.fi> 2 23
Note: See TracChangeset
for help on using the changeset viewer.