pinch-to-zoom and double-tap flicker when using the new scrolling model
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Mar 2012 04:33:16 +0000 (04:33 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Mar 2012 04:33:16 +0000 (04:33 +0000)
commit0d29a2698c4ac9e6343e1d799a59f015be5ab1ad
tree2952e8f0d3d9a82420e8344f1b25503268c818da
parent19db9009b85f531783bba37c959c0e74e6b68323
pinch-to-zoom and double-tap flicker when using the new scrolling model
https://bugs.webkit.org/show_bug.cgi?id=80368
<rdar://problem/10866221>

Reviewed by Sam Weinig.

Source/WebCore:

In order to work better with zooming, make the tile cache undo the scale transformation
and handle the scaling manually. This avoids creating huge tile backing stores when zoomed in.

* platform/graphics/ca/mac/TileCache.mm:
(WebCore::TileCache::TileCache):
Initialize m_scale to 1.

(WebCore::TileCache::setNeedsDisplayInRect):
Scale the given rect appropriately.

(WebCore::TileCache::drawLayer):
Apply a scale context transform.

(WebCore::TileCache::setScale):
No longer set the contents scale. Instead, update the scale and revalidate the tiles.

(WebCore::TileCache::revalidateTiles):
Return early if the bounds are empty. This avoids showing a single tile if that happens due to a race condition.

(WebCore::TileCache::getTileIndexRangeForRect):
Apply the scale to the bounds.

(WebCore::TileCache::createTileLayer):
Don't set the contents scale.

* platform/graphics/ca/mac/WebTileCacheLayer.mm:
(-[WebTileCacheLayer setContentsScale:]):
Call TileCache::setScale.

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateCompositedBounds):
Make sure to give the tile cache layer sane composited bounds, even if the page has absolutely positioned
elements that are outside of the page.

Source/WebKit2:

Add a way for drawing areas to respond to callback based force repaint requests asynchronously.
This is currently needed for the tiled drawing area when there might be outstanding scroll updates
that are sent from the scrolling thread to the main thread and we need to ensure that they're processed
before sending a message back.

* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::forceRepaintAsync):
Add new member function.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::forceRepaint):
Try forceRepaintAsync first.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::forceRepaintAndSendMessage):
Force the repaint and send the message.

(WebKit::dispatchBackToMainThread):
Dispatch a call to forceRepaintAndSendMessage to the main thread.

(WebKit::TiledCoreAnimationDrawingArea::forceRepaintAsync):
Dispatch a function on the scrolling thread. Its sole purpose is to dispatch a function back to the
main thread, ensuring that all previously dispatched functions have been executed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@109843 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ca/mac/TileCache.h
Source/WebCore/platform/graphics/ca/mac/TileCache.mm
Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/DrawingArea.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h
Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm