Changeset 167256 in webkit
- Timestamp:
- Apr 14, 2014, 11:40:04 AM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r167251 r167256 1 2014-04-12 Antti Koivisto <antti@apple.com> 2 3 Keep secondary tile grid for zoomed-out scale 4 https://bugs.webkit.org/show_bug.cgi?id=131586 5 6 Reviewed by Darin Adler. 7 8 * platform/graphics/ca/GraphicsLayerCA.cpp: 9 (WebCore::GraphicsLayerCA::updateContentsScale): 10 11 Don't repaint tiled backing with setNeedsDisplay, it invalidates itself correctly in setContentsScale. 12 Update custom child layers when tiled backing scale changes. 13 14 * platform/graphics/ca/mac/TileController.h: 15 * platform/graphics/ca/mac/TileController.mm: 16 (WebCore::TileController::TileController): 17 (WebCore::TileController::setNeedsDisplay): 18 19 Drop the whole zoomed-out grid on full repaint. 20 21 (WebCore::TileController::setNeedsDisplayInRect): 22 23 Drop changed zoomed-out tiles. A more sophisticated strategy is possible. 24 25 (WebCore::TileController::setContentsScale): 26 27 Swap the zoomed-out grid in and out as needed. 28 Repaint the active grid after scale change so the client does not have to. 29 30 (WebCore::TileController::contentsScale): 31 32 Get the content scale from the tile grid so it is not kept in two places. 33 34 (WebCore::TileController::zoomedOutContentsScale): 35 (WebCore::TileController::setZoomedOutContentsScale): 36 37 Drop the zoomed-out grid if it no longer matches the zoomed-out scale. 38 39 (WebCore::TileController::tileRevalidationTimerFired): 40 (WebCore::TileController::retainedTileBackingStoreMemory): 41 (WebCore::TileController::containerLayers): 42 43 Return both zoomed-out tiles and the active tiles. Active tiles are on top. 44 45 (WebCore::TileController::numberOfUnparentedTiles): 46 (WebCore::TileController::removeUnparentedTilesNow): 47 * platform/graphics/ca/mac/TileGrid.h: 48 * platform/graphics/ca/mac/TileGrid.mm: 49 (WebCore::TileGrid::dropTilesInRect): 50 51 Add a function for dropping tiles. 52 53 (WebCore::TileGrid::revalidateTiles): 54 1 55 2014-04-14 Oliver Hunt <oliver@apple.com> 2 56 -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
r167196 r167256 2993 2993 2994 2994 m_layer->setContentsScale(contentsScale); 2995 2996 if (tiledBacking()) { 2997 // Scale change may swap in a different set of tiles changing the custom child layers. 2998 if (m_isPageTiledBackingLayer) 2999 m_uncommittedChanges |= ChildrenChanged; 3000 // Tiled backing repaints automatically on scale change. 3001 return; 3002 } 2995 3003 if (drawsContent()) 2996 3004 m_layer->setNeedsDisplay(); -
trunk/Source/WebCore/platform/graphics/ca/mac/TileController.h
r167138 r167256 61 61 62 62 void setContentsScale(float); 63 float contentsScale() const { return m_contentsScale; }63 float contentsScale() const; 64 64 65 65 bool acceleratesDrawing() const { return m_acceleratesDrawing; } … … 149 149 virtual void setTileMargins(int marginTop, int marginBottom, int marginLeft, int marginRight) override; 150 150 virtual void setZoomedOutContentsScale(float) override; 151 virtual float zoomedOutContentsScale() const override { return m_zoomedOutContentsScale; }151 virtual float zoomedOutContentsScale() const override; 152 152 153 153 void scheduleTileRevalidation(double interval); … … 163 163 164 164 std::unique_ptr<TileGrid> m_tileGrid; 165 std::unique_ptr<TileGrid> m_zoomedOutTileGrid; 165 166 166 167 IntSize m_tileSize; … … 171 172 Timer<TileController> m_tileRevalidationTimer; 172 173 173 float m_contentsScale;174 174 float m_zoomedOutContentsScale; 175 175 float m_deviceScaleFactor; -
trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm
r167138 r167256 45 45 namespace WebCore { 46 46 47 enum TileValidationPolicyFlag {48 PruneSecondaryTiles = 1 << 0,49 UnparentAllTiles = 1 << 150 };51 52 47 PassOwnPtr<TileController> TileController::create(PlatformCALayer* rootPlatformLayer) 53 48 { … … 60 55 , m_tileSize(defaultTileWidth, defaultTileHeight) 61 56 , m_tileRevalidationTimer(this, &TileController::tileRevalidationTimerFired) 62 , m_contentsScale(1)63 57 , m_zoomedOutContentsScale(0) 64 58 , m_deviceScaleFactor(1) … … 97 91 { 98 92 tileGrid().setNeedsDisplay(); 93 m_zoomedOutTileGrid = nullptr; 99 94 } 100 95 … … 102 97 { 103 98 tileGrid().setNeedsDisplayInRect(rect); 99 if (m_zoomedOutTileGrid) 100 m_zoomedOutTileGrid->dropTilesInRect(rect); 104 101 } 105 102 … … 108 105 ASSERT(owningGraphicsLayer()->isCommittingChanges()); 109 106 110 m_contentsScale = scale;111 112 107 float deviceScaleFactor = owningGraphicsLayer()->platformCALayerDeviceScaleFactor(); 113 114 108 // The scale we get is the product of the page scale factor and device scale factor. 115 109 // Divide by the device scale factor so we'll get the page scale factor. … … 122 116 m_deviceScaleFactor = deviceScaleFactor; 123 117 118 if (m_zoomedOutTileGrid && m_zoomedOutTileGrid->scale() == scale) { 119 m_tileGrid = std::move(m_zoomedOutTileGrid); 120 m_tileGrid->revalidateTiles(0); 121 return; 122 } 123 124 if (m_zoomedOutContentsScale && m_zoomedOutContentsScale == tileGrid().scale() && tileGrid().scale() != scale && !m_hasTilesWithTemporaryScaleFactor) { 125 m_zoomedOutTileGrid = std::move(m_tileGrid); 126 m_tileGrid = std::make_unique<TileGrid>(*this); 127 } 128 124 129 tileGrid().setScale(scale); 130 tileGrid().setNeedsDisplay(); 131 } 132 133 float TileController::contentsScale() const 134 { 135 return tileGrid().scale() * m_deviceScaleFactor; 136 } 137 138 float TileController::zoomedOutContentsScale() const 139 { 140 return m_zoomedOutContentsScale * m_deviceScaleFactor; 125 141 } 126 142 … … 129 145 ASSERT(owningGraphicsLayer()->isCommittingChanges()); 130 146 147 float deviceScaleFactor = owningGraphicsLayer()->platformCALayerDeviceScaleFactor(); 148 scale /= deviceScaleFactor; 149 131 150 if (m_zoomedOutContentsScale == scale) 132 151 return; 133 152 m_zoomedOutContentsScale = scale; 153 154 if (m_zoomedOutTileGrid && m_zoomedOutTileGrid->scale() != m_zoomedOutContentsScale) 155 m_zoomedOutTileGrid = nullptr; 134 156 } 135 157 … … 323 345 return; 324 346 } 325 326 TileGrid::TileValidationPolicyFlags validationPolicy = (shouldAggressivelyRetainTiles() ? 0 : PruneSecondaryTiles) | UnparentAllTiles; 347 // If we are not visible get rid of the zoomed-out tiles. 348 m_zoomedOutTileGrid = nullptr; 349 350 unsigned validationPolicy = (shouldAggressivelyRetainTiles() ? 0 : TileGrid::PruneSecondaryTiles) | TileGrid::UnparentAllTiles; 327 351 328 352 tileGrid().revalidateTiles(validationPolicy); … … 380 404 double TileController::retainedTileBackingStoreMemory() const 381 405 { 382 return tileGrid().retainedTileBackingStoreMemory(); 406 double bytes = tileGrid().retainedTileBackingStoreMemory(); 407 if (m_zoomedOutTileGrid) 408 bytes += m_zoomedOutTileGrid->retainedTileBackingStoreMemory(); 409 return bytes; 383 410 } 384 411 … … 479 506 Vector<RefPtr<PlatformCALayer>> TileController::containerLayers() 480 507 { 481 Vector<RefPtr<PlatformCALayer>> layerList(1); 482 layerList[0] = &tileGrid().containerLayer(); 508 Vector<RefPtr<PlatformCALayer>> layerList; 509 if (m_zoomedOutTileGrid) 510 layerList.append(&m_zoomedOutTileGrid->containerLayer()); 511 layerList.append(&tileGrid().containerLayer()); 483 512 return layerList; 484 513 } 485 514 486 515 #if PLATFORM(IOS) 487 516 unsigned TileController::numberOfUnparentedTiles() const 488 517 { 489 return tileGrid().numberOfUnparentedTiles(); 518 unsigned count = tileGrid().numberOfUnparentedTiles(); 519 if (m_zoomedOutTileGrid) 520 count += m_zoomedOutTileGrid->numberOfUnparentedTiles(); 521 return count; 490 522 } 491 523 … … 493 525 { 494 526 tileGrid().removeUnparentedTilesNow(); 527 if (m_zoomedOutTileGrid) 528 m_zoomedOutTileGrid->removeUnparentedTilesNow(); 495 529 496 530 updateTileCoverageMap(); -
trunk/Source/WebCore/platform/graphics/ca/mac/TileGrid.h
r167041 r167256 55 55 void setNeedsDisplay(); 56 56 void setNeedsDisplayInRect(const IntRect&); 57 void dropTilesInRect(const IntRect&); 57 58 58 59 void updateTilerLayerProperties(); … … 60 61 bool prepopulateRect(const FloatRect&); 61 62 62 typedef unsigned TileValidationPolicyFlags; 63 void revalidateTiles(TileValidationPolicyFlags); 63 enum TileValidationPolicyFlag { 64 PruneSecondaryTiles = 1 << 0, 65 UnparentAllTiles = 1 << 1 66 }; 67 void revalidateTiles(unsigned validationPolicyFlags); 64 68 bool tilesWouldChangeForVisibleRect(const FloatRect& newVisibleRect, const FloatRect& oldVisibleRect) const; 65 69 -
trunk/Source/WebCore/platform/graphics/ca/mac/TileGrid.mm
r167047 r167256 40 40 namespace WebCore { 41 41 42 enum TileValidationPolicyFlag {43 PruneSecondaryTiles = 1 << 0,44 UnparentAllTiles = 1 << 145 };46 47 42 TileGrid::TileGrid(TileController& controller) 48 43 : m_controller(controller) … … 125 120 } 126 121 122 void TileGrid::dropTilesInRect(const IntRect& rect) 123 { 124 if (m_tiles.isEmpty()) 125 return; 126 127 FloatRect scaledRect(rect); 128 scaledRect.scale(m_scale); 129 IntRect dropRectInTileCoords(enclosingIntRect(scaledRect)); 130 131 Vector<TileIndex> tilesToRemove; 132 133 for (auto& index : m_tiles.keys()) { 134 if (rectForTileIndex(index).intersects(dropRectInTileCoords)) 135 tilesToRemove.append(index); 136 } 137 138 removeTiles(tilesToRemove); 139 } 140 127 141 void TileGrid::setTileNeedsDisplayInRect(const TileIndex& tileIndex, TileInfo& tileInfo, const IntRect& repaintRectInTileCoords, const IntRect& coverageRectInTileCoords) 128 142 { … … 324 338 } 325 339 326 void TileGrid::revalidateTiles( TileValidationPolicyFlagsvalidationPolicy)340 void TileGrid::revalidateTiles(unsigned validationPolicy) 327 341 { 328 342 FloatRect visibleRect = m_controller.visibleRect(); -
trunk/Source/WebKit2/ChangeLog
r167253 r167256 1 2014-04-12 Antti Koivisto <antti@apple.com> 2 3 Keep secondary tile grid for zoomed-out scale 4 https://bugs.webkit.org/show_bug.cgi?id=131586 5 6 Reviewed by Darin Adler. 7 8 * WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp: 9 (WebKit::PlatformCALayerRemoteTiledBacking::PlatformCALayerRemoteTiledBacking): 10 (WebKit::PlatformCALayerRemoteTiledBacking::customSublayers): 11 12 Always request new sublayer list from tile controller. 13 14 * WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h: 15 1 16 2014-04-14 Tim Horton <timothy_horton@apple.com> 2 17 -
trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp
r166748 r167256 41 41 { 42 42 m_tileController = TileController::create(this); 43 m_customSublayers = std::make_unique<PlatformCALayerList>(m_tileController->containerLayers());44 43 } 45 44 … … 58 57 const WebCore::PlatformCALayerList* PlatformCALayerRemoteTiledBacking::customSublayers() const 59 58 { 60 return m_customSublayers.get(); 59 m_customSublayers = m_tileController->containerLayers(); 60 return &m_customSublayers; 61 61 } 62 62 -
trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h
r166654 r167256 55 55 56 56 OwnPtr<WebCore::TileController> m_tileController; 57 std::unique_ptr<WebCore::PlatformCALayerList>m_customSublayers;57 mutable WebCore::PlatformCALayerList m_customSublayers; 58 58 }; 59 59
Note:
See TracChangeset
for help on using the changeset viewer.