WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
rebased
bug-108149-20130131012959.patch (text/plain), 378.41 KB, created by
Jae Hyun Park
on 2013-01-31 01:32:34 PST
(
hide
)
Description:
rebased
Filename:
MIME Type:
Creator:
Jae Hyun Park
Created:
2013-01-31 01:32:34 PST
Size:
378.41 KB
patch
obsolete
>Subversion Revision: 141390 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index e6408a809fdebcee7e887e3a12dc7912733cd162..b90581ad0dabdb20bd944b831076c57b0fa1336c 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,346 @@ >+2013-01-30 Jae Hyun Park <jae.park@company100.net> >+ >+ Coordinated Graphics : Move CoordinatedGraphics related files to WebCore >+ https://bugs.webkit.org/show_bug.cgi?id=108149 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch moves Coordinated Graphics related code to WebCore. To >+ implement Threaded Coordinated Graphics, most of Coordianted Graphics >+ code should be shared. Therefore, they should reside in WebCore instead of >+ WebKit2. >+ >+ When moving to WebCore, two renamings have been done. >+ >+ 1. Rename LayerTreeRenderer to TextureMapperScene. >+ >+ 2. Rename WebCustomFilterProgram and WebCustomFilterOperation to >+ CoordinatedCustomFilterProgram and CoordinatedCustomFilterOperation, >+ respectively. >+ >+ No new tests, covered by existing tests. >+ >+ * CMakeLists.txt: >+ * Target.pri: >+ * platform/graphics/texmap/GraphicsLayerTextureMapper.h: >+ (GraphicsLayerTextureMapper): >+ * platform/graphics/texmap/coordinated/AreaAllocator.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp. >+ (WebCore): >+ (WebCore::AreaAllocator::AreaAllocator): >+ (WebCore::AreaAllocator::~AreaAllocator): >+ (WebCore::AreaAllocator::expand): >+ (WebCore::AreaAllocator::expandBy): >+ (WebCore::AreaAllocator::release): >+ (WebCore::AreaAllocator::overhead): >+ (WebCore::AreaAllocator::roundAllocation): >+ (WebCore::GeneralAreaAllocator::GeneralAreaAllocator): >+ (WebCore::GeneralAreaAllocator::~GeneralAreaAllocator): >+ (WebCore::GeneralAreaAllocator::freeNode): >+ (WebCore::GeneralAreaAllocator::expand): >+ (WebCore::fitsWithin): >+ (WebCore::GeneralAreaAllocator::allocate): >+ (WebCore::GeneralAreaAllocator::allocateFromNode): >+ (WebCore::GeneralAreaAllocator::splitNode): >+ (WebCore::GeneralAreaAllocator::updateLargestFree): >+ (WebCore::GeneralAreaAllocator::release): >+ (WebCore::GeneralAreaAllocator::overhead): >+ * platform/graphics/texmap/coordinated/AreaAllocator.h: Renamed from Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.h. >+ (WebCore): >+ (WebCore::nextPowerOfTwo): >+ (AreaAllocator): >+ (WebCore::AreaAllocator::size): >+ (WebCore::AreaAllocator::minimumAllocation): >+ (WebCore::AreaAllocator::setMinimumAllocation): >+ (WebCore::AreaAllocator::margin): >+ (WebCore::AreaAllocator::setMargin): >+ (GeneralAreaAllocator): >+ (Node): >+ * platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp: Renamed from Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp. >+ (WebCore): >+ (WebCore::CoordinatedBackingStoreTile::swapBuffers): >+ (WebCore::CoordinatedBackingStoreTile::setBackBuffer): >+ (WebCore::CoordinatedBackingStore::createTile): >+ (WebCore::CoordinatedBackingStore::removeTile): >+ (WebCore::CoordinatedBackingStore::removeAllTiles): >+ (WebCore::CoordinatedBackingStore::updateTile): >+ (WebCore::CoordinatedBackingStore::texture): >+ (WebCore::CoordinatedBackingStore::setSize): >+ (WebCore::CoordinatedBackingStore::paintTilesToTextureMapper): >+ (WebCore::CoordinatedBackingStore::adjustedTransformForRect): >+ (WebCore::CoordinatedBackingStore::paintToTextureMapper): >+ (WebCore::CoordinatedBackingStore::drawBorder): >+ (WebCore::CoordinatedBackingStore::drawRepaintCounter): >+ (WebCore::CoordinatedBackingStore::commitTileOperations): >+ * platform/graphics/texmap/coordinated/CoordinatedBackingStore.h: Renamed from Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h. >+ (WebCore): >+ (CoordinatedBackingStoreTile): >+ (WebCore::CoordinatedBackingStoreTile::CoordinatedBackingStoreTile): >+ (WebCore::CoordinatedBackingStoreTile::scale): >+ (CoordinatedBackingStore): >+ (WebCore::CoordinatedBackingStore::create): >+ (WebCore::CoordinatedBackingStore::CoordinatedBackingStore): >+ (WebCore::CoordinatedBackingStore::rect): >+ * platform/graphics/texmap/coordinated/CoordinatedCustomFilterOperation.h: Renamed from Source/WebKit2/Shared/CoordinatedGraphics/WebCustomFilterOperation.h. >+ (WebCore): >+ (CoordinatedCustomFilterOperation): >+ (WebCore::CoordinatedCustomFilterOperation::create): >+ (WebCore::CoordinatedCustomFilterOperation::programID): >+ (WebCore::CoordinatedCustomFilterOperation::CoordinatedCustomFilterOperation): >+ * platform/graphics/texmap/coordinated/CoordinatedCustomFilterProgram.h: Renamed from Source/WebKit2/Shared/CoordinatedGraphics/WebCustomFilterProgram.h. >+ (WebCore): >+ (CoordinatedCustomFilterProgram): >+ (WebCore::CoordinatedCustomFilterProgram::create): >+ (WebCore::CoordinatedCustomFilterProgram::CoordinatedCustomFilterProgram): >+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp. >+ (WebCore): >+ (WebCore::toCoordinatedLayerID): >+ (WebCore::CoordinatedGraphicsLayer::didChangeLayerState): >+ (WebCore::CoordinatedGraphicsLayer::didChangeAnimations): >+ (WebCore::CoordinatedGraphicsLayer::didChangeChildren): >+ (WebCore::CoordinatedGraphicsLayer::didChangeFilters): >+ (WebCore::CoordinatedGraphicsLayer::didChangeImageBacking): >+ (WebCore::CoordinatedGraphicsLayer::setShouldUpdateVisibleRect): >+ (WebCore::CoordinatedGraphicsLayer::didChangeGeometry): >+ (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer): >+ (WebCore::CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer): >+ (WebCore::CoordinatedGraphicsLayer::setChildren): >+ (WebCore::CoordinatedGraphicsLayer::addChild): >+ (WebCore::CoordinatedGraphicsLayer::addChildAtIndex): >+ (WebCore::CoordinatedGraphicsLayer::addChildAbove): >+ (WebCore::CoordinatedGraphicsLayer::addChildBelow): >+ (WebCore::CoordinatedGraphicsLayer::replaceChild): >+ (WebCore::CoordinatedGraphicsLayer::removeFromParent): >+ (WebCore::CoordinatedGraphicsLayer::setPosition): >+ (WebCore::CoordinatedGraphicsLayer::setAnchorPoint): >+ (WebCore::CoordinatedGraphicsLayer::setSize): >+ (WebCore::CoordinatedGraphicsLayer::setTransform): >+ (WebCore::CoordinatedGraphicsLayer::setChildrenTransform): >+ (WebCore::CoordinatedGraphicsLayer::setPreserves3D): >+ (WebCore::CoordinatedGraphicsLayer::setMasksToBounds): >+ (WebCore::CoordinatedGraphicsLayer::setDrawsContent): >+ (WebCore::CoordinatedGraphicsLayer::setContentsVisible): >+ (WebCore::CoordinatedGraphicsLayer::setContentsOpaque): >+ (WebCore::CoordinatedGraphicsLayer::setBackfaceVisibility): >+ (WebCore::CoordinatedGraphicsLayer::setOpacity): >+ (WebCore::CoordinatedGraphicsLayer::setContentsRect): >+ (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay): >+ (WebCore::CoordinatedGraphicsLayer::setContentsToCanvas): >+ (WebCore::CoordinatedGraphicsLayer::setFilters): >+ (WebCore::CoordinatedGraphicsLayer::setContentsToSolidColor): >+ (WebCore::CoordinatedGraphicsLayer::setShowDebugBorder): >+ (WebCore::CoordinatedGraphicsLayer::setShowRepaintCounter): >+ (WebCore::CoordinatedGraphicsLayer::setContentsToImage): >+ (WebCore::CoordinatedGraphicsLayer::setMaskLayer): >+ (WebCore::CoordinatedGraphicsLayer::shouldDirectlyCompositeImage): >+ (WebCore::CoordinatedGraphicsLayer::setReplicatedByLayer): >+ (WebCore::CoordinatedGraphicsLayer::setNeedsDisplay): >+ (WebCore::CoordinatedGraphicsLayer::setNeedsDisplayInRect): >+ (WebCore::CoordinatedGraphicsLayer::id): >+ (WebCore::CoordinatedGraphicsLayer::flushCompositingState): >+ (WebCore::toCoordinatedGraphicsLayer): >+ (WebCore::CoordinatedGraphicsLayer::syncChildren): >+ (WebCore::CoordinatedGraphicsLayer::syncFilters): >+ (WebCore::CoordinatedGraphicsLayer::syncImageBacking): >+ (WebCore::CoordinatedGraphicsLayer::syncLayerState): >+ (WebCore::CoordinatedGraphicsLayer::setDebugBorder): >+ (WebCore::CoordinatedGraphicsLayer::syncAnimations): >+ (WebCore::CoordinatedGraphicsLayer::syncCanvas): >+ (WebCore::CoordinatedGraphicsLayer::destroyCanvasIfNeeded): >+ (WebCore::CoordinatedGraphicsLayer::createCanvasIfNeeded): >+ (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly): >+ (WebCore::CoordinatedGraphicsLayer::imageBackingVisible): >+ (WebCore::CoordinatedGraphicsLayer::releaseImageBackingIfNeeded): >+ (WebCore::CoordinatedGraphicsLayer::tiledBackingStorePaintBegin): >+ (WebCore::CoordinatedGraphicsLayer::setRootLayer): >+ (WebCore::CoordinatedGraphicsLayer::setVisibleContentRectTrajectoryVector): >+ (WebCore::CoordinatedGraphicsLayer::deviceOrPageScaleFactorChanged): >+ (WebCore::CoordinatedGraphicsLayer::effectiveContentsScale): >+ (WebCore::CoordinatedGraphicsLayer::adjustContentsScale): >+ (WebCore::CoordinatedGraphicsLayer::createBackingStore): >+ (WebCore::CoordinatedGraphicsLayer::tiledBackingStorePaint): >+ (WebCore::CoordinatedGraphicsLayer::tiledBackingStorePaintEnd): >+ (WebCore::CoordinatedGraphicsLayer::tiledBackingStoreHasPendingTileCreation): >+ (WebCore::CoordinatedGraphicsLayer::tiledBackingStoreContentsRect): >+ (WebCore::clampToContentsRectIfRectIsInfinite): >+ (WebCore::CoordinatedGraphicsLayer::tiledBackingStoreVisibleRect): >+ (WebCore::CoordinatedGraphicsLayer::tiledBackingStoreBackgroundColor): >+ (WebCore::CoordinatedGraphicsLayer::beginContentUpdate): >+ (WebCore::CoordinatedGraphicsLayer::createTile): >+ (WebCore::CoordinatedGraphicsLayer::updateTile): >+ (WebCore::CoordinatedGraphicsLayer::removeTile): >+ (WebCore::CoordinatedGraphicsLayer::updateContentBuffers): >+ (WebCore::CoordinatedGraphicsLayer::purgeBackingStores): >+ (WebCore::CoordinatedGraphicsLayer::setCoordinator): >+ (WebCore::CoordinatedGraphicsLayer::setNeedsVisibleRectAdjustment): >+ (WebCore::CoordinatedGraphicsLayer::hasPendingVisibleChanges): >+ (WebCore::isIntegral): >+ (WebCore::CoordinatedGraphicsLayer::computePositionRelativeToBase): >+ (WebCore::CoordinatedGraphicsLayer::computePixelAlignment): >+ (WebCore::CoordinatedGraphicsLayer::computeTransformedVisibleRect): >+ (WebCore::CoordinatedGraphicsLayer::shouldHaveBackingStore): >+ (WebCore::CoordinatedGraphicsLayer::selfOrAncestorHasActiveTransformAnimation): >+ (WebCore::CoordinatedGraphicsLayer::selfOrAncestorHaveNonAffineTransforms): >+ (WebCore::CoordinatedGraphicsLayer::addAnimation): >+ (WebCore::CoordinatedGraphicsLayer::pauseAnimation): >+ (WebCore::CoordinatedGraphicsLayer::removeAnimation): >+ (WebCore::CoordinatedGraphicsLayer::suspendAnimations): >+ (WebCore::CoordinatedGraphicsLayer::resumeAnimations): >+ (WebCore::CoordinatedGraphicsLayer::animationStartedTimerFired): >+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: Renamed from Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h. >+ (WebCore): >+ (CoordinatedGraphicsLayerClient): >+ (CoordinatedGraphicsLayer): >+ (WebCore::CoordinatedGraphicsLayer::setFixedToViewport): >+ (WebCore::CoordinatedGraphicsLayer::coverRect): >+ (WebCore::CoordinatedGraphicsLayer::fixedToViewport): >+ * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedImageBacking.cpp. >+ (WebCore): >+ (WebCore::CoordinatedImageBacking::getCoordinatedImageBackingID): >+ (WebCore::CoordinatedImageBacking::create): >+ (WebCore::CoordinatedImageBacking::CoordinatedImageBacking): >+ (WebCore::CoordinatedImageBacking::~CoordinatedImageBacking): >+ (WebCore::CoordinatedImageBacking::addHost): >+ (WebCore::CoordinatedImageBacking::removeHost): >+ (WebCore::CoordinatedImageBacking::markDirty): >+ (WebCore::CoordinatedImageBacking::update): >+ (WebCore::CoordinatedImageBacking::releaseSurfaceIfNeeded): >+ (WebCore::CoordinatedImageBacking::updateVisibilityIfNeeded): >+ (WebCore::CoordinatedImageBacking::clearContentsTimerFired): >+ * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h: Renamed from Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedImageBacking.h. >+ (WebCore): >+ (CoordinatedImageBacking): >+ (Coordinator): >+ (Host): >+ (WebCore::CoordinatedImageBacking::id): >+ * platform/graphics/texmap/coordinated/CoordinatedLayerInfo.h: Renamed from Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedLayerInfo.h. >+ (WebCore): >+ (WebCore::CoordinatedLayerInfo::CoordinatedLayerInfo): >+ (CoordinatedLayerInfo): >+ * platform/graphics/texmap/coordinated/CoordinatedSurface.cpp: Renamed from Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedSurface.cpp. >+ (WebCore): >+ (WebCore::CoordinatedSurface::setFactory): >+ (WebCore::CoordinatedSurface::create): >+ * platform/graphics/texmap/coordinated/CoordinatedSurface.h: Renamed from Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedSurface.h. >+ (WebCore): >+ (CoordinatedSurface): >+ (WebCore::CoordinatedSurface::~CoordinatedSurface): >+ (WebCore::CoordinatedSurface::supportsAlpha): >+ * platform/graphics/texmap/coordinated/CoordinatedTile.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.cpp. >+ (WebCore): >+ (WebCore::CoordinatedTile::CoordinatedTile): >+ (WebCore::CoordinatedTile::~CoordinatedTile): >+ (WebCore::CoordinatedTile::isDirty): >+ (WebCore::CoordinatedTile::invalidate): >+ (WebCore::CoordinatedTile::updateBackBuffer): >+ (WebCore::CoordinatedTile::swapBackBufferToFront): >+ (WebCore::CoordinatedTile::isReadyToPaint): >+ (WebCore::CoordinatedTile::paint): >+ (WebCore::CoordinatedTile::resize): >+ (WebCore::CoordinatedTileBackend::CoordinatedTileBackend): >+ (WebCore::CoordinatedTileBackend::createTile): >+ (WebCore::CoordinatedTileBackend::paintCheckerPattern): >+ * platform/graphics/texmap/coordinated/CoordinatedTile.h: Renamed from Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.h. >+ (WebCore): >+ (CoordinatedTile): >+ (WebCore::CoordinatedTile::create): >+ (WebCore::CoordinatedTile::coordinate): >+ (WebCore::CoordinatedTile::rect): >+ (CoordinatedTileClient): >+ (WebCore::CoordinatedTileClient::~CoordinatedTileClient): >+ (CoordinatedTileBackend): >+ (WebCore::CoordinatedTileBackend::create): >+ * platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h: Renamed from Source/WebKit2/Shared/CoordinatedGraphics/SurfaceUpdateInfo.h. >+ (WebCore): >+ (SurfaceUpdateInfo): >+ (WebCore::SurfaceUpdateInfo::SurfaceUpdateInfo): >+ * platform/graphics/texmap/coordinated/TextureMapperScene.cpp: Renamed from Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp. >+ (WebCore): >+ (WebCore::TextureMapperScene::dispatchOnMainThread): >+ (WebCore::boundedScrollPosition): >+ (WebCore::layerShouldHaveBackingStore): >+ (WebCore::TextureMapperScene::TextureMapperScene): >+ (WebCore::TextureMapperScene::~TextureMapperScene): >+ (WebCore::TextureMapperScene::paintToCurrentGLContext): >+ (WebCore::TextureMapperScene::animationFrameReady): >+ (WebCore::TextureMapperScene::requestAnimationFrame): >+ (WebCore::TextureMapperScene::paintToGraphicsContext): >+ (WebCore::TextureMapperScene::setContentsSize): >+ (WebCore::TextureMapperScene::setVisibleContentsRect): >+ (WebCore::TextureMapperScene::updateViewport): >+ (WebCore::TextureMapperScene::adjustPositionForFixedLayers): >+ (WebCore::TextureMapperScene::didChangeScrollPosition): >+ (WebCore::TextureMapperScene::createCanvas): >+ (WebCore::TextureMapperScene::syncCanvas): >+ (WebCore::TextureMapperScene::destroyCanvas): >+ (WebCore::TextureMapperScene::setLayerRepaintCount): >+ (WebCore::TextureMapperScene::setLayerChildren): >+ (WebCore::TextureMapperScene::setLayerFilters): >+ (WebCore::TextureMapperScene::injectCachedCustomFilterPrograms): >+ (WebCore::TextureMapperScene::createCustomFilterProgram): >+ (WebCore::TextureMapperScene::removeCustomFilterProgram): >+ (WebCore::TextureMapperScene::setLayerState): >+ (WebCore::TextureMapperScene::getLayerByIDIfExists): >+ (WebCore::TextureMapperScene::createLayers): >+ (WebCore::TextureMapperScene::createLayer): >+ (WebCore::TextureMapperScene::deleteLayers): >+ (WebCore::TextureMapperScene::deleteLayer): >+ (WebCore::TextureMapperScene::setRootLayerID): >+ (WebCore::TextureMapperScene::prepareContentBackingStore): >+ (WebCore::TextureMapperScene::createBackingStoreIfNeeded): >+ (WebCore::TextureMapperScene::removeBackingStoreIfNeeded): >+ (WebCore::TextureMapperScene::resetBackingStoreSizeToLayerSize): >+ (WebCore::TextureMapperScene::createTile): >+ (WebCore::TextureMapperScene::removeTile): >+ (WebCore::TextureMapperScene::updateTile): >+ (WebCore::TextureMapperScene::createUpdateAtlas): >+ (WebCore::TextureMapperScene::removeUpdateAtlas): >+ (WebCore::TextureMapperScene::createImageBacking): >+ (WebCore::TextureMapperScene::updateImageBacking): >+ (WebCore::TextureMapperScene::clearImageBackingContents): >+ (WebCore::TextureMapperScene::removeImageBacking): >+ (WebCore::TextureMapperScene::assignImageBackingToLayer): >+ (WebCore::TextureMapperScene::removeReleasedImageBackingsIfNeeded): >+ (WebCore::TextureMapperScene::commitPendingBackingStoreOperations): >+ (WebCore::TextureMapperScene::flushLayerChanges): >+ (WebCore::TextureMapperScene::renderNextFrame): >+ (WebCore::TextureMapperScene::ensureRootLayer): >+ (WebCore::TextureMapperScene::syncRemoteContent): >+ (WebCore::TextureMapperScene::purgeGLResources): >+ (WebCore::TextureMapperScene::purgeBackingStores): >+ (WebCore::TextureMapperScene::setLayerAnimations): >+ (WebCore::TextureMapperScene::setAnimationsLocked): >+ (WebCore::TextureMapperScene::detach): >+ (WebCore::TextureMapperScene::appendUpdate): >+ (WebCore::TextureMapperScene::setActive): >+ (WebCore::TextureMapperScene::setBackgroundColor): >+ * platform/graphics/texmap/coordinated/TextureMapperScene.h: Renamed from Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h. >+ (WebCore): >+ (TextureMapperSceneClient): >+ (TextureMapperScene): >+ (TileUpdate): >+ (WebCore::TextureMapperScene::TileUpdate::TileUpdate): >+ (WebCore::TextureMapperScene::setDrawsBackground): >+ (WebCore::TextureMapperScene::layerByID): >+ (WebCore::TextureMapperScene::rootLayer): >+ (WebCore::TextureMapperScene::notifyAnimationStarted): >+ (WebCore::TextureMapperScene::notifyFlushRequired): >+ * platform/graphics/texmap/coordinated/UpdateAtlas.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp. >+ (WebCore): >+ (WebCore::UpdateAtlas::UpdateAtlas): >+ (WebCore::UpdateAtlas::~UpdateAtlas): >+ (WebCore::UpdateAtlas::buildLayoutIfNeeded): >+ (WebCore::UpdateAtlas::didSwapBuffers): >+ (WebCore::UpdateAtlas::beginPaintingOnAvailableBuffer): >+ * platform/graphics/texmap/coordinated/UpdateAtlas.h: Renamed from Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h. >+ (WebCore): >+ (UpdateAtlasClient): >+ (UpdateAtlas): >+ (WebCore::UpdateAtlas::size): >+ (WebCore::UpdateAtlas::supportsAlpha): >+ (WebCore::UpdateAtlas::addTimeInactive): >+ (WebCore::UpdateAtlas::isInactive): >+ (WebCore::UpdateAtlas::isInUse): >+ > 2013-01-31 Kentaro Hara <haraken@chromium.org> > > [V8] Trace not only major DOM GCs but also minor DOM GCs >diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog >index d8310cb5da062ec49dc9fe4108b4a1bef2c26a90..b4b5105d7e5dcf7049c347c220369de9e3909b77 100644 >--- a/Source/WebKit2/ChangeLog >+++ b/Source/WebKit2/ChangeLog >@@ -1,3 +1,112 @@ >+2013-01-30 Jae Hyun Park <jae.park@company100.net> >+ >+ Coordinated Graphics : Move CoordinatedGraphics related files to WebCore >+ https://bugs.webkit.org/show_bug.cgi?id=108149 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch moves Coordinated Graphics related code to WebCore. To >+ implement Threaded Coordinated Graphics, most of Coordianted Graphics >+ code should be shared. Therefore, they should reside in WebCore instead of >+ WebKit2. >+ >+ When moving to WebCore, two renamings have been done. >+ >+ 1. Rename LayerTreeRenderer to TextureMapperScene. >+ >+ 2. Rename WebCustomFilterProgram and WebCustomFilterOperation to >+ CoordinatedCustomFilterProgram and CoordinatedCustomFilterOperation, >+ respectively. >+ >+ No new tests, covered by existing tests. >+ >+ * CMakeLists.txt: >+ * Scripts/webkit2/messages.py: >+ (headers_for_type): >+ * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp: >+ (CoreIPC::::decode): >+ * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h: >+ (WebCore): >+ * Shared/CoordinatedGraphics/WebCoordinatedSurface.h: >+ (Handle): >+ * Target.pri: >+ * UIProcess/API/efl/EwkView.cpp: >+ (EwkView::textureMapperScene): >+ (EwkView::displayTimerFired): >+ (EwkView::enterAcceleratedCompositingMode): >+ * UIProcess/API/efl/EwkView.h: >+ (WebKit): >+ (WebCore): >+ (EwkView): >+ * UIProcess/API/qt/qquickwebpage.cpp: >+ (QQuickWebPagePrivate::paint): >+ (QQuickWebPage::updatePaintNode): >+ * UIProcess/API/qt/raw/qrawwebview.cpp: >+ (QRawWebView::setActive): >+ (QRawWebView::textureMapperScene): >+ (QRawWebView::paint): >+ * UIProcess/API/qt/raw/qrawwebview_p.h: >+ (WebCore): >+ * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp: >+ (WebKit::CoordinatedLayerTreeHostProxy::CoordinatedLayerTreeHostProxy): >+ (WebKit::CoordinatedLayerTreeHostProxy::~CoordinatedLayerTreeHostProxy): >+ (WebKit::CoordinatedLayerTreeHostProxy::dispatchUpdate): >+ (WebKit::CoordinatedLayerTreeHostProxy::createTileForLayer): >+ (WebKit::CoordinatedLayerTreeHostProxy::updateTileForLayer): >+ (WebKit::CoordinatedLayerTreeHostProxy::removeTileForLayer): >+ (WebKit::CoordinatedLayerTreeHostProxy::createUpdateAtlas): >+ (WebKit::CoordinatedLayerTreeHostProxy::removeUpdateAtlas): >+ (WebKit::CoordinatedLayerTreeHostProxy::createCompositingLayers): >+ (WebKit::CoordinatedLayerTreeHostProxy::deleteCompositingLayers): >+ (WebKit::CoordinatedLayerTreeHostProxy::setRootCompositingLayer): >+ (WebKit::CoordinatedLayerTreeHostProxy::setCompositingLayerState): >+ (WebKit::CoordinatedLayerTreeHostProxy::setCompositingLayerChildren): >+ (WebKit::CoordinatedLayerTreeHostProxy::setCompositingLayerFilters): >+ (WebKit::CoordinatedLayerTreeHostProxy::removeCustomFilterProgram): >+ (WebKit::CoordinatedLayerTreeHostProxy::createCustomFilterProgram): >+ (WebKit::CoordinatedLayerTreeHostProxy::didRenderFrame): >+ (WebKit::CoordinatedLayerTreeHostProxy::createImageBacking): >+ (WebKit::CoordinatedLayerTreeHostProxy::updateImageBacking): >+ (WebKit::CoordinatedLayerTreeHostProxy::clearImageBackingContents): >+ (WebKit::CoordinatedLayerTreeHostProxy::removeImageBacking): >+ (WebKit::CoordinatedLayerTreeHostProxy::setContentsSize): >+ (WebKit::CoordinatedLayerTreeHostProxy::setLayerAnimations): >+ (WebKit::CoordinatedLayerTreeHostProxy::setAnimationsLocked): >+ (WebKit::CoordinatedLayerTreeHostProxy::setVisibleContentsRect): >+ (WebKit::CoordinatedLayerTreeHostProxy::requestAnimationFrame): >+ (WebKit::CoordinatedLayerTreeHostProxy::didChangeScrollPosition): >+ (WebKit::CoordinatedLayerTreeHostProxy::createCanvas): >+ (WebKit::CoordinatedLayerTreeHostProxy::syncCanvas): >+ (WebKit::CoordinatedLayerTreeHostProxy::destroyCanvas): >+ (WebKit::CoordinatedLayerTreeHostProxy::setLayerRepaintCount): >+ (WebKit::CoordinatedLayerTreeHostProxy::setBackgroundColor): >+ * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h: >+ (WebCore): >+ (WebKit): >+ (CoordinatedLayerTreeHostProxy): >+ (WebKit::CoordinatedLayerTreeHostProxy::textureMapperScene): >+ * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.messages.in: >+ * UIProcess/efl/PageClientBase.cpp: >+ * UIProcess/efl/PageViewportControllerClientEfl.cpp: >+ (WebKit::PageViewportControllerClientEfl::setRendererActive): >+ * UIProcess/qt/QtWebPageSGNode.cpp: >+ (WebKit::ContentsSGNode::ContentsSGNode): >+ (WebKit::ContentsSGNode::render): >+ (WebKit::ContentsSGNode::~ContentsSGNode): >+ (WebKit::ContentsSGNode::textureMapperScene): >+ (ContentsSGNode): >+ (WebKit::QtWebPageSGNode::setTextureMapperScene): >+ * UIProcess/qt/QtWebPageSGNode.h: >+ (WebCore): >+ (WebKit): >+ (QtWebPageSGNode): >+ * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp: >+ (WebKit::CoordinatedLayerTreeHost::createTile): >+ (WebKit::CoordinatedLayerTreeHost::updateTile): >+ * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h: >+ (WebCore): >+ (CoordinatedLayerTreeHost): >+ > 2013-01-31 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> > > [EFL][WK2] RequestManagerClientEfl, DownloadManagerEfl and ContextHistoryClientEfl should be based on C API >diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt >index 803644b7ae9b1469f4f085a9a37a7f21186f39e6..5a1529e38d7c646e75b8622f8e56c10e8dfe873b 100644 >--- a/Source/WebCore/CMakeLists.txt >+++ b/Source/WebCore/CMakeLists.txt >@@ -55,6 +55,8 @@ set(WebCore_INCLUDE_DIRECTORIES > "${WEBCORE_DIR}/platform/graphics/harfbuzz" > "${WEBCORE_DIR}/platform/graphics/harfbuzz/ng" > "${WEBCORE_DIR}/platform/graphics/opentype" >+ "${WEBCORE_DIR}/platform/graphics/texmap" >+ "${WEBCORE_DIR}/platform/graphics/texmap/coordinated" > "${WEBCORE_DIR}/platform/graphics/transforms" > "${WEBCORE_DIR}/platform/image-decoders" > "${WEBCORE_DIR}/platform/image-decoders/bmp" >@@ -1987,6 +1989,14 @@ set(WebCore_SOURCES > platform/graphics/filters/SourceGraphic.cpp > platform/graphics/filters/SpotLightSource.cpp > >+ platform/graphics/texmap/coordinated/AreaAllocator.cpp >+ platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp >+ platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >+ platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp >+ platform/graphics/texmap/coordinated/CoordinatedSurface.cpp >+ platform/graphics/texmap/coordinated/CoordinatedTile.cpp >+ platform/graphics/texmap/coordinated/TextureMapperScene.cpp >+ platform/graphics/texmap/coordinated/UpdateAtlas.cpp > platform/graphics/texmap/TextureMapper.cpp > platform/graphics/texmap/TextureMapperBackingStore.cpp > platform/graphics/texmap/TextureMapperImageBuffer.cpp >diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri >index c3b8fc020c126a64d619a7d70bebbc97bdbdf21d..d901c1baeda20f42ee458a9c9470e4f5436a577a 100644 >--- a/Source/WebCore/Target.pri >+++ b/Source/WebCore/Target.pri >@@ -2239,6 +2239,18 @@ HEADERS += \ > platform/graphics/surfaces/GraphicsSurface.h \ > platform/graphics/surfaces/GraphicsSurfaceToken.h \ > platform/graphics/SurrogatePairAwareTextIterator.h \ >+ platform/graphics/texmap/coordinated/AreaAllocator.h \ >+ platform/graphics/texmap/coordinated/CoordinatedBackingStore.h \ >+ platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h \ >+ platform/graphics/texmap/coordinated/CoordinatedImageBacking.h \ >+ platform/graphics/texmap/coordinated/CoordinatedLayerInfo.h \ >+ platform/graphics/texmap/coordinated/CoordinatedSurface.h \ >+ platform/graphics/texmap/coordinated/CoordinatedTile.h \ >+ platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h \ >+ platform/graphics/texmap/coordinated/TextureMapperScene.h \ >+ platform/graphics/texmap/coordinated/UpdateAtlas.h \ >+ platform/graphics/texmap/coordinated/CoordinatedCustomFilterOperation.h \ >+ platform/graphics/texmap/coordinated/CoordinatedCustomFilterProgram.h \ > platform/graphics/texmap/GraphicsLayerTextureMapper.h \ > platform/graphics/texmap/TextureMapper.h \ > platform/graphics/texmap/TextureMapperBackingStore.h \ >@@ -2874,6 +2886,14 @@ SOURCES += \ > platform/graphics/qt/PathQt.cpp \ > platform/graphics/qt/PatternQt.cpp \ > platform/graphics/qt/StillImageQt.cpp \ >+ platform/graphics/texmap/coordinated/AreaAllocator.cpp \ >+ platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp \ >+ platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp \ >+ platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp \ >+ platform/graphics/texmap/coordinated/CoordinatedSurface.cpp \ >+ platform/graphics/texmap/coordinated/CoordinatedTile.cpp \ >+ platform/graphics/texmap/coordinated/TextureMapperScene.cpp \ >+ platform/graphics/texmap/coordinated/UpdateAtlas.cpp \ > platform/graphics/texmap/GraphicsLayerTextureMapper.cpp \ > platform/graphics/texmap/TextureMapper.cpp \ > platform/graphics/texmap/TextureMapperBackingStore.cpp \ >diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h >index 8f75f5f8643e39f33f45b6a4134f666db2dc8865..7fc97c659fc4fdc7eb4bd1c4cafcca6e7ee771f8 100644 >--- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h >+++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h >@@ -84,7 +84,7 @@ public: > virtual bool setFilters(const FilterOperations&); > #endif > >- // FIXME: It will be removed after removing dependency of LayerTreeRenderer on GraphicsLayerTextureMapper. >+ // FIXME: It will be removed after removing dependency of TextureMapperScene on GraphicsLayerTextureMapper. > void setHasOwnBackingStore(bool b) { m_hasOwnBackingStore = b; } > void setBackingStore(PassRefPtr<TextureMapperBackingStore>); > >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/AreaAllocator.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/AreaAllocator.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..9f54185b98e8a708a6d6f1ab2045d2b123483601 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/AreaAllocator.cpp >@@ -0,0 +1,335 @@ >+/* >+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Lesser General Public >+ * License as published by the Free Software Foundation; either >+ * version 2.1 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Lesser General Public License for more details. >+ * >+ * You should have received a copy of the GNU Lesser General Public >+ * License along with this library; if not, write to the Free Software >+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA >+ * >+ */ >+ >+#include "config.h" >+ >+#if USE(COORDINATED_GRAPHICS) >+ >+#include "AreaAllocator.h" >+ >+namespace WebCore { >+ >+AreaAllocator::AreaAllocator(const IntSize& size) >+ : m_size(size) >+ , m_minAlloc(1, 1) >+ , m_margin(0, 0) >+{ >+} >+ >+AreaAllocator::~AreaAllocator() >+{ >+} >+ >+void AreaAllocator::expand(const IntSize& size) >+{ >+ m_size = m_size.expandedTo(size); >+} >+ >+void AreaAllocator::expandBy(const IntSize& size) >+{ >+ m_size += size; >+} >+ >+void AreaAllocator::release(const IntRect&) >+{ >+} >+ >+int AreaAllocator::overhead() const >+{ >+ return 0; >+} >+ >+IntSize AreaAllocator::roundAllocation(const IntSize& size) const >+{ >+ int width = size.width() + m_margin.width(); >+ int height = size.height() + m_margin.height(); >+ int extra = width % m_minAlloc.width(); >+ if (extra) >+ width += m_minAlloc.width() - extra; >+ extra = height % m_minAlloc.height(); >+ if (extra) >+ height += m_minAlloc.height() - extra; >+ >+ return IntSize(width, height); >+} >+ >+GeneralAreaAllocator::GeneralAreaAllocator(const IntSize& size) >+ : AreaAllocator(nextPowerOfTwo(size)) >+{ >+ m_root = new Node(); >+ m_root->rect = IntRect(0, 0, m_size.width(), m_size.height()); >+ m_root->largestFree = m_size; >+ m_root->parent = 0; >+ m_root->left = 0; >+ m_root->right = 0; >+ m_nodeCount = 1; >+ setMinimumAllocation(IntSize(8, 8)); >+} >+ >+GeneralAreaAllocator::~GeneralAreaAllocator() >+{ >+ freeNode(m_root); >+} >+ >+void GeneralAreaAllocator::freeNode(Node* node) >+{ >+ if (node) { >+ freeNode(node->left); >+ freeNode(node->right); >+ } >+ delete node; >+} >+ >+void GeneralAreaAllocator::expand(const IntSize& size) >+{ >+ AreaAllocator::expand(nextPowerOfTwo(size)); >+ >+ if (m_root->rect.size() == m_size) >+ return; // No change. >+ >+ if (!m_root->left && m_root->largestFree.width() > 0) { >+ // No allocations have occurred, so just adjust the root size. >+ m_root->rect = IntRect(0, 0, m_size.width(), m_size.height()); >+ m_root->largestFree = m_size; >+ return; >+ } >+ >+ // Add extra nodes above the current root to expand the tree. >+ Node* oldRoot = m_root; >+ Split split; >+ if (m_size.width() >= m_size.height()) >+ split = SplitOnX; >+ else >+ split = SplitOnY; >+ >+ while (m_root->rect.size() != m_size) { >+ if (m_root->rect.width() == m_size.width()) >+ split = SplitOnY; >+ else if (m_root->rect.height() == m_size.height()) >+ split = SplitOnX; >+ Node* parent = new Node(); >+ Node* right = new Node(); >+ m_nodeCount += 2; >+ m_root->parent = parent; >+ parent->parent = 0; >+ parent->left = m_root; >+ parent->right = right; >+ parent->largestFree = m_root->rect.size(); >+ right->parent = parent; >+ right->left = 0; >+ right->right = 0; >+ right->largestFree = m_root->rect.size(); >+ if (split == SplitOnX) { >+ parent->rect = IntRect(m_root->rect.x(), m_root->rect.y(), >+ m_root->rect.width() * 2, m_root->rect.height()); >+ right->rect = IntRect(m_root->rect.x() + m_root->rect.width(), m_root->rect.y(), >+ m_root->rect.width(), m_root->rect.height()); >+ } else { >+ parent->rect = IntRect(m_root->rect.x(), m_root->rect.y(), >+ m_root->rect.width(), m_root->rect.height() * 2); >+ right->rect = IntRect(m_root->rect.x(), m_root->rect.y() + m_root->rect.width(), >+ m_root->rect.width(), m_root->rect.height()); >+ } >+ split = (split == SplitOnX ? SplitOnY : SplitOnX); >+ m_root = parent; >+ } >+ updateLargestFree(oldRoot); >+} >+ >+static inline bool fitsWithin(const IntSize& size1, const IntSize& size2) >+{ >+ return size1.width() <= size2.width() && size1.height() <= size2.height(); >+} >+ >+IntRect GeneralAreaAllocator::allocate(const IntSize& size) >+{ >+ IntSize rounded = roundAllocation(size); >+ rounded = nextPowerOfTwo(rounded); >+ if (rounded.width() <= 0 || rounded.width() > m_size.width() >+ || rounded.height() <= 0 || rounded.height() > m_size.height()) >+ return IntRect(); >+ >+ IntPoint point = allocateFromNode(rounded, m_root); >+ if (point.x() >= 0) >+ return IntRect(point, size); >+ return IntRect(); >+} >+ >+IntPoint GeneralAreaAllocator::allocateFromNode(const IntSize& size, Node* node) >+{ >+ // Find the best node to insert into, which should be >+ // a node with the least amount of unused space that is >+ // big enough to contain the requested size. >+ while (node) { >+ // Go down a level and determine if the left or right >+ // sub-tree contains the best chance of allocation. >+ Node* left = node->left; >+ Node* right = node->right; >+ if (left && fitsWithin(size, left->largestFree)) { >+ if (right && fitsWithin(size, right->largestFree)) { >+ if (left->largestFree.width() < right->largestFree.width() >+ || left->largestFree.height() < right->largestFree.height()) { >+ // The largestFree values may be a little oversized, >+ // so try the left sub-tree and then the right sub-tree. >+ IntPoint point = allocateFromNode(size, left); >+ if (point.x() >= 0) >+ return point; >+ return allocateFromNode(size, right); >+ } >+ node = right; >+ } else >+ node = left; >+ } else if (right && fitsWithin(size, right->largestFree)) >+ node = right; >+ else if (left || right) { >+ // Neither sub-node has enough space to allocate from. >+ return IntPoint(-1, -1); >+ } else if (fitsWithin(size, node->largestFree)) { >+ // Do we need to split this node into smaller pieces? >+ Split split; >+ if (fitsWithin(IntSize(size.width() * 2, size.height() * 2), node->largestFree)) { >+ // Split in either direction: choose the inverse of >+ // the parent node's split direction to try to balance >+ // out the wasted space as further subdivisions happen. >+ if (node->parent >+ && node->parent->left->rect.x() == node->parent->right->rect.x()) >+ split = SplitOnX; >+ else if (node->parent) >+ split = SplitOnY; >+ else if (node->rect.width() >= node->rect.height()) >+ split = SplitOnX; >+ else >+ split = SplitOnY; >+ } else if (fitsWithin(IntSize(size.width() * 2, size.height()), node->largestFree)) { >+ // Split along the X direction. >+ split = SplitOnX; >+ } else if (fitsWithin(IntSize(size.width(), size.height() * 2), node->largestFree)) { >+ // Split along the Y direction. >+ split = SplitOnY; >+ } else { >+ // Cannot split further - allocate this node. >+ node->largestFree = IntSize(0, 0); >+ updateLargestFree(node); >+ return node->rect.location(); >+ } >+ >+ // Split the node, then go around again using the left sub-tree. >+ node = splitNode(node, split); >+ } else { >+ // Cannot possibly fit into this node. >+ break; >+ } >+ } >+ return IntPoint(-1, -1); >+} >+ >+GeneralAreaAllocator::Node* GeneralAreaAllocator::splitNode >+ (Node* node, Split split) >+{ >+ Node* left = new Node(); >+ Node* right = new Node(); >+ m_nodeCount += 2; >+ left->parent = node; >+ left->left = 0; >+ left->right = 0; >+ right->parent = node; >+ right->left = 0; >+ right->right = 0; >+ node->left = left; >+ node->right = right; >+ >+ if (split == SplitOnX) { >+ left->rect = IntRect(node->rect.x(), node->rect.y(), >+ node->rect.width() / 2, node->rect.height()); >+ right->rect = IntRect(left->rect.maxX(), node->rect.y(), >+ node->rect.width() / 2, node->rect.height()); >+ } else { >+ left->rect = IntRect(node->rect.x(), node->rect.y(), >+ node->rect.width(), node->rect.height() / 2); >+ right->rect = IntRect(node->rect.x(), left->rect.maxY(), >+ node->rect.width(), node->rect.height() / 2); >+ } >+ >+ left->largestFree = left->rect.size(); >+ right->largestFree = right->rect.size(); >+ node->largestFree = right->largestFree; >+ return left; >+} >+ >+void GeneralAreaAllocator::updateLargestFree(Node* node) >+{ >+ while ((node = node->parent)) { >+ node->largestFree = IntSize( >+ std::max(node->left->largestFree.width(), node->right->largestFree.width()), >+ std::max(node->left->largestFree.height(), node->right->largestFree.height()) >+ ); >+ } >+} >+ >+void GeneralAreaAllocator::release(const IntRect& rect) >+{ >+ // Locate the node that contains the allocated region. >+ Node* node = m_root; >+ IntPoint point = rect.location(); >+ while (node) { >+ if (node->left && node->left->rect.contains(point)) >+ node = node->left; >+ else if (node->right && node->right->rect.contains(point)) >+ node = node->right; >+ else if (node->rect.contains(point)) >+ break; >+ else >+ return; // Point is completely outside the tree. >+ } >+ if (!node) >+ return; >+ >+ // Mark the node as free and then work upwards through the tree >+ // recombining and deleting nodes until we reach a sibling >+ // that is still allocated. >+ node->largestFree = node->rect.size(); >+ while (node->parent) { >+ if (node->parent->left == node) { >+ if (node->parent->right->largestFree != node->parent->right->rect.size()) >+ break; >+ } else { >+ if (node->parent->left->largestFree != node->parent->left->rect.size()) >+ break; >+ } >+ node = node->parent; >+ freeNode(node->left); >+ freeNode(node->right); >+ m_nodeCount -= 2; >+ node->left = 0; >+ node->right = 0; >+ node->largestFree = node->rect.size(); >+ } >+ >+ // Make the rest of our ancestors have the correct "largest free size". >+ updateLargestFree(node); >+} >+ >+int GeneralAreaAllocator::overhead() const >+{ >+ return m_nodeCount * sizeof(Node); >+} >+ >+} // namespace WebCore >+ >+#endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/AreaAllocator.h b/Source/WebCore/platform/graphics/texmap/coordinated/AreaAllocator.h >new file mode 100644 >index 0000000000000000000000000000000000000000..4180cae237750f6fa343b0bc7f2a93093908d32f >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/AreaAllocator.h >@@ -0,0 +1,112 @@ >+/* >+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Lesser General Public >+ * License as published by the Free Software Foundation; either >+ * version 2.1 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Lesser General Public License for more details. >+ * >+ * You should have received a copy of the GNU Lesser General Public >+ * License along with this library; if not, write to the Free Software >+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA >+ * >+ */ >+ >+#ifndef AreaAllocator_h >+#define AreaAllocator_h >+ >+#include "IntPoint.h" >+#include "IntRect.h" >+#include "IntSize.h" >+ >+#if USE(COORDINATED_GRAPHICS) >+ >+namespace WebCore { >+ >+inline int nextPowerOfTwo(int number) >+{ >+ // This is a fast trick to get nextPowerOfTwo for an integer. >+ --number; >+ number |= number >> 1; >+ number |= number >> 2; >+ number |= number >> 4; >+ number |= number >> 8; >+ number |= number >> 16; >+ number++; >+ return number; >+} >+ >+inline IntSize nextPowerOfTwo(const IntSize& size) >+{ >+ return IntSize(nextPowerOfTwo(size.width()), nextPowerOfTwo(size.height())); >+} >+ >+class AreaAllocator { >+public: >+ explicit AreaAllocator(const IntSize&); >+ virtual ~AreaAllocator(); >+ >+ IntSize size() const { return m_size; } >+ >+ IntSize minimumAllocation() const { return m_minAlloc; } >+ void setMinimumAllocation(const IntSize& size) { m_minAlloc = size; } >+ >+ IntSize margin() const { return m_margin; } >+ void setMargin(const IntSize &margin) { m_margin = margin; } >+ >+ virtual void expand(const IntSize&); >+ void expandBy(const IntSize&); >+ >+ virtual IntRect allocate(const IntSize&) = 0; >+ virtual void release(const IntRect&); >+ >+ virtual int overhead() const; >+ >+protected: >+ IntSize m_size; >+ IntSize m_minAlloc; >+ IntSize m_margin; >+ >+ IntSize roundAllocation(const IntSize&) const; >+}; >+ >+class GeneralAreaAllocator : public AreaAllocator { >+public: >+ explicit GeneralAreaAllocator(const IntSize&); >+ virtual ~GeneralAreaAllocator(); >+ >+ void expand(const IntSize&); >+ IntRect allocate(const IntSize&); >+ void release(const IntRect&); >+ int overhead() const; >+ >+private: >+ enum Split { SplitOnX, SplitOnY }; >+ >+ struct Node { >+ IntRect rect; >+ IntSize largestFree; >+ Node* parent; >+ Node* left; >+ Node* right; >+ }; >+ >+ Node* m_root; >+ int m_nodeCount; >+ >+ static void freeNode(Node*); >+ IntPoint allocateFromNode(const IntSize&, Node*); >+ Node* splitNode(Node*, Split); >+ static void updateLargestFree(Node*); >+}; >+ >+} // namespace WebCore >+ >+#endif // USE(COORDINATED_GRAPHICS) >+ >+#endif // AreaAllocator_h >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..95da2b8fb5f4a8d9d2c9879e93acb85c0f3c9b8b >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp >@@ -0,0 +1,188 @@ >+/* >+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >+ >+ This library is free software; you can redistribute it and/or >+ modify it under the terms of the GNU Library General Public >+ License as published by the Free Software Foundation; either >+ version 2 of the License, or (at your option) any later version. >+ >+ This library is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ Library General Public License for more details. >+ >+ You should have received a copy of the GNU Library General Public License >+ along with this library; see the file COPYING.LIB. If not, write to >+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ Boston, MA 02110-1301, USA. >+ */ >+ >+#include "config.h" >+#include "CoordinatedBackingStore.h" >+ >+#if USE(COORDINATED_GRAPHICS) >+#include "CoordinatedSurface.h" >+#include "GraphicsLayer.h" >+#include "TextureMapper.h" >+#include "TextureMapperGL.h" >+ >+namespace WebCore { >+ >+void CoordinatedBackingStoreTile::swapBuffers(TextureMapper* textureMapper) >+{ >+ if (!m_surface) >+ return; >+ >+ FloatRect tileRect(m_tileRect); >+ tileRect.scale(1. / m_scale); >+ bool shouldReset = false; >+ if (tileRect != rect()) { >+ setRect(tileRect); >+ shouldReset = true; >+ } >+ RefPtr<BitmapTexture> texture = this->texture(); >+ if (!texture) { >+ texture = textureMapper->createTexture(); >+ setTexture(texture.get()); >+ shouldReset = true; >+ } >+ >+ ASSERT(textureMapper->maxTextureSize().width() >= m_tileRect.size().width() && textureMapper->maxTextureSize().height() >= m_tileRect.size().height()); >+ if (shouldReset) >+ texture->reset(m_tileRect.size(), m_surface->supportsAlpha()); >+ >+ m_surface->copyToTexture(texture, m_sourceRect, m_surfaceOffset); >+ m_surface.clear(); >+} >+ >+void CoordinatedBackingStoreTile::setBackBuffer(const IntRect& tileRect, const IntRect& sourceRect, PassRefPtr<CoordinatedSurface> buffer, const IntPoint& offset) >+{ >+ m_sourceRect = sourceRect; >+ m_tileRect = tileRect; >+ m_surfaceOffset = offset; >+ m_surface = buffer; >+} >+ >+void CoordinatedBackingStore::createTile(uint32_t id, float scale) >+{ >+ m_tiles.add(id, CoordinatedBackingStoreTile(scale)); >+ m_scale = scale; >+} >+ >+void CoordinatedBackingStore::removeTile(uint32_t id) >+{ >+ ASSERT(m_tiles.contains(id)); >+ m_tilesToRemove.add(id); >+} >+ >+void CoordinatedBackingStore::removeAllTiles() >+{ >+ CoordinatedBackingStoreTileMap::iterator end = m_tiles.end(); >+ for (CoordinatedBackingStoreTileMap::iterator it = m_tiles.begin(); it != end; ++it) >+ m_tilesToRemove.add(it->key); >+} >+ >+void CoordinatedBackingStore::updateTile(uint32_t id, const IntRect& sourceRect, const IntRect& tileRect, PassRefPtr<CoordinatedSurface> backBuffer, const IntPoint& offset) >+{ >+ CoordinatedBackingStoreTileMap::iterator it = m_tiles.find(id); >+ ASSERT(it != m_tiles.end()); >+ it->value.setBackBuffer(tileRect, sourceRect, backBuffer, offset); >+} >+ >+PassRefPtr<BitmapTexture> CoordinatedBackingStore::texture() const >+{ >+ CoordinatedBackingStoreTileMap::const_iterator end = m_tiles.end(); >+ for (CoordinatedBackingStoreTileMap::const_iterator it = m_tiles.begin(); it != end; ++it) { >+ RefPtr<BitmapTexture> texture = it->value.texture(); >+ if (texture) >+ return texture; >+ } >+ >+ return PassRefPtr<BitmapTexture>(); >+} >+ >+void CoordinatedBackingStore::setSize(const FloatSize& size) >+{ >+ m_size = size; >+} >+ >+void CoordinatedBackingStore::paintTilesToTextureMapper(Vector<TextureMapperTile*>& tiles, TextureMapper* textureMapper, const TransformationMatrix& transform, float opacity, BitmapTexture* mask, const FloatRect& rect) >+{ >+ for (size_t i = 0; i < tiles.size(); ++i) >+ tiles[i]->paint(textureMapper, transform, opacity, mask, calculateExposedTileEdges(rect, tiles[i]->rect())); >+} >+ >+TransformationMatrix CoordinatedBackingStore::adjustedTransformForRect(const FloatRect& targetRect) >+{ >+ return TransformationMatrix::rectToRect(rect(), targetRect); >+} >+ >+void CoordinatedBackingStore::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity, BitmapTexture* mask) >+{ >+ if (m_tiles.isEmpty()) >+ return; >+ ASSERT(!m_size.isZero()); >+ >+ Vector<TextureMapperTile*> tilesToPaint; >+ Vector<TextureMapperTile*> previousTilesToPaint; >+ >+ // We have to do this every time we paint, in case the opacity has changed. >+ CoordinatedBackingStoreTileMap::iterator end = m_tiles.end(); >+ FloatRect coveredRect; >+ for (CoordinatedBackingStoreTileMap::iterator it = m_tiles.begin(); it != end; ++it) { >+ CoordinatedBackingStoreTile& tile = it->value; >+ if (!tile.texture()) >+ continue; >+ >+ if (tile.scale() == m_scale) { >+ tilesToPaint.append(&tile); >+ coveredRect.unite(tile.rect()); >+ continue; >+ } >+ >+ // Only show the previous tile if the opacity is high, otherwise effect looks like a bug. >+ // We show the previous-scale tile anyway if it doesn't intersect with any current-scale tile. >+ if (opacity < 0.95 && coveredRect.intersects(tile.rect())) >+ continue; >+ >+ previousTilesToPaint.append(&tile); >+ } >+ >+ // targetRect is on the contents coordinate system, so we must compare two rects on the contents coordinate system. >+ // See TiledBackingStore. >+ TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect); >+ >+ paintTilesToTextureMapper(previousTilesToPaint, textureMapper, adjustedTransform, opacity, mask, rect()); >+ paintTilesToTextureMapper(tilesToPaint, textureMapper, adjustedTransform, opacity, mask, rect()); >+} >+ >+void CoordinatedBackingStore::drawBorder(TextureMapper* textureMapper, const Color& borderColor, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& transform) >+{ >+ TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect); >+ CoordinatedBackingStoreTileMap::iterator end = m_tiles.end(); >+ for (CoordinatedBackingStoreTileMap::iterator it = m_tiles.begin(); it != end; ++it) >+ textureMapper->drawBorder(borderColor, borderWidth, it->value.rect(), adjustedTransform); >+} >+ >+void CoordinatedBackingStore::drawRepaintCounter(TextureMapper* textureMapper, int repaintCount, const Color& borderColor, const FloatRect& targetRect, const TransformationMatrix& transform) >+{ >+ TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect); >+ CoordinatedBackingStoreTileMap::iterator end = m_tiles.end(); >+ for (CoordinatedBackingStoreTileMap::iterator it = m_tiles.begin(); it != end; ++it) >+ textureMapper->drawRepaintCounter(repaintCount, borderColor, it->value.rect().location(), adjustedTransform); >+} >+ >+void CoordinatedBackingStore::commitTileOperations(TextureMapper* textureMapper) >+{ >+ HashSet<uint32_t>::iterator tilesToRemoveEnd = m_tilesToRemove.end(); >+ for (HashSet<uint32_t>::iterator it = m_tilesToRemove.begin(); it != tilesToRemoveEnd; ++it) >+ m_tiles.remove(*it); >+ m_tilesToRemove.clear(); >+ >+ CoordinatedBackingStoreTileMap::iterator tilesEnd = m_tiles.end(); >+ for (CoordinatedBackingStoreTileMap::iterator it = m_tiles.begin(); it != tilesEnd; ++it) >+ it->value.swapBuffers(textureMapper); >+} >+ >+} // namespace WebCore >+#endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBackingStore.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBackingStore.h >new file mode 100644 >index 0000000000000000000000000000000000000000..e336d71fc8f358ee8cb12f5ff0de0c7ff7f3a997 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBackingStore.h >@@ -0,0 +1,87 @@ >+/* >+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >+ >+ This library is free software; you can redistribute it and/or >+ modify it under the terms of the GNU Library General Public >+ License as published by the Free Software Foundation; either >+ version 2 of the License, or (at your option) any later version. >+ >+ This library is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ Library General Public License for more details. >+ >+ You should have received a copy of the GNU Library General Public License >+ along with this library; see the file COPYING.LIB. If not, write to >+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ Boston, MA 02110-1301, USA. >+ */ >+ >+#ifndef CoordinatedBackingStore_h >+#define CoordinatedBackingStore_h >+ >+#if USE(COORDINATED_GRAPHICS) >+ >+#include "TextureMapper.h" >+#include "TextureMapperBackingStore.h" >+#include <wtf/HashMap.h> >+#include <wtf/HashSet.h> >+ >+namespace WebCore { >+ >+class CoordinatedSurface; >+ >+class CoordinatedBackingStoreTile : public TextureMapperTile { >+public: >+ explicit CoordinatedBackingStoreTile(float scale = 1) >+ : TextureMapperTile(FloatRect()) >+ , m_scale(scale) >+ { >+ } >+ >+ inline float scale() const { return m_scale; } >+ void swapBuffers(TextureMapper*); >+ void setBackBuffer(const IntRect&, const IntRect&, PassRefPtr<CoordinatedSurface> buffer, const IntPoint&); >+ >+private: >+ RefPtr<CoordinatedSurface> m_surface; >+ IntRect m_sourceRect; >+ IntRect m_tileRect; >+ IntPoint m_surfaceOffset; >+ float m_scale; >+}; >+ >+class CoordinatedBackingStore : public TextureMapperBackingStore { >+public: >+ void createTile(uint32_t tileID, float); >+ void removeTile(uint32_t tileID); >+ void removeAllTiles(); >+ void updateTile(uint32_t tileID, const IntRect&, const IntRect&, PassRefPtr<CoordinatedSurface>, const IntPoint&); >+ static PassRefPtr<CoordinatedBackingStore> create() { return adoptRef(new CoordinatedBackingStore); } >+ void commitTileOperations(TextureMapper*); >+ PassRefPtr<BitmapTexture> texture() const; >+ void setSize(const FloatSize&); >+ virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float, BitmapTexture*); >+ virtual void drawBorder(TextureMapper*, const Color&, float borderWidth, const FloatRect&, const TransformationMatrix&) OVERRIDE; >+ virtual void drawRepaintCounter(TextureMapper*, int repaintCount, const Color&, const FloatRect&, const TransformationMatrix&) OVERRIDE; >+ >+private: >+ CoordinatedBackingStore() >+ : m_scale(1.) >+ { } >+ void paintTilesToTextureMapper(Vector<TextureMapperTile*>&, TextureMapper*, const TransformationMatrix&, float, BitmapTexture*, const FloatRect&); >+ TransformationMatrix adjustedTransformForRect(const FloatRect&); >+ FloatRect rect() const { return FloatRect(FloatPoint::zero(), m_size); } >+ >+ typedef HashMap<uint32_t, CoordinatedBackingStoreTile> CoordinatedBackingStoreTileMap; >+ CoordinatedBackingStoreTileMap m_tiles; >+ HashSet<uint32_t> m_tilesToRemove; >+ FloatSize m_size; >+ float m_scale; >+}; >+ >+} // namespace WebCore >+ >+#endif // USE(COORDINATED_GRAPHICS) >+ >+#endif // CoordinatedBackingStore_h >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedCustomFilterOperation.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedCustomFilterOperation.h >new file mode 100644 >index 0000000000000000000000000000000000000000..f021b0b496eacc6bda2fe6d509ee3f63f8890dc2 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedCustomFilterOperation.h >@@ -0,0 +1,66 @@ >+/* >+ * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above >+ * copyright notice, this list of conditions and the following >+ * disclaimer. >+ * 2. Redistributions in binary form must reproduce the above >+ * copyright notice, this list of conditions and the following >+ * disclaimer in the documentation and/or other materials >+ * provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE >+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, >+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR >+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF >+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >+ * SUCH DAMAGE. >+ */ >+ >+#ifndef CoordinatedCustomFilterOperation_h >+#define CoordinatedCustomFilterOperation_h >+ >+#if ENABLE(CSS_SHADERS) >+#include "CustomFilterOperation.h" >+ >+namespace WebCore { >+ >+// This class is only adding the programId on top of CustomFilterOperation. The argument decoder has no >+// context, so we cannot search in our cached CustomFilterPrograms while decoding. In that case >+// it will just store the programId and no CustomFilterProgram instance. The receiver is supposed to >+// iterate on this structure and inject the right CustomFilterPrograms. >+ >+class CoordinatedCustomFilterOperation : public CustomFilterOperation { >+public: >+ static PassRefPtr<CoordinatedCustomFilterOperation> create(PassRefPtr<CustomFilterProgram> program, int programID, const CustomFilterParameterList& sortedParameters, unsigned meshRows, unsigned meshColumns, CustomFilterMeshType meshType) >+ { >+ return adoptRef(new CoordinatedCustomFilterOperation(program, programID, sortedParameters, meshRows, meshColumns, meshType)); >+ } >+ >+ int programID() const { return m_programID; } >+ >+private: >+ CoordinatedCustomFilterOperation(PassRefPtr<CustomFilterProgram> program, int programID, const CustomFilterParameterList& sortedParameters, unsigned meshRows, unsigned meshColumns, CustomFilterMeshType meshType) >+ : CustomFilterOperation(program, sortedParameters, meshRows, meshColumns, meshType) >+ , m_programID(programID) >+ { >+ } >+ >+ int m_programID; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(CSS_SHADERS) >+ >+#endif // CoordinatedCustomFilterOperation_h >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedCustomFilterProgram.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedCustomFilterProgram.h >new file mode 100644 >index 0000000000000000000000000000000000000000..6a49b1bea5df2dbae1c153d5427803fe54115958 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedCustomFilterProgram.h >@@ -0,0 +1,78 @@ >+/* >+ * Copyright (C) 2012 Company 100, Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef CoordinatedCustomFilterProgram_h >+#define CoordinatedCustomFilterProgram_h >+ >+#if USE(COORDINATED_GRAPHICS) && ENABLE(CSS_SHADERS) >+#include "CustomFilterConstants.h" >+#include "CustomFilterProgram.h" >+ >+namespace WebCore { >+ >+class CoordinatedCustomFilterProgram : public CustomFilterProgram { >+public: >+ static PassRefPtr<CoordinatedCustomFilterProgram> create(String vertexShaderString, String m_fragmentShaderString, CustomFilterProgramType programType, CustomFilterProgramMixSettings mixSettings, CustomFilterMeshType meshType) >+ { >+ return adoptRef(new CoordinatedCustomFilterProgram(vertexShaderString, m_fragmentShaderString, programType, mixSettings, meshType)); >+ } >+ >+ virtual bool isLoaded() const OVERRIDE { return true; } >+ >+ virtual bool operator==(const CustomFilterProgram& o) const OVERRIDE >+ { >+ // We don't use the != operator because that would recursively call this method. >+ if (!CustomFilterProgram::operator==(o)) >+ return false; >+ >+ // The following cast is ugly, but CoordinatedCustomFilterProgram is the single implementation of CustomFilterProgram on UI Process. >+ const CoordinatedCustomFilterProgram* other = static_cast<const CoordinatedCustomFilterProgram*>(&o); >+ return m_vertexShaderString == other->vertexShaderString() && m_fragmentShaderString == other->fragmentShaderString(); >+ } >+ >+protected: >+ virtual String vertexShaderString() const OVERRIDE { return m_vertexShaderString; } >+ virtual String fragmentShaderString() const OVERRIDE { return m_fragmentShaderString; } >+ >+ virtual void willHaveClients() OVERRIDE { notifyClients(); } >+ virtual void didRemoveLastClient() OVERRIDE { } >+ >+private: >+ CoordinatedCustomFilterProgram(String vertexShaderString, String fragmentShaderString, CustomFilterProgramType programType, CustomFilterProgramMixSettings mixSettings, CustomFilterMeshType meshType) >+ : CustomFilterProgram(programType, mixSettings, meshType) >+ , m_vertexShaderString(vertexShaderString) >+ , m_fragmentShaderString(fragmentShaderString) >+ { >+ } >+ >+ String m_vertexShaderString; >+ String m_fragmentShaderString; >+}; >+ >+} // namespace WebCore >+ >+#endif // USE(COORDINATED_GRAPHICS) && ENABLE(CSS_SHADERS) >+ >+#endif // CoordinatedCustomFilterProgram_h >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..3736f2604c0c104399957b98a2525ee7dbcdd9bb >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >@@ -0,0 +1,1056 @@ >+/* >+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) >+ Copyright (C) 2010 Apple Inc. All rights reserved. >+ Copyright (C) 2012 Company 100, Inc. >+ Copyright (C) 2012 Intel Corporation. All rights reserved. >+ >+ This library is free software; you can redistribute it and/or >+ modify it under the terms of the GNU Library General Public >+ License as published by the Free Software Foundation; either >+ version 2 of the License, or (at your option) any later version. >+ >+ This library is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ Library General Public License for more details. >+ >+ You should have received a copy of the GNU Library General Public License >+ along with this library; see the file COPYING.LIB. If not, write to >+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ Boston, MA 02110-1301, USA. >+ */ >+ >+#include "config.h" >+ >+#if USE(COORDINATED_GRAPHICS) >+#include "CoordinatedGraphicsLayer.h" >+ >+#include "CoordinatedTile.h" >+#include "FloatQuad.h" >+#include "Frame.h" >+#include "FrameView.h" >+#include "GraphicsContext.h" >+#include "GraphicsLayer.h" >+#include "Page.h" >+#include "TextureMapperPlatformLayer.h" >+#include <wtf/CurrentTime.h> >+#include <wtf/HashMap.h> >+#ifndef NDEBUG >+#include <wtf/TemporaryChange.h> >+#endif >+#include <wtf/text/CString.h> >+ >+namespace WebCore { >+ >+static CoordinatedLayerID toCoordinatedLayerID(GraphicsLayer* layer) >+{ >+ return layer ? toCoordinatedGraphicsLayer(layer)->id() : 0; >+} >+ >+void CoordinatedGraphicsLayer::didChangeLayerState() >+{ >+ m_shouldSyncLayerState = true; >+ if (client()) >+ client()->notifyFlushRequired(this); >+} >+ >+void CoordinatedGraphicsLayer::didChangeAnimations() >+{ >+ m_shouldSyncAnimations = true; >+ if (client()) >+ client()->notifyFlushRequired(this); >+} >+ >+void CoordinatedGraphicsLayer::didChangeChildren() >+{ >+ m_shouldSyncChildren = true; >+ if (client()) >+ client()->notifyFlushRequired(this); >+} >+ >+#if ENABLE(CSS_FILTERS) >+void CoordinatedGraphicsLayer::didChangeFilters() >+{ >+ m_shouldSyncFilters = true; >+ if (client()) >+ client()->notifyFlushRequired(this); >+} >+#endif >+ >+void CoordinatedGraphicsLayer::didChangeImageBacking() >+{ >+ m_shouldSyncImageBacking = true; >+ if (client()) >+ client()->notifyFlushRequired(this); >+} >+ >+void CoordinatedGraphicsLayer::setShouldUpdateVisibleRect() >+{ >+ m_shouldUpdateVisibleRect = true; >+ for (size_t i = 0; i < children().size(); ++i) >+ toCoordinatedGraphicsLayer(children()[i])->setShouldUpdateVisibleRect(); >+ if (replicaLayer()) >+ toCoordinatedGraphicsLayer(replicaLayer())->setShouldUpdateVisibleRect(); >+} >+ >+void CoordinatedGraphicsLayer::didChangeGeometry() >+{ >+ didChangeLayerState(); >+ setShouldUpdateVisibleRect(); >+} >+ >+CoordinatedGraphicsLayer::CoordinatedGraphicsLayer(GraphicsLayerClient* client) >+ : GraphicsLayer(client) >+#ifndef NDEBUG >+ , m_isPurging(false) >+#endif >+ , m_shouldUpdateVisibleRect(true) >+ , m_shouldSyncLayerState(true) >+ , m_shouldSyncChildren(true) >+ , m_shouldSyncFilters(true) >+ , m_shouldSyncImageBacking(true) >+ , m_shouldSyncAnimations(true) >+ , m_fixedToViewport(false) >+ , m_pendingContentsScaleAdjustment(false) >+ , m_pendingVisibleRectAdjustment(false) >+#if USE(GRAPHICS_SURFACE) >+ , m_isValidCanvas(false) >+ , m_pendingCanvasOperation(None) >+#endif >+ , m_coordinator(0) >+ , m_compositedNativeImagePtr(0) >+ , m_canvasPlatformLayer(0) >+ , m_animationStartedTimer(this, &CoordinatedGraphicsLayer::animationStartedTimerFired) >+{ >+ static CoordinatedLayerID nextLayerID = 1; >+ m_id = nextLayerID++; >+} >+ >+CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer() >+{ >+ if (m_coordinator) { >+ purgeBackingStores(); >+ m_coordinator->detachLayer(this); >+ } >+ ASSERT(!m_coordinatedImageBacking && !m_mainBackingStore); >+ willBeDestroyed(); >+} >+ >+bool CoordinatedGraphicsLayer::setChildren(const Vector<GraphicsLayer*>& children) >+{ >+ bool ok = GraphicsLayer::setChildren(children); >+ if (!ok) >+ return false; >+ didChangeChildren(); >+ return true; >+} >+ >+void CoordinatedGraphicsLayer::addChild(GraphicsLayer* layer) >+{ >+ GraphicsLayer::addChild(layer); >+ didChangeChildren(); >+} >+ >+void CoordinatedGraphicsLayer::addChildAtIndex(GraphicsLayer* layer, int index) >+{ >+ GraphicsLayer::addChildAtIndex(layer, index); >+ didChangeChildren(); >+} >+ >+void CoordinatedGraphicsLayer::addChildAbove(GraphicsLayer* layer, GraphicsLayer* sibling) >+{ >+ GraphicsLayer::addChildAbove(layer, sibling); >+ didChangeChildren(); >+} >+ >+void CoordinatedGraphicsLayer::addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling) >+{ >+ GraphicsLayer::addChildBelow(layer, sibling); >+ didChangeChildren(); >+} >+ >+bool CoordinatedGraphicsLayer::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild) >+{ >+ bool ok = GraphicsLayer::replaceChild(oldChild, newChild); >+ if (!ok) >+ return false; >+ didChangeChildren(); >+ return true; >+} >+ >+void CoordinatedGraphicsLayer::removeFromParent() >+{ >+ if (CoordinatedGraphicsLayer* parentLayer = toCoordinatedGraphicsLayer(parent())) >+ parentLayer->didChangeChildren(); >+ GraphicsLayer::removeFromParent(); >+} >+ >+void CoordinatedGraphicsLayer::setPosition(const FloatPoint& p) >+{ >+ if (position() == p) >+ return; >+ >+ GraphicsLayer::setPosition(p); >+ didChangeGeometry(); >+} >+ >+void CoordinatedGraphicsLayer::setAnchorPoint(const FloatPoint3D& p) >+{ >+ if (anchorPoint() == p) >+ return; >+ >+ GraphicsLayer::setAnchorPoint(p); >+ didChangeGeometry(); >+} >+ >+void CoordinatedGraphicsLayer::setSize(const FloatSize& size) >+{ >+ if (this->size() == size) >+ return; >+ >+ GraphicsLayer::setSize(size); >+ >+ if (maskLayer()) >+ maskLayer()->setSize(size); >+ didChangeGeometry(); >+} >+ >+void CoordinatedGraphicsLayer::setTransform(const TransformationMatrix& t) >+{ >+ if (transform() == t) >+ return; >+ >+ GraphicsLayer::setTransform(t); >+ didChangeGeometry(); >+} >+ >+void CoordinatedGraphicsLayer::setChildrenTransform(const TransformationMatrix& t) >+{ >+ if (childrenTransform() == t) >+ return; >+ >+ GraphicsLayer::setChildrenTransform(t); >+ didChangeGeometry(); >+} >+ >+void CoordinatedGraphicsLayer::setPreserves3D(bool b) >+{ >+ if (preserves3D() == b) >+ return; >+ >+ GraphicsLayer::setPreserves3D(b); >+ didChangeGeometry(); >+} >+ >+void CoordinatedGraphicsLayer::setMasksToBounds(bool b) >+{ >+ if (masksToBounds() == b) >+ return; >+ GraphicsLayer::setMasksToBounds(b); >+ didChangeGeometry(); >+} >+ >+void CoordinatedGraphicsLayer::setDrawsContent(bool b) >+{ >+ if (drawsContent() == b) >+ return; >+ GraphicsLayer::setDrawsContent(b); >+ >+ didChangeLayerState(); >+} >+ >+void CoordinatedGraphicsLayer::setContentsVisible(bool b) >+{ >+ if (contentsAreVisible() == b) >+ return; >+ GraphicsLayer::setContentsVisible(b); >+ if (maskLayer()) >+ maskLayer()->setContentsVisible(b); >+ >+ didChangeLayerState(); >+} >+ >+void CoordinatedGraphicsLayer::setContentsOpaque(bool b) >+{ >+ if (contentsOpaque() == b) >+ return; >+ if (m_mainBackingStore) >+ m_mainBackingStore->setSupportsAlpha(!b); >+ GraphicsLayer::setContentsOpaque(b); >+ didChangeLayerState(); >+} >+ >+void CoordinatedGraphicsLayer::setBackfaceVisibility(bool b) >+{ >+ if (backfaceVisibility() == b) >+ return; >+ >+ GraphicsLayer::setBackfaceVisibility(b); >+ didChangeLayerState(); >+} >+ >+void CoordinatedGraphicsLayer::setOpacity(float opacity) >+{ >+ if (this->opacity() == opacity) >+ return; >+ >+ GraphicsLayer::setOpacity(opacity); >+ didChangeLayerState(); >+} >+ >+void CoordinatedGraphicsLayer::setContentsRect(const IntRect& r) >+{ >+ if (contentsRect() == r) >+ return; >+ >+ GraphicsLayer::setContentsRect(r); >+ didChangeLayerState(); >+} >+ >+void CoordinatedGraphicsLayer::setContentsNeedsDisplay() >+{ >+#if USE(GRAPHICS_SURFACE) >+ if (m_canvasPlatformLayer) >+ m_pendingCanvasOperation |= SyncCanvas; >+#endif >+ >+ if (client()) >+ client()->notifyFlushRequired(this); >+ >+ addRepaintRect(contentsRect()); >+} >+ >+void CoordinatedGraphicsLayer::setContentsToCanvas(PlatformLayer* platformLayer) >+{ >+#if USE(GRAPHICS_SURFACE) >+ if (m_canvasPlatformLayer) { >+ ASSERT(m_canvasToken.isValid()); >+ if (!platformLayer) { >+ m_pendingCanvasOperation |= DestroyCanvas; >+ m_pendingCanvasOperation &= ~CreateCanvas; >+ } else if ((m_canvasSize != platformLayer->platformLayerSize()) || (m_canvasToken != platformLayer->graphicsSurfaceToken())) { >+ // m_canvasToken can be different to platformLayer->graphicsSurfaceToken(), even if m_canvasPlatformLayer equals platformLayer. >+ m_pendingCanvasOperation |= RecreateCanvas; >+ } >+ } else { >+ if (platformLayer) >+ m_pendingCanvasOperation |= CreateAndSyncCanvas; >+ } >+ >+ m_canvasPlatformLayer = platformLayer; >+ // m_canvasToken is updated only here. In detail, when GraphicsContext3D is changed or reshaped, m_canvasToken is changed and setContentsToCanvas() is always called. >+ m_canvasSize = m_canvasPlatformLayer ? m_canvasPlatformLayer->platformLayerSize() : IntSize(); >+ m_canvasToken = m_canvasPlatformLayer ? m_canvasPlatformLayer->graphicsSurfaceToken() : GraphicsSurfaceToken(); >+ ASSERT(!(!m_canvasToken.isValid() && m_canvasPlatformLayer)); >+ >+ if (client()) >+ client()->notifyFlushRequired(this); >+#else >+ UNUSED_PARAM(platformLayer); >+#endif >+} >+ >+#if ENABLE(CSS_FILTERS) >+bool CoordinatedGraphicsLayer::setFilters(const FilterOperations& newFilters) >+{ >+ if (filters() == newFilters) >+ return true; >+ didChangeFilters(); >+ return GraphicsLayer::setFilters(newFilters); >+} >+#endif >+ >+void CoordinatedGraphicsLayer::setContentsToSolidColor(const Color& color) >+{ >+ if (m_layerInfo.solidColor == color) >+ return; >+ m_layerInfo.solidColor = color; >+ didChangeLayerState(); >+} >+ >+void CoordinatedGraphicsLayer::setShowDebugBorder(bool show) >+{ >+ if (isShowingDebugBorder() == show) >+ return; >+ >+ GraphicsLayer::setShowDebugBorder(show); >+ didChangeLayerState(); >+} >+ >+void CoordinatedGraphicsLayer::setShowRepaintCounter(bool show) >+{ >+ if (isShowingRepaintCounter() == show) >+ return; >+ >+ GraphicsLayer::setShowRepaintCounter(show); >+ didChangeLayerState(); >+} >+ >+void CoordinatedGraphicsLayer::setContentsToImage(Image* image) >+{ >+ NativeImagePtr newNativeImagePtr = image ? image->nativeImageForCurrentFrame() : 0; >+ if (newNativeImagePtr) { >+ // This code makes the assumption that pointer equality on a NativeImagePtr is a valid way to tell if the image is changed. >+ // This assumption is true in Qt, GTK and EFL. >+ if (newNativeImagePtr == m_compositedNativeImagePtr) >+ return; >+ >+ m_compositedImage = image; >+ m_compositedNativeImagePtr = newNativeImagePtr; >+ } else { >+ m_compositedImage = 0; >+ m_compositedNativeImagePtr = 0; >+ } >+ >+ GraphicsLayer::setContentsToImage(image); >+ didChangeImageBacking(); >+} >+ >+void CoordinatedGraphicsLayer::setMaskLayer(GraphicsLayer* layer) >+{ >+ if (layer == maskLayer()) >+ return; >+ >+ GraphicsLayer::setMaskLayer(layer); >+ >+ if (!layer) >+ return; >+ >+ layer->setSize(size()); >+ layer->setContentsVisible(contentsAreVisible()); >+ CoordinatedGraphicsLayer* coordinatedLayer = toCoordinatedGraphicsLayer(layer); >+ coordinatedLayer->didChangeLayerState(); >+ didChangeLayerState(); >+} >+ >+bool CoordinatedGraphicsLayer::shouldDirectlyCompositeImage(Image* image) const >+{ >+ if (!image || !image->isBitmapImage()) >+ return false; >+ >+ enum { MaxDimenstionForDirectCompositing = 2000 }; >+ if (image->width() > MaxDimenstionForDirectCompositing || image->height() > MaxDimenstionForDirectCompositing) >+ return false; >+ >+ return true; >+} >+ >+void CoordinatedGraphicsLayer::setReplicatedByLayer(GraphicsLayer* layer) >+{ >+ if (layer == replicaLayer()) >+ return; >+ >+ GraphicsLayer::setReplicatedByLayer(layer); >+ didChangeLayerState(); >+} >+ >+void CoordinatedGraphicsLayer::setNeedsDisplay() >+{ >+ setNeedsDisplayInRect(FloatRect(FloatPoint(), size())); >+} >+ >+void CoordinatedGraphicsLayer::setNeedsDisplayInRect(const FloatRect& rect) >+{ >+ if (m_mainBackingStore) >+ m_mainBackingStore->invalidate(IntRect(rect)); >+ >+ didChangeLayerState(); >+ >+ addRepaintRect(rect); >+} >+ >+CoordinatedLayerID CoordinatedGraphicsLayer::id() const >+{ >+ return m_id; >+} >+ >+void CoordinatedGraphicsLayer::flushCompositingState(const FloatRect& rect) >+{ >+ if (!m_coordinator->isFlushingLayerChanges()) { >+ if (client()) >+ client()->notifyFlushRequired(this); >+ return; >+ } >+ >+ if (CoordinatedGraphicsLayer* mask = toCoordinatedGraphicsLayer(maskLayer())) >+ mask->flushCompositingStateForThisLayerOnly(); >+ >+ if (CoordinatedGraphicsLayer* replica = toCoordinatedGraphicsLayer(replicaLayer())) >+ replica->flushCompositingStateForThisLayerOnly(); >+ >+ m_coordinator->syncFixedLayers(); >+ >+ flushCompositingStateForThisLayerOnly(); >+ >+ for (size_t i = 0; i < children().size(); ++i) >+ children()[i]->flushCompositingState(rect); >+} >+ >+CoordinatedGraphicsLayer* toCoordinatedGraphicsLayer(GraphicsLayer* layer) >+{ >+ return static_cast<CoordinatedGraphicsLayer*>(layer); >+} >+ >+void CoordinatedGraphicsLayer::syncChildren() >+{ >+ if (!m_shouldSyncChildren) >+ return; >+ m_shouldSyncChildren = false; >+ Vector<CoordinatedLayerID> childIDs; >+ for (size_t i = 0; i < children().size(); ++i) >+ childIDs.append(toCoordinatedLayerID(children()[i])); >+ >+ m_coordinator->syncLayerChildren(m_id, childIDs); >+} >+ >+#if ENABLE(CSS_FILTERS) >+void CoordinatedGraphicsLayer::syncFilters() >+{ >+ if (!m_shouldSyncFilters) >+ return; >+ m_shouldSyncFilters = false; >+ m_coordinator->syncLayerFilters(m_id, filters()); >+} >+#endif >+ >+void CoordinatedGraphicsLayer::syncImageBacking() >+{ >+ if (!m_shouldSyncImageBacking) >+ return; >+ m_shouldSyncImageBacking = false; >+ >+ if (m_compositedNativeImagePtr) { >+ ASSERT(!shouldHaveBackingStore()); >+ ASSERT(m_compositedImage); >+ >+ bool imageInstanceReplaced = m_coordinatedImageBacking && (m_coordinatedImageBacking->id() != CoordinatedImageBacking::getCoordinatedImageBackingID(m_compositedImage.get())); >+ if (imageInstanceReplaced) >+ releaseImageBackingIfNeeded(); >+ >+ if (!m_coordinatedImageBacking) { >+ m_coordinatedImageBacking = m_coordinator->createImageBackingIfNeeded(m_compositedImage.get()); >+ m_coordinatedImageBacking->addHost(this); >+ m_layerInfo.imageID = m_coordinatedImageBacking->id(); >+ } >+ >+ m_coordinatedImageBacking->markDirty(); >+ } else >+ releaseImageBackingIfNeeded(); >+ >+ // syncImageBacking() changed m_layerInfo.imageID. >+ didChangeLayerState(); >+} >+ >+void CoordinatedGraphicsLayer::syncLayerState() >+{ >+ if (!m_shouldSyncLayerState) >+ return; >+ m_shouldSyncLayerState = false; >+ m_layerInfo.fixedToViewport = fixedToViewport(); >+ >+ m_layerInfo.backfaceVisible = backfaceVisibility(); >+ m_layerInfo.childrenTransform = childrenTransform(); >+ m_layerInfo.contentsOpaque = contentsOpaque(); >+ m_layerInfo.contentsRect = contentsRect(); >+ m_layerInfo.drawsContent = drawsContent(); >+ m_layerInfo.contentsVisible = contentsAreVisible(); >+ m_layerInfo.mask = toCoordinatedLayerID(maskLayer()); >+ m_layerInfo.masksToBounds = masksToBounds(); >+ m_layerInfo.opacity = opacity(); >+ m_layerInfo.preserves3D = preserves3D(); >+ m_layerInfo.replica = toCoordinatedLayerID(replicaLayer()); >+ m_layerInfo.transform = transform(); >+ >+ m_layerInfo.anchorPoint = m_adjustedAnchorPoint; >+ m_layerInfo.pos = m_adjustedPosition; >+ m_layerInfo.size = m_adjustedSize; >+ >+ m_layerInfo.showDebugBorders = isShowingDebugBorder(); >+ if (m_layerInfo.showDebugBorders) >+ updateDebugIndicators(); >+ m_layerInfo.showRepaintCounter = isShowingRepaintCounter(); >+ >+ m_coordinator->syncLayerState(m_id, m_layerInfo); >+} >+ >+void CoordinatedGraphicsLayer::setDebugBorder(const Color& color, float width) >+{ >+ ASSERT(m_layerInfo.showDebugBorders); >+ m_layerInfo.debugBorderColor = color; >+ m_layerInfo.debugBorderWidth = width; >+} >+ >+void CoordinatedGraphicsLayer::syncAnimations() >+{ >+ if (!m_shouldSyncAnimations) >+ return; >+ >+ m_shouldSyncAnimations = false; >+ >+ m_coordinator->setLayerAnimations(m_id, m_animations); >+} >+ >+#if USE(GRAPHICS_SURFACE) >+void CoordinatedGraphicsLayer::syncCanvas() >+{ >+ destroyCanvasIfNeeded(); >+ createCanvasIfNeeded(); >+ >+ if (!(m_pendingCanvasOperation & SyncCanvas)) >+ return; >+ >+ m_pendingCanvasOperation &= ~SyncCanvas; >+ >+ if (!m_isValidCanvas) >+ return; >+ >+ m_coordinator->syncCanvas(m_id, m_canvasPlatformLayer); >+} >+ >+void CoordinatedGraphicsLayer::destroyCanvasIfNeeded() >+{ >+ if (!(m_pendingCanvasOperation & DestroyCanvas)) >+ return; >+ >+ if (m_isValidCanvas) { >+ m_coordinator->destroyCanvas(m_id); >+ m_isValidCanvas = false; >+ } >+ >+ m_pendingCanvasOperation &= ~DestroyCanvas; >+} >+ >+void CoordinatedGraphicsLayer::createCanvasIfNeeded() >+{ >+ if (!(m_pendingCanvasOperation & CreateCanvas)) >+ return; >+ >+ ASSERT(m_canvasPlatformLayer); >+ if (!m_isValidCanvas) { >+ m_coordinator->createCanvas(m_id, m_canvasPlatformLayer); >+ m_isValidCanvas = true; >+ } >+ >+ m_pendingCanvasOperation &= ~CreateCanvas; >+} >+#endif >+ >+void CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly() >+{ >+ ASSERT(m_coordinator->isFlushingLayerChanges()); >+ >+ // Sets the values. >+ computePixelAlignment(m_adjustedPosition, m_adjustedSize, m_adjustedAnchorPoint, m_pixelAlignmentOffset); >+ >+ syncImageBacking(); >+ syncLayerState(); >+ syncAnimations(); >+ computeTransformedVisibleRect(); >+ syncChildren(); >+#if ENABLE(CSS_FILTERS) >+ syncFilters(); >+#endif >+ updateContentBuffers(); >+#if USE(GRAPHICS_SURFACE) >+ syncCanvas(); >+#endif >+} >+ >+bool CoordinatedGraphicsLayer::imageBackingVisible() >+{ >+ ASSERT(m_coordinatedImageBacking); >+ return tiledBackingStoreVisibleRect().intersects(contentsRect()); >+} >+ >+void CoordinatedGraphicsLayer::releaseImageBackingIfNeeded() >+{ >+ if (!m_coordinatedImageBacking) >+ return; >+ >+ ASSERT(m_coordinator); >+ m_coordinatedImageBacking->removeHost(this); >+ m_coordinatedImageBacking.clear(); >+ m_layerInfo.imageID = InvalidCoordinatedImageBackingID; >+} >+ >+void CoordinatedGraphicsLayer::tiledBackingStorePaintBegin() >+{ >+} >+ >+void CoordinatedGraphicsLayer::setRootLayer(bool isRoot) >+{ >+ m_layerInfo.isRootLayer = isRoot; >+ didChangeLayerState(); >+} >+ >+void CoordinatedGraphicsLayer::setVisibleContentRectTrajectoryVector(const FloatPoint& trajectoryVector) >+{ >+ if (!m_mainBackingStore) >+ return; >+ >+ m_mainBackingStore->setTrajectoryVector(trajectoryVector); >+ setNeedsVisibleRectAdjustment(); >+} >+ >+void CoordinatedGraphicsLayer::deviceOrPageScaleFactorChanged() >+{ >+ if (shouldHaveBackingStore()) >+ m_pendingContentsScaleAdjustment = true; >+} >+ >+float CoordinatedGraphicsLayer::effectiveContentsScale() >+{ >+ return selfOrAncestorHaveNonAffineTransforms() ? 1 : deviceScaleFactor() * pageScaleFactor(); >+} >+ >+void CoordinatedGraphicsLayer::adjustContentsScale() >+{ >+ ASSERT(shouldHaveBackingStore()); >+ if (!m_mainBackingStore || m_mainBackingStore->contentsScale() == effectiveContentsScale()) >+ return; >+ >+ // Between creating the new backing store and painting the content, >+ // we do not want to drop the previous one as that might result in >+ // briefly seeing flickering as the old tiles may be dropped before >+ // something replaces them. >+ m_previousBackingStore = m_mainBackingStore.release(); >+ >+ // No reason to save the previous backing store for non-visible areas. >+ m_previousBackingStore->removeAllNonVisibleTiles(); >+} >+ >+void CoordinatedGraphicsLayer::createBackingStore() >+{ >+ m_mainBackingStore = adoptPtr(new TiledBackingStore(this, CoordinatedTileBackend::create(this))); >+ m_mainBackingStore->setSupportsAlpha(!contentsOpaque()); >+ m_mainBackingStore->setContentsScale(effectiveContentsScale()); >+} >+ >+void CoordinatedGraphicsLayer::tiledBackingStorePaint(GraphicsContext* context, const IntRect& rect) >+{ >+ if (rect.isEmpty()) >+ return; >+ paintGraphicsLayerContents(*context, rect); >+} >+ >+void CoordinatedGraphicsLayer::tiledBackingStorePaintEnd(const Vector<IntRect>& updatedRects) >+{ >+ if (isShowingRepaintCounter() && !updatedRects.isEmpty()) >+ m_coordinator->setLayerRepaintCount(id(), incrementRepaintCount()); >+} >+ >+void CoordinatedGraphicsLayer::tiledBackingStoreHasPendingTileCreation() >+{ >+ setNeedsVisibleRectAdjustment(); >+ if (client()) >+ client()->notifyFlushRequired(this); >+} >+ >+IntRect CoordinatedGraphicsLayer::tiledBackingStoreContentsRect() >+{ >+ return IntRect(0, 0, size().width(), size().height()); >+} >+ >+static void clampToContentsRectIfRectIsInfinite(FloatRect& rect, const IntRect& contentsRect) >+{ >+ if (rect.width() >= LayoutUnit::nearlyMax() || rect.width() <= LayoutUnit::nearlyMin()) { >+ rect.setX(contentsRect.x()); >+ rect.setWidth(contentsRect.width()); >+ } >+ >+ if (rect.height() >= LayoutUnit::nearlyMax() || rect.height() <= LayoutUnit::nearlyMin()) { >+ rect.setY(contentsRect.y()); >+ rect.setHeight(contentsRect.height()); >+ } >+} >+ >+IntRect CoordinatedGraphicsLayer::tiledBackingStoreVisibleRect() >+{ >+ // Non-invertible layers are not visible. >+ if (!m_layerTransform.combined().isInvertible()) >+ return IntRect(); >+ >+ // Return a projection of the visible rect (surface coordinates) onto the layer's plane (layer coordinates). >+ // The resulting quad might be squewed and the visible rect is the bounding box of this quad, >+ // so it might spread further than the real visible area (and then even more amplified by the cover rect multiplier). >+ ASSERT(m_cachedInverseTransform == m_layerTransform.combined().inverse()); >+ FloatRect rect = m_cachedInverseTransform.clampedBoundsOfProjectedQuad(FloatQuad(m_coordinator->visibleContentsRect())); >+ clampToContentsRectIfRectIsInfinite(rect, tiledBackingStoreContentsRect()); >+ return enclosingIntRect(rect); >+} >+ >+Color CoordinatedGraphicsLayer::tiledBackingStoreBackgroundColor() const >+{ >+ return contentsOpaque() ? Color::white : Color::transparent; >+} >+ >+PassOwnPtr<GraphicsContext> CoordinatedGraphicsLayer::beginContentUpdate(const IntSize& size, uint32_t& atlas, IntPoint& offset) >+{ >+ ASSERT(m_coordinator); >+ ASSERT(m_coordinator->isFlushingLayerChanges()); >+ return m_coordinator->beginContentUpdate(size, contentsOpaque() ? CoordinatedSurface::NoFlags : CoordinatedSurface::SupportsAlpha, atlas, offset); >+} >+ >+void CoordinatedGraphicsLayer::createTile(uint32_t tileID, const SurfaceUpdateInfo& updateInfo, const IntRect& tileRect) >+{ >+ ASSERT(m_coordinator); >+ ASSERT(m_coordinator->isFlushingLayerChanges()); >+ m_coordinator->createTile(id(), tileID, updateInfo, tileRect); >+} >+ >+void CoordinatedGraphicsLayer::updateTile(uint32_t tileID, const SurfaceUpdateInfo& updateInfo, const IntRect& tileRect) >+{ >+ ASSERT(m_coordinator); >+ ASSERT(m_coordinator->isFlushingLayerChanges()); >+ m_coordinator->updateTile(id(), tileID, updateInfo, tileRect); >+} >+ >+void CoordinatedGraphicsLayer::removeTile(uint32_t tileID) >+{ >+ ASSERT(m_coordinator); >+ ASSERT(m_coordinator->isFlushingLayerChanges() || m_isPurging); >+ m_coordinator->removeTile(id(), tileID); >+} >+ >+void CoordinatedGraphicsLayer::updateContentBuffers() >+{ >+ if (!shouldHaveBackingStore()) { >+ m_mainBackingStore.clear(); >+ m_previousBackingStore.clear(); >+ return; >+ } >+ >+ if (m_pendingContentsScaleAdjustment) { >+ adjustContentsScale(); >+ m_pendingContentsScaleAdjustment = false; >+ } >+ >+ // This is the only place we (re)create the main tiled backing store, once we >+ // have a remote client and we are ready to send our data to the UI process. >+ if (!m_mainBackingStore) >+ createBackingStore(); >+ >+ if (m_pendingVisibleRectAdjustment) { >+ m_pendingVisibleRectAdjustment = false; >+ m_mainBackingStore->coverWithTilesIfNeeded(); >+ } >+ >+ m_mainBackingStore->updateTileBuffers(); >+ >+ // The previous backing store is kept around to avoid flickering between >+ // removing the existing tiles and painting the new ones. The first time >+ // the visibleRect is full painted we remove the previous backing store. >+ if (m_mainBackingStore->visibleAreaIsCovered()) >+ m_previousBackingStore.clear(); >+} >+ >+void CoordinatedGraphicsLayer::purgeBackingStores() >+{ >+#ifndef NDEBUG >+ TemporaryChange<bool> updateModeProtector(m_isPurging, true); >+#endif >+ m_mainBackingStore.clear(); >+ m_previousBackingStore.clear(); >+ >+ releaseImageBackingIfNeeded(); >+ >+ didChangeLayerState(); >+} >+ >+void CoordinatedGraphicsLayer::setCoordinator(CoordinatedGraphicsLayerClient* coordinator) >+{ >+ m_coordinator = coordinator; >+} >+ >+void CoordinatedGraphicsLayer::setNeedsVisibleRectAdjustment() >+{ >+ if (shouldHaveBackingStore()) >+ m_pendingVisibleRectAdjustment = true; >+} >+ >+bool CoordinatedGraphicsLayer::hasPendingVisibleChanges() >+{ >+ if (opacity() < 0.01 && !m_animations.hasActiveAnimationsOfType(AnimatedPropertyOpacity)) >+ return false; >+ >+ for (size_t i = 0; i < children().size(); ++i) { >+ if (toCoordinatedGraphicsLayer(children()[i])->hasPendingVisibleChanges()) >+ return true; >+ } >+ >+ bool shouldSyncCanvas = false; >+#if USE(GRAPHICS_SURFACE) >+ shouldSyncCanvas = m_pendingCanvasOperation & SyncCanvas; >+#endif >+ >+ if (!m_shouldSyncLayerState && !m_shouldSyncChildren && !m_shouldSyncFilters && !m_shouldSyncImageBacking && !m_shouldSyncAnimations && !shouldSyncCanvas) >+ return false; >+ >+ return tiledBackingStoreVisibleRect().intersects(tiledBackingStoreContentsRect()); >+} >+ >+static inline bool isIntegral(float value) >+{ >+ return static_cast<int>(value) == value; >+} >+ >+FloatPoint CoordinatedGraphicsLayer::computePositionRelativeToBase() >+{ >+ FloatPoint offset; >+ for (const GraphicsLayer* currLayer = this; currLayer; currLayer = currLayer->parent()) >+ offset += currLayer->position(); >+ >+ return offset; >+} >+ >+void CoordinatedGraphicsLayer::computePixelAlignment(FloatPoint& position, FloatSize& size, FloatPoint3D& anchorPoint, FloatSize& alignmentOffset) >+{ >+ if (isIntegral(effectiveContentsScale())) { >+ position = m_position; >+ size = m_size; >+ anchorPoint = m_anchorPoint; >+ alignmentOffset = FloatSize(); >+ return; >+ } >+ >+ FloatPoint positionRelativeToBase = computePositionRelativeToBase(); >+ >+ FloatRect baseRelativeBounds(positionRelativeToBase, m_size); >+ FloatRect scaledBounds = baseRelativeBounds; >+ >+ // Scale by the effective scale factor to compute the screen-relative bounds. >+ scaledBounds.scale(effectiveContentsScale()); >+ >+ // Round to integer boundaries. >+ // NOTE: When using enclosingIntRect (as mac) it will have different sizes depending on position. >+ FloatRect alignedBounds = roundedIntRect(scaledBounds); >+ >+ // Convert back to layer coordinates. >+ alignedBounds.scale(1 / effectiveContentsScale()); >+ >+ // Convert back to layer coordinates. >+ alignmentOffset = baseRelativeBounds.location() - alignedBounds.location(); >+ >+ position = m_position - alignmentOffset; >+ size = alignedBounds.size(); >+ >+ // Now we have to compute a new anchor point which compensates for rounding. >+ float anchorPointX = m_anchorPoint.x(); >+ float anchorPointY = m_anchorPoint.y(); >+ >+ if (alignedBounds.width()) >+ anchorPointX = (baseRelativeBounds.width() * anchorPointX + alignmentOffset.width()) / alignedBounds.width(); >+ >+ if (alignedBounds.height()) >+ anchorPointY = (baseRelativeBounds.height() * anchorPointY + alignmentOffset.height()) / alignedBounds.height(); >+ >+ anchorPoint = FloatPoint3D(anchorPointX, anchorPointY, m_anchorPoint.z() * effectiveContentsScale()); >+} >+ >+void CoordinatedGraphicsLayer::computeTransformedVisibleRect() >+{ >+ // When we have a transform animation, we need to update visible rect every frame to adjust the visible rect of a backing store. >+ bool hasActiveTransformAnimation = selfOrAncestorHasActiveTransformAnimation(); >+ if (!m_shouldUpdateVisibleRect && !hasActiveTransformAnimation) >+ return; >+ >+ m_shouldUpdateVisibleRect = false; >+ TransformationMatrix currentTransform = transform(); >+ if (hasActiveTransformAnimation) >+ client()->getCurrentTransform(this, currentTransform); >+ m_layerTransform.setLocalTransform(currentTransform); >+ >+ m_layerTransform.setAnchorPoint(m_adjustedAnchorPoint); >+ m_layerTransform.setPosition(m_adjustedPosition); >+ m_layerTransform.setSize(m_adjustedSize); >+ >+ m_layerTransform.setFlattening(!preserves3D()); >+ m_layerTransform.setChildrenTransform(childrenTransform()); >+ m_layerTransform.combineTransforms(parent() ? toCoordinatedGraphicsLayer(parent())->m_layerTransform.combinedForChildren() : TransformationMatrix()); >+ >+ m_cachedInverseTransform = m_layerTransform.combined().inverse(); >+ >+ // The combined transform will be used in tiledBackingStoreVisibleRect. >+ setNeedsVisibleRectAdjustment(); >+} >+ >+bool CoordinatedGraphicsLayer::shouldHaveBackingStore() const >+{ >+ return drawsContent() && contentsAreVisible() && !m_size.isEmpty(); >+} >+ >+bool CoordinatedGraphicsLayer::selfOrAncestorHasActiveTransformAnimation() const >+{ >+ if (m_animations.hasActiveAnimationsOfType(AnimatedPropertyWebkitTransform)) >+ return true; >+ >+ if (!parent()) >+ return false; >+ >+ return toCoordinatedGraphicsLayer(parent())->selfOrAncestorHasActiveTransformAnimation(); >+} >+ >+bool CoordinatedGraphicsLayer::selfOrAncestorHaveNonAffineTransforms() >+{ >+ if (m_animations.hasActiveAnimationsOfType(AnimatedPropertyWebkitTransform)) >+ return true; >+ >+ if (!m_layerTransform.combined().isAffine()) >+ return true; >+ >+ if (!parent()) >+ return false; >+ >+ return toCoordinatedGraphicsLayer(parent())->selfOrAncestorHaveNonAffineTransforms(); >+} >+ >+bool CoordinatedGraphicsLayer::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& keyframesName, double delayAsNegativeTimeOffset) >+{ >+ ASSERT(!keyframesName.isEmpty()); >+ >+ if (!anim || anim->isEmptyOrZeroDuration() || valueList.size() < 2 || (valueList.property() != AnimatedPropertyWebkitTransform && valueList.property() != AnimatedPropertyOpacity)) >+ return false; >+ >+ bool listsMatch = false; >+ bool ignoredHasBigRotation; >+ >+ if (valueList.property() == AnimatedPropertyWebkitTransform) >+ listsMatch = validateTransformOperations(valueList, ignoredHasBigRotation) >= 0; >+ >+ m_lastAnimationStartTime = WTF::currentTime() - delayAsNegativeTimeOffset; >+ m_animations.add(GraphicsLayerAnimation(keyframesName, valueList, boxSize, anim, m_lastAnimationStartTime, listsMatch)); >+ m_animationStartedTimer.startOneShot(0); >+ didChangeAnimations(); >+ return true; >+} >+ >+void CoordinatedGraphicsLayer::pauseAnimation(const String& animationName, double time) >+{ >+ m_animations.pause(animationName, time); >+ didChangeAnimations(); >+} >+ >+void CoordinatedGraphicsLayer::removeAnimation(const String& animationName) >+{ >+ m_animations.remove(animationName); >+ didChangeAnimations(); >+} >+ >+void CoordinatedGraphicsLayer::suspendAnimations(double time) >+{ >+ m_animations.suspend(time); >+ didChangeAnimations(); >+} >+ >+void CoordinatedGraphicsLayer::resumeAnimations() >+{ >+ m_animations.resume(); >+ didChangeAnimations(); >+} >+ >+void CoordinatedGraphicsLayer::animationStartedTimerFired(Timer<CoordinatedGraphicsLayer>*) >+{ >+ client()->notifyAnimationStarted(this, m_lastAnimationStartTime); >+} >+} // namespace WebCore >+#endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h >new file mode 100644 >index 0000000000000000000000000000000000000000..a551d3511ada644ebf732bef62e86ad9d87f1a20 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h >@@ -0,0 +1,268 @@ >+/* >+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) >+ >+ This library is free software; you can redistribute it and/or >+ modify it under the terms of the GNU Library General Public >+ License as published by the Free Software Foundation; either >+ version 2 of the License, or (at your option) any later version. >+ >+ This library is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ Library General Public License for more details. >+ >+ You should have received a copy of the GNU Library General Public License >+ along with this library; see the file COPYING.LIB. If not, write to >+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ Boston, MA 02110-1301, USA. >+ */ >+ >+ >+#ifndef CoordinatedGraphicsLayer_h >+#define CoordinatedGraphicsLayer_h >+ >+#include "CoordinatedImageBacking.h" >+#include "CoordinatedLayerInfo.h" >+#include "CoordinatedTile.h" >+#include "FloatPoint3D.h" >+#include "GraphicsLayer.h" >+#include "GraphicsLayerAnimation.h" >+#include "GraphicsLayerTransform.h" >+#include "Image.h" >+#include "IntSize.h" >+#include "RunLoop.h" >+#include "TiledBackingStore.h" >+#include "TiledBackingStoreClient.h" >+#include "TransformationMatrix.h" >+#if USE(GRAPHICS_SURFACE) >+#include "GraphicsSurfaceToken.h" >+#endif >+#include <wtf/text/StringHash.h> >+ >+#if USE(COORDINATED_GRAPHICS) >+ >+namespace WebCore { >+class CoordinatedGraphicsLayer; >+class GraphicsLayerAnimations; >+ >+class CoordinatedGraphicsLayerClient { >+public: >+ virtual bool isFlushingLayerChanges() const = 0; >+ >+ // CoordinatedTileClient >+ virtual void createTile(CoordinatedLayerID, uint32_t tileID, const SurfaceUpdateInfo&, const IntRect&) = 0; >+ virtual void updateTile(CoordinatedLayerID, uint32_t tileID, const SurfaceUpdateInfo&, const IntRect&) = 0; >+ virtual void removeTile(CoordinatedLayerID, uint32_t tileID) = 0; >+ >+ virtual FloatRect visibleContentsRect() const = 0; >+ virtual PassRefPtr<CoordinatedImageBacking> createImageBackingIfNeeded(Image*) = 0; >+ virtual void syncLayerState(CoordinatedLayerID, const CoordinatedLayerInfo&) = 0; >+ virtual void syncLayerChildren(CoordinatedLayerID, const Vector<CoordinatedLayerID>&) = 0; >+#if ENABLE(CSS_FILTERS) >+ virtual void syncLayerFilters(CoordinatedLayerID, const FilterOperations&) = 0; >+#endif >+#if USE(GRAPHICS_SURFACE) >+ virtual void createCanvas(CoordinatedLayerID, PlatformLayer*) = 0; >+ virtual void syncCanvas(CoordinatedLayerID, PlatformLayer*) = 0; >+ virtual void destroyCanvas(CoordinatedLayerID) = 0; >+#endif >+ >+ virtual void setLayerRepaintCount(CoordinatedLayerID, int) = 0; >+ >+ virtual void setLayerAnimations(CoordinatedLayerID, const GraphicsLayerAnimations&) = 0; >+ >+ virtual void detachLayer(CoordinatedGraphicsLayer*) = 0; >+ virtual void syncFixedLayers() = 0; >+ virtual PassOwnPtr<GraphicsContext> beginContentUpdate(const IntSize&, CoordinatedSurface::Flags, uint32_t& atlasID, IntPoint&) = 0; >+}; >+ >+class CoordinatedGraphicsLayer : public GraphicsLayer >+ , public TiledBackingStoreClient >+ , public CoordinatedImageBacking::Host >+ , public CoordinatedTileClient { >+public: >+ explicit CoordinatedGraphicsLayer(GraphicsLayerClient*); >+ virtual ~CoordinatedGraphicsLayer(); >+ >+ // Reimplementations from GraphicsLayer.h. >+ virtual bool setChildren(const Vector<GraphicsLayer*>&) OVERRIDE; >+ virtual void addChild(GraphicsLayer*) OVERRIDE; >+ virtual void addChildAtIndex(GraphicsLayer*, int) OVERRIDE; >+ virtual void addChildAbove(GraphicsLayer*, GraphicsLayer*) OVERRIDE; >+ virtual void addChildBelow(GraphicsLayer*, GraphicsLayer*) OVERRIDE; >+ virtual bool replaceChild(GraphicsLayer*, GraphicsLayer*) OVERRIDE; >+ virtual void removeFromParent() OVERRIDE; >+ virtual void setPosition(const FloatPoint&) OVERRIDE; >+ virtual void setAnchorPoint(const FloatPoint3D&) OVERRIDE; >+ virtual void setSize(const FloatSize&) OVERRIDE; >+ virtual void setTransform(const TransformationMatrix&) OVERRIDE; >+ virtual void setChildrenTransform(const TransformationMatrix&) OVERRIDE; >+ virtual void setPreserves3D(bool) OVERRIDE; >+ virtual void setMasksToBounds(bool) OVERRIDE; >+ virtual void setDrawsContent(bool) OVERRIDE; >+ virtual void setContentsVisible(bool) OVERRIDE; >+ virtual void setContentsOpaque(bool) OVERRIDE; >+ virtual void setBackfaceVisibility(bool) OVERRIDE; >+ virtual void setOpacity(float) OVERRIDE; >+ virtual void setContentsRect(const IntRect&) OVERRIDE; >+ virtual void setContentsToImage(Image*) OVERRIDE; >+ virtual void setContentsToSolidColor(const Color&) OVERRIDE; >+ virtual void setShowDebugBorder(bool) OVERRIDE; >+ virtual void setShowRepaintCounter(bool) OVERRIDE; >+ virtual bool shouldDirectlyCompositeImage(Image*) const OVERRIDE; >+ virtual void setContentsToCanvas(PlatformLayer*) OVERRIDE; >+ virtual void setMaskLayer(GraphicsLayer*) OVERRIDE; >+ virtual void setReplicatedByLayer(GraphicsLayer*) OVERRIDE; >+ virtual void setNeedsDisplay() OVERRIDE; >+ virtual void setNeedsDisplayInRect(const FloatRect&) OVERRIDE; >+ virtual void setContentsNeedsDisplay() OVERRIDE; >+ virtual void deviceOrPageScaleFactorChanged() OVERRIDE; >+ virtual void flushCompositingState(const FloatRect&) OVERRIDE; >+ virtual void flushCompositingStateForThisLayerOnly() OVERRIDE; >+#if ENABLE(CSS_FILTERS) >+ virtual bool setFilters(const FilterOperations&) OVERRIDE; >+#endif >+ virtual bool addAnimation(const KeyframeValueList&, const IntSize&, const Animation*, const String&, double) OVERRIDE; >+ virtual void pauseAnimation(const String&, double) OVERRIDE; >+ virtual void removeAnimation(const String&) OVERRIDE; >+ virtual void suspendAnimations(double time) OVERRIDE; >+ virtual void resumeAnimations() OVERRIDE; >+ >+ FloatPoint computePositionRelativeToBase(); >+ void computePixelAlignment(FloatPoint& position, FloatSize&, FloatPoint3D& anchorPoint, FloatSize& alignmentOffset); >+ >+ void setVisibleContentRectTrajectoryVector(const FloatPoint&); >+ >+ void setRootLayer(bool); >+ >+ CoordinatedLayerID id() const; >+ >+ void setFixedToViewport(bool isFixed) { m_fixedToViewport = isFixed; } >+ >+ IntRect coverRect() const { return m_mainBackingStore ? m_mainBackingStore->mapToContents(m_mainBackingStore->coverRect()) : IntRect(); } >+ >+ // TiledBackingStoreClient >+ virtual void tiledBackingStorePaintBegin() OVERRIDE; >+ virtual void tiledBackingStorePaint(GraphicsContext*, const IntRect&) OVERRIDE; >+ virtual void tiledBackingStorePaintEnd(const Vector<IntRect>& paintedArea) OVERRIDE; >+ virtual void tiledBackingStoreHasPendingTileCreation() OVERRIDE; >+ virtual IntRect tiledBackingStoreContentsRect() OVERRIDE; >+ virtual IntRect tiledBackingStoreVisibleRect() OVERRIDE; >+ virtual Color tiledBackingStoreBackgroundColor() const OVERRIDE; >+ >+ // CoordinatedTileClient >+ virtual void createTile(uint32_t tileID, const SurfaceUpdateInfo&, const IntRect&) OVERRIDE; >+ virtual void updateTile(uint32_t tileID, const SurfaceUpdateInfo&, const IntRect&) OVERRIDE; >+ virtual void removeTile(uint32_t tileID) OVERRIDE; >+ virtual PassOwnPtr<GraphicsContext> beginContentUpdate(const IntSize&, uint32_t& atlasID, IntPoint&) OVERRIDE; >+ >+ void setCoordinator(CoordinatedGraphicsLayerClient*); >+ >+ void setNeedsVisibleRectAdjustment(); >+ void purgeBackingStores(); >+ bool hasPendingVisibleChanges(); >+ >+private: >+#if USE(GRAPHICS_SURFACE) >+ enum PendingCanvasOperation { >+ None = 0x00, >+ CreateCanvas = 0x01, >+ DestroyCanvas = 0x02, >+ SyncCanvas = 0x04, >+ CreateAndSyncCanvas = CreateCanvas | SyncCanvas, >+ RecreateCanvas = CreateAndSyncCanvas | DestroyCanvas >+ }; >+ >+ void syncCanvas(); >+ void destroyCanvasIfNeeded(); >+ void createCanvasIfNeeded(); >+#endif >+ >+ virtual void setDebugBorder(const Color&, float width) OVERRIDE; >+ >+ bool fixedToViewport() const { return m_fixedToViewport; } >+ >+ void didChangeLayerState(); >+ void didChangeAnimations(); >+ void didChangeGeometry(); >+ void didChangeChildren(); >+#if ENABLE(CSS_FILTERS) >+ void didChangeFilters(); >+#endif >+ void didChangeImageBacking(); >+ >+ void syncLayerState(); >+ void syncAnimations(); >+ void syncChildren(); >+#if ENABLE(CSS_FILTERS) >+ void syncFilters(); >+#endif >+ void syncImageBacking(); >+ void computeTransformedVisibleRect(); >+ void updateContentBuffers(); >+ >+ void createBackingStore(); >+ void releaseImageBackingIfNeeded(); >+ >+ // CoordinatedImageBacking::Host >+ virtual bool imageBackingVisible() OVERRIDE; >+ bool shouldHaveBackingStore() const; >+ bool selfOrAncestorHasActiveTransformAnimation() const; >+ bool selfOrAncestorHaveNonAffineTransforms(); >+ void adjustContentsScale(); >+ >+ void setShouldUpdateVisibleRect(); >+ float effectiveContentsScale(); >+ >+ void animationStartedTimerFired(Timer<CoordinatedGraphicsLayer>*); >+ >+ CoordinatedLayerID m_id; >+ CoordinatedLayerInfo m_layerInfo; >+ GraphicsLayerTransform m_layerTransform; >+ TransformationMatrix m_cachedInverseTransform; >+ FloatSize m_pixelAlignmentOffset; >+ FloatSize m_adjustedSize; >+ FloatPoint m_adjustedPosition; >+ FloatPoint3D m_adjustedAnchorPoint; >+ >+#ifndef NDEBUG >+ bool m_isPurging; >+#endif >+ bool m_shouldUpdateVisibleRect: 1; >+ bool m_shouldSyncLayerState: 1; >+ bool m_shouldSyncChildren: 1; >+ bool m_shouldSyncFilters: 1; >+ bool m_shouldSyncImageBacking: 1; >+ bool m_shouldSyncAnimations: 1; >+ bool m_fixedToViewport : 1; >+ bool m_pendingContentsScaleAdjustment : 1; >+ bool m_pendingVisibleRectAdjustment : 1; >+#if USE(GRAPHICS_SURFACE) >+ bool m_isValidCanvas : 1; >+ unsigned m_pendingCanvasOperation : 3; >+#endif >+ >+ CoordinatedGraphicsLayerClient* m_coordinator; >+ OwnPtr<TiledBackingStore> m_mainBackingStore; >+ OwnPtr<TiledBackingStore> m_previousBackingStore; >+ >+ RefPtr<Image> m_compositedImage; >+ NativeImagePtr m_compositedNativeImagePtr; >+ RefPtr<CoordinatedImageBacking> m_coordinatedImageBacking; >+ >+ PlatformLayer* m_canvasPlatformLayer; >+#if USE(GRAPHICS_SURFACE) >+ IntSize m_canvasSize; >+ GraphicsSurfaceToken m_canvasToken; >+#endif >+ Timer<CoordinatedGraphicsLayer> m_animationStartedTimer; >+ GraphicsLayerAnimations m_animations; >+ double m_lastAnimationStartTime; >+}; >+ >+CoordinatedGraphicsLayer* toCoordinatedGraphicsLayer(GraphicsLayer*); >+ >+} // namespace WebCore >+#endif // USE(COORDINATED_GRAPHICS) >+ >+#endif // CoordinatedGraphicsLayer_h >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..f692482875d5cfc21db6bb0d6f200e1d99c5b20f >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp >@@ -0,0 +1,163 @@ >+/* >+ * Copyright (C) 2012 Company 100, Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+ >+#if USE(COORDINATED_GRAPHICS) >+#include "CoordinatedImageBacking.h" >+ >+#include "GraphicsContext.h" >+ >+namespace WebCore { >+ >+CoordinatedImageBackingID CoordinatedImageBacking::getCoordinatedImageBackingID(Image* image) >+{ >+ // CoordinatedImageBacking keeps a RefPtr<Image> member, so the same Image pointer can not refer two different instances until CoordinatedImageBacking releases the member. >+ return reinterpret_cast<CoordinatedImageBackingID>(image); >+} >+ >+PassRefPtr<CoordinatedImageBacking> CoordinatedImageBacking::create(Coordinator* client, PassRefPtr<Image> image) >+{ >+ return adoptRef(new CoordinatedImageBacking(client, image)); >+} >+ >+CoordinatedImageBacking::CoordinatedImageBacking(Coordinator* client, PassRefPtr<Image> image) >+ : m_coordinator(client) >+ , m_image(image) >+ , m_id(getCoordinatedImageBackingID(m_image.get())) >+ , m_clearContentsTimer(this, &CoordinatedImageBacking::clearContentsTimerFired) >+ , m_isDirty(false) >+ , m_isVisible(false) >+{ >+ // FIXME: We would need to decode a small image directly into a GraphicsSurface. >+ // http://webkit.org/b/101426 >+ >+ m_coordinator->createImageBacking(id()); >+} >+ >+CoordinatedImageBacking::~CoordinatedImageBacking() >+{ >+} >+ >+void CoordinatedImageBacking::addHost(Host* host) >+{ >+ ASSERT(!m_hosts.contains(host)); >+ m_hosts.append(host); >+} >+ >+void CoordinatedImageBacking::removeHost(Host* host) >+{ >+ size_t position = m_hosts.find(host); >+ ASSERT(position != notFound); >+ m_hosts.remove(position); >+ >+ if (m_hosts.isEmpty()) >+ m_coordinator->removeImageBacking(id()); >+} >+ >+void CoordinatedImageBacking::markDirty() >+{ >+ m_isDirty = true; >+} >+ >+void CoordinatedImageBacking::update() >+{ >+ releaseSurfaceIfNeeded(); >+ >+ bool changedToVisible; >+ updateVisibilityIfNeeded(changedToVisible); >+ if (!m_isVisible) >+ return; >+ >+ if (!changedToVisible) { >+ if (!m_isDirty) >+ return; >+ >+ if (m_nativeImagePtr == m_image->nativeImageForCurrentFrame()) { >+ m_isDirty = false; >+ return; >+ } >+ } >+ >+ m_surface = CoordinatedSurface::create(m_image->size(), m_image->currentFrameHasAlpha() ? CoordinatedSurface::SupportsAlpha : CoordinatedSurface::NoFlags); >+ if (!m_surface) { >+ m_isDirty = false; >+ return; >+ } >+ >+ IntRect rect(IntPoint::zero(), m_image->size()); >+ OwnPtr<GraphicsContext> context = m_surface->createGraphicsContext(rect); >+ context->drawImage(m_image.get(), ColorSpaceDeviceRGB, rect, rect); >+ >+ m_nativeImagePtr = m_image->nativeImageForCurrentFrame(); >+ >+ // If sending the message fails, try again in the next update. >+ bool success = m_coordinator->updateImageBacking(id(), m_surface); >+ m_isDirty = !success; >+} >+ >+void CoordinatedImageBacking::releaseSurfaceIfNeeded() >+{ >+ // We must keep m_surface until UI Process reads m_surface. >+ // If m_surface exists, it was created in the previous update. >+ m_surface.clear(); >+} >+ >+static const double clearContentsTimerInterval = 3; >+ >+void CoordinatedImageBacking::updateVisibilityIfNeeded(bool& changedToVisible) >+{ >+ bool previousIsVisible = m_isVisible; >+ >+ m_isVisible = false; >+ for (size_t i = 0; i < m_hosts.size(); ++i) { >+ if (m_hosts[i]->imageBackingVisible()) { >+ m_isVisible = true; >+ break; >+ } >+ } >+ >+ bool changedToInvisible = previousIsVisible && !m_isVisible; >+ if (changedToInvisible) { >+ ASSERT(!m_clearContentsTimer.isActive()); >+ m_clearContentsTimer.startOneShot(clearContentsTimerInterval); >+ } >+ >+ changedToVisible = !previousIsVisible && m_isVisible; >+ >+ if (m_isVisible && m_clearContentsTimer.isActive()) { >+ m_clearContentsTimer.stop(); >+ // We don't want to update the texture if we didn't remove the texture. >+ changedToVisible = false; >+ } >+} >+ >+void CoordinatedImageBacking::clearContentsTimerFired(Timer<CoordinatedImageBacking>*) >+{ >+ m_coordinator->clearImageBackingContents(id()); >+} >+ >+} // namespace WebCore >+#endif >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h >new file mode 100644 >index 0000000000000000000000000000000000000000..5b5b57a6ecb101ef75b29191b57507bedda2f765 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h >@@ -0,0 +1,95 @@ >+/* >+ * Copyright (C) 2012 Company 100, Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+ >+#ifndef CoordinatedImageBacking_h >+#define CoordinatedImageBacking_h >+ >+#if USE(COORDINATED_GRAPHICS) >+#include "CoordinatedLayerInfo.h" >+#include "CoordinatedSurface.h" >+#include "Image.h" >+#include "Timer.h" >+#include <wtf/RefCounted.h> >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+class CoordinatedImageBacking : public RefCounted<CoordinatedImageBacking> { >+public: >+ class Coordinator { >+ public: >+ virtual void createImageBacking(CoordinatedImageBackingID) = 0; >+ virtual bool updateImageBacking(CoordinatedImageBackingID, PassRefPtr<CoordinatedSurface>) = 0; >+ virtual void clearImageBackingContents(CoordinatedImageBackingID) = 0; >+ virtual void removeImageBacking(CoordinatedImageBackingID) = 0; >+ }; >+ >+ class Host { >+ public: >+ virtual bool imageBackingVisible() = 0; >+ }; >+ >+ static PassRefPtr<CoordinatedImageBacking> create(Coordinator*, PassRefPtr<Image>); >+ virtual ~CoordinatedImageBacking(); >+ >+ static CoordinatedImageBackingID getCoordinatedImageBackingID(Image*); >+ CoordinatedImageBackingID id() const { return m_id; } >+ >+ void addHost(Host*); >+ void removeHost(Host*); >+ >+ // When a new image is updated or an animated gif is progressed, CoordinatedGraphicsLayer calls markDirty(). >+ void markDirty(); >+ >+ // Create, remove or update its backing. >+ void update(); >+ >+private: >+ CoordinatedImageBacking(Coordinator*, PassRefPtr<Image>); >+ >+ void releaseSurfaceIfNeeded(); >+ void updateVisibilityIfNeeded(bool& changedToVisible); >+ void clearContentsTimerFired(Timer<CoordinatedImageBacking>*); >+ >+ Coordinator* m_coordinator; >+ RefPtr<Image> m_image; >+ NativeImagePtr m_nativeImagePtr; >+ CoordinatedImageBackingID m_id; >+ Vector<Host*> m_hosts; >+ >+ RefPtr<CoordinatedSurface> m_surface; >+ >+ Timer<CoordinatedImageBacking> m_clearContentsTimer; >+ >+ bool m_isDirty; >+ bool m_isVisible; >+ >+}; >+ >+} // namespace WebCore >+#endif // USE(COORDINATED_GRAPHICS) >+ >+#endif // CoordinatedImageBacking_h >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedLayerInfo.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedLayerInfo.h >new file mode 100644 >index 0000000000000000000000000000000000000000..0fa2a12ed3f46c08423b4b9c4dc916569f038b76 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedLayerInfo.h >@@ -0,0 +1,85 @@ >+/* >+ Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) >+ >+ This library is free software; you can redistribute it and/or >+ modify it under the terms of the GNU Library General Public >+ License as published by the Free Software Foundation; either >+ version 2 of the License, or (at your option) any later version. >+ >+ This library is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ Library General Public License for more details. >+ >+ You should have received a copy of the GNU Library General Public License >+ along with this library; see the file COPYING.LIB. If not, write to >+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ Boston, MA 02110-1301, USA. >+ */ >+ >+#ifndef CoordinatedLayerInfo_h >+#define CoordinatedLayerInfo_h >+ >+#if USE(COORDINATED_GRAPHICS) >+ >+#include "Color.h" >+#include "FloatRect.h" >+#include "FloatSize.h" >+#include "IntRect.h" >+#include "TransformationMatrix.h" >+ >+namespace WebCore { >+ >+typedef uint32_t CoordinatedLayerID; >+enum { InvalidCoordinatedLayerID = 0 }; >+ >+typedef uint64_t CoordinatedImageBackingID; >+enum { InvalidCoordinatedImageBackingID = 0 }; >+ >+// NOTE: CoordinatedLayerInfo should only use POD types, as to make serialization faster. >+struct CoordinatedLayerInfo { >+ CoordinatedLayerInfo() >+ : replica(InvalidCoordinatedLayerID) >+ , mask(InvalidCoordinatedLayerID) >+ , imageID(InvalidCoordinatedImageBackingID) >+ , opacity(0) >+ , debugBorderWidth(0) >+ , flags(0) { } >+ >+ CoordinatedLayerID replica; >+ CoordinatedLayerID mask; >+ CoordinatedImageBackingID imageID; >+ >+ FloatPoint pos; >+ FloatPoint3D anchorPoint; >+ FloatSize size; >+ TransformationMatrix transform; >+ TransformationMatrix childrenTransform; >+ IntRect contentsRect; >+ float opacity; >+ Color solidColor; >+ Color debugBorderColor; >+ float debugBorderWidth; >+ >+ union { >+ struct { >+ bool contentsOpaque : 1; >+ bool drawsContent : 1; >+ bool contentsVisible : 1; >+ bool backfaceVisible : 1; >+ bool masksToBounds : 1; >+ bool preserves3D : 1; >+ bool isRootLayer: 1; >+ bool fixedToViewport : 1; >+ bool showDebugBorders : 1; >+ bool showRepaintCounter : 1; >+ }; >+ unsigned flags; >+ }; >+}; >+ >+} // namespace WebCore >+ >+#endif // USE(COORDINATED_GRAPHICS) >+ >+#endif // CoordinatedLayerInfo_h >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedSurface.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedSurface.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..f9a9423727435a4584d75bd0038ab36d71f0a36f >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedSurface.cpp >@@ -0,0 +1,48 @@ >+/* >+ * Copyright (C) 2013 Company 100, Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "CoordinatedSurface.h" >+ >+#if USE(COORDINATED_GRAPHICS) >+ >+namespace WebCore { >+ >+CoordinatedSurface::Factory* CoordinatedSurface::s_factory = 0; >+ >+void CoordinatedSurface::setFactory(CoordinatedSurface::Factory factory) >+{ >+ s_factory = factory; >+} >+ >+PassRefPtr<CoordinatedSurface> CoordinatedSurface::create(const IntSize& size, Flags flags) >+{ >+ ASSERT(s_factory); >+ return s_factory(size, flags); >+} >+ >+} // namespace WebCore >+ >+#endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedSurface.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedSurface.h >new file mode 100644 >index 0000000000000000000000000000000000000000..3077c3c09c4ab067ffb98666b40f60759785e5d6 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedSurface.h >@@ -0,0 +1,68 @@ >+/* >+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >+ Copyright (C) 2012 Company 100, Inc. >+ >+ This library is free software; you can redistribute it and/or >+ modify it under the terms of the GNU Library General Public >+ License as published by the Free Software Foundation; either >+ version 2 of the License, or (at your option) any later version. >+ >+ This library is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ Library General Public License for more details. >+ >+ You should have received a copy of the GNU Library General Public License >+ along with this library; see the file COPYING.LIB. If not, write to >+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ Boston, MA 02110-1301, USA. >+ */ >+ >+#ifndef CoordinatedSurface_h >+#define CoordinatedSurface_h >+ >+#if USE(COORDINATED_GRAPHICS) >+#include "IntRect.h" >+#include <wtf/PassOwnPtr.h> >+#include <wtf/PassRefPtr.h> >+#include <wtf/ThreadSafeRefCounted.h> >+ >+namespace WebCore { >+class BitmapTexture; >+class GraphicsContext; >+ >+class CoordinatedSurface : public ThreadSafeRefCounted<CoordinatedSurface> { >+public: >+ enum Flag { >+ NoFlags = 0, >+ SupportsAlpha = 1 << 0, >+ }; >+ typedef unsigned Flags; >+ >+ typedef PassRefPtr<CoordinatedSurface> Factory(const IntSize&, Flags); >+ static void setFactory(Factory); >+ static PassRefPtr<CoordinatedSurface> create(const IntSize&, Flags); >+ >+ virtual ~CoordinatedSurface() { } >+ >+ bool supportsAlpha() const { return flags() & SupportsAlpha; } >+ virtual IntSize size() const = 0; >+ >+ // Create a graphics context that can be used to paint into the backing store. >+ virtual PassOwnPtr<GraphicsContext> createGraphicsContext(const IntRect&) = 0; >+ >+#if USE(TEXTURE_MAPPER) >+ virtual void copyToTexture(PassRefPtr<BitmapTexture>, const IntRect& target, const IntPoint& sourceOffset) = 0; >+#endif >+ >+protected: >+ virtual Flags flags() const = 0; >+ >+private: >+ static CoordinatedSurface::Factory* s_factory; >+}; >+ >+} // namespace WebCore >+ >+#endif // USE(COORDINATED_GRAPHICS) >+#endif // CoordinatedSurface_h >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTile.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTile.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..9f9d34e605b0e2b25268baa66c4805dbefa20931 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTile.cpp >@@ -0,0 +1,141 @@ >+/* >+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "CoordinatedTile.h" >+ >+#if USE(TILED_BACKING_STORE) >+ >+#include "GraphicsContext.h" >+#include "ImageBuffer.h" >+#include "SurfaceUpdateInfo.h" >+#include "TiledBackingStoreClient.h" >+ >+namespace WebCore { >+ >+static const uint32_t InvalidCoordinatedTileID = 0; >+ >+CoordinatedTile::CoordinatedTile(CoordinatedTileClient* client, TiledBackingStore* tiledBackingStore, const Coordinate& tileCoordinate) >+ : m_client(client) >+ , m_tiledBackingStore(tiledBackingStore) >+ , m_coordinate(tileCoordinate) >+ , m_rect(tiledBackingStore->tileRectForCoordinate(tileCoordinate)) >+ , m_ID(InvalidCoordinatedTileID) >+ , m_dirtyRect(m_rect) >+{ >+} >+ >+CoordinatedTile::~CoordinatedTile() >+{ >+ if (m_ID != InvalidCoordinatedTileID) >+ m_client->removeTile(m_ID); >+} >+ >+bool CoordinatedTile::isDirty() const >+{ >+ return !m_dirtyRect.isEmpty(); >+} >+ >+void CoordinatedTile::invalidate(const IntRect& dirtyRect) >+{ >+ IntRect tileDirtyRect = intersection(dirtyRect, m_rect); >+ if (tileDirtyRect.isEmpty()) >+ return; >+ >+ m_dirtyRect.unite(tileDirtyRect); >+} >+ >+Vector<IntRect> CoordinatedTile::updateBackBuffer() >+{ >+ if (!isDirty()) >+ return Vector<IntRect>(); >+ >+ SurfaceUpdateInfo updateInfo; >+ OwnPtr<GraphicsContext> graphicsContext = m_client->beginContentUpdate(m_dirtyRect.size(), updateInfo.atlasID, updateInfo.surfaceOffset); >+ if (!graphicsContext) >+ return Vector<IntRect>(); >+ graphicsContext->translate(-m_dirtyRect.x(), -m_dirtyRect.y()); >+ graphicsContext->scale(FloatSize(m_tiledBackingStore->contentsScale(), m_tiledBackingStore->contentsScale())); >+ m_tiledBackingStore->client()->tiledBackingStorePaint(graphicsContext.get(), m_tiledBackingStore->mapToContents(m_dirtyRect)); >+ >+ updateInfo.updateRect = m_dirtyRect; >+ updateInfo.updateRect.move(-m_rect.x(), -m_rect.y()); >+ updateInfo.scaleFactor = m_tiledBackingStore->contentsScale(); >+ graphicsContext.release(); >+ >+ static uint32_t id = 1; >+ if (m_ID == InvalidCoordinatedTileID) { >+ m_ID = id++; >+ // We may get an invalid ID due to wrap-around on overflow. >+ if (m_ID == InvalidCoordinatedTileID) >+ m_ID = id++; >+ m_client->createTile(m_ID, updateInfo, m_rect); >+ } else >+ m_client->updateTile(m_ID, updateInfo, m_rect); >+ >+ Vector<IntRect> updatedRects; >+ updatedRects.append(m_dirtyRect); >+ m_dirtyRect = IntRect(); >+ return updatedRects; >+} >+ >+void CoordinatedTile::swapBackBufferToFront() >+{ >+ // Handled by tiledBackingStorePaintEnd. >+} >+ >+bool CoordinatedTile::isReadyToPaint() const >+{ >+ return m_ID != InvalidCoordinatedTileID; >+} >+ >+void CoordinatedTile::paint(GraphicsContext*, const IntRect&) >+{ >+ ASSERT_NOT_REACHED(); >+} >+ >+void CoordinatedTile::resize(const IntSize& newSize) >+{ >+ m_rect = IntRect(m_rect.location(), newSize); >+ m_dirtyRect = m_rect; >+} >+ >+CoordinatedTileBackend::CoordinatedTileBackend(CoordinatedTileClient* client) >+ : m_client(client) >+{ >+} >+ >+PassRefPtr<Tile> CoordinatedTileBackend::createTile(TiledBackingStore* tiledBackingStore, const Tile::Coordinate& tileCoordinate) >+{ >+ return CoordinatedTile::create(m_client, tiledBackingStore, tileCoordinate); >+} >+ >+void CoordinatedTileBackend::paintCheckerPattern(GraphicsContext*, const FloatRect&) >+{ >+} >+ >+} // namespace WebCore >+ >+#endif // USE(TILED_BACKING_STORE) >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTile.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTile.h >new file mode 100644 >index 0000000000000000000000000000000000000000..be99bfdafef491dad3a36ffc5b23f4447dbee45f >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTile.h >@@ -0,0 +1,96 @@ >+/* >+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#ifndef CoordinatedTile_h >+#define CoordinatedTile_h >+ >+#if USE(TILED_BACKING_STORE) >+ >+#include "IntRect.h" >+#include "Tile.h" >+#include "TiledBackingStore.h" >+ >+namespace WebCore { >+ >+class CoordinatedTileClient; >+class ImageBuffer; >+class SurfaceUpdateInfo; >+class TiledBackingStore; >+ >+class CoordinatedTile : public Tile { >+public: >+ static PassRefPtr<Tile> create(CoordinatedTileClient* client, TiledBackingStore* tiledBackingStore, const Coordinate& tileCoordinate) { return adoptRef(new CoordinatedTile(client, tiledBackingStore, tileCoordinate)); } >+ ~CoordinatedTile(); >+ >+ bool isDirty() const; >+ void invalidate(const IntRect&); >+ Vector<IntRect> updateBackBuffer(); >+ void swapBackBufferToFront(); >+ bool isReadyToPaint() const; >+ void paint(GraphicsContext*, const IntRect&); >+ >+ const Coordinate& coordinate() const { return m_coordinate; } >+ const IntRect& rect() const { return m_rect; } >+ void resize(const IntSize&); >+ >+private: >+ CoordinatedTile(CoordinatedTileClient*, TiledBackingStore*, const Coordinate&); >+ >+ CoordinatedTileClient* m_client; >+ TiledBackingStore* m_tiledBackingStore; >+ Coordinate m_coordinate; >+ IntRect m_rect; >+ >+ uint32_t m_ID; >+ IntRect m_dirtyRect; >+ >+ OwnPtr<ImageBuffer> m_localBuffer; >+}; >+ >+class CoordinatedTileClient { >+public: >+ virtual ~CoordinatedTileClient() { } >+ virtual void createTile(uint32_t tileID, const SurfaceUpdateInfo&, const IntRect&) = 0; >+ virtual void updateTile(uint32_t tileID, const SurfaceUpdateInfo&, const IntRect&) = 0; >+ virtual void removeTile(uint32_t tileID) = 0; >+ virtual PassOwnPtr<GraphicsContext> beginContentUpdate(const IntSize&, uint32_t& atlasID, IntPoint&) = 0; >+}; >+ >+class CoordinatedTileBackend : public TiledBackingStoreBackend { >+public: >+ static PassOwnPtr<TiledBackingStoreBackend> create(CoordinatedTileClient* client) { return adoptPtr(new CoordinatedTileBackend(client)); } >+ PassRefPtr<Tile> createTile(TiledBackingStore*, const Tile::Coordinate&); >+ void paintCheckerPattern(GraphicsContext*, const FloatRect&); >+ >+private: >+ explicit CoordinatedTileBackend(CoordinatedTileClient*); >+ CoordinatedTileClient* m_client; >+}; >+ >+} // namespace WebCore >+ >+#endif // USE(TILED_BACKING_STORE) >+ >+#endif // CoordinatedTile_h >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h b/Source/WebCore/platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h >new file mode 100644 >index 0000000000000000000000000000000000000000..6ab384a11eaa5ea2540813c7025e5fc8c17d3910 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h >@@ -0,0 +1,53 @@ >+/* >+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >+ >+ This library is free software; you can redistribute it and/or >+ modify it under the terms of the GNU Library General Public >+ License as published by the Free Software Foundation; either >+ version 2 of the License, or (at your option) any later version. >+ >+ This library is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ Library General Public License for more details. >+ >+ You should have received a copy of the GNU Library General Public License >+ along with this library; see the file COPYING.LIB. If not, write to >+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ Boston, MA 02110-1301, USA. >+ */ >+ >+#ifndef SurfaceUpdateInfo_h >+#define SurfaceUpdateInfo_h >+ >+#if USE(COORDINATED_GRAPHICS) >+ >+#include "IntRect.h" >+#include <wtf/Noncopyable.h> >+ >+namespace WebCore { >+ >+class SurfaceUpdateInfo { >+ WTF_MAKE_NONCOPYABLE(SurfaceUpdateInfo); >+ >+public: >+ SurfaceUpdateInfo() { } >+ >+ // The rect to be updated. >+ IntRect updateRect; >+ >+ // The page scale factor used to render this update. >+ float scaleFactor; >+ >+ // The id of the update atlas including the shareable bitmap containing the updates. >+ uint32_t atlasID; >+ >+ // The offset in the bitmap where the rendered contents are. >+ IntPoint surfaceOffset; >+}; >+ >+} // namespace WebCore >+ >+#endif // USE(COORDINATED_GRAPHICS) >+ >+#endif // SurfaceUpdateInfo_h >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/TextureMapperScene.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/TextureMapperScene.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..bc7d8abdc1cbe04f0483001bf182fa53cf933835 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/TextureMapperScene.cpp >@@ -0,0 +1,698 @@ >+/* >+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >+ Copyright (C) 2012 Company 100, Inc. >+ >+ This library is free software; you can redistribute it and/or >+ modify it under the terms of the GNU Library General Public >+ License as published by the Free Software Foundation; either >+ version 2 of the License, or (at your option) any later version. >+ >+ This library is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ Library General Public License for more details. >+ >+ You should have received a copy of the GNU Library General Public License >+ along with this library; see the file COPYING.LIB. If not, write to >+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ Boston, MA 02110-1301, USA. >+*/ >+ >+#include "config.h" >+ >+#if USE(COORDINATED_GRAPHICS) >+ >+#include "TextureMapperScene.h" >+ >+#include "CoordinatedBackingStore.h" >+#include "GraphicsLayerTextureMapper.h" >+#include "TextureMapper.h" >+#include "TextureMapperBackingStore.h" >+#include "TextureMapperGL.h" >+#include "TextureMapperLayer.h" >+#include <OpenGLShims.h> >+#include <wtf/Atomics.h> >+#include <wtf/MainThread.h> >+ >+#if ENABLE(CSS_SHADERS) >+#include "CoordinatedCustomFilterOperation.h" >+#include "CoordinatedCustomFilterProgram.h" >+#include "CustomFilterProgram.h" >+#include "CustomFilterProgramInfo.h" >+#endif >+ >+namespace WebCore { >+ >+void TextureMapperScene::dispatchOnMainThread(const Function<void()>& function) >+{ >+ if (isMainThread()) >+ function(); >+ else >+ callOnMainThread(function); >+} >+ >+static FloatPoint boundedScrollPosition(const FloatPoint& scrollPosition, const FloatRect& visibleContentRect, const FloatSize& contentSize) >+{ >+ float scrollPositionX = std::max(scrollPosition.x(), 0.0f); >+ scrollPositionX = std::min(scrollPositionX, contentSize.width() - visibleContentRect.width()); >+ >+ float scrollPositionY = std::max(scrollPosition.y(), 0.0f); >+ scrollPositionY = std::min(scrollPositionY, contentSize.height() - visibleContentRect.height()); >+ return FloatPoint(scrollPositionX, scrollPositionY); >+} >+ >+static bool layerShouldHaveBackingStore(GraphicsLayer* layer) >+{ >+ return layer->drawsContent() && layer->contentsAreVisible() && !layer->size().isEmpty(); >+} >+ >+TextureMapperScene::TextureMapperScene(TextureMapperSceneClient* client) >+ : m_client(client) >+ , m_isActive(false) >+ , m_rootLayerID(InvalidCoordinatedLayerID) >+ , m_animationsLocked(false) >+#if ENABLE(REQUEST_ANIMATION_FRAME) >+ , m_animationFrameRequested(false) >+#endif >+ , m_backgroundColor(Color::white) >+ , m_setDrawsBackground(false) >+{ >+ ASSERT(isMainThread()); >+} >+ >+TextureMapperScene::~TextureMapperScene() >+{ >+} >+ >+void TextureMapperScene::paintToCurrentGLContext(const TransformationMatrix& matrix, float opacity, const FloatRect& clipRect, TextureMapper::PaintFlags PaintFlags) >+{ >+ if (!m_textureMapper) { >+ m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode); >+ static_cast<TextureMapperGL*>(m_textureMapper.get())->setEnableEdgeDistanceAntialiasing(true); >+ } >+ >+ ASSERT(m_textureMapper->accelerationMode() == TextureMapper::OpenGLMode); >+ syncRemoteContent(); >+ >+ adjustPositionForFixedLayers(); >+ GraphicsLayer* currentRootLayer = rootLayer(); >+ if (!currentRootLayer) >+ return; >+ >+ TextureMapperLayer* layer = toTextureMapperLayer(currentRootLayer); >+ >+ if (!layer) >+ return; >+ >+ layer->setTextureMapper(m_textureMapper.get()); >+ if (!m_animationsLocked) >+ layer->applyAnimationsRecursively(); >+ m_textureMapper->beginPainting(PaintFlags); >+ m_textureMapper->beginClip(TransformationMatrix(), clipRect); >+ >+ if (m_setDrawsBackground) { >+ RGBA32 rgba = makeRGBA32FromFloats(m_backgroundColor.red(), >+ m_backgroundColor.green(), m_backgroundColor.blue(), >+ m_backgroundColor.alpha() * opacity); >+ m_textureMapper->drawSolidColor(clipRect, TransformationMatrix(), Color(rgba)); >+ } >+ >+ if (currentRootLayer->opacity() != opacity || currentRootLayer->transform() != matrix) { >+ currentRootLayer->setOpacity(opacity); >+ currentRootLayer->setTransform(matrix); >+ currentRootLayer->flushCompositingStateForThisLayerOnly(); >+ } >+ >+ layer->paint(); >+ m_textureMapper->endClip(); >+ m_textureMapper->endPainting(); >+ >+ if (layer->descendantsOrSelfHaveRunningAnimations()) >+ dispatchOnMainThread(bind(&TextureMapperScene::updateViewport, this)); >+ >+#if ENABLE(REQUEST_ANIMATION_FRAME) >+ if (m_animationFrameRequested) { >+ m_animationFrameRequested = false; >+ dispatchOnMainThread(bind(&TextureMapperScene::animationFrameReady, this)); >+ } >+#endif >+} >+ >+#if ENABLE(REQUEST_ANIMATION_FRAME) >+void TextureMapperScene::animationFrameReady() >+{ >+ ASSERT(isMainThread()); >+ if (m_client) >+ m_client->animationFrameReady(); >+} >+ >+void TextureMapperScene::requestAnimationFrame() >+{ >+ m_animationFrameRequested = true; >+} >+#endif >+ >+#if PLATFORM(QT) >+void TextureMapperScene::paintToGraphicsContext(QPainter* painter) >+#elif USE(CAIRO) >+void TextureMapperScene::paintToGraphicsContext(cairo_t* painter) >+#endif >+{ >+ if (!m_textureMapper) >+ m_textureMapper = TextureMapper::create(); >+ ASSERT(m_textureMapper->accelerationMode() == TextureMapper::SoftwareMode); >+ syncRemoteContent(); >+ TextureMapperLayer* layer = toTextureMapperLayer(rootLayer()); >+ >+ if (!layer) >+ return; >+ >+ GraphicsContext graphicsContext(painter); >+ m_textureMapper->setGraphicsContext(&graphicsContext); >+ m_textureMapper->beginPainting(); >+ >+ if (m_setDrawsBackground) >+ m_textureMapper->drawSolidColor(graphicsContext.clipBounds(), TransformationMatrix(), m_backgroundColor); >+ >+ layer->paint(); >+ m_textureMapper->endPainting(); >+ m_textureMapper->setGraphicsContext(0); >+} >+ >+void TextureMapperScene::setContentsSize(const FloatSize& contentsSize) >+{ >+ m_contentsSize = contentsSize; >+} >+ >+void TextureMapperScene::setVisibleContentsRect(const FloatRect& rect) >+{ >+ m_visibleContentsRect = rect; >+} >+ >+void TextureMapperScene::updateViewport() >+{ >+ ASSERT(isMainThread()); >+ if (m_client) >+ m_client->updateViewport(); >+} >+ >+void TextureMapperScene::adjustPositionForFixedLayers() >+{ >+ if (m_fixedLayers.isEmpty()) >+ return; >+ >+ // Fixed layer positions are updated by the web process when we update the visible contents rect / scroll position. >+ // If we want those layers to follow accurately the viewport when we move between the web process updates, we have to offset >+ // them by the delta between the current position and the position of the viewport used for the last layout. >+ FloatPoint scrollPosition = boundedScrollPosition(m_visibleContentsRect.location(), m_visibleContentsRect, m_contentsSize); >+ FloatPoint renderedScrollPosition = boundedScrollPosition(m_renderedContentsScrollPosition, m_visibleContentsRect, m_contentsSize); >+ FloatSize delta = scrollPosition - renderedScrollPosition; >+ >+ LayerRawPtrMap::iterator end = m_fixedLayers.end(); >+ for (LayerRawPtrMap::iterator it = m_fixedLayers.begin(); it != end; ++it) >+ toTextureMapperLayer(it->value)->setScrollPositionDeltaIfNeeded(delta); >+} >+ >+void TextureMapperScene::didChangeScrollPosition(const FloatPoint& position) >+{ >+ m_pendingRenderedContentsScrollPosition = position; >+} >+ >+#if USE(GRAPHICS_SURFACE) >+void TextureMapperScene::createCanvas(CoordinatedLayerID id, const IntSize&, PassRefPtr<GraphicsSurface> surface) >+{ >+ ASSERT(m_textureMapper); >+ GraphicsLayer* layer = layerByID(id); >+ ASSERT(!m_surfaceBackingStores.contains(id)); >+ >+ RefPtr<TextureMapperSurfaceBackingStore> canvasBackingStore(TextureMapperSurfaceBackingStore::create()); >+ m_surfaceBackingStores.set(id, canvasBackingStore); >+ >+ canvasBackingStore->setGraphicsSurface(surface); >+ layer->setContentsToMedia(canvasBackingStore.get()); >+} >+ >+void TextureMapperScene::syncCanvas(CoordinatedLayerID id, uint32_t frontBuffer) >+{ >+ ASSERT(m_textureMapper); >+ ASSERT(m_surfaceBackingStores.contains(id)); >+ >+ SurfaceBackingStoreMap::iterator it = m_surfaceBackingStores.find(id); >+ RefPtr<TextureMapperSurfaceBackingStore> canvasBackingStore = it->value; >+ >+ canvasBackingStore->swapBuffersIfNeeded(frontBuffer); >+} >+ >+void TextureMapperScene::destroyCanvas(CoordinatedLayerID id) >+{ >+ ASSERT(m_textureMapper); >+ GraphicsLayer* layer = layerByID(id); >+ ASSERT(m_surfaceBackingStores.contains(id)); >+ >+ m_surfaceBackingStores.remove(id); >+ layer->setContentsToMedia(0); >+} >+#endif >+ >+void TextureMapperScene::setLayerRepaintCount(CoordinatedLayerID id, int value) >+{ >+ GraphicsLayer* layer = layerByID(id); >+ toGraphicsLayerTextureMapper(layer)->setRepaintCount(value); >+} >+ >+void TextureMapperScene::setLayerChildren(CoordinatedLayerID id, const Vector<CoordinatedLayerID>& childIDs) >+{ >+ GraphicsLayer* layer = layerByID(id); >+ Vector<GraphicsLayer*> children; >+ >+ for (size_t i = 0; i < childIDs.size(); ++i) { >+ CoordinatedLayerID childID = childIDs[i]; >+ GraphicsLayer* child = layerByID(childID); >+ children.append(child); >+ } >+ layer->setChildren(children); >+} >+ >+#if ENABLE(CSS_FILTERS) >+void TextureMapperScene::setLayerFilters(CoordinatedLayerID id, const FilterOperations& filters) >+{ >+ GraphicsLayer* layer = layerByID(id); >+ >+#if ENABLE(CSS_SHADERS) >+ injectCachedCustomFilterPrograms(filters); >+#endif >+ layer->setFilters(filters); >+} >+#endif >+ >+#if ENABLE(CSS_SHADERS) >+void TextureMapperScene::injectCachedCustomFilterPrograms(const FilterOperations& filters) const >+{ >+ for (size_t i = 0; i < filters.size(); ++i) { >+ FilterOperation* operation = filters.operations().at(i).get(); >+ if (operation->getOperationType() != FilterOperation::CUSTOM) >+ continue; >+ >+ CoordinatedCustomFilterOperation* customOperation = static_cast<CoordinatedCustomFilterOperation*>(operation); >+ ASSERT(!customOperation->program()); >+ CustomFilterProgramMap::const_iterator iter = m_customFilterPrograms.find(customOperation->programID()); >+ ASSERT(iter != m_customFilterPrograms.end()); >+ customOperation->setProgram(iter->value.get()); >+ } >+} >+ >+void TextureMapperScene::createCustomFilterProgram(int id, const CustomFilterProgramInfo& programInfo) >+{ >+ ASSERT(!m_customFilterPrograms.contains(id)); >+ m_customFilterPrograms.set(id, CoordinatedCustomFilterProgram::create(programInfo.vertexShaderString(), programInfo.fragmentShaderString(), programInfo.programType(), programInfo.mixSettings(), programInfo.meshType())); >+} >+ >+void TextureMapperScene::removeCustomFilterProgram(int id) >+{ >+ CustomFilterProgramMap::iterator iter = m_customFilterPrograms.find(id); >+ ASSERT(iter != m_customFilterPrograms.end()); >+ if (m_textureMapper) >+ m_textureMapper->removeCachedCustomFilterProgram(iter->value.get()); >+ m_customFilterPrograms.remove(iter); >+} >+#endif // ENABLE(CSS_SHADERS) >+ >+void TextureMapperScene::setLayerState(CoordinatedLayerID id, const CoordinatedLayerInfo& layerInfo) >+{ >+ ASSERT(m_rootLayerID != InvalidCoordinatedLayerID); >+ GraphicsLayer* layer = layerByID(id); >+ >+ layer->setReplicatedByLayer(getLayerByIDIfExists(layerInfo.replica)); >+ layer->setMaskLayer(getLayerByIDIfExists(layerInfo.mask)); >+ >+ layer->setAnchorPoint(layerInfo.anchorPoint); >+ layer->setPosition(layerInfo.pos); >+ layer->setSize(layerInfo.size); >+ >+ layer->setTransform(layerInfo.transform); >+ layer->setChildrenTransform(layerInfo.childrenTransform); >+ layer->setBackfaceVisibility(layerInfo.backfaceVisible); >+ layer->setContentsOpaque(layerInfo.contentsOpaque); >+ layer->setContentsRect(layerInfo.contentsRect); >+ layer->setContentsToSolidColor(layerInfo.solidColor); >+ layer->setDrawsContent(layerInfo.drawsContent); >+ layer->setContentsVisible(layerInfo.contentsVisible); >+ toGraphicsLayerTextureMapper(layer)->setFixedToViewport(layerInfo.fixedToViewport); >+ layer->setShowDebugBorder(layerInfo.showDebugBorders); >+ layer->setDebugBorder(layerInfo.debugBorderColor, layerInfo.debugBorderWidth); >+ layer->setShowRepaintCounter(layerInfo.showRepaintCounter); >+ >+ if (layerInfo.fixedToViewport) >+ m_fixedLayers.add(id, layer); >+ else >+ m_fixedLayers.remove(id); >+ >+ assignImageBackingToLayer(layer, layerInfo.imageID); >+ prepareContentBackingStore(layer); >+ >+ // Never make the root layer clip. >+ layer->setMasksToBounds(layerInfo.isRootLayer ? false : layerInfo.masksToBounds); >+ layer->setOpacity(layerInfo.opacity); >+ layer->setPreserves3D(layerInfo.preserves3D); >+} >+ >+GraphicsLayer* TextureMapperScene::getLayerByIDIfExists(CoordinatedLayerID id) >+{ >+ return (id != InvalidCoordinatedLayerID) ? layerByID(id) : 0; >+} >+ >+void TextureMapperScene::createLayers(const Vector<CoordinatedLayerID>& ids) >+{ >+ for (size_t index = 0; index < ids.size(); ++index) >+ createLayer(ids[index]); >+} >+ >+void TextureMapperScene::createLayer(CoordinatedLayerID id) >+{ >+ OwnPtr<GraphicsLayer> newLayer = GraphicsLayer::create(0 /* factory */, this); >+ toGraphicsLayerTextureMapper(newLayer.get())->setHasOwnBackingStore(false); >+ m_layers.add(id, newLayer.release()); >+} >+ >+void TextureMapperScene::deleteLayers(const Vector<CoordinatedLayerID>& layerIDs) >+{ >+ for (size_t index = 0; index < layerIDs.size(); ++index) >+ deleteLayer(layerIDs[index]); >+} >+ >+void TextureMapperScene::deleteLayer(CoordinatedLayerID layerID) >+{ >+ OwnPtr<GraphicsLayer> layer = m_layers.take(layerID); >+ ASSERT(layer); >+ >+ m_backingStores.remove(layer.get()); >+ m_fixedLayers.remove(layerID); >+#if USE(GRAPHICS_SURFACE) >+ m_surfaceBackingStores.remove(layerID); >+#endif >+} >+ >+void TextureMapperScene::setRootLayerID(CoordinatedLayerID layerID) >+{ >+ ASSERT(layerID != InvalidCoordinatedLayerID); >+ ASSERT(m_rootLayerID == InvalidCoordinatedLayerID); >+ >+ m_rootLayerID = layerID; >+ >+ GraphicsLayer* layer = layerByID(layerID); >+ ASSERT(m_rootLayer->children().isEmpty()); >+ m_rootLayer->addChild(layer); >+} >+ >+void TextureMapperScene::prepareContentBackingStore(GraphicsLayer* graphicsLayer) >+{ >+ if (!layerShouldHaveBackingStore(graphicsLayer)) { >+ removeBackingStoreIfNeeded(graphicsLayer); >+ return; >+ } >+ >+ createBackingStoreIfNeeded(graphicsLayer); >+} >+ >+void TextureMapperScene::createBackingStoreIfNeeded(GraphicsLayer* graphicsLayer) >+{ >+ if (m_backingStores.contains(graphicsLayer)) >+ return; >+ >+ RefPtr<CoordinatedBackingStore> backingStore(CoordinatedBackingStore::create()); >+ backingStore->setSize(graphicsLayer->size()); >+ m_backingStores.add(graphicsLayer, backingStore); >+ toGraphicsLayerTextureMapper(graphicsLayer)->setBackingStore(backingStore); >+} >+ >+void TextureMapperScene::removeBackingStoreIfNeeded(GraphicsLayer* graphicsLayer) >+{ >+ RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.take(graphicsLayer); >+ if (!backingStore) >+ return; >+ >+ toGraphicsLayerTextureMapper(graphicsLayer)->setBackingStore(0); >+} >+ >+void TextureMapperScene::resetBackingStoreSizeToLayerSize(GraphicsLayer* graphicsLayer) >+{ >+ RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(graphicsLayer); >+ ASSERT(backingStore); >+ backingStore->setSize(graphicsLayer->size()); >+} >+ >+void TextureMapperScene::createTile(CoordinatedLayerID layerID, uint32_t tileID, float scale) >+{ >+ GraphicsLayer* layer = layerByID(layerID); >+ RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(layer); >+ ASSERT(backingStore); >+ backingStore->createTile(tileID, scale); >+ resetBackingStoreSizeToLayerSize(layer); >+} >+ >+void TextureMapperScene::removeTile(CoordinatedLayerID layerID, uint32_t tileID) >+{ >+ GraphicsLayer* layer = layerByID(layerID); >+ RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(layer); >+ if (!backingStore) >+ return; >+ >+ backingStore->removeTile(tileID); >+ resetBackingStoreSizeToLayerSize(layer); >+ m_backingStoresWithPendingBuffers.add(backingStore); >+} >+ >+void TextureMapperScene::updateTile(CoordinatedLayerID layerID, uint32_t tileID, const TileUpdate& update) >+{ >+ GraphicsLayer* layer = layerByID(layerID); >+ RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(layer); >+ ASSERT(backingStore); >+ >+ SurfaceMap::iterator it = m_surfaces.find(update.atlasID); >+ ASSERT(it != m_surfaces.end()); >+ >+ backingStore->updateTile(tileID, update.sourceRect, update.tileRect, it->value, update.offset); >+ resetBackingStoreSizeToLayerSize(layer); >+ m_backingStoresWithPendingBuffers.add(backingStore); >+} >+ >+void TextureMapperScene::createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface> surface) >+{ >+ ASSERT(!m_surfaces.contains(atlasID)); >+ m_surfaces.add(atlasID, surface); >+} >+ >+void TextureMapperScene::removeUpdateAtlas(uint32_t atlasID) >+{ >+ ASSERT(m_surfaces.contains(atlasID)); >+ m_surfaces.remove(atlasID); >+} >+ >+void TextureMapperScene::createImageBacking(CoordinatedImageBackingID imageID) >+{ >+ ASSERT(!m_imageBackings.contains(imageID)); >+ RefPtr<CoordinatedBackingStore> backingStore(CoordinatedBackingStore::create()); >+ m_imageBackings.add(imageID, backingStore.release()); >+} >+ >+void TextureMapperScene::updateImageBacking(CoordinatedImageBackingID imageID, PassRefPtr<CoordinatedSurface> surface) >+{ >+ ASSERT(m_imageBackings.contains(imageID)); >+ ImageBackingMap::iterator it = m_imageBackings.find(imageID); >+ RefPtr<CoordinatedBackingStore> backingStore = it->value; >+ >+ // CoordinatedImageBacking is realized to CoordinatedBackingStore with only one tile in UI Process. >+ backingStore->createTile(1 /* id */, 1 /* scale */); >+ IntRect rect(IntPoint::zero(), surface->size()); >+ // See CoordinatedGraphicsLayer::shouldDirectlyCompositeImage() >+ ASSERT(2000 >= std::max(rect.width(), rect.height())); >+ backingStore->setSize(rect.size()); >+ backingStore->updateTile(1 /* id */, rect, rect, surface, rect.location()); >+ >+ m_backingStoresWithPendingBuffers.add(backingStore); >+} >+ >+void TextureMapperScene::clearImageBackingContents(CoordinatedImageBackingID imageID) >+{ >+ ASSERT(m_imageBackings.contains(imageID)); >+ ImageBackingMap::iterator it = m_imageBackings.find(imageID); >+ RefPtr<CoordinatedBackingStore> backingStore = it->value; >+ backingStore->removeAllTiles(); >+ m_backingStoresWithPendingBuffers.add(backingStore); >+} >+ >+void TextureMapperScene::removeImageBacking(CoordinatedImageBackingID imageID) >+{ >+ ASSERT(m_imageBackings.contains(imageID)); >+ >+ // We don't want TextureMapperLayer refers a dangling pointer. >+ m_releasedImageBackings.append(m_imageBackings.take(imageID)); >+} >+ >+void TextureMapperScene::assignImageBackingToLayer(GraphicsLayer* layer, CoordinatedImageBackingID imageID) >+{ >+ if (imageID == InvalidCoordinatedImageBackingID) { >+ layer->setContentsToMedia(0); >+ return; >+ } >+ ImageBackingMap::iterator it = m_imageBackings.find(imageID); >+ ASSERT(it != m_imageBackings.end()); >+ layer->setContentsToMedia(it->value.get()); >+} >+ >+void TextureMapperScene::removeReleasedImageBackingsIfNeeded() >+{ >+ m_releasedImageBackings.clear(); >+} >+ >+void TextureMapperScene::commitPendingBackingStoreOperations() >+{ >+ HashSet<RefPtr<CoordinatedBackingStore> >::iterator end = m_backingStoresWithPendingBuffers.end(); >+ for (HashSet<RefPtr<CoordinatedBackingStore> >::iterator it = m_backingStoresWithPendingBuffers.begin(); it != end; ++it) >+ (*it)->commitTileOperations(m_textureMapper.get()); >+ >+ m_backingStoresWithPendingBuffers.clear(); >+} >+ >+void TextureMapperScene::flushLayerChanges() >+{ >+ m_renderedContentsScrollPosition = m_pendingRenderedContentsScrollPosition; >+ >+ // Since the frame has now been rendered, we can safely unlock the animations until the next layout. >+ setAnimationsLocked(false); >+ >+ m_rootLayer->flushCompositingState(FloatRect()); >+ commitPendingBackingStoreOperations(); >+ removeReleasedImageBackingsIfNeeded(); >+ >+ // The pending tiles state is on its way for the screen, tell the web process to render the next one. >+ dispatchOnMainThread(bind(&TextureMapperScene::renderNextFrame, this)); >+} >+ >+void TextureMapperScene::renderNextFrame() >+{ >+ if (m_client) >+ m_client->renderNextFrame(); >+} >+ >+void TextureMapperScene::ensureRootLayer() >+{ >+ if (m_rootLayer) >+ return; >+ >+ m_rootLayer = GraphicsLayer::create(0 /* factory */, this); >+ m_rootLayer->setMasksToBounds(false); >+ m_rootLayer->setDrawsContent(false); >+ m_rootLayer->setAnchorPoint(FloatPoint3D(0, 0, 0)); >+ >+ // The root layer should not have zero size, or it would be optimized out. >+ m_rootLayer->setSize(FloatSize(1.0, 1.0)); >+ >+ ASSERT(m_textureMapper); >+ toTextureMapperLayer(m_rootLayer.get())->setTextureMapper(m_textureMapper.get()); >+} >+ >+void TextureMapperScene::syncRemoteContent() >+{ >+ // We enqueue messages and execute them during paint, as they require an active GL context. >+ ensureRootLayer(); >+ >+ Vector<Function<void()> > renderQueue; >+ bool calledOnMainThread = WTF::isMainThread(); >+ if (!calledOnMainThread) >+ m_renderQueueMutex.lock(); >+ renderQueue.swap(m_renderQueue); >+ if (!calledOnMainThread) >+ m_renderQueueMutex.unlock(); >+ >+ for (size_t i = 0; i < renderQueue.size(); ++i) >+ renderQueue[i](); >+} >+ >+void TextureMapperScene::purgeGLResources() >+{ >+ m_imageBackings.clear(); >+ m_releasedImageBackings.clear(); >+#if USE(GRAPHICS_SURFACE) >+ m_surfaceBackingStores.clear(); >+#endif >+ m_surfaces.clear(); >+ >+ m_rootLayer.clear(); >+ m_rootLayerID = InvalidCoordinatedLayerID; >+ m_layers.clear(); >+ m_fixedLayers.clear(); >+ m_textureMapper.clear(); >+ m_backingStores.clear(); >+ m_backingStoresWithPendingBuffers.clear(); >+ >+ setActive(false); >+ dispatchOnMainThread(bind(&TextureMapperScene::purgeBackingStores, this)); >+} >+ >+void TextureMapperScene::purgeBackingStores() >+{ >+ if (m_client) >+ m_client->purgeBackingStores(); >+} >+ >+void TextureMapperScene::setLayerAnimations(CoordinatedLayerID id, const GraphicsLayerAnimations& animations) >+{ >+ GraphicsLayerTextureMapper* layer = toGraphicsLayerTextureMapper(layerByID(id)); >+#if ENABLE(CSS_SHADERS) >+ for (size_t i = 0; i < animations.animations().size(); ++i) { >+ const KeyframeValueList& keyframes = animations.animations().at(i).keyframes(); >+ if (keyframes.property() != AnimatedPropertyWebkitFilter) >+ continue; >+ for (size_t j = 0; j < keyframes.size(); ++j) { >+ const FilterAnimationValue* filterValue = static_cast<const FilterAnimationValue*>(keyframes.at(i)); >+ injectCachedCustomFilterPrograms(*filterValue->value()); >+ } >+ } >+#endif >+ layer->setAnimations(animations); >+} >+ >+void TextureMapperScene::setAnimationsLocked(bool locked) >+{ >+ m_animationsLocked = locked; >+} >+ >+void TextureMapperScene::detach() >+{ >+ ASSERT(isMainThread()); >+ m_client = 0; >+} >+ >+void TextureMapperScene::appendUpdate(const Function<void()>& function) >+{ >+ if (!m_isActive) >+ return; >+ >+ ASSERT(isMainThread()); >+ MutexLocker locker(m_renderQueueMutex); >+ m_renderQueue.append(function); >+} >+ >+void TextureMapperScene::setActive(bool active) >+{ >+ if (m_isActive == active) >+ return; >+ >+ // Have to clear render queue in both cases. >+ // If there are some updates in queue during activation then those updates are from previous instance of paint node >+ // and cannot be applied to the newly created instance. >+ m_renderQueue.clear(); >+ m_isActive = active; >+ if (m_isActive) >+ dispatchOnMainThread(bind(&TextureMapperScene::renderNextFrame, this)); >+} >+ >+void TextureMapperScene::setBackgroundColor(const Color& color) >+{ >+ m_backgroundColor = color; >+} >+ >+} // namespace WebCore >+ >+#endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/TextureMapperScene.h b/Source/WebCore/platform/graphics/texmap/coordinated/TextureMapperScene.h >new file mode 100644 >index 0000000000000000000000000000000000000000..081b8b081d02a6811ed807d9b8240b802cf8719d >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/TextureMapperScene.h >@@ -0,0 +1,230 @@ >+/* >+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >+ >+ This library is free software; you can redistribute it and/or >+ modify it under the terms of the GNU Library General Public >+ License as published by the Free Software Foundation; either >+ version 2 of the License, or (at your option) any later version. >+ >+ This library is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ Library General Public License for more details. >+ >+ You should have received a copy of the GNU Library General Public License >+ along with this library; see the file COPYING.LIB. If not, write to >+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ Boston, MA 02110-1301, USA. >+*/ >+ >+#ifndef TextureMapperScene_h >+#define TextureMapperScene_h >+ >+#if USE(COORDINATED_GRAPHICS) >+#include "CoordinatedLayerInfo.h" >+#include "CoordinatedSurface.h" >+#include "GraphicsContext.h" >+#include "GraphicsLayer.h" >+#include "GraphicsLayerAnimation.h" >+#include "GraphicsSurface.h" >+#include "IntRect.h" >+#include "IntSize.h" >+#include "RunLoop.h" >+#include "TextureMapper.h" >+#include "TextureMapperBackingStore.h" >+#include "Timer.h" >+#include <wtf/Functional.h> >+#include <wtf/HashSet.h> >+#include <wtf/ThreadingPrimitives.h> >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+class CoordinatedBackingStore; >+class CoordinatedLayerInfo; >+class CustomFilterProgram; >+class CustomFilterProgramInfo; >+class TextureMapperLayer; >+ >+class TextureMapperSceneClient { >+public: >+#if ENABLE(REQUEST_ANIMATION_FRAME) >+ virtual void animationFrameReady() = 0; >+#endif >+ virtual void purgeBackingStores() = 0; >+ virtual void renderNextFrame() = 0; >+ virtual void updateViewport() = 0; >+}; >+ >+class TextureMapperScene : public ThreadSafeRefCounted<TextureMapperScene>, public GraphicsLayerClient { >+public: >+ struct TileUpdate { >+ IntRect sourceRect; >+ IntRect tileRect; >+ uint32_t atlasID; >+ IntPoint offset; >+ TileUpdate(const IntRect& source, const IntRect& tile, uint32_t atlas, const IntPoint& newOffset) >+ : sourceRect(source) >+ , tileRect(tile) >+ , atlasID(atlas) >+ , offset(newOffset) >+ { >+ } >+ }; >+ explicit TextureMapperScene(TextureMapperSceneClient*); >+ virtual ~TextureMapperScene(); >+ void paintToCurrentGLContext(const TransformationMatrix&, float, const FloatRect&, TextureMapper::PaintFlags = 0); >+#if PLATFORM(QT) >+ void paintToGraphicsContext(QPainter*); >+#elif USE(CAIRO) >+ void paintToGraphicsContext(cairo_t*); >+#endif >+ void setContentsSize(const FloatSize&); >+ void setVisibleContentsRect(const FloatRect&); >+ void didChangeScrollPosition(const FloatPoint& position); >+#if USE(GRAPHICS_SURFACE) >+ void createCanvas(CoordinatedLayerID, const IntSize&, PassRefPtr<GraphicsSurface>); >+ void syncCanvas(CoordinatedLayerID, uint32_t frontBuffer); >+ void destroyCanvas(CoordinatedLayerID); >+#endif >+ void setLayerRepaintCount(CoordinatedLayerID, int value); >+ >+ void detach(); >+ void appendUpdate(const Function<void()>&); >+ >+ // The painting thread must lock the main thread to use below two methods, because two methods access members that the main thread manages. See m_client. >+ // Currently, QQuickWebPage::updatePaintNode() locks the main thread before calling both methods. >+ void purgeGLResources(); >+ void setActive(bool); >+ >+ void createLayers(const Vector<CoordinatedLayerID>&); >+ void deleteLayers(const Vector<CoordinatedLayerID>&); >+ void setRootLayerID(CoordinatedLayerID); >+ void setLayerChildren(CoordinatedLayerID, const Vector<CoordinatedLayerID>&); >+ void setLayerState(CoordinatedLayerID, const CoordinatedLayerInfo&); >+#if ENABLE(CSS_FILTERS) >+ void setLayerFilters(CoordinatedLayerID, const FilterOperations&); >+#endif >+#if ENABLE(CSS_SHADERS) >+ void injectCachedCustomFilterPrograms(const FilterOperations& filters) const; >+ void createCustomFilterProgram(int id, const CustomFilterProgramInfo&); >+ void removeCustomFilterProgram(int id); >+#endif >+ >+ void createTile(CoordinatedLayerID, uint32_t tileID, float scale); >+ void removeTile(CoordinatedLayerID, uint32_t tileID); >+ void updateTile(CoordinatedLayerID, uint32_t tileID, const TileUpdate&); >+ void createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface>); >+ void removeUpdateAtlas(uint32_t atlasID); >+ void flushLayerChanges(); >+ void createImageBacking(CoordinatedImageBackingID); >+ void updateImageBacking(CoordinatedImageBackingID, PassRefPtr<CoordinatedSurface>); >+ void clearImageBackingContents(CoordinatedImageBackingID); >+ void removeImageBacking(CoordinatedImageBackingID); >+ void setLayerAnimations(CoordinatedLayerID, const GraphicsLayerAnimations&); >+ void setAnimationsLocked(bool); >+ void setBackgroundColor(const Color&); >+ void setDrawsBackground(bool enable) { m_setDrawsBackground = enable; } >+ >+#if ENABLE(REQUEST_ANIMATION_FRAME) >+ void requestAnimationFrame(); >+#endif >+ >+private: >+ GraphicsLayer* layerByID(CoordinatedLayerID id) >+ { >+ ASSERT(m_layers.contains(id)); >+ ASSERT(id != InvalidCoordinatedLayerID); >+ return m_layers.get(id); >+ } >+ GraphicsLayer* getLayerByIDIfExists(CoordinatedLayerID); >+ GraphicsLayer* rootLayer() { return m_rootLayer.get(); } >+ >+ void syncRemoteContent(); >+ void adjustPositionForFixedLayers(); >+ >+ // Reimplementations from GraphicsLayerClient. >+ virtual void notifyAnimationStarted(const GraphicsLayer*, double) { } >+ virtual void notifyFlushRequired(const GraphicsLayer*) { } >+ virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect&) OVERRIDE { } >+ >+ void dispatchOnMainThread(const Function<void()>&); >+ void updateViewport(); >+#if ENABLE(REQUEST_ANIMATION_FRAME) >+ void animationFrameReady(); >+#endif >+ void renderNextFrame(); >+ void purgeBackingStores(); >+ >+ void createLayer(CoordinatedLayerID); >+ void deleteLayer(CoordinatedLayerID); >+ >+ void assignImageBackingToLayer(GraphicsLayer*, CoordinatedImageBackingID); >+ void removeReleasedImageBackingsIfNeeded(); >+ void ensureRootLayer(); >+ void commitPendingBackingStoreOperations(); >+ >+ void prepareContentBackingStore(GraphicsLayer*); >+ void createBackingStoreIfNeeded(GraphicsLayer*); >+ void removeBackingStoreIfNeeded(GraphicsLayer*); >+ void resetBackingStoreSizeToLayerSize(GraphicsLayer*); >+ >+ FloatSize m_contentsSize; >+ FloatRect m_visibleContentsRect; >+ >+ // Render queue can be accessed ony from main thread or updatePaintNode call stack! >+ Vector<Function<void()> > m_renderQueue; >+ Mutex m_renderQueueMutex; >+ >+ OwnPtr<TextureMapper> m_textureMapper; >+ >+ typedef HashMap<CoordinatedImageBackingID, RefPtr<CoordinatedBackingStore> > ImageBackingMap; >+ ImageBackingMap m_imageBackings; >+ Vector<RefPtr<CoordinatedBackingStore> > m_releasedImageBackings; >+ >+ typedef HashMap<GraphicsLayer*, RefPtr<CoordinatedBackingStore> > BackingStoreMap; >+ BackingStoreMap m_backingStores; >+ >+ HashSet<RefPtr<CoordinatedBackingStore> > m_backingStoresWithPendingBuffers; >+ >+#if USE(GRAPHICS_SURFACE) >+ typedef HashMap<CoordinatedLayerID, RefPtr<TextureMapperSurfaceBackingStore> > SurfaceBackingStoreMap; >+ SurfaceBackingStoreMap m_surfaceBackingStores; >+#endif >+ >+ typedef HashMap<uint32_t /* atlasID */, RefPtr<CoordinatedSurface> > SurfaceMap; >+ SurfaceMap m_surfaces; >+ >+ // Below two members are accessed by only the main thread. The painting thread must lock the main thread to access both members. >+ TextureMapperSceneClient* m_client; >+ bool m_isActive; >+ >+ OwnPtr<GraphicsLayer> m_rootLayer; >+ >+ typedef HashMap<CoordinatedLayerID, OwnPtr<GraphicsLayer> > LayerMap; >+ LayerMap m_layers; >+ typedef HashMap<CoordinatedLayerID, GraphicsLayer*> LayerRawPtrMap; >+ LayerRawPtrMap m_fixedLayers; >+ CoordinatedLayerID m_rootLayerID; >+ FloatPoint m_renderedContentsScrollPosition; >+ FloatPoint m_pendingRenderedContentsScrollPosition; >+ bool m_animationsLocked; >+#if ENABLE(REQUEST_ANIMATION_FRAME) >+ bool m_animationFrameRequested; >+#endif >+ Color m_backgroundColor; >+ bool m_setDrawsBackground; >+ >+#if ENABLE(CSS_SHADERS) >+ typedef HashMap<int, RefPtr<CustomFilterProgram> > CustomFilterProgramMap; >+ CustomFilterProgramMap m_customFilterPrograms; >+#endif >+}; >+ >+} // namespace WebCore >+ >+#endif // USE(COORDINATED_GRAPHICS) >+ >+#endif // TextureMapperScene_h >+ >+ >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..364f06871082b58fcbd83a0ef31450be4800848b >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.cpp >@@ -0,0 +1,94 @@ >+/* >+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >+ Copyright (C) 2012 Company 100, Inc. >+ >+ This library is free software; you can redistribute it and/or >+ modify it under the terms of the GNU Library General Public >+ License as published by the Free Software Foundation; either >+ version 2 of the License, or (at your option) any later version. >+ >+ This library is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ Library General Public License for more details. >+ >+ You should have received a copy of the GNU Library General Public License >+ along with this library; see the file COPYING.LIB. If not, write to >+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ Boston, MA 02110-1301, USA. >+ */ >+ >+#include "config.h" >+#include "UpdateAtlas.h" >+ >+#if USE(COORDINATED_GRAPHICS) >+ >+#include "GraphicsContext.h" >+#include "IntRect.h" >+#include <wtf/MathExtras.h> >+ >+namespace WebCore { >+ >+UpdateAtlas::UpdateAtlas(UpdateAtlasClient* client, int dimension, CoordinatedSurface::Flags flags) >+ : m_client(client) >+ , m_inactivityInSeconds(0) >+{ >+ static uint32_t nextID = 0; >+ m_ID = ++nextID; >+ IntSize size = nextPowerOfTwo(IntSize(dimension, dimension)); >+ m_surface = CoordinatedSurface::create(size, flags); >+ >+ // FIXME: Currently, if sending the message fails, UpdateAtlas gives up drawing anything implicitly. >+ if (!m_client->createUpdateAtlas(m_ID, m_surface)) >+ m_surface.clear(); >+} >+ >+UpdateAtlas::~UpdateAtlas() >+{ >+ if (m_surface) >+ m_client->removeUpdateAtlas(m_ID); >+} >+ >+void UpdateAtlas::buildLayoutIfNeeded() >+{ >+ if (!m_areaAllocator) { >+ m_areaAllocator = adoptPtr(new GeneralAreaAllocator(size())); >+ m_areaAllocator->setMinimumAllocation(IntSize(32, 32)); >+ } >+} >+ >+void UpdateAtlas::didSwapBuffers() >+{ >+ m_areaAllocator.clear(); >+} >+ >+PassOwnPtr<GraphicsContext> UpdateAtlas::beginPaintingOnAvailableBuffer(uint32_t& atlasID, const IntSize& size, IntPoint& offset) >+{ >+ m_inactivityInSeconds = 0; >+ buildLayoutIfNeeded(); >+ IntRect rect = m_areaAllocator->allocate(size); >+ >+ // No available buffer was found, returning null. >+ if (rect.isEmpty()) >+ return PassOwnPtr<GraphicsContext>(); >+ >+ if (!m_surface) >+ return PassOwnPtr<GraphicsContext>(); >+ >+ atlasID = m_ID; >+ >+ // FIXME: Use tri-state buffers, to allow faster updates. >+ offset = rect.location(); >+ OwnPtr<GraphicsContext> graphicsContext = m_surface->createGraphicsContext(rect); >+ >+ if (supportsAlpha()) { >+ graphicsContext->setCompositeOperation(CompositeCopy); >+ graphicsContext->fillRect(IntRect(IntPoint::zero(), size), Color::transparent, ColorSpaceDeviceRGB); >+ graphicsContext->setCompositeOperation(CompositeSourceOver); >+ } >+ >+ return graphicsContext.release(); >+} >+ >+} // namespace WebCore >+#endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.h b/Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.h >new file mode 100644 >index 0000000000000000000000000000000000000000..48a6bf844a490f7fd2c39a0424e330fddb16d78b >--- /dev/null >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.h >@@ -0,0 +1,78 @@ >+/* >+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >+ Copyright (C) 2012 Company 100, Inc. >+ >+ This library is free software; you can redistribute it and/or >+ modify it under the terms of the GNU Library General Public >+ License as published by the Free Software Foundation; either >+ version 2 of the License, or (at your option) any later version. >+ >+ This library is distributed in the hope that it will be useful, >+ but WITHOUT ANY WARRANTY; without even the implied warranty of >+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ Library General Public License for more details. >+ >+ You should have received a copy of the GNU Library General Public License >+ along with this library; see the file COPYING.LIB. If not, write to >+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ Boston, MA 02110-1301, USA. >+ */ >+ >+#ifndef UpdateAtlas_h >+#define UpdateAtlas_h >+ >+#include "AreaAllocator.h" >+#include "CoordinatedSurface.h" >+#include "IntSize.h" >+ >+#if USE(COORDINATED_GRAPHICS) >+ >+namespace WebCore { >+class GraphicsContext; >+class IntPoint; >+ >+class UpdateAtlasClient { >+public: >+ virtual bool createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface>) = 0; >+ virtual void removeUpdateAtlas(uint32_t atlasID) = 0; >+}; >+ >+class UpdateAtlas { >+ WTF_MAKE_NONCOPYABLE(UpdateAtlas); >+public: >+ UpdateAtlas(UpdateAtlasClient*, int dimension, CoordinatedSurface::Flags); >+ ~UpdateAtlas(); >+ >+ inline IntSize size() const { return m_surface->size(); } >+ >+ // Returns a null pointer of there is no available buffer. >+ PassOwnPtr<GraphicsContext> beginPaintingOnAvailableBuffer(uint32_t& atlasID, const IntSize&, IntPoint& offset); >+ void didSwapBuffers(); >+ bool supportsAlpha() const { return m_surface->supportsAlpha(); } >+ >+ void addTimeInactive(double seconds) >+ { >+ ASSERT(!isInUse()); >+ m_inactivityInSeconds += seconds; >+ } >+ bool isInactive() const >+ { >+ const double inactiveSecondsTolerance = 3; >+ return m_inactivityInSeconds > inactiveSecondsTolerance; >+ } >+ bool isInUse() const { return m_areaAllocator; } >+ >+private: >+ void buildLayoutIfNeeded(); >+ >+private: >+ UpdateAtlasClient* m_client; >+ OwnPtr<GeneralAreaAllocator> m_areaAllocator; >+ RefPtr<CoordinatedSurface> m_surface; >+ double m_inactivityInSeconds; >+ uint32_t m_ID; >+}; >+ >+} // namespace WebCore >+#endif // USE(COORDINATED_GRAPHICS) >+#endif // UpdateAtlas_h >diff --git a/Source/WebKit2/CMakeLists.txt b/Source/WebKit2/CMakeLists.txt >index 8fdda376786b0c48b458a06da01a370444cf8ac1..d2b99a24f74aa472e535b0637c01d5c90ab58251 100644 >--- a/Source/WebKit2/CMakeLists.txt >+++ b/Source/WebKit2/CMakeLists.txt >@@ -224,7 +224,6 @@ set(WebKit2_SOURCES > Shared/API/c/WKUserContentURLPattern.cpp > > Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp >- Shared/CoordinatedGraphics/CoordinatedSurface.cpp > Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp > Shared/CoordinatedGraphics/WebCustomFilterProgramProxy.cpp > >@@ -352,9 +351,7 @@ set(WebKit2_SOURCES > UIProcess/Authentication/WebCredential.cpp > UIProcess/Authentication/WebProtectionSpace.cpp > >- UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp > UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp >- UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp > > UIProcess/Downloads/DownloadProxy.cpp > UIProcess/Downloads/DownloadProxyMap.cpp >@@ -505,12 +502,7 @@ set(WebKit2_SOURCES > WebProcess/WebPage/WebPageGroupProxy.cpp > WebProcess/WebPage/WebUndoStep.cpp > >- WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp >- WebProcess/WebPage/CoordinatedGraphics/CoordinatedImageBacking.cpp >- WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp >- WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.cpp > WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp >- WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp > ) > > set(WebKit2_MESSAGES_IN_FILES >diff --git a/Source/WebKit2/Scripts/webkit2/messages.py b/Source/WebKit2/Scripts/webkit2/messages.py >index fabaec460bfe9e814c686545216af943125d5dd8..5fb80b4320f3e2c801d605f25efe18b40059af71 100644 >--- a/Source/WebKit2/Scripts/webkit2/messages.py >+++ b/Source/WebKit2/Scripts/webkit2/messages.py >@@ -371,6 +371,7 @@ def headers_for_type(type): > special_cases = { > 'WTF::String': ['<wtf/text/WTFString.h>'], > 'WebCore::CompositionUnderline': ['<WebCore/Editor.h>'], >+ 'WebCore::CoordinatedLayerID': ['<WebCore/CoordinatedLayerInfo.h>'], > 'WebCore::GrammarDetail': ['<WebCore/TextCheckerClient.h>'], > 'WebCore::GraphicsLayerAnimations': ['<WebCore/GraphicsLayerAnimation.h>'], > 'WebCore::KeyframeValueList': ['<WebCore/GraphicsLayer.h>'], >@@ -379,7 +380,6 @@ def headers_for_type(type): > 'WebCore::PluginInfo': ['<WebCore/PluginData.h>'], > 'WebCore::TextCheckingResult': ['<WebCore/TextCheckerClient.h>'], > 'WebCore::ViewportAttributes': ['<WebCore/ViewportArguments.h>'], >- 'WebKit::CoordinatedLayerID': ['"CoordinatedLayerInfo.h"'], > 'WebKit::InjectedBundleUserMessageEncoder': [], > 'WebKit::WebContextUserMessageEncoder': [], > 'WebKit::WebGestureEvent': ['"WebEvent.h"'], >diff --git a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp b/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp >index e5ab34586f47437181b7c43521c4e07b04b0bf42..c3371d2c084e052dedcf64eff4bd147500e9b54b 100644 >--- a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp >+++ b/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp >@@ -29,11 +29,10 @@ > #include "CoordinatedGraphicsArgumentCoders.h" > > #if USE(COORDINATED_GRAPHICS) >-#include "CoordinatedLayerInfo.h" >-#include "SurfaceUpdateInfo.h" > #include "WebCoreArgumentCoders.h" > #include <WebCore/Animation.h> > #include <WebCore/Color.h> >+#include <WebCore/CoordinatedLayerInfo.h> > #include <WebCore/FloatPoint3D.h> > #include <WebCore/GraphicsLayerAnimation.h> > #include <WebCore/IdentityTransformOperation.h> >@@ -45,6 +44,7 @@ > #include <WebCore/RotateTransformOperation.h> > #include <WebCore/ScaleTransformOperation.h> > #include <WebCore/SkewTransformOperation.h> >+#include <WebCore/SurfaceUpdateInfo.h> > #include <WebCore/TimingFunction.h> > #include <WebCore/TransformationMatrix.h> > #include <WebCore/TranslateTransformOperation.h> >@@ -54,9 +54,9 @@ > #endif > > #if ENABLE(CSS_SHADERS) >-#include "WebCustomFilterOperation.h" >-#include "WebCustomFilterProgram.h" > #include "WebCustomFilterProgramProxy.h" >+#include <WebCore/CoordinatedCustomFilterOperation.h> >+#include <WebCore/CoordinatedCustomFilterProgram.h> > #include <WebCore/CustomFilterArrayParameter.h> > #include <WebCore/CustomFilterConstants.h> > #include <WebCore/CustomFilterNumberParameter.h> >@@ -73,7 +73,9 @@ > #endif > > using namespace WebCore; >+#if ENABLE(CSS_SHADERS) > using namespace WebKit; >+#endif > > namespace CoreIPC { > >@@ -329,7 +331,7 @@ bool ArgumentCoder<WebCore::FilterOperations>::decode(ArgumentDecoder* decoder, > return false; > > // At this point the Shaders are already validated, so we just use WebCustomFilterOperation for transportation. >- filter = WebCustomFilterOperation::create(0, programID, parameters, meshRows, meshColumns, meshType); >+ filter = CoordinatedCustomFilterOperation::create(0, programID, parameters, meshRows, meshColumns, meshType); > break; > } > #endif >diff --git a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h b/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h >index 0b5e14cc17996e65d946afdb92a14a8bf2ebfcfc..2aefc6574ff3ea41113fc1e42c01918f4241bf67 100644 >--- a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h >+++ b/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h >@@ -32,11 +32,13 @@ > #include "ArgumentCoders.h" > > namespace WebCore { >+class SurfaceUpdateInfo; > class FloatPoint3D; > class GraphicsLayerAnimation; > class GraphicsLayerAnimations; > class TransformationMatrix; > class TransformOperations; >+struct CoordinatedLayerInfo; > struct Length; > > #if ENABLE(CSS_FILTERS) >@@ -52,11 +54,6 @@ struct GraphicsSurfaceToken; > #endif > } > >-namespace WebKit { >-struct CoordinatedLayerInfo; >-class SurfaceUpdateInfo; >-} >- > namespace CoreIPC { > > template<> struct ArgumentCoder<WebCore::FloatPoint3D> { >@@ -110,14 +107,14 @@ template<> struct ArgumentCoder<WebCore::GraphicsSurfaceToken> { > }; > #endif > >-template<> struct ArgumentCoder<WebKit::CoordinatedLayerInfo> { >- static void encode(ArgumentEncoder&, const WebKit::CoordinatedLayerInfo&); >- static bool decode(ArgumentDecoder*, WebKit::CoordinatedLayerInfo&); >+template<> struct ArgumentCoder<WebCore::CoordinatedLayerInfo> { >+ static void encode(ArgumentEncoder&, const WebCore::CoordinatedLayerInfo&); >+ static bool decode(ArgumentDecoder*, WebCore::CoordinatedLayerInfo&); > }; > >-template<> struct ArgumentCoder<WebKit::SurfaceUpdateInfo> { >- static void encode(ArgumentEncoder&, const WebKit::SurfaceUpdateInfo&); >- static bool decode(ArgumentDecoder*, WebKit::SurfaceUpdateInfo&); >+template<> struct ArgumentCoder<WebCore::SurfaceUpdateInfo> { >+ static void encode(ArgumentEncoder&, const WebCore::SurfaceUpdateInfo&); >+ static bool decode(ArgumentDecoder*, WebCore::SurfaceUpdateInfo&); > }; > > } // namespace CoreIPC >diff --git a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedLayerInfo.h b/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedLayerInfo.h >deleted file mode 100644 >index 415fbb66a802581b48c903d48b5e183984c13e4f..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedLayerInfo.h >+++ /dev/null >@@ -1,85 +0,0 @@ >-/* >- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) >- >- This library is free software; you can redistribute it and/or >- modify it under the terms of the GNU Library General Public >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Library General Public License for more details. >- >- You should have received a copy of the GNU Library General Public License >- along with this library; see the file COPYING.LIB. If not, write to >- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- Boston, MA 02110-1301, USA. >- */ >- >-#ifndef CoordinatedLayerInfo_h >-#define CoordinatedLayerInfo_h >- >-#if USE(COORDINATED_GRAPHICS) >- >-#include "Color.h" >-#include "FloatRect.h" >-#include "FloatSize.h" >-#include "IntRect.h" >-#include "TransformationMatrix.h" >- >-namespace WebKit { >- >-typedef uint32_t CoordinatedLayerID; >-enum { InvalidCoordinatedLayerID = 0 }; >- >-typedef uint64_t CoordinatedImageBackingID; >-enum { InvalidCoordinatedImageBackingID = 0 }; >- >-// NOTE: CoordinatedLayerInfo should only use POD types, as to make serialization faster. >-struct CoordinatedLayerInfo { >- CoordinatedLayerInfo() >- : replica(InvalidCoordinatedLayerID) >- , mask(InvalidCoordinatedLayerID) >- , imageID(InvalidCoordinatedImageBackingID) >- , opacity(0) >- , debugBorderWidth(0) >- , flags(0) { } >- >- CoordinatedLayerID replica; >- CoordinatedLayerID mask; >- CoordinatedImageBackingID imageID; >- >- WebCore::FloatPoint pos; >- WebCore::FloatPoint3D anchorPoint; >- WebCore::FloatSize size; >- WebCore::TransformationMatrix transform; >- WebCore::TransformationMatrix childrenTransform; >- WebCore::IntRect contentsRect; >- float opacity; >- WebCore::Color solidColor; >- WebCore::Color debugBorderColor; >- float debugBorderWidth; >- >- union { >- struct { >- bool contentsOpaque : 1; >- bool drawsContent : 1; >- bool contentsVisible : 1; >- bool backfaceVisible : 1; >- bool masksToBounds : 1; >- bool preserves3D : 1; >- bool isRootLayer: 1; >- bool fixedToViewport : 1; >- bool showDebugBorders : 1; >- bool showRepaintCounter : 1; >- }; >- unsigned flags; >- }; >-}; >- >-} >- >-#endif // USE(COORDINATED_GRAPHICS) >- >-#endif // CoordinatedLayerInfo_h >diff --git a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedSurface.cpp b/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedSurface.cpp >deleted file mode 100644 >index 86a2d55a76e9061792efc9669c74d8862810ea85..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedSurface.cpp >+++ /dev/null >@@ -1,48 +0,0 @@ >-/* >- * Copyright (C) 2013 Company 100, Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "CoordinatedSurface.h" >- >-#if USE(COORDINATED_GRAPHICS) >- >-namespace WebKit { >- >-CoordinatedSurface::Factory* CoordinatedSurface::s_factory = 0; >- >-void CoordinatedSurface::setFactory(CoordinatedSurface::Factory factory) >-{ >- s_factory = factory; >-} >- >-PassRefPtr<CoordinatedSurface> CoordinatedSurface::create(const WebCore::IntSize& size, Flags flags) >-{ >- ASSERT(s_factory); >- return s_factory(size, flags); >-} >- >-} // namespace WebKit >- >-#endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedSurface.h b/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedSurface.h >deleted file mode 100644 >index 34b17ced199b37bf444f3793f104b85d397d218b..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedSurface.h >+++ /dev/null >@@ -1,71 +0,0 @@ >-/* >- Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >- Copyright (C) 2012 Company 100, Inc. >- >- This library is free software; you can redistribute it and/or >- modify it under the terms of the GNU Library General Public >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Library General Public License for more details. >- >- You should have received a copy of the GNU Library General Public License >- along with this library; see the file COPYING.LIB. If not, write to >- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- Boston, MA 02110-1301, USA. >- */ >- >-#ifndef CoordinatedSurface_h >-#define CoordinatedSurface_h >- >-#if USE(COORDINATED_GRAPHICS) >-#include "IntRect.h" >-#include <wtf/PassOwnPtr.h> >-#include <wtf/PassRefPtr.h> >-#include <wtf/ThreadSafeRefCounted.h> >- >-namespace WebCore { >-class BitmapTexture; >-class GraphicsContext; >-} >- >-namespace WebKit { >- >-class CoordinatedSurface : public ThreadSafeRefCounted<CoordinatedSurface> { >-public: >- enum Flag { >- NoFlags = 0, >- SupportsAlpha = 1 << 0, >- }; >- typedef unsigned Flags; >- >- typedef PassRefPtr<CoordinatedSurface> Factory(const WebCore::IntSize&, Flags); >- static void setFactory(Factory); >- static PassRefPtr<CoordinatedSurface> create(const WebCore::IntSize&, Flags); >- >- virtual ~CoordinatedSurface() { } >- >- bool supportsAlpha() const { return flags() & SupportsAlpha; } >- virtual WebCore::IntSize size() const = 0; >- >- // Create a graphics context that can be used to paint into the backing store. >- virtual PassOwnPtr<WebCore::GraphicsContext> createGraphicsContext(const WebCore::IntRect&) = 0; >- >-#if USE(TEXTURE_MAPPER) >- virtual void copyToTexture(PassRefPtr<WebCore::BitmapTexture>, const WebCore::IntRect& target, const WebCore::IntPoint& sourceOffset) = 0; >-#endif >- >-protected: >- virtual Flags flags() const = 0; >- >-private: >- static CoordinatedSurface::Factory* s_factory; >-}; >- >-} // namespace WebKit >- >-#endif >-#endif // CoordinatedSurface_h >diff --git a/Source/WebKit2/Shared/CoordinatedGraphics/SurfaceUpdateInfo.h b/Source/WebKit2/Shared/CoordinatedGraphics/SurfaceUpdateInfo.h >deleted file mode 100644 >index 27289fcdf0ffb9fee06e044198483170f832fb29..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Shared/CoordinatedGraphics/SurfaceUpdateInfo.h >+++ /dev/null >@@ -1,53 +0,0 @@ >-/* >- Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >- >- This library is free software; you can redistribute it and/or >- modify it under the terms of the GNU Library General Public >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Library General Public License for more details. >- >- You should have received a copy of the GNU Library General Public License >- along with this library; see the file COPYING.LIB. If not, write to >- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- Boston, MA 02110-1301, USA. >- */ >- >-#ifndef SurfaceUpdateInfo_h >-#define SurfaceUpdateInfo_h >- >-#if USE(COORDINATED_GRAPHICS) >- >-#include <WebCore/IntRect.h> >-#include <wtf/Noncopyable.h> >- >-namespace WebKit { >- >-class SurfaceUpdateInfo { >- WTF_MAKE_NONCOPYABLE(SurfaceUpdateInfo); >- >-public: >- SurfaceUpdateInfo() { } >- >- // The rect to be updated. >- WebCore::IntRect updateRect; >- >- // The page scale factor used to render this update. >- float scaleFactor; >- >- // The id of the update atlas including the shareable bitmap containing the updates. >- uint32_t atlasID; >- >- // The offset in the bitmap where the rendered contents are. >- WebCore::IntPoint surfaceOffset; >-}; >- >-} // namespace WebKit >- >-#endif // USE(COORDINATED_GRAPHICS) >- >-#endif // SurfaceUpdateInfo_h >diff --git a/Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.h b/Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.h >index b828aad8174542edd37b18e37f26cdc94ab809f0..14a7c0078549074d03579bd49efdd28be4a5fd96 100644 >--- a/Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.h >+++ b/Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.h >@@ -22,8 +22,8 @@ > #define WebCoordinatedSurface_h > > #if USE(COORDINATED_GRAPHICS) >-#include "CoordinatedSurface.h" > #include "ShareableBitmap.h" >+#include <WebCore/CoordinatedSurface.h> > > #if USE(GRAPHICS_SURFACE) > #include "GraphicsSurface.h" >@@ -36,7 +36,7 @@ class GraphicsContext; > > namespace WebKit { > >-class WebCoordinatedSurface : public CoordinatedSurface { >+class WebCoordinatedSurface : public WebCore::CoordinatedSurface { > public: > class Handle { > WTF_MAKE_NONCOPYABLE(Handle); >@@ -57,7 +57,7 @@ public: > WebCore::GraphicsSurfaceToken m_graphicsSurfaceToken; > #endif > WebCore::IntSize m_size; >- CoordinatedSurface::Flags m_flags; >+ WebCore::CoordinatedSurface::Flags m_flags; > }; > > // Create a new WebCoordinatedSurface, and allocate either a GraphicsSurface or a ShareableBitmap as backing. >diff --git a/Source/WebKit2/Shared/CoordinatedGraphics/WebCustomFilterOperation.h b/Source/WebKit2/Shared/CoordinatedGraphics/WebCustomFilterOperation.h >deleted file mode 100644 >index 4bf277a70e6eaeae73bfe320818c764e04050553..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Shared/CoordinatedGraphics/WebCustomFilterOperation.h >+++ /dev/null >@@ -1,66 +0,0 @@ >-/* >- * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * >- * 1. Redistributions of source code must retain the above >- * copyright notice, this list of conditions and the following >- * disclaimer. >- * 2. Redistributions in binary form must reproduce the above >- * copyright notice, this list of conditions and the following >- * disclaimer in the documentation and/or other materials >- * provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE >- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, >- * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR >- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF >- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >- * SUCH DAMAGE. >- */ >- >-#ifndef WebCustomFilterOperation_h >-#define WebCustomFilterOperation_h >- >-#if ENABLE(CSS_SHADERS) >-#include "CustomFilterOperation.h" >- >-namespace WebCore { >- >-// This class is only adding the programId on top of CustomFilterOperation. The argument decoder has no >-// context, so we cannot search in our cached CustomFilterPrograms while decoding. In that case >-// it will just store the programId and no CustomFilterProgram instance. The receiver is supposed to >-// iterate on this structure and inject the right CustomFilterPrograms. >- >-class WebCustomFilterOperation : public CustomFilterOperation { >-public: >- static PassRefPtr<WebCustomFilterOperation> create(PassRefPtr<CustomFilterProgram> program, int programID, const CustomFilterParameterList& sortedParameters, unsigned meshRows, unsigned meshColumns, CustomFilterMeshType meshType) >- { >- return adoptRef(new WebCustomFilterOperation(program, programID, sortedParameters, meshRows, meshColumns, meshType)); >- } >- >- int programID() const { return m_programID; } >- >-private: >- WebCustomFilterOperation(PassRefPtr<CustomFilterProgram> program, int programID, const CustomFilterParameterList& sortedParameters, unsigned meshRows, unsigned meshColumns, CustomFilterMeshType meshType) >- : CustomFilterOperation(program, sortedParameters, meshRows, meshColumns, meshType) >- , m_programID(programID) >- { >- } >- >- int m_programID; >-}; >- >-} // namespace WebCore >- >-#endif // ENABLE(CSS_SHADERS) >- >-#endif // CustomFilterOperation_h >diff --git a/Source/WebKit2/Shared/CoordinatedGraphics/WebCustomFilterProgram.h b/Source/WebKit2/Shared/CoordinatedGraphics/WebCustomFilterProgram.h >deleted file mode 100644 >index aaaadd6fed79cc48b3ce5948e06f746f37775cfe..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/Shared/CoordinatedGraphics/WebCustomFilterProgram.h >+++ /dev/null >@@ -1,78 +0,0 @@ >-/* >- * Copyright (C) 2012 Company 100, Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#ifndef WebCustomFilterProgram_h >-#define WebCustomFilterProgram_h >- >-#if USE(COORDINATED_GRAPHICS) && ENABLE(CSS_SHADERS) >-#include <WebCore/CustomFilterConstants.h> >-#include <WebCore/CustomFilterProgram.h> >- >-namespace WebKit { >- >-class WebCustomFilterProgram : public WebCore::CustomFilterProgram { >-public: >- static PassRefPtr<WebCustomFilterProgram> create(String vertexShaderString, String m_fragmentShaderString, WebCore::CustomFilterProgramType programType, WebCore::CustomFilterProgramMixSettings mixSettings, WebCore::CustomFilterMeshType meshType) >- { >- return adoptRef(new WebCustomFilterProgram(vertexShaderString, m_fragmentShaderString, programType, mixSettings, meshType)); >- } >- >- virtual bool isLoaded() const OVERRIDE { return true; } >- >- virtual bool operator==(const CustomFilterProgram& o) const OVERRIDE >- { >- // We don't use the != operator because that would recursively call this method. >- if (!CustomFilterProgram::operator==(o)) >- return false; >- >- // The following cast is ugly, but WebCustomFilterProgram is the single implementation of CustomFilterProgram on UI Process. >- const WebCustomFilterProgram* other = static_cast<const WebCustomFilterProgram*>(&o); >- return m_vertexShaderString == other->vertexShaderString() && m_fragmentShaderString == other->fragmentShaderString(); >- } >- >-protected: >- virtual String vertexShaderString() const OVERRIDE { return m_vertexShaderString; } >- virtual String fragmentShaderString() const OVERRIDE { return m_fragmentShaderString; } >- >- virtual void willHaveClients() OVERRIDE { notifyClients(); } >- virtual void didRemoveLastClient() OVERRIDE { } >- >-private: >- WebCustomFilterProgram(String vertexShaderString, String fragmentShaderString, WebCore::CustomFilterProgramType programType, WebCore::CustomFilterProgramMixSettings mixSettings, WebCore::CustomFilterMeshType meshType) >- : WebCore::CustomFilterProgram(programType, mixSettings, meshType) >- , m_vertexShaderString(vertexShaderString) >- , m_fragmentShaderString(fragmentShaderString) >- { >- } >- >- String m_vertexShaderString; >- String m_fragmentShaderString; >-}; >- >-} // namespace WebKit >- >-#endif // USE(COORDINATED_GRAPHICS) && ENABLE(CSS_SHADERS) >- >-#endif // WebCustomFilterProgram_h >diff --git a/Source/WebKit2/Target.pri b/Source/WebKit2/Target.pri >index bfd14c64dc3d5c19a849bf151d522ed4496f2bed..bedca3aee54209cfb16d1a97499a41e11f5e7829 100644 >--- a/Source/WebKit2/Target.pri >+++ b/Source/WebKit2/Target.pri >@@ -139,11 +139,7 @@ HEADERS += \ > Shared/WebURLResponse.h \ > Shared/WebUserContentURLPattern.h \ > Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h \ >- Shared/CoordinatedGraphics/CoordinatedLayerInfo.h \ >- Shared/CoordinatedGraphics/CoordinatedSurface.h \ >- Shared/CoordinatedGraphics/SurfaceUpdateInfo.h \ > Shared/CoordinatedGraphics/WebCoordinatedSurface.h \ >- Shared/CoordinatedGraphics/WebCustomFilterProgram.h \ > Shared/Plugins/Netscape/NetscapePluginModule.h \ > Shared/Plugins/NPRemoteObjectMap.h \ > Shared/Plugins/NPIdentifierData.h \ >@@ -216,9 +212,7 @@ HEADERS += \ > UIProcess/Authentication/WebProtectionSpace.h \ > UIProcess/BackingStore.h \ > UIProcess/Downloads/DownloadProxy.h \ >- UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h \ > UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h \ >- UIProcess/CoordinatedGraphics/LayerTreeRenderer.h \ > UIProcess/DefaultUndoController.h \ > UIProcess/DrawingAreaProxy.h \ > UIProcess/DrawingAreaProxyImpl.h \ >@@ -374,12 +368,7 @@ HEADERS += \ > WebProcess/WebPage/DrawingAreaImpl.h \ > WebProcess/WebPage/EventDispatcher.h \ > WebProcess/WebPage/FindController.h \ >- WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.h \ >- WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h \ >- WebProcess/WebPage/CoordinatedGraphics/CoordinatedImageBacking.h \ > WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h \ >- WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.h \ >- WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h \ > WebProcess/WebPage/TapHighlightController.h \ > WebProcess/WebPage/PageOverlay.h \ > WebProcess/WebPage/WebContextMenu.h \ >@@ -517,7 +506,6 @@ SOURCES += \ > Shared/WebURLResponse.cpp \ > Shared/WebWheelEvent.cpp \ > Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp \ >- Shared/CoordinatedGraphics/CoordinatedSurface.cpp \ > Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp \ > Shared/CoordinatedGraphics/WebCustomFilterProgramProxy.cpp \ > Shared/qt/ArgumentCodersQt.cpp \ >@@ -581,9 +569,7 @@ SOURCES += \ > UIProcess/Authentication/WebProtectionSpace.cpp \ > UIProcess/BackingStore.cpp \ > UIProcess/qt/BackingStoreQt.cpp \ >- UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp \ > UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp \ >- UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp \ > UIProcess/DefaultUndoController.cpp \ > UIProcess/Downloads/DownloadProxy.cpp \ > UIProcess/Downloads/DownloadProxyMap.cpp \ >@@ -765,12 +751,7 @@ SOURCES += \ > WebProcess/WebPage/EncoderAdapter.cpp \ > WebProcess/WebPage/EventDispatcher.cpp \ > WebProcess/WebPage/FindController.cpp \ >- WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp \ >- WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp \ >- WebProcess/WebPage/CoordinatedGraphics/CoordinatedImageBacking.cpp \ > WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp \ >- WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.cpp \ >- WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp \ > WebProcess/WebPage/TapHighlightController.cpp \ > WebProcess/WebPage/LayerTreeHost.cpp \ > WebProcess/WebPage/PageOverlay.cpp \ >diff --git a/Source/WebKit2/UIProcess/API/efl/EwkView.cpp b/Source/WebKit2/UIProcess/API/efl/EwkView.cpp >index 5bb446477cbd2575f56d0cc93dea0211f721a903..806ec2f2872d27b09968b5bc2ee0a11ae9777045 100644 >--- a/Source/WebKit2/UIProcess/API/efl/EwkView.cpp >+++ b/Source/WebKit2/UIProcess/API/efl/EwkView.cpp >@@ -27,7 +27,6 @@ > #include "FindClientEfl.h" > #include "FormClientEfl.h" > #include "InputMethodContextEfl.h" >-#include "LayerTreeRenderer.h" > #include "PageClientBase.h" > #include "PageClientDefaultImpl.h" > #include "PageClientLegacyImpl.h" >@@ -63,6 +62,7 @@ > #include <Edje.h> > #include <WebCore/CairoUtilitiesEfl.h> > #include <WebCore/Cursor.h> >+#include <WebCore/TextureMapperScene.h> > #include <WebKit2/WKImageCairo.h> > > #if ENABLE(VIBRATION) >@@ -362,7 +362,7 @@ AffineTransform EwkView::transformToScreen() const > } > > #if USE(COORDINATED_GRAPHICS) >-LayerTreeRenderer* EwkView::layerTreeRenderer() >+TextureMapperScene* EwkView::textureMapperScene() > { > DrawingAreaProxy* drawingArea = page()->drawingArea(); > if (!drawingArea) >@@ -372,7 +372,7 @@ LayerTreeRenderer* EwkView::layerTreeRenderer() > if (!coordinatedLayerTreeHostProxy) > return 0; > >- return coordinatedLayerTreeHostProxy->layerTreeRenderer(); >+ return coordinatedLayerTreeHostProxy->textureMapperScene(); > } > #endif > >@@ -394,14 +394,14 @@ void EwkView::displayTimerFired(Timer<EwkView>*) > // We are supposed to clip to the actual viewport, nothing less. > IntRect viewport(sd->view.x, sd->view.y, sd->view.w, sd->view.h); > >- LayerTreeRenderer* renderer = layerTreeRenderer(); >- if (!renderer) >+ TextureMapperScene* scene = textureMapperScene(); >+ if (!scene) > return; > >- renderer->setActive(true); >- renderer->setDrawsBackground(m_setDrawsBackground); >+ scene->setActive(true); >+ scene->setDrawsBackground(m_setDrawsBackground); > if (m_isHardwareAccelerated) { >- renderer->paintToCurrentGLContext(transformToScene().toTransformationMatrix(), /* opacity */ 1, viewport); >+ scene->paintToCurrentGLContext(transformToScene().toTransformationMatrix(), /* opacity */ 1, viewport); > // sd->image is tied to a native surface. The native surface is in the parent's coordinates, > // so we need to account for the viewport position when calling evas_object_image_data_update_add. > evas_object_image_data_update_add(sd->image, viewport.x(), viewport.y(), viewport.width(), viewport.height()); >@@ -414,7 +414,7 @@ void EwkView::displayTimerFired(Timer<EwkView>*) > cairo_translate(graphicsContext.get(), - pagePosition().x(), - pagePosition().y()); > cairo_scale(graphicsContext.get(), pageScaleFactor(), pageScaleFactor()); > cairo_scale(graphicsContext.get(), deviceScaleFactor(), deviceScaleFactor()); >- renderer->paintToGraphicsContext(graphicsContext.get()); >+ scene->paintToGraphicsContext(graphicsContext.get()); > evas_object_image_data_update_add(sd->image, 0, 0, viewport.width(), viewport.height()); > } > #endif >@@ -695,7 +695,7 @@ bool EwkView::createGLSurface(const IntSize& viewSize) > > bool EwkView::enterAcceleratedCompositingMode() > { >- layerTreeRenderer()->setActive(true); >+ textureMapperScene()->setActive(true); > > if (!m_isHardwareAccelerated) > return true; >diff --git a/Source/WebKit2/UIProcess/API/efl/EwkView.h b/Source/WebKit2/UIProcess/API/efl/EwkView.h >index 37a8d1bdbbbac801df9b51a27f66d28e146eb76b..195285e3229467665f61ad98e720e03d56208a8a 100644 >--- a/Source/WebKit2/UIProcess/API/efl/EwkView.h >+++ b/Source/WebKit2/UIProcess/API/efl/EwkView.h >@@ -68,10 +68,6 @@ class WebPopupMenuProxyEfl; > #if ENABLE(VIBRATION) > class VibrationClientEfl; > #endif >- >-#if USE(COORDINATED_GRAPHICS) >-class LayerTreeRenderer; >-#endif > } > > namespace WebCore { >@@ -79,6 +75,9 @@ class AffineTransform; > class Color; > class Cursor; > class IntSize; >+#if USE(COORDINATED_GRAPHICS) >+class TextureMapperScene; >+#endif > } > > class EwkContext; >@@ -219,7 +218,7 @@ private: > void displayTimerFired(WebCore::Timer<EwkView>*); > > #if USE(COORDINATED_GRAPHICS) >- WebKit::LayerTreeRenderer* layerTreeRenderer(); >+ WebCore::TextureMapperScene* textureMapperScene(); > #endif > > void informIconChange(); >diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp >index fa013af537680a42b3939f7c28ef708a6efda0cd..d1aef75d864027f125cf2a3186ec6ec13d992755 100644 >--- a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp >+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp >@@ -22,7 +22,6 @@ > #include "qquickwebpage_p.h" > > #include "CoordinatedLayerTreeHostProxy.h" >-#include "LayerTreeRenderer.h" > #include "QtWebPageEventHandler.h" > #include "QtWebPageSGNode.h" > #include "TransformationMatrix.h" >@@ -31,6 +30,7 @@ > #include "qquickwebview_p.h" > #include "qwebkittest_p.h" > #include <QQuickWindow> >+#include <WebCore/TextureMapperScene.h> > > using namespace WebKit; > >@@ -71,8 +71,8 @@ void QQuickWebPagePrivate::paint(QPainter* painter) > if (!webPageProxy->drawingArea()) > return; > >- if (coordinatedLayerTreeHostProxy()->layerTreeRenderer()) >- coordinatedLayerTreeHostProxy()->layerTreeRenderer()->paintToGraphicsContext(painter); >+ if (coordinatedLayerTreeHostProxy()->textureMapperScene()) >+ coordinatedLayerTreeHostProxy()->textureMapperScene()->paintToGraphicsContext(painter); > } > > CoordinatedLayerTreeHostProxy* QQuickWebPagePrivate::coordinatedLayerTreeHostProxy() >@@ -88,7 +88,7 @@ QSGNode* QQuickWebPage::updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData*) > if (!d->webPageProxy->drawingArea()) > return oldNode; > >- LayerTreeRenderer* renderer = d->coordinatedLayerTreeHostProxy()->layerTreeRenderer(); >+ WebCore::TextureMapperScene* textureMapperScene = d->coordinatedLayerTreeHostProxy()->textureMapperScene(); > > QtWebPageSGNode* node = static_cast<QtWebPageSGNode*>(oldNode); > >@@ -105,7 +105,7 @@ QSGNode* QQuickWebPage::updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData*) > if (!node) > node = new QtWebPageSGNode; > >- node->setRenderer(renderer); >+ node->setTextureMapperScene(textureMapperScene); > > node->setScale(d->contentsScale); > node->setDevicePixelRatio(window->devicePixelRatio()); >diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp >index 361f74dab851ad898ed39d277a7a6f479b259731..62619d9fc8c4f01eebd357d68e69577d8eb8d464 100644 >--- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp >+++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp >@@ -23,7 +23,6 @@ > #include "CoordinatedLayerTreeHostProxy.h" > #include "Cursor.h" > #include "DrawingAreaProxyImpl.h" >-#include "LayerTreeRenderer.h" > #include "NativeWebKeyboardEvent.h" > #include "NativeWebMouseEvent.h" > #if ENABLE(TOUCH_EVENTS) >@@ -35,6 +34,7 @@ > #include "WebPageGroup.h" > #include "WebPreferences.h" > #include "qrawwebview_p_p.h" >+#include <WebCore/TextureMapperScene.h> > #include <WebKit2/qrawwebview_p.h> > > void QRawWebViewPrivate::didReceiveMessageFromNavigatorQtObject(const String& message) >@@ -329,7 +329,7 @@ void QRawWebView::setActive(bool active) > { > d->m_active = active; > d->m_webPageProxy->viewStateDidChange(WebKit::WebPageProxy::ViewWindowIsActive); >- layerTreeRenderer()->setActive(active); >+ textureMapperScene()->setActive(active); > } > > QSize QRawWebView::size() const >@@ -363,7 +363,7 @@ WKPageRef QRawWebView::pageRef() > return toAPI(d->m_webPageProxy.get()); > } > >-WebKit::LayerTreeRenderer* QRawWebView::layerTreeRenderer() const >+WebCore::TextureMapperScene* QRawWebView::textureMapperScene() const > { > WebKit::DrawingAreaProxy* drawingArea = d->m_webPageProxy->drawingArea(); > if (!drawingArea) >@@ -371,20 +371,20 @@ WebKit::LayerTreeRenderer* QRawWebView::layerTreeRenderer() const > WebKit::CoordinatedLayerTreeHostProxy* coordinatedLayerTreeHostProxy = drawingArea->coordinatedLayerTreeHostProxy(); > if (!coordinatedLayerTreeHostProxy) > return 0; >- return coordinatedLayerTreeHostProxy->layerTreeRenderer(); >+ return coordinatedLayerTreeHostProxy->textureMapperScene(); > } > > void QRawWebView::paint(const QMatrix4x4& transform, float opacity, unsigned paintFlags) > { >- WebKit::LayerTreeRenderer* renderer = layerTreeRenderer(); >- if (!renderer) >+ WebCore::TextureMapperScene* scene = textureMapperScene(); >+ if (!scene) > return; > >- renderer->setActive(true); >+ scene->setActive(true); > > WebCore::FloatRect rect(0, 0, d->m_size.width(), d->m_size.height()); > >- renderer->paintToCurrentGLContext(transform, opacity, transform.mapRect(rect), paintFlags); >+ scene->paintToCurrentGLContext(transform, opacity, transform.mapRect(rect), paintFlags); > } > > void QRawWebView::sendKeyEvent(QKeyEvent* event) >diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h >index 015815ad8c70a9de05d81ba6a630210b722cf7f4..81c6b24ee927883338b1bf4b522db5e5f055b352 100644 >--- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h >+++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p.h >@@ -47,8 +47,8 @@ QT_END_NAMESPACE > > class QRawWebViewPrivate; > >-namespace WebKit { >-class LayerTreeRenderer; >+namespace WebCore { >+class TextureMapperScene; > } > > class QRawWebViewClient { >@@ -101,7 +101,7 @@ public: > void sendTouchEvent(QTouchEvent*); > > private: >- WebKit::LayerTreeRenderer* layerTreeRenderer() const; >+ WebCore::TextureMapperScene* textureMapperScene() const; > > QRawWebViewPrivate* d; > }; >diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp >deleted file mode 100644 >index 7838bb0db20d87434c8a431a4f04f4fd86a660fb..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp >+++ /dev/null >@@ -1,190 +0,0 @@ >-/* >- Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >- >- This library is free software; you can redistribute it and/or >- modify it under the terms of the GNU Library General Public >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Library General Public License for more details. >- >- You should have received a copy of the GNU Library General Public License >- along with this library; see the file COPYING.LIB. If not, write to >- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "CoordinatedBackingStore.h" >- >-#if USE(COORDINATED_GRAPHICS) >-#include "CoordinatedSurface.h" >-#include "GraphicsLayer.h" >-#include "TextureMapper.h" >-#include "TextureMapperGL.h" >- >-using namespace WebCore; >- >-namespace WebKit { >- >-void CoordinatedBackingStoreTile::swapBuffers(WebCore::TextureMapper* textureMapper) >-{ >- if (!m_surface) >- return; >- >- FloatRect tileRect(m_tileRect); >- tileRect.scale(1. / m_scale); >- bool shouldReset = false; >- if (tileRect != rect()) { >- setRect(tileRect); >- shouldReset = true; >- } >- RefPtr<BitmapTexture> texture = this->texture(); >- if (!texture) { >- texture = textureMapper->createTexture(); >- setTexture(texture.get()); >- shouldReset = true; >- } >- >- ASSERT(textureMapper->maxTextureSize().width() >= m_tileRect.size().width() && textureMapper->maxTextureSize().height() >= m_tileRect.size().height()); >- if (shouldReset) >- texture->reset(m_tileRect.size(), m_surface->supportsAlpha()); >- >- m_surface->copyToTexture(texture, m_sourceRect, m_surfaceOffset); >- m_surface.clear(); >-} >- >-void CoordinatedBackingStoreTile::setBackBuffer(const IntRect& tileRect, const IntRect& sourceRect, PassRefPtr<CoordinatedSurface> buffer, const IntPoint& offset) >-{ >- m_sourceRect = sourceRect; >- m_tileRect = tileRect; >- m_surfaceOffset = offset; >- m_surface = buffer; >-} >- >-void CoordinatedBackingStore::createTile(uint32_t id, float scale) >-{ >- m_tiles.add(id, CoordinatedBackingStoreTile(scale)); >- m_scale = scale; >-} >- >-void CoordinatedBackingStore::removeTile(uint32_t id) >-{ >- ASSERT(m_tiles.contains(id)); >- m_tilesToRemove.add(id); >-} >- >-void CoordinatedBackingStore::removeAllTiles() >-{ >- CoordinatedBackingStoreTileMap::iterator end = m_tiles.end(); >- for (CoordinatedBackingStoreTileMap::iterator it = m_tiles.begin(); it != end; ++it) >- m_tilesToRemove.add(it->key); >-} >- >-void CoordinatedBackingStore::updateTile(uint32_t id, const IntRect& sourceRect, const IntRect& tileRect, PassRefPtr<CoordinatedSurface> backBuffer, const IntPoint& offset) >-{ >- CoordinatedBackingStoreTileMap::iterator it = m_tiles.find(id); >- ASSERT(it != m_tiles.end()); >- it->value.setBackBuffer(tileRect, sourceRect, backBuffer, offset); >-} >- >-PassRefPtr<BitmapTexture> CoordinatedBackingStore::texture() const >-{ >- CoordinatedBackingStoreTileMap::const_iterator end = m_tiles.end(); >- for (CoordinatedBackingStoreTileMap::const_iterator it = m_tiles.begin(); it != end; ++it) { >- RefPtr<BitmapTexture> texture = it->value.texture(); >- if (texture) >- return texture; >- } >- >- return PassRefPtr<BitmapTexture>(); >-} >- >-void CoordinatedBackingStore::setSize(const WebCore::FloatSize& size) >-{ >- m_size = size; >-} >- >-void CoordinatedBackingStore::paintTilesToTextureMapper(Vector<TextureMapperTile*>& tiles, TextureMapper* textureMapper, const TransformationMatrix& transform, float opacity, BitmapTexture* mask, const FloatRect& rect) >-{ >- for (size_t i = 0; i < tiles.size(); ++i) >- tiles[i]->paint(textureMapper, transform, opacity, mask, calculateExposedTileEdges(rect, tiles[i]->rect())); >-} >- >-TransformationMatrix CoordinatedBackingStore::adjustedTransformForRect(const FloatRect& targetRect) >-{ >- return TransformationMatrix::rectToRect(rect(), targetRect); >-} >- >-void CoordinatedBackingStore::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect& targetRect, const TransformationMatrix& transform, float opacity, BitmapTexture* mask) >-{ >- if (m_tiles.isEmpty()) >- return; >- ASSERT(!m_size.isZero()); >- >- Vector<TextureMapperTile*> tilesToPaint; >- Vector<TextureMapperTile*> previousTilesToPaint; >- >- // We have to do this every time we paint, in case the opacity has changed. >- CoordinatedBackingStoreTileMap::iterator end = m_tiles.end(); >- FloatRect coveredRect; >- for (CoordinatedBackingStoreTileMap::iterator it = m_tiles.begin(); it != end; ++it) { >- CoordinatedBackingStoreTile& tile = it->value; >- if (!tile.texture()) >- continue; >- >- if (tile.scale() == m_scale) { >- tilesToPaint.append(&tile); >- coveredRect.unite(tile.rect()); >- continue; >- } >- >- // Only show the previous tile if the opacity is high, otherwise effect looks like a bug. >- // We show the previous-scale tile anyway if it doesn't intersect with any current-scale tile. >- if (opacity < 0.95 && coveredRect.intersects(tile.rect())) >- continue; >- >- previousTilesToPaint.append(&tile); >- } >- >- // targetRect is on the contents coordinate system, so we must compare two rects on the contents coordinate system. >- // See TiledBackingStore. >- TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect); >- >- paintTilesToTextureMapper(previousTilesToPaint, textureMapper, adjustedTransform, opacity, mask, rect()); >- paintTilesToTextureMapper(tilesToPaint, textureMapper, adjustedTransform, opacity, mask, rect()); >-} >- >-void CoordinatedBackingStore::drawBorder(TextureMapper* textureMapper, const Color& borderColor, float borderWidth, const FloatRect& targetRect, const TransformationMatrix& transform) >-{ >- TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect); >- CoordinatedBackingStoreTileMap::iterator end = m_tiles.end(); >- for (CoordinatedBackingStoreTileMap::iterator it = m_tiles.begin(); it != end; ++it) >- textureMapper->drawBorder(borderColor, borderWidth, it->value.rect(), adjustedTransform); >-} >- >-void CoordinatedBackingStore::drawRepaintCounter(TextureMapper* textureMapper, int repaintCount, const Color& borderColor, const FloatRect& targetRect, const TransformationMatrix& transform) >-{ >- TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect); >- CoordinatedBackingStoreTileMap::iterator end = m_tiles.end(); >- for (CoordinatedBackingStoreTileMap::iterator it = m_tiles.begin(); it != end; ++it) >- textureMapper->drawRepaintCounter(repaintCount, borderColor, it->value.rect().location(), adjustedTransform); >-} >- >-void CoordinatedBackingStore::commitTileOperations(TextureMapper* textureMapper) >-{ >- HashSet<uint32_t>::iterator tilesToRemoveEnd = m_tilesToRemove.end(); >- for (HashSet<uint32_t>::iterator it = m_tilesToRemove.begin(); it != tilesToRemoveEnd; ++it) >- m_tiles.remove(*it); >- m_tilesToRemove.clear(); >- >- CoordinatedBackingStoreTileMap::iterator tilesEnd = m_tiles.end(); >- for (CoordinatedBackingStoreTileMap::iterator it = m_tiles.begin(); it != tilesEnd; ++it) >- it->value.swapBuffers(textureMapper); >-} >- >-} // namespace WebKit >-#endif >diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h >deleted file mode 100644 >index a8120e9e38225f640954608368f4924347d834fb..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h >+++ /dev/null >@@ -1,86 +0,0 @@ >-/* >- Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >- >- This library is free software; you can redistribute it and/or >- modify it under the terms of the GNU Library General Public >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Library General Public License for more details. >- >- You should have received a copy of the GNU Library General Public License >- along with this library; see the file COPYING.LIB. If not, write to >- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- Boston, MA 02110-1301, USA. >- */ >- >-#ifndef CoordinatedBackingStore_h >-#define CoordinatedBackingStore_h >- >-#if USE(COORDINATED_GRAPHICS) >- >-#include "TextureMapper.h" >-#include "TextureMapperBackingStore.h" >-#include <wtf/HashMap.h> >-#include <wtf/HashSet.h> >- >-namespace WebKit { >- >-class CoordinatedSurface; >- >-class CoordinatedBackingStoreTile : public WebCore::TextureMapperTile { >-public: >- explicit CoordinatedBackingStoreTile(float scale = 1) >- : TextureMapperTile(WebCore::FloatRect()) >- , m_scale(scale) >- { >- } >- >- inline float scale() const { return m_scale; } >- void swapBuffers(WebCore::TextureMapper*); >- void setBackBuffer(const WebCore::IntRect&, const WebCore::IntRect&, PassRefPtr<CoordinatedSurface> buffer, const WebCore::IntPoint&); >- >-private: >- RefPtr<CoordinatedSurface> m_surface; >- WebCore::IntRect m_sourceRect; >- WebCore::IntRect m_tileRect; >- WebCore::IntPoint m_surfaceOffset; >- float m_scale; >-}; >- >-class CoordinatedBackingStore : public WebCore::TextureMapperBackingStore { >-public: >- void createTile(uint32_t tileID, float); >- void removeTile(uint32_t tileID); >- void removeAllTiles(); >- void updateTile(uint32_t tileID, const WebCore::IntRect&, const WebCore::IntRect&, PassRefPtr<CoordinatedSurface>, const WebCore::IntPoint&); >- static PassRefPtr<CoordinatedBackingStore> create() { return adoptRef(new CoordinatedBackingStore); } >- void commitTileOperations(WebCore::TextureMapper*); >- PassRefPtr<WebCore::BitmapTexture> texture() const; >- void setSize(const WebCore::FloatSize&); >- virtual void paintToTextureMapper(WebCore::TextureMapper*, const WebCore::FloatRect&, const WebCore::TransformationMatrix&, float, WebCore::BitmapTexture*); >- virtual void drawBorder(WebCore::TextureMapper*, const WebCore::Color&, float borderWidth, const WebCore::FloatRect&, const WebCore::TransformationMatrix&) OVERRIDE; >- virtual void drawRepaintCounter(WebCore::TextureMapper*, int repaintCount, const WebCore::Color&, const WebCore::FloatRect&, const WebCore::TransformationMatrix&) OVERRIDE; >- >-private: >- CoordinatedBackingStore() >- : m_scale(1.) >- { } >- void paintTilesToTextureMapper(Vector<WebCore::TextureMapperTile*>&, WebCore::TextureMapper*, const WebCore::TransformationMatrix&, float, WebCore::BitmapTexture*, const WebCore::FloatRect&); >- WebCore::TransformationMatrix adjustedTransformForRect(const WebCore::FloatRect&); >- WebCore::FloatRect rect() const { return WebCore::FloatRect(WebCore::FloatPoint::zero(), m_size); } >- >- typedef HashMap<uint32_t, CoordinatedBackingStoreTile> CoordinatedBackingStoreTileMap; >- CoordinatedBackingStoreTileMap m_tiles; >- HashSet<uint32_t> m_tilesToRemove; >- WebCore::FloatSize m_size; >- float m_scale; >-}; >- >-} // namespace WebKit >-#endif >- >-#endif // CoordinatedBackingStore_h >diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp >index 0cc34299596a11d5c593fd18278f50f4b7c2d4cc..6544404c826b1f4c7f2a0632ec9cf1363ae55ded 100644 >--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp >+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp >@@ -22,13 +22,13 @@ > #if USE(COORDINATED_GRAPHICS) > #include "CoordinatedLayerTreeHostProxy.h" > >-#include "CoordinatedLayerInfo.h" > #include "CoordinatedLayerTreeHostMessages.h" >-#include "LayerTreeRenderer.h" > #include "WebCoreArgumentCoders.h" > #include "WebPageProxy.h" > #include "WebProcessProxy.h" >+#include <WebCore/CoordinatedLayerInfo.h> > #include <WebCore/GraphicsSurface.h> >+#include <WebCore/SurfaceUpdateInfo.h> > > #if ENABLE(CSS_SHADERS) > #include "CustomFilterProgramInfo.h" >@@ -40,13 +40,13 @@ using namespace WebCore; > > CoordinatedLayerTreeHostProxy::CoordinatedLayerTreeHostProxy(DrawingAreaProxy* drawingAreaProxy) > : m_drawingAreaProxy(drawingAreaProxy) >- , m_renderer(adoptRef(new LayerTreeRenderer(this))) >+ , m_textureMapperScene(adoptRef(new TextureMapperScene(this))) > { > } > > CoordinatedLayerTreeHostProxy::~CoordinatedLayerTreeHostProxy() > { >- m_renderer->detach(); >+ m_textureMapperScene->detach(); > } > > void CoordinatedLayerTreeHostProxy::updateViewport() >@@ -56,81 +56,81 @@ void CoordinatedLayerTreeHostProxy::updateViewport() > > void CoordinatedLayerTreeHostProxy::dispatchUpdate(const Function<void()>& function) > { >- m_renderer->appendUpdate(function); >+ m_textureMapperScene->appendUpdate(function); > } > >-void CoordinatedLayerTreeHostProxy::createTileForLayer(CoordinatedLayerID layerID, uint32_t tileID, const WebCore::IntRect& tileRect, const WebKit::SurfaceUpdateInfo& updateInfo) >+void CoordinatedLayerTreeHostProxy::createTileForLayer(CoordinatedLayerID layerID, uint32_t tileID, const IntRect& tileRect, const SurfaceUpdateInfo& updateInfo) > { >- dispatchUpdate(bind(&LayerTreeRenderer::createTile, m_renderer.get(), layerID, tileID, updateInfo.scaleFactor)); >+ dispatchUpdate(bind(&TextureMapperScene::createTile, m_textureMapperScene.get(), layerID, tileID, updateInfo.scaleFactor)); > updateTileForLayer(layerID, tileID, tileRect, updateInfo); > } > >-void CoordinatedLayerTreeHostProxy::updateTileForLayer(CoordinatedLayerID layerID, uint32_t tileID, const IntRect& tileRect, const WebKit::SurfaceUpdateInfo& updateInfo) >+void CoordinatedLayerTreeHostProxy::updateTileForLayer(CoordinatedLayerID layerID, uint32_t tileID, const IntRect& tileRect, const SurfaceUpdateInfo& updateInfo) > { >- dispatchUpdate(bind(&LayerTreeRenderer::updateTile, m_renderer.get(), layerID, tileID, LayerTreeRenderer::TileUpdate(updateInfo.updateRect, tileRect, updateInfo.atlasID, updateInfo.surfaceOffset))); >+ dispatchUpdate(bind(&TextureMapperScene::updateTile, m_textureMapperScene.get(), layerID, tileID, TextureMapperScene::TileUpdate(updateInfo.updateRect, tileRect, updateInfo.atlasID, updateInfo.surfaceOffset))); > } > > void CoordinatedLayerTreeHostProxy::removeTileForLayer(CoordinatedLayerID layerID, uint32_t tileID) > { >- dispatchUpdate(bind(&LayerTreeRenderer::removeTile, m_renderer.get(), layerID, tileID)); >+ dispatchUpdate(bind(&TextureMapperScene::removeTile, m_textureMapperScene.get(), layerID, tileID)); > } > > void CoordinatedLayerTreeHostProxy::createUpdateAtlas(uint32_t atlasID, const WebCoordinatedSurface::Handle& handle) > { >- dispatchUpdate(bind(&LayerTreeRenderer::createUpdateAtlas, m_renderer.get(), atlasID, WebCoordinatedSurface::create(handle))); >+ dispatchUpdate(bind(&TextureMapperScene::createUpdateAtlas, m_textureMapperScene.get(), atlasID, WebCoordinatedSurface::create(handle))); > } > > void CoordinatedLayerTreeHostProxy::removeUpdateAtlas(uint32_t atlasID) > { >- dispatchUpdate(bind(&LayerTreeRenderer::removeUpdateAtlas, m_renderer.get(), atlasID)); >+ dispatchUpdate(bind(&TextureMapperScene::removeUpdateAtlas, m_textureMapperScene.get(), atlasID)); > } > > void CoordinatedLayerTreeHostProxy::createCompositingLayers(const Vector<CoordinatedLayerID>& ids) > { >- dispatchUpdate(bind(&LayerTreeRenderer::createLayers, m_renderer.get(), ids)); >+ dispatchUpdate(bind(&TextureMapperScene::createLayers, m_textureMapperScene.get(), ids)); > } > > void CoordinatedLayerTreeHostProxy::deleteCompositingLayers(const Vector<CoordinatedLayerID>& ids) > { >- dispatchUpdate(bind(&LayerTreeRenderer::deleteLayers, m_renderer.get(), ids)); >+ dispatchUpdate(bind(&TextureMapperScene::deleteLayers, m_textureMapperScene.get(), ids)); > } > > void CoordinatedLayerTreeHostProxy::setRootCompositingLayer(CoordinatedLayerID id) > { >- dispatchUpdate(bind(&LayerTreeRenderer::setRootLayerID, m_renderer.get(), id)); >+ dispatchUpdate(bind(&TextureMapperScene::setRootLayerID, m_textureMapperScene.get(), id)); > } > > void CoordinatedLayerTreeHostProxy::setCompositingLayerState(CoordinatedLayerID id, const CoordinatedLayerInfo& info) > { >- dispatchUpdate(bind(&LayerTreeRenderer::setLayerState, m_renderer.get(), id, info)); >+ dispatchUpdate(bind(&TextureMapperScene::setLayerState, m_textureMapperScene.get(), id, info)); > } > > void CoordinatedLayerTreeHostProxy::setCompositingLayerChildren(CoordinatedLayerID id, const Vector<CoordinatedLayerID>& children) > { >- dispatchUpdate(bind(&LayerTreeRenderer::setLayerChildren, m_renderer.get(), id, children)); >+ dispatchUpdate(bind(&TextureMapperScene::setLayerChildren, m_textureMapperScene.get(), id, children)); > } > > #if ENABLE(CSS_FILTERS) > void CoordinatedLayerTreeHostProxy::setCompositingLayerFilters(CoordinatedLayerID id, const FilterOperations& filters) > { >- dispatchUpdate(bind(&LayerTreeRenderer::setLayerFilters, m_renderer.get(), id, filters)); >+ dispatchUpdate(bind(&TextureMapperScene::setLayerFilters, m_textureMapperScene.get(), id, filters)); > } > #endif > > #if ENABLE(CSS_SHADERS) > void CoordinatedLayerTreeHostProxy::removeCustomFilterProgram(int id) > { >- dispatchUpdate(bind(&LayerTreeRenderer::removeCustomFilterProgram, m_renderer.get(), id)); >+ dispatchUpdate(bind(&TextureMapperScene::removeCustomFilterProgram, m_textureMapperScene.get(), id)); > } >-void CoordinatedLayerTreeHostProxy::createCustomFilterProgram(int id, const WebCore::CustomFilterProgramInfo& programInfo) >+void CoordinatedLayerTreeHostProxy::createCustomFilterProgram(int id, const CustomFilterProgramInfo& programInfo) > { >- dispatchUpdate(bind(&LayerTreeRenderer::createCustomFilterProgram, m_renderer.get(), id, programInfo)); >+ dispatchUpdate(bind(&TextureMapperScene::createCustomFilterProgram, m_textureMapperScene.get(), id, programInfo)); > } > #endif > >-void CoordinatedLayerTreeHostProxy::didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect) >+void CoordinatedLayerTreeHostProxy::didRenderFrame(const IntSize& contentsSize, const IntRect& coveredRect) > { >- dispatchUpdate(bind(&LayerTreeRenderer::flushLayerChanges, m_renderer.get())); >+ dispatchUpdate(bind(&TextureMapperScene::flushLayerChanges, m_textureMapperScene.get())); > updateViewport(); > #if USE(TILED_BACKING_STORE) > m_drawingAreaProxy->page()->didRenderFrame(contentsSize, coveredRect); >@@ -142,43 +142,43 @@ void CoordinatedLayerTreeHostProxy::didRenderFrame(const WebCore::IntSize& conte > > void CoordinatedLayerTreeHostProxy::createImageBacking(CoordinatedImageBackingID imageID) > { >- dispatchUpdate(bind(&LayerTreeRenderer::createImageBacking, m_renderer.get(), imageID)); >+ dispatchUpdate(bind(&TextureMapperScene::createImageBacking, m_textureMapperScene.get(), imageID)); > } > > void CoordinatedLayerTreeHostProxy::updateImageBacking(CoordinatedImageBackingID imageID, const WebCoordinatedSurface::Handle& handle) > { >- dispatchUpdate(bind(&LayerTreeRenderer::updateImageBacking, m_renderer.get(), imageID, WebCoordinatedSurface::create(handle))); >+ dispatchUpdate(bind(&TextureMapperScene::updateImageBacking, m_textureMapperScene.get(), imageID, WebCoordinatedSurface::create(handle))); > } > > void CoordinatedLayerTreeHostProxy::clearImageBackingContents(CoordinatedImageBackingID imageID) > { >- dispatchUpdate(bind(&LayerTreeRenderer::clearImageBackingContents, m_renderer.get(), imageID)); >+ dispatchUpdate(bind(&TextureMapperScene::clearImageBackingContents, m_textureMapperScene.get(), imageID)); > } > > void CoordinatedLayerTreeHostProxy::removeImageBacking(CoordinatedImageBackingID imageID) > { >- dispatchUpdate(bind(&LayerTreeRenderer::removeImageBacking, m_renderer.get(), imageID)); >+ dispatchUpdate(bind(&TextureMapperScene::removeImageBacking, m_textureMapperScene.get(), imageID)); > } > > void CoordinatedLayerTreeHostProxy::setContentsSize(const FloatSize& contentsSize) > { >- dispatchUpdate(bind(&LayerTreeRenderer::setContentsSize, m_renderer.get(), contentsSize)); >+ dispatchUpdate(bind(&TextureMapperScene::setContentsSize, m_textureMapperScene.get(), contentsSize)); > } > > void CoordinatedLayerTreeHostProxy::setLayerAnimations(CoordinatedLayerID id, const GraphicsLayerAnimations& animations) > { >- dispatchUpdate(bind(&LayerTreeRenderer::setLayerAnimations, m_renderer.get(), id, animations)); >+ dispatchUpdate(bind(&TextureMapperScene::setLayerAnimations, m_textureMapperScene.get(), id, animations)); > } > > void CoordinatedLayerTreeHostProxy::setAnimationsLocked(bool locked) > { >- dispatchUpdate(bind(&LayerTreeRenderer::setAnimationsLocked, m_renderer.get(), locked)); >+ dispatchUpdate(bind(&TextureMapperScene::setAnimationsLocked, m_textureMapperScene.get(), locked)); > } > > void CoordinatedLayerTreeHostProxy::setVisibleContentsRect(const FloatRect& rect, const FloatPoint& trajectoryVector) > { > // Inform the renderer to adjust viewport-fixed layers. >- dispatchUpdate(bind(&LayerTreeRenderer::setVisibleContentsRect, m_renderer.get(), rect)); >+ dispatchUpdate(bind(&TextureMapperScene::setVisibleContentsRect, m_textureMapperScene.get(), rect)); > > if (rect == m_lastSentVisibleRect && trajectoryVector == m_lastSentTrajectoryVector) > return; >@@ -196,7 +196,7 @@ void CoordinatedLayerTreeHostProxy::renderNextFrame() > #if ENABLE(REQUEST_ANIMATION_FRAME) > void CoordinatedLayerTreeHostProxy::requestAnimationFrame() > { >- dispatchUpdate(bind(&LayerTreeRenderer::requestAnimationFrame, m_renderer.get())); >+ dispatchUpdate(bind(&TextureMapperScene::requestAnimationFrame, m_textureMapperScene.get())); > updateViewport(); > } > >@@ -208,30 +208,30 @@ void CoordinatedLayerTreeHostProxy::animationFrameReady() > > void CoordinatedLayerTreeHostProxy::didChangeScrollPosition(const FloatPoint& position) > { >- dispatchUpdate(bind(&LayerTreeRenderer::didChangeScrollPosition, m_renderer.get(), position)); >+ dispatchUpdate(bind(&TextureMapperScene::didChangeScrollPosition, m_textureMapperScene.get(), position)); > } > > #if USE(GRAPHICS_SURFACE) > void CoordinatedLayerTreeHostProxy::createCanvas(CoordinatedLayerID id, const IntSize& canvasSize, const GraphicsSurfaceToken& token) > { > GraphicsSurface::Flags surfaceFlags = GraphicsSurface::SupportsTextureTarget | GraphicsSurface::SupportsSharing; >- dispatchUpdate(bind(&LayerTreeRenderer::createCanvas, m_renderer.get(), id, canvasSize, GraphicsSurface::create(canvasSize, surfaceFlags, token))); >+ dispatchUpdate(bind(&TextureMapperScene::createCanvas, m_textureMapperScene.get(), id, canvasSize, GraphicsSurface::create(canvasSize, surfaceFlags, token))); > } > > void CoordinatedLayerTreeHostProxy::syncCanvas(CoordinatedLayerID id, uint32_t frontBuffer) > { >- dispatchUpdate(bind(&LayerTreeRenderer::syncCanvas, m_renderer.get(), id, frontBuffer)); >+ dispatchUpdate(bind(&TextureMapperScene::syncCanvas, m_textureMapperScene.get(), id, frontBuffer)); > } > > void CoordinatedLayerTreeHostProxy::destroyCanvas(CoordinatedLayerID id) > { >- dispatchUpdate(bind(&LayerTreeRenderer::destroyCanvas, m_renderer.get(), id)); >+ dispatchUpdate(bind(&TextureMapperScene::destroyCanvas, m_textureMapperScene.get(), id)); > } > #endif > > void CoordinatedLayerTreeHostProxy::setLayerRepaintCount(CoordinatedLayerID id, int value) > { >- dispatchUpdate(bind(&LayerTreeRenderer::setLayerRepaintCount, m_renderer.get(), id, value)); >+ dispatchUpdate(bind(&TextureMapperScene::setLayerRepaintCount, m_textureMapperScene.get(), id, value)); > } > > void CoordinatedLayerTreeHostProxy::purgeBackingStores() >@@ -239,9 +239,9 @@ void CoordinatedLayerTreeHostProxy::purgeBackingStores() > m_drawingAreaProxy->page()->process()->send(Messages::CoordinatedLayerTreeHost::PurgeBackingStores(), m_drawingAreaProxy->page()->pageID()); > } > >-void CoordinatedLayerTreeHostProxy::setBackgroundColor(const WebCore::Color& color) >+void CoordinatedLayerTreeHostProxy::setBackgroundColor(const Color& color) > { >- dispatchUpdate(bind(&LayerTreeRenderer::setBackgroundColor, m_renderer.get(), color)); >+ dispatchUpdate(bind(&TextureMapperScene::setBackgroundColor, m_textureMapperScene.get(), color)); > } > > } >diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h >index bd0a3ee40702bd23f786a395012a86269ab9c129..c3d1368198fefa35c50db3a0347c7b9d73424bb7 100644 >--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h >+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h >@@ -24,11 +24,8 @@ > > #include "BackingStore.h" > #include "CoordinatedGraphicsArgumentCoders.h" >-#include "CoordinatedLayerInfo.h" > #include "DrawingAreaProxy.h" >-#include "LayerTreeRenderer.h" > #include "Region.h" >-#include "SurfaceUpdateInfo.h" > #include "WebCoordinatedSurface.h" > #include <WebCore/GraphicsContext.h> > #include <WebCore/GraphicsLayer.h> >@@ -37,63 +34,66 @@ > #include <WebCore/IntRect.h> > #include <WebCore/IntSize.h> > #include <WebCore/RunLoop.h> >+#include <WebCore/TextureMapperScene.h> > #include <WebCore/Timer.h> > #include <wtf/Functional.h> > #include <wtf/HashSet.h> > #include <wtf/Vector.h> > >-namespace WebKit { >- >+namespace WebCore { > class CoordinatedLayerInfo; >-class LayerTreeRenderer; >+class SurfaceUpdateInfo; >+} > >-class CoordinatedLayerTreeHostProxy : public LayerTreeRendererClient { >+namespace WebKit { >+ >+class CoordinatedLayerTreeHostProxy : public WebCore::TextureMapperSceneClient { > WTF_MAKE_NONCOPYABLE(CoordinatedLayerTreeHostProxy); > WTF_MAKE_FAST_ALLOCATED; > public: > explicit CoordinatedLayerTreeHostProxy(DrawingAreaProxy*); >- ~CoordinatedLayerTreeHostProxy(); >- void setCompositingLayerState(CoordinatedLayerID, const CoordinatedLayerInfo&); >- void setCompositingLayerChildren(CoordinatedLayerID, const Vector<CoordinatedLayerID>&); >+ virtual ~CoordinatedLayerTreeHostProxy(); >+ void setCompositingLayerState(WebCore::CoordinatedLayerID, const WebCore::CoordinatedLayerInfo&); >+ void setCompositingLayerChildren(WebCore::CoordinatedLayerID, const Vector<WebCore::CoordinatedLayerID>&); > #if ENABLE(CSS_FILTERS) >- void setCompositingLayerFilters(CoordinatedLayerID, const WebCore::FilterOperations&); >+ void setCompositingLayerFilters(WebCore::CoordinatedLayerID, const WebCore::FilterOperations&); > #endif > #if ENABLE(CSS_SHADERS) > void createCustomFilterProgram(int id, const WebCore::CustomFilterProgramInfo&); > void removeCustomFilterProgram(int id); > #endif >- void createCompositingLayers(const Vector<CoordinatedLayerID>&); >- void deleteCompositingLayers(const Vector<CoordinatedLayerID>&); >- void setRootCompositingLayer(CoordinatedLayerID); >+ void createCompositingLayers(const Vector<WebCore::CoordinatedLayerID>&); >+ void deleteCompositingLayers(const Vector<WebCore::CoordinatedLayerID>&); >+ void setRootCompositingLayer(WebCore::CoordinatedLayerID); > void setContentsSize(const WebCore::FloatSize&); > void setVisibleContentsRect(const WebCore::FloatRect&, const WebCore::FloatPoint& trajectoryVector); > void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect); >- void createTileForLayer(CoordinatedLayerID, uint32_t tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&); >- void updateTileForLayer(CoordinatedLayerID, uint32_t tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&); >- void removeTileForLayer(CoordinatedLayerID, uint32_t tileID); >+ void createTileForLayer(WebCore::CoordinatedLayerID, uint32_t tileID, const WebCore::IntRect&, const WebCore::SurfaceUpdateInfo&); >+ void updateTileForLayer(WebCore::CoordinatedLayerID, uint32_t tileID, const WebCore::IntRect&, const WebCore::SurfaceUpdateInfo&); >+ void removeTileForLayer(WebCore::CoordinatedLayerID, uint32_t tileID); > void createUpdateAtlas(uint32_t atlasID, const WebCoordinatedSurface::Handle&); > void removeUpdateAtlas(uint32_t atlasID); >- void createImageBacking(CoordinatedImageBackingID); >- void updateImageBacking(CoordinatedImageBackingID, const WebCoordinatedSurface::Handle&); >- void clearImageBackingContents(CoordinatedImageBackingID); >- void removeImageBacking(CoordinatedImageBackingID); >+ void createImageBacking(WebCore::CoordinatedImageBackingID); >+ void updateImageBacking(WebCore::CoordinatedImageBackingID, const WebCoordinatedSurface::Handle&); >+ void clearImageBackingContents(WebCore::CoordinatedImageBackingID); >+ void removeImageBacking(WebCore::CoordinatedImageBackingID); > void didReceiveCoordinatedLayerTreeHostProxyMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&); > void didChangeScrollPosition(const WebCore::FloatPoint& position); > #if USE(GRAPHICS_SURFACE) >- void createCanvas(CoordinatedLayerID, const WebCore::IntSize&, const WebCore::GraphicsSurfaceToken&); >- void syncCanvas(CoordinatedLayerID, uint32_t frontBuffer); >- void destroyCanvas(CoordinatedLayerID); >+ void createCanvas(WebCore::CoordinatedLayerID, const WebCore::IntSize&, const WebCore::GraphicsSurfaceToken&); >+ void syncCanvas(WebCore::CoordinatedLayerID, uint32_t frontBuffer); >+ void destroyCanvas(WebCore::CoordinatedLayerID); > #endif >- void setLayerRepaintCount(CoordinatedLayerID, int value); >- LayerTreeRenderer* layerTreeRenderer() const { return m_renderer.get(); } >- void setLayerAnimations(CoordinatedLayerID, const WebCore::GraphicsLayerAnimations&); >+ void setLayerRepaintCount(WebCore::CoordinatedLayerID, int value); >+ WebCore::TextureMapperScene* textureMapperScene() const { return m_textureMapperScene.get(); } >+ void setLayerAnimations(WebCore::CoordinatedLayerID, const WebCore::GraphicsLayerAnimations&); > void setAnimationsLocked(bool); > #if ENABLE(REQUEST_ANIMATION_FRAME) > void requestAnimationFrame(); > #endif > void setBackgroundColor(const WebCore::Color&); > >- // LayerTreeRendererClient Methods. >+ // TextureMapperSceneClient Methods. > #if ENABLE(REQUEST_ANIMATION_FRAME) > virtual void animationFrameReady() OVERRIDE; > #endif >@@ -105,13 +105,13 @@ protected: > void dispatchUpdate(const Function<void()>&); > > DrawingAreaProxy* m_drawingAreaProxy; >- RefPtr<LayerTreeRenderer> m_renderer; >+ RefPtr<WebCore::TextureMapperScene> m_textureMapperScene; > WebCore::FloatRect m_lastSentVisibleRect; > WebCore::FloatPoint m_lastSentTrajectoryVector; > }; > >-} >+} // namespace WebKit > >-#endif >+#endif // USE(COORDINATED_GRAPHICS) > > #endif // CoordinatedLayerTreeHostProxy_h >diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.messages.in b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.messages.in >index e3e78b30b0192553b06c6928928b0a6b33d6d6ae..21dc2634503ccde879062d79323c6bbabe4f72ec 100644 >--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.messages.in >+++ b/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.messages.in >@@ -19,7 +19,7 @@ > > #if USE(COORDINATED_GRAPHICS) > messages -> CoordinatedLayerTreeHostProxy LegacyReceiver { >- SetCompositingLayerState(uint32_t id, WebKit::CoordinatedLayerInfo layerInfo) >+ SetCompositingLayerState(uint32_t id, WebCore::CoordinatedLayerInfo layerInfo) > SetCompositingLayerChildren(uint32_t id, Vector<uint32_t> children) > #if ENABLE(CSS_FILTERS) > SetCompositingLayerFilters(uint32_t id, WebCore::FilterOperations filters) >@@ -31,8 +31,8 @@ messages -> CoordinatedLayerTreeHostProxy LegacyReceiver { > SetRootCompositingLayer(uint32_t id) > CreateCompositingLayers(Vector<uint32_t> ids) > DeleteCompositingLayers(Vector<uint32_t> ids) >- CreateTileForLayer(uint32_t layerID, uint32_t tileID, WebCore::IntRect tileRect, WebKit::SurfaceUpdateInfo updateInfo) >- UpdateTileForLayer(uint32_t layerID, uint32_t tileID, WebCore::IntRect tileRect, WebKit::SurfaceUpdateInfo updateInfo) >+ CreateTileForLayer(uint32_t layerID, uint32_t tileID, WebCore::IntRect tileRect, WebCore::SurfaceUpdateInfo updateInfo) >+ UpdateTileForLayer(uint32_t layerID, uint32_t tileID, WebCore::IntRect tileRect, WebCore::SurfaceUpdateInfo updateInfo) > RemoveTileForLayer(uint32_t layerID, uint32_t tileID) > CreateUpdateAtlas(uint32_t atlasID, WebKit::WebCoordinatedSurface::Handle handle) > RemoveUpdateAtlas(uint32_t atlasID) >diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp >deleted file mode 100644 >index 70fa963a785782300bebfcf2dc83811864a8a1df..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp >+++ /dev/null >@@ -1,698 +0,0 @@ >-/* >- Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >- Copyright (C) 2012 Company 100, Inc. >- >- This library is free software; you can redistribute it and/or >- modify it under the terms of the GNU Library General Public >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Library General Public License for more details. >- >- You should have received a copy of the GNU Library General Public License >- along with this library; see the file COPYING.LIB. If not, write to >- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- Boston, MA 02110-1301, USA. >-*/ >- >-#include "config.h" >- >-#if USE(COORDINATED_GRAPHICS) >- >-#include "LayerTreeRenderer.h" >- >-#include "CoordinatedBackingStore.h" >-#include "GraphicsLayerTextureMapper.h" >-#include "MessageID.h" >-#include "TextureMapper.h" >-#include "TextureMapperBackingStore.h" >-#include "TextureMapperGL.h" >-#include "TextureMapperLayer.h" >-#include "UpdateInfo.h" >-#include <OpenGLShims.h> >-#include <wtf/Atomics.h> >-#include <wtf/MainThread.h> >- >-#if ENABLE(CSS_SHADERS) >-#include "CustomFilterProgram.h" >-#include "CustomFilterProgramInfo.h" >-#include "WebCustomFilterOperation.h" >-#include "WebCustomFilterProgram.h" >-#endif >- >-namespace WebKit { >- >-using namespace WebCore; >- >-void LayerTreeRenderer::dispatchOnMainThread(const Function<void()>& function) >-{ >- if (isMainThread()) >- function(); >- else >- callOnMainThread(function); >-} >- >-static FloatPoint boundedScrollPosition(const FloatPoint& scrollPosition, const FloatRect& visibleContentRect, const FloatSize& contentSize) >-{ >- float scrollPositionX = std::max(scrollPosition.x(), 0.0f); >- scrollPositionX = std::min(scrollPositionX, contentSize.width() - visibleContentRect.width()); >- >- float scrollPositionY = std::max(scrollPosition.y(), 0.0f); >- scrollPositionY = std::min(scrollPositionY, contentSize.height() - visibleContentRect.height()); >- return FloatPoint(scrollPositionX, scrollPositionY); >-} >- >-static bool layerShouldHaveBackingStore(GraphicsLayer* layer) >-{ >- return layer->drawsContent() && layer->contentsAreVisible() && !layer->size().isEmpty(); >-} >- >-LayerTreeRenderer::LayerTreeRenderer(LayerTreeRendererClient* client) >- : m_client(client) >- , m_isActive(false) >- , m_rootLayerID(InvalidCoordinatedLayerID) >- , m_animationsLocked(false) >-#if ENABLE(REQUEST_ANIMATION_FRAME) >- , m_animationFrameRequested(false) >-#endif >- , m_backgroundColor(Color::white) >- , m_setDrawsBackground(false) >-{ >- ASSERT(isMainThread()); >-} >- >-LayerTreeRenderer::~LayerTreeRenderer() >-{ >-} >- >-void LayerTreeRenderer::paintToCurrentGLContext(const TransformationMatrix& matrix, float opacity, const FloatRect& clipRect, TextureMapper::PaintFlags PaintFlags) >-{ >- if (!m_textureMapper) { >- m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode); >- static_cast<TextureMapperGL*>(m_textureMapper.get())->setEnableEdgeDistanceAntialiasing(true); >- } >- >- ASSERT(m_textureMapper->accelerationMode() == TextureMapper::OpenGLMode); >- syncRemoteContent(); >- >- adjustPositionForFixedLayers(); >- GraphicsLayer* currentRootLayer = rootLayer(); >- if (!currentRootLayer) >- return; >- >- TextureMapperLayer* layer = toTextureMapperLayer(currentRootLayer); >- >- if (!layer) >- return; >- >- layer->setTextureMapper(m_textureMapper.get()); >- if (!m_animationsLocked) >- layer->applyAnimationsRecursively(); >- m_textureMapper->beginPainting(PaintFlags); >- m_textureMapper->beginClip(TransformationMatrix(), clipRect); >- >- if (m_setDrawsBackground) { >- RGBA32 rgba = makeRGBA32FromFloats(m_backgroundColor.red(), >- m_backgroundColor.green(), m_backgroundColor.blue(), >- m_backgroundColor.alpha() * opacity); >- m_textureMapper->drawSolidColor(clipRect, TransformationMatrix(), Color(rgba)); >- } >- >- if (currentRootLayer->opacity() != opacity || currentRootLayer->transform() != matrix) { >- currentRootLayer->setOpacity(opacity); >- currentRootLayer->setTransform(matrix); >- currentRootLayer->flushCompositingStateForThisLayerOnly(); >- } >- >- layer->paint(); >- m_textureMapper->endClip(); >- m_textureMapper->endPainting(); >- >- if (layer->descendantsOrSelfHaveRunningAnimations()) >- dispatchOnMainThread(bind(&LayerTreeRenderer::updateViewport, this)); >- >-#if ENABLE(REQUEST_ANIMATION_FRAME) >- if (m_animationFrameRequested) { >- m_animationFrameRequested = false; >- dispatchOnMainThread(bind(&LayerTreeRenderer::animationFrameReady, this)); >- } >-#endif >-} >- >-#if ENABLE(REQUEST_ANIMATION_FRAME) >-void LayerTreeRenderer::animationFrameReady() >-{ >- ASSERT(isMainThread()); >- if (m_client) >- m_client->animationFrameReady(); >-} >- >-void LayerTreeRenderer::requestAnimationFrame() >-{ >- m_animationFrameRequested = true; >-} >-#endif >- >-void LayerTreeRenderer::paintToGraphicsContext(BackingStore::PlatformGraphicsContext painter) >-{ >- if (!m_textureMapper) >- m_textureMapper = TextureMapper::create(); >- ASSERT(m_textureMapper->accelerationMode() == TextureMapper::SoftwareMode); >- syncRemoteContent(); >- TextureMapperLayer* layer = toTextureMapperLayer(rootLayer()); >- >- if (!layer) >- return; >- >- GraphicsContext graphicsContext(painter); >- m_textureMapper->setGraphicsContext(&graphicsContext); >- m_textureMapper->beginPainting(); >- >- if (m_setDrawsBackground) >- m_textureMapper->drawSolidColor(graphicsContext.clipBounds(), TransformationMatrix(), m_backgroundColor); >- >- layer->paint(); >- m_textureMapper->endPainting(); >- m_textureMapper->setGraphicsContext(0); >-} >- >-void LayerTreeRenderer::setContentsSize(const WebCore::FloatSize& contentsSize) >-{ >- m_contentsSize = contentsSize; >-} >- >-void LayerTreeRenderer::setVisibleContentsRect(const FloatRect& rect) >-{ >- m_visibleContentsRect = rect; >-} >- >-void LayerTreeRenderer::updateViewport() >-{ >- ASSERT(isMainThread()); >- if (m_client) >- m_client->updateViewport(); >-} >- >-void LayerTreeRenderer::adjustPositionForFixedLayers() >-{ >- if (m_fixedLayers.isEmpty()) >- return; >- >- // Fixed layer positions are updated by the web process when we update the visible contents rect / scroll position. >- // If we want those layers to follow accurately the viewport when we move between the web process updates, we have to offset >- // them by the delta between the current position and the position of the viewport used for the last layout. >- FloatPoint scrollPosition = boundedScrollPosition(m_visibleContentsRect.location(), m_visibleContentsRect, m_contentsSize); >- FloatPoint renderedScrollPosition = boundedScrollPosition(m_renderedContentsScrollPosition, m_visibleContentsRect, m_contentsSize); >- FloatSize delta = scrollPosition - renderedScrollPosition; >- >- LayerRawPtrMap::iterator end = m_fixedLayers.end(); >- for (LayerRawPtrMap::iterator it = m_fixedLayers.begin(); it != end; ++it) >- toTextureMapperLayer(it->value)->setScrollPositionDeltaIfNeeded(delta); >-} >- >-void LayerTreeRenderer::didChangeScrollPosition(const FloatPoint& position) >-{ >- m_pendingRenderedContentsScrollPosition = position; >-} >- >-#if USE(GRAPHICS_SURFACE) >-void LayerTreeRenderer::createCanvas(CoordinatedLayerID id, const WebCore::IntSize&, PassRefPtr<GraphicsSurface> surface) >-{ >- ASSERT(m_textureMapper); >- GraphicsLayer* layer = layerByID(id); >- ASSERT(!m_surfaceBackingStores.contains(id)); >- >- RefPtr<TextureMapperSurfaceBackingStore> canvasBackingStore(TextureMapperSurfaceBackingStore::create()); >- m_surfaceBackingStores.set(id, canvasBackingStore); >- >- canvasBackingStore->setGraphicsSurface(surface); >- layer->setContentsToMedia(canvasBackingStore.get()); >-} >- >-void LayerTreeRenderer::syncCanvas(CoordinatedLayerID id, uint32_t frontBuffer) >-{ >- ASSERT(m_textureMapper); >- ASSERT(m_surfaceBackingStores.contains(id)); >- >- SurfaceBackingStoreMap::iterator it = m_surfaceBackingStores.find(id); >- RefPtr<TextureMapperSurfaceBackingStore> canvasBackingStore = it->value; >- >- canvasBackingStore->swapBuffersIfNeeded(frontBuffer); >-} >- >-void LayerTreeRenderer::destroyCanvas(CoordinatedLayerID id) >-{ >- ASSERT(m_textureMapper); >- GraphicsLayer* layer = layerByID(id); >- ASSERT(m_surfaceBackingStores.contains(id)); >- >- m_surfaceBackingStores.remove(id); >- layer->setContentsToMedia(0); >-} >-#endif >- >-void LayerTreeRenderer::setLayerRepaintCount(CoordinatedLayerID id, int value) >-{ >- GraphicsLayer* layer = layerByID(id); >- toGraphicsLayerTextureMapper(layer)->setRepaintCount(value); >-} >- >-void LayerTreeRenderer::setLayerChildren(CoordinatedLayerID id, const Vector<CoordinatedLayerID>& childIDs) >-{ >- GraphicsLayer* layer = layerByID(id); >- Vector<GraphicsLayer*> children; >- >- for (size_t i = 0; i < childIDs.size(); ++i) { >- CoordinatedLayerID childID = childIDs[i]; >- GraphicsLayer* child = layerByID(childID); >- children.append(child); >- } >- layer->setChildren(children); >-} >- >-#if ENABLE(CSS_FILTERS) >-void LayerTreeRenderer::setLayerFilters(CoordinatedLayerID id, const FilterOperations& filters) >-{ >- GraphicsLayer* layer = layerByID(id); >- >-#if ENABLE(CSS_SHADERS) >- injectCachedCustomFilterPrograms(filters); >-#endif >- layer->setFilters(filters); >-} >-#endif >- >-#if ENABLE(CSS_SHADERS) >-void LayerTreeRenderer::injectCachedCustomFilterPrograms(const FilterOperations& filters) const >-{ >- for (size_t i = 0; i < filters.size(); ++i) { >- FilterOperation* operation = filters.operations().at(i).get(); >- if (operation->getOperationType() != FilterOperation::CUSTOM) >- continue; >- >- WebCustomFilterOperation* customOperation = static_cast<WebCustomFilterOperation*>(operation); >- ASSERT(!customOperation->program()); >- CustomFilterProgramMap::const_iterator iter = m_customFilterPrograms.find(customOperation->programID()); >- ASSERT(iter != m_customFilterPrograms.end()); >- customOperation->setProgram(iter->value.get()); >- } >-} >- >-void LayerTreeRenderer::createCustomFilterProgram(int id, const WebCore::CustomFilterProgramInfo& programInfo) >-{ >- ASSERT(!m_customFilterPrograms.contains(id)); >- m_customFilterPrograms.set(id, WebCustomFilterProgram::create(programInfo.vertexShaderString(), programInfo.fragmentShaderString(), programInfo.programType(), programInfo.mixSettings(), programInfo.meshType())); >-} >- >-void LayerTreeRenderer::removeCustomFilterProgram(int id) >-{ >- CustomFilterProgramMap::iterator iter = m_customFilterPrograms.find(id); >- ASSERT(iter != m_customFilterPrograms.end()); >- if (m_textureMapper) >- m_textureMapper->removeCachedCustomFilterProgram(iter->value.get()); >- m_customFilterPrograms.remove(iter); >-} >-#endif // ENABLE(CSS_SHADERS) >- >-void LayerTreeRenderer::setLayerState(CoordinatedLayerID id, const CoordinatedLayerInfo& layerInfo) >-{ >- ASSERT(m_rootLayerID != InvalidCoordinatedLayerID); >- GraphicsLayer* layer = layerByID(id); >- >- layer->setReplicatedByLayer(getLayerByIDIfExists(layerInfo.replica)); >- layer->setMaskLayer(getLayerByIDIfExists(layerInfo.mask)); >- >- layer->setAnchorPoint(layerInfo.anchorPoint); >- layer->setPosition(layerInfo.pos); >- layer->setSize(layerInfo.size); >- >- layer->setTransform(layerInfo.transform); >- layer->setChildrenTransform(layerInfo.childrenTransform); >- layer->setBackfaceVisibility(layerInfo.backfaceVisible); >- layer->setContentsOpaque(layerInfo.contentsOpaque); >- layer->setContentsRect(layerInfo.contentsRect); >- layer->setContentsToSolidColor(layerInfo.solidColor); >- layer->setDrawsContent(layerInfo.drawsContent); >- layer->setContentsVisible(layerInfo.contentsVisible); >- toGraphicsLayerTextureMapper(layer)->setFixedToViewport(layerInfo.fixedToViewport); >- layer->setShowDebugBorder(layerInfo.showDebugBorders); >- layer->setDebugBorder(layerInfo.debugBorderColor, layerInfo.debugBorderWidth); >- layer->setShowRepaintCounter(layerInfo.showRepaintCounter); >- >- if (layerInfo.fixedToViewport) >- m_fixedLayers.add(id, layer); >- else >- m_fixedLayers.remove(id); >- >- assignImageBackingToLayer(layer, layerInfo.imageID); >- prepareContentBackingStore(layer); >- >- // Never make the root layer clip. >- layer->setMasksToBounds(layerInfo.isRootLayer ? false : layerInfo.masksToBounds); >- layer->setOpacity(layerInfo.opacity); >- layer->setPreserves3D(layerInfo.preserves3D); >-} >- >-GraphicsLayer* LayerTreeRenderer::getLayerByIDIfExists(CoordinatedLayerID id) >-{ >- return (id != InvalidCoordinatedLayerID) ? layerByID(id) : 0; >-} >- >-void LayerTreeRenderer::createLayers(const Vector<CoordinatedLayerID>& ids) >-{ >- for (size_t index = 0; index < ids.size(); ++index) >- createLayer(ids[index]); >-} >- >-void LayerTreeRenderer::createLayer(CoordinatedLayerID id) >-{ >- OwnPtr<WebCore::GraphicsLayer> newLayer = GraphicsLayer::create(0 /* factory */, this); >- toGraphicsLayerTextureMapper(newLayer.get())->setHasOwnBackingStore(false); >- m_layers.add(id, newLayer.release()); >-} >- >-void LayerTreeRenderer::deleteLayers(const Vector<CoordinatedLayerID>& layerIDs) >-{ >- for (size_t index = 0; index < layerIDs.size(); ++index) >- deleteLayer(layerIDs[index]); >-} >- >-void LayerTreeRenderer::deleteLayer(CoordinatedLayerID layerID) >-{ >- OwnPtr<GraphicsLayer> layer = m_layers.take(layerID); >- ASSERT(layer); >- >- m_backingStores.remove(layer.get()); >- m_fixedLayers.remove(layerID); >-#if USE(GRAPHICS_SURFACE) >- m_surfaceBackingStores.remove(layerID); >-#endif >-} >- >-void LayerTreeRenderer::setRootLayerID(CoordinatedLayerID layerID) >-{ >- ASSERT(layerID != InvalidCoordinatedLayerID); >- ASSERT(m_rootLayerID == InvalidCoordinatedLayerID); >- >- m_rootLayerID = layerID; >- >- GraphicsLayer* layer = layerByID(layerID); >- ASSERT(m_rootLayer->children().isEmpty()); >- m_rootLayer->addChild(layer); >-} >- >-void LayerTreeRenderer::prepareContentBackingStore(GraphicsLayer* graphicsLayer) >-{ >- if (!layerShouldHaveBackingStore(graphicsLayer)) { >- removeBackingStoreIfNeeded(graphicsLayer); >- return; >- } >- >- createBackingStoreIfNeeded(graphicsLayer); >-} >- >-void LayerTreeRenderer::createBackingStoreIfNeeded(GraphicsLayer* graphicsLayer) >-{ >- if (m_backingStores.contains(graphicsLayer)) >- return; >- >- RefPtr<CoordinatedBackingStore> backingStore(CoordinatedBackingStore::create()); >- backingStore->setSize(graphicsLayer->size()); >- m_backingStores.add(graphicsLayer, backingStore); >- toGraphicsLayerTextureMapper(graphicsLayer)->setBackingStore(backingStore); >-} >- >-void LayerTreeRenderer::removeBackingStoreIfNeeded(GraphicsLayer* graphicsLayer) >-{ >- RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.take(graphicsLayer); >- if (!backingStore) >- return; >- >- toGraphicsLayerTextureMapper(graphicsLayer)->setBackingStore(0); >-} >- >-void LayerTreeRenderer::resetBackingStoreSizeToLayerSize(GraphicsLayer* graphicsLayer) >-{ >- RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(graphicsLayer); >- ASSERT(backingStore); >- backingStore->setSize(graphicsLayer->size()); >-} >- >-void LayerTreeRenderer::createTile(CoordinatedLayerID layerID, uint32_t tileID, float scale) >-{ >- GraphicsLayer* layer = layerByID(layerID); >- RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(layer); >- ASSERT(backingStore); >- backingStore->createTile(tileID, scale); >- resetBackingStoreSizeToLayerSize(layer); >-} >- >-void LayerTreeRenderer::removeTile(CoordinatedLayerID layerID, uint32_t tileID) >-{ >- GraphicsLayer* layer = layerByID(layerID); >- RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(layer); >- if (!backingStore) >- return; >- >- backingStore->removeTile(tileID); >- resetBackingStoreSizeToLayerSize(layer); >- m_backingStoresWithPendingBuffers.add(backingStore); >-} >- >-void LayerTreeRenderer::updateTile(CoordinatedLayerID layerID, uint32_t tileID, const TileUpdate& update) >-{ >- GraphicsLayer* layer = layerByID(layerID); >- RefPtr<CoordinatedBackingStore> backingStore = m_backingStores.get(layer); >- ASSERT(backingStore); >- >- SurfaceMap::iterator it = m_surfaces.find(update.atlasID); >- ASSERT(it != m_surfaces.end()); >- >- backingStore->updateTile(tileID, update.sourceRect, update.tileRect, it->value, update.offset); >- resetBackingStoreSizeToLayerSize(layer); >- m_backingStoresWithPendingBuffers.add(backingStore); >-} >- >-void LayerTreeRenderer::createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface> surface) >-{ >- ASSERT(!m_surfaces.contains(atlasID)); >- m_surfaces.add(atlasID, surface); >-} >- >-void LayerTreeRenderer::removeUpdateAtlas(uint32_t atlasID) >-{ >- ASSERT(m_surfaces.contains(atlasID)); >- m_surfaces.remove(atlasID); >-} >- >-void LayerTreeRenderer::createImageBacking(CoordinatedImageBackingID imageID) >-{ >- ASSERT(!m_imageBackings.contains(imageID)); >- RefPtr<CoordinatedBackingStore> backingStore(CoordinatedBackingStore::create()); >- m_imageBackings.add(imageID, backingStore.release()); >-} >- >-void LayerTreeRenderer::updateImageBacking(CoordinatedImageBackingID imageID, PassRefPtr<CoordinatedSurface> surface) >-{ >- ASSERT(m_imageBackings.contains(imageID)); >- ImageBackingMap::iterator it = m_imageBackings.find(imageID); >- RefPtr<CoordinatedBackingStore> backingStore = it->value; >- >- // CoordinatedImageBacking is realized to CoordinatedBackingStore with only one tile in UI Process. >- backingStore->createTile(1 /* id */, 1 /* scale */); >- IntRect rect(IntPoint::zero(), surface->size()); >- // See CoordinatedGraphicsLayer::shouldDirectlyCompositeImage() >- ASSERT(2000 >= std::max(rect.width(), rect.height())); >- backingStore->setSize(rect.size()); >- backingStore->updateTile(1 /* id */, rect, rect, surface, rect.location()); >- >- m_backingStoresWithPendingBuffers.add(backingStore); >-} >- >-void LayerTreeRenderer::clearImageBackingContents(CoordinatedImageBackingID imageID) >-{ >- ASSERT(m_imageBackings.contains(imageID)); >- ImageBackingMap::iterator it = m_imageBackings.find(imageID); >- RefPtr<CoordinatedBackingStore> backingStore = it->value; >- backingStore->removeAllTiles(); >- m_backingStoresWithPendingBuffers.add(backingStore); >-} >- >-void LayerTreeRenderer::removeImageBacking(CoordinatedImageBackingID imageID) >-{ >- ASSERT(m_imageBackings.contains(imageID)); >- >- // We don't want TextureMapperLayer refers a dangling pointer. >- m_releasedImageBackings.append(m_imageBackings.take(imageID)); >-} >- >-void LayerTreeRenderer::assignImageBackingToLayer(GraphicsLayer* layer, CoordinatedImageBackingID imageID) >-{ >- if (imageID == InvalidCoordinatedImageBackingID) { >- layer->setContentsToMedia(0); >- return; >- } >- ImageBackingMap::iterator it = m_imageBackings.find(imageID); >- ASSERT(it != m_imageBackings.end()); >- layer->setContentsToMedia(it->value.get()); >-} >- >-void LayerTreeRenderer::removeReleasedImageBackingsIfNeeded() >-{ >- m_releasedImageBackings.clear(); >-} >- >-void LayerTreeRenderer::commitPendingBackingStoreOperations() >-{ >- HashSet<RefPtr<CoordinatedBackingStore> >::iterator end = m_backingStoresWithPendingBuffers.end(); >- for (HashSet<RefPtr<CoordinatedBackingStore> >::iterator it = m_backingStoresWithPendingBuffers.begin(); it != end; ++it) >- (*it)->commitTileOperations(m_textureMapper.get()); >- >- m_backingStoresWithPendingBuffers.clear(); >-} >- >-void LayerTreeRenderer::flushLayerChanges() >-{ >- m_renderedContentsScrollPosition = m_pendingRenderedContentsScrollPosition; >- >- // Since the frame has now been rendered, we can safely unlock the animations until the next layout. >- setAnimationsLocked(false); >- >- m_rootLayer->flushCompositingState(FloatRect()); >- commitPendingBackingStoreOperations(); >- removeReleasedImageBackingsIfNeeded(); >- >- // The pending tiles state is on its way for the screen, tell the web process to render the next one. >- dispatchOnMainThread(bind(&LayerTreeRenderer::renderNextFrame, this)); >-} >- >-void LayerTreeRenderer::renderNextFrame() >-{ >- if (m_client) >- m_client->renderNextFrame(); >-} >- >-void LayerTreeRenderer::ensureRootLayer() >-{ >- if (m_rootLayer) >- return; >- >- m_rootLayer = GraphicsLayer::create(0 /* factory */, this); >- m_rootLayer->setMasksToBounds(false); >- m_rootLayer->setDrawsContent(false); >- m_rootLayer->setAnchorPoint(FloatPoint3D(0, 0, 0)); >- >- // The root layer should not have zero size, or it would be optimized out. >- m_rootLayer->setSize(FloatSize(1.0, 1.0)); >- >- ASSERT(m_textureMapper); >- toTextureMapperLayer(m_rootLayer.get())->setTextureMapper(m_textureMapper.get()); >-} >- >-void LayerTreeRenderer::syncRemoteContent() >-{ >- // We enqueue messages and execute them during paint, as they require an active GL context. >- ensureRootLayer(); >- >- Vector<Function<void()> > renderQueue; >- bool calledOnMainThread = WTF::isMainThread(); >- if (!calledOnMainThread) >- m_renderQueueMutex.lock(); >- renderQueue.swap(m_renderQueue); >- if (!calledOnMainThread) >- m_renderQueueMutex.unlock(); >- >- for (size_t i = 0; i < renderQueue.size(); ++i) >- renderQueue[i](); >-} >- >-void LayerTreeRenderer::purgeGLResources() >-{ >- m_imageBackings.clear(); >- m_releasedImageBackings.clear(); >-#if USE(GRAPHICS_SURFACE) >- m_surfaceBackingStores.clear(); >-#endif >- m_surfaces.clear(); >- >- m_rootLayer.clear(); >- m_rootLayerID = InvalidCoordinatedLayerID; >- m_layers.clear(); >- m_fixedLayers.clear(); >- m_textureMapper.clear(); >- m_backingStores.clear(); >- m_backingStoresWithPendingBuffers.clear(); >- >- setActive(false); >- dispatchOnMainThread(bind(&LayerTreeRenderer::purgeBackingStores, this)); >-} >- >-void LayerTreeRenderer::purgeBackingStores() >-{ >- if (m_client) >- m_client->purgeBackingStores(); >-} >- >-void LayerTreeRenderer::setLayerAnimations(CoordinatedLayerID id, const GraphicsLayerAnimations& animations) >-{ >- GraphicsLayerTextureMapper* layer = toGraphicsLayerTextureMapper(layerByID(id)); >-#if ENABLE(CSS_SHADERS) >- for (size_t i = 0; i < animations.animations().size(); ++i) { >- const KeyframeValueList& keyframes = animations.animations().at(i).keyframes(); >- if (keyframes.property() != AnimatedPropertyWebkitFilter) >- continue; >- for (size_t j = 0; j < keyframes.size(); ++j) { >- const FilterAnimationValue* filterValue = static_cast<const FilterAnimationValue*>(keyframes.at(i)); >- injectCachedCustomFilterPrograms(*filterValue->value()); >- } >- } >-#endif >- layer->setAnimations(animations); >-} >- >-void LayerTreeRenderer::setAnimationsLocked(bool locked) >-{ >- m_animationsLocked = locked; >-} >- >-void LayerTreeRenderer::detach() >-{ >- ASSERT(isMainThread()); >- m_client = 0; >-} >- >-void LayerTreeRenderer::appendUpdate(const Function<void()>& function) >-{ >- if (!m_isActive) >- return; >- >- ASSERT(isMainThread()); >- MutexLocker locker(m_renderQueueMutex); >- m_renderQueue.append(function); >-} >- >-void LayerTreeRenderer::setActive(bool active) >-{ >- if (m_isActive == active) >- return; >- >- // Have to clear render queue in both cases. >- // If there are some updates in queue during activation then those updates are from previous instance of paint node >- // and cannot be applied to the newly created instance. >- m_renderQueue.clear(); >- m_isActive = active; >- if (m_isActive) >- dispatchOnMainThread(bind(&LayerTreeRenderer::renderNextFrame, this)); >-} >- >-void LayerTreeRenderer::setBackgroundColor(const WebCore::Color& color) >-{ >- m_backgroundColor = color; >-} >- >-} // namespace WebKit >- >-#endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h b/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h >deleted file mode 100644 >index d1381e33c6ceea1bef7cad56b4be5e8e8182fdb2..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h >+++ /dev/null >@@ -1,230 +0,0 @@ >-/* >- Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >- >- This library is free software; you can redistribute it and/or >- modify it under the terms of the GNU Library General Public >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Library General Public License for more details. >- >- You should have received a copy of the GNU Library General Public License >- along with this library; see the file COPYING.LIB. If not, write to >- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- Boston, MA 02110-1301, USA. >-*/ >- >-#ifndef LayerTreeRenderer_h >-#define LayerTreeRenderer_h >- >-#if USE(COORDINATED_GRAPHICS) >-#include "BackingStore.h" >-#include "CoordinatedLayerInfo.h" >-#include "CoordinatedSurface.h" >-#include "TextureMapper.h" >-#include "TextureMapperBackingStore.h" >-#include <WebCore/GraphicsContext.h> >-#include <WebCore/GraphicsLayer.h> >-#include <WebCore/GraphicsLayerAnimation.h> >-#include <WebCore/GraphicsSurface.h> >-#include <WebCore/IntRect.h> >-#include <WebCore/IntSize.h> >-#include <WebCore/RunLoop.h> >-#include <WebCore/Timer.h> >-#include <wtf/Functional.h> >-#include <wtf/HashSet.h> >-#include <wtf/ThreadingPrimitives.h> >-#include <wtf/Vector.h> >- >-namespace WebCore { >-class CustomFilterProgram; >-class CustomFilterProgramInfo; >-class TextureMapperLayer; >-} >- >-namespace WebKit { >- >-class CoordinatedBackingStore; >-class CoordinatedLayerInfo; >- >-class LayerTreeRendererClient { >-public: >-#if ENABLE(REQUEST_ANIMATION_FRAME) >- virtual void animationFrameReady() = 0; >-#endif >- virtual void updateViewport() = 0; >- virtual void renderNextFrame() = 0; >- virtual void purgeBackingStores() = 0; >-}; >- >-class LayerTreeRenderer : public ThreadSafeRefCounted<LayerTreeRenderer>, public WebCore::GraphicsLayerClient { >-public: >- struct TileUpdate { >- WebCore::IntRect sourceRect; >- WebCore::IntRect tileRect; >- uint32_t atlasID; >- WebCore::IntPoint offset; >- TileUpdate(const WebCore::IntRect& source, const WebCore::IntRect& tile, uint32_t atlas, const WebCore::IntPoint& newOffset) >- : sourceRect(source) >- , tileRect(tile) >- , atlasID(atlas) >- , offset(newOffset) >- { >- } >- }; >- explicit LayerTreeRenderer(LayerTreeRendererClient*); >- virtual ~LayerTreeRenderer(); >- void paintToCurrentGLContext(const WebCore::TransformationMatrix&, float, const WebCore::FloatRect&, WebCore::TextureMapper::PaintFlags = 0); >- void paintToGraphicsContext(BackingStore::PlatformGraphicsContext); >- void setContentsSize(const WebCore::FloatSize&); >- void setVisibleContentsRect(const WebCore::FloatRect&); >- void didChangeScrollPosition(const WebCore::FloatPoint& position); >-#if USE(GRAPHICS_SURFACE) >- void createCanvas(CoordinatedLayerID, const WebCore::IntSize&, PassRefPtr<WebCore::GraphicsSurface>); >- void syncCanvas(CoordinatedLayerID, uint32_t frontBuffer); >- void destroyCanvas(CoordinatedLayerID); >-#endif >- void setLayerRepaintCount(CoordinatedLayerID, int value); >- >- void detach(); >- void appendUpdate(const Function<void()>&); >- >- // The painting thread must lock the main thread to use below two methods, because two methods access members that the main thread manages. See m_client. >- // Currently, QQuickWebPage::updatePaintNode() locks the main thread before calling both methods. >- void purgeGLResources(); >- void setActive(bool); >- >- void createLayers(const Vector<CoordinatedLayerID>&); >- void deleteLayers(const Vector<CoordinatedLayerID>&); >- void setRootLayerID(CoordinatedLayerID); >- void setLayerChildren(CoordinatedLayerID, const Vector<CoordinatedLayerID>&); >- void setLayerState(CoordinatedLayerID, const CoordinatedLayerInfo&); >-#if ENABLE(CSS_FILTERS) >- void setLayerFilters(CoordinatedLayerID, const WebCore::FilterOperations&); >-#endif >-#if ENABLE(CSS_SHADERS) >- void injectCachedCustomFilterPrograms(const WebCore::FilterOperations& filters) const; >- void createCustomFilterProgram(int id, const WebCore::CustomFilterProgramInfo&); >- void removeCustomFilterProgram(int id); >-#endif >- >- void createTile(CoordinatedLayerID, uint32_t tileID, float scale); >- void removeTile(CoordinatedLayerID, uint32_t tileID); >- void updateTile(CoordinatedLayerID, uint32_t tileID, const TileUpdate&); >- void createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface>); >- void removeUpdateAtlas(uint32_t atlasID); >- void flushLayerChanges(); >- void createImageBacking(CoordinatedImageBackingID); >- void updateImageBacking(CoordinatedImageBackingID, PassRefPtr<CoordinatedSurface>); >- void clearImageBackingContents(CoordinatedImageBackingID); >- void removeImageBacking(CoordinatedImageBackingID); >- void setLayerAnimations(CoordinatedLayerID, const WebCore::GraphicsLayerAnimations&); >- void setAnimationsLocked(bool); >- void setBackgroundColor(const WebCore::Color&); >- void setDrawsBackground(bool enable) { m_setDrawsBackground = enable; } >- >-#if ENABLE(REQUEST_ANIMATION_FRAME) >- void requestAnimationFrame(); >-#endif >- >-private: >- WebCore::GraphicsLayer* layerByID(CoordinatedLayerID id) >- { >- ASSERT(m_layers.contains(id)); >- ASSERT(id != InvalidCoordinatedLayerID); >- return m_layers.get(id); >- } >- WebCore::GraphicsLayer* getLayerByIDIfExists(CoordinatedLayerID); >- WebCore::GraphicsLayer* rootLayer() { return m_rootLayer.get(); } >- >- void syncRemoteContent(); >- void adjustPositionForFixedLayers(); >- >- // Reimplementations from WebCore::GraphicsLayerClient. >- virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double) { } >- virtual void notifyFlushRequired(const WebCore::GraphicsLayer*) { } >- virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect&) OVERRIDE { } >- >- void dispatchOnMainThread(const Function<void()>&); >- void updateViewport(); >-#if ENABLE(REQUEST_ANIMATION_FRAME) >- void animationFrameReady(); >-#endif >- void renderNextFrame(); >- void purgeBackingStores(); >- >- void createLayer(CoordinatedLayerID); >- void deleteLayer(CoordinatedLayerID); >- >- void assignImageBackingToLayer(WebCore::GraphicsLayer*, CoordinatedImageBackingID); >- void removeReleasedImageBackingsIfNeeded(); >- void ensureRootLayer(); >- void commitPendingBackingStoreOperations(); >- >- void prepareContentBackingStore(WebCore::GraphicsLayer*); >- void createBackingStoreIfNeeded(WebCore::GraphicsLayer*); >- void removeBackingStoreIfNeeded(WebCore::GraphicsLayer*); >- void resetBackingStoreSizeToLayerSize(WebCore::GraphicsLayer*); >- >- WebCore::FloatSize m_contentsSize; >- WebCore::FloatRect m_visibleContentsRect; >- >- // Render queue can be accessed ony from main thread or updatePaintNode call stack! >- Vector<Function<void()> > m_renderQueue; >- Mutex m_renderQueueMutex; >- >- OwnPtr<WebCore::TextureMapper> m_textureMapper; >- >- typedef HashMap<CoordinatedImageBackingID, RefPtr<CoordinatedBackingStore> > ImageBackingMap; >- ImageBackingMap m_imageBackings; >- Vector<RefPtr<CoordinatedBackingStore> > m_releasedImageBackings; >- >- typedef HashMap<WebCore::GraphicsLayer*, RefPtr<CoordinatedBackingStore> > BackingStoreMap; >- BackingStoreMap m_backingStores; >- >- HashSet<RefPtr<CoordinatedBackingStore> > m_backingStoresWithPendingBuffers; >- >-#if USE(GRAPHICS_SURFACE) >- typedef HashMap<CoordinatedLayerID, RefPtr<WebCore::TextureMapperSurfaceBackingStore> > SurfaceBackingStoreMap; >- SurfaceBackingStoreMap m_surfaceBackingStores; >-#endif >- >- typedef HashMap<uint32_t /* atlasID */, RefPtr<CoordinatedSurface> > SurfaceMap; >- SurfaceMap m_surfaces; >- >- // Below two members are accessed by only the main thread. The painting thread must lock the main thread to access both members. >- LayerTreeRendererClient* m_client; >- bool m_isActive; >- >- OwnPtr<WebCore::GraphicsLayer> m_rootLayer; >- >- typedef HashMap<CoordinatedLayerID, OwnPtr<WebCore::GraphicsLayer> > LayerMap; >- LayerMap m_layers; >- typedef HashMap<CoordinatedLayerID, WebCore::GraphicsLayer*> LayerRawPtrMap; >- LayerRawPtrMap m_fixedLayers; >- CoordinatedLayerID m_rootLayerID; >- WebCore::FloatPoint m_renderedContentsScrollPosition; >- WebCore::FloatPoint m_pendingRenderedContentsScrollPosition; >- bool m_animationsLocked; >-#if ENABLE(REQUEST_ANIMATION_FRAME) >- bool m_animationFrameRequested; >-#endif >- WebCore::Color m_backgroundColor; >- bool m_setDrawsBackground; >- >-#if ENABLE(CSS_SHADERS) >- typedef HashMap<int, RefPtr<WebCore::CustomFilterProgram> > CustomFilterProgramMap; >- CustomFilterProgramMap m_customFilterPrograms; >-#endif >-}; >- >-}; >- >-#endif // USE(COORDINATED_GRAPHICS) >- >-#endif // LayerTreeRenderer_h >- >- >diff --git a/Source/WebKit2/UIProcess/efl/PageClientBase.cpp b/Source/WebKit2/UIProcess/efl/PageClientBase.cpp >index 2efdbd0e139eb00885f91aef9b28c903bfdc1c3d..51154bc837c9fac3495bb436d64a9a59e3a0cfe7 100644 >--- a/Source/WebKit2/UIProcess/efl/PageClientBase.cpp >+++ b/Source/WebKit2/UIProcess/efl/PageClientBase.cpp >@@ -30,7 +30,6 @@ > #include "DrawingAreaProxyImpl.h" > #include "EwkView.h" > #include "InputMethodContextEfl.h" >-#include "LayerTreeRenderer.h" > #include "NativeWebKeyboardEvent.h" > #include "NotImplemented.h" > #include "TextureMapper.h" >diff --git a/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp b/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp >index f11d08dd099c83b0ec8b7c5aed09ed64adcce16c..e703995877974202aeb47ac94c149803b9eb2014 100644 >--- a/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp >+++ b/Source/WebKit2/UIProcess/efl/PageViewportControllerClientEfl.cpp >@@ -30,9 +30,9 @@ > > #include "CoordinatedLayerTreeHostProxy.h" > #include "EwkView.h" >-#include "LayerTreeRenderer.h" > #include "PageViewportController.h" > #include "TransformationMatrix.h" >+#include <WebCore/TextureMapperScene.h> > > using namespace WebCore; > >@@ -56,7 +56,7 @@ DrawingAreaProxy* PageViewportControllerClientEfl::drawingArea() const > > void PageViewportControllerClientEfl::setRendererActive(bool active) > { >- drawingArea()->coordinatedLayerTreeHostProxy()->layerTreeRenderer()->setActive(active); >+ drawingArea()->coordinatedLayerTreeHostProxy()->textureMapperScene()->setActive(active); > } > > void PageViewportControllerClientEfl::updateViewportSize() >diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp >index f536c421765f2b6666c630d31ba33428a9569729..ce73337b36603ab8df2578af86417a0e092d619f 100644 >--- a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp >+++ b/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.cpp >@@ -21,11 +21,11 @@ > #include "config.h" > #include "QtWebPageSGNode.h" > >-#include "LayerTreeRenderer.h" > #include <QtGui/QPolygonF> > #include <QtQuick/QQuickItem> > #include <QtQuick/QQuickWindow> > #include <QtQuick/QSGSimpleRectNode> >+#include <WebCore/TextureMapperScene.h> > #include <WebCore/TransformationMatrix.h> > #include <private/qsgrendernode_p.h> > >@@ -35,10 +35,10 @@ namespace WebKit { > > class ContentsSGNode : public QSGRenderNode { > public: >- ContentsSGNode(PassRefPtr<LayerTreeRenderer> renderer) >- : m_renderer(renderer) >+ ContentsSGNode(PassRefPtr<TextureMapperScene> scene) >+ : m_textureMapperScene(scene) > { >- layerTreeRenderer()->setActive(true); >+ textureMapperScene()->setActive(true); > } > > virtual StateFlags changedStates() >@@ -62,12 +62,12 @@ public: > bool mirrored = projection && (*projection)(0, 0) * (*projection)(1, 1) - (*projection)(0, 1) * (*projection)(1, 0) > 0; > > // FIXME: Support non-rectangular clippings. >- layerTreeRenderer()->paintToCurrentGLContext(renderMatrix, inheritedOpacity(), clipRect(), mirrored ? TextureMapper::PaintingMirrored : 0); >+ textureMapperScene()->paintToCurrentGLContext(renderMatrix, inheritedOpacity(), clipRect(), mirrored ? TextureMapper::PaintingMirrored : 0); > } > > ~ContentsSGNode() > { >- layerTreeRenderer()->purgeGLResources(); >+ textureMapperScene()->purgeGLResources(); > } > > const QtWebPageSGNode* pageNode() const >@@ -77,7 +77,7 @@ public: > return parent; > } > >- LayerTreeRenderer* layerTreeRenderer() const { return m_renderer.get(); } >+ WebCore::TextureMapperScene* textureMapperScene() const { return m_textureMapperScene.get(); } > > private: > QRectF clipRect() const >@@ -126,7 +126,7 @@ private: > return resultRect; > } > >- RefPtr<LayerTreeRenderer> m_renderer; >+ RefPtr<WebCore::TextureMapperScene> m_textureMapperScene; > }; > > QtWebPageSGNode::QtWebPageSGNode() >@@ -150,13 +150,13 @@ void QtWebPageSGNode::setScale(float scale) > setMatrix(matrix); > } > >-void QtWebPageSGNode::setRenderer(PassRefPtr<LayerTreeRenderer> renderer) >+void QtWebPageSGNode::setTextureMapperScene(PassRefPtr<WebCore::TextureMapperScene> textureMapperScene) > { >- if (m_contentsNode && m_contentsNode->layerTreeRenderer() == renderer) >+ if (m_contentsNode && m_contentsNode->textureMapperScene() == textureMapperScene) > return; > > delete m_contentsNode; >- m_contentsNode = new ContentsSGNode(renderer); >+ m_contentsNode = new ContentsSGNode(textureMapperScene); > // This sets the parent node of the content to QtWebPageSGNode. > appendChildNode(m_contentsNode); > } >diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.h b/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.h >index 1bcc28e439902f59fdc849d407686e15038188b2..380ca14f26eb64b57fe148a8374fb1f8a7dfe19a 100644 >--- a/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.h >+++ b/Source/WebKit2/UIProcess/qt/QtWebPageSGNode.h >@@ -29,17 +29,20 @@ class QQuickItem; > class QSGSimpleRectNode; > QT_END_NAMESPACE > >+namespace WebCore { >+class TextureMapperScene; >+} >+ > namespace WebKit { > > class ContentsSGNode; >-class LayerTreeRenderer; > > class QtWebPageSGNode : public QSGTransformNode { > public: > QtWebPageSGNode(); > void setBackground(const QRectF&, const QColor&); > void setScale(float); >- void setRenderer(PassRefPtr<LayerTreeRenderer>); >+ void setTextureMapperScene(PassRefPtr<WebCore::TextureMapperScene>); > qreal devicePixelRatio() const { return m_devicePixelRatio; } > void setDevicePixelRatio(qreal devicePixelRatio) { m_devicePixelRatio = devicePixelRatio; } > >diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp >deleted file mode 100644 >index 3befcdac852012cfe93c87a5a9321a81d7535846..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp >+++ /dev/null >@@ -1,335 +0,0 @@ >-/* >- * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Lesser General Public >- * License as published by the Free Software Foundation; either >- * version 2.1 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Lesser General Public License for more details. >- * >- * You should have received a copy of the GNU Lesser General Public >- * License along with this library; if not, write to the Free Software >- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA >- * >- */ >- >-#include "config.h" >- >-#if USE(COORDINATED_GRAPHICS) >- >-#include "AreaAllocator.h" >- >-namespace WebKit { >- >-AreaAllocator::AreaAllocator(const WebCore::IntSize& size) >- : m_size(size) >- , m_minAlloc(1, 1) >- , m_margin(0, 0) >-{ >-} >- >-AreaAllocator::~AreaAllocator() >-{ >-} >- >-void AreaAllocator::expand(const WebCore::IntSize& size) >-{ >- m_size = m_size.expandedTo(size); >-} >- >-void AreaAllocator::expandBy(const WebCore::IntSize& size) >-{ >- m_size += size; >-} >- >-void AreaAllocator::release(const WebCore::IntRect&) >-{ >-} >- >-int AreaAllocator::overhead() const >-{ >- return 0; >-} >- >-WebCore::IntSize AreaAllocator::roundAllocation(const WebCore::IntSize& size) const >-{ >- int width = size.width() + m_margin.width(); >- int height = size.height() + m_margin.height(); >- int extra = width % m_minAlloc.width(); >- if (extra) >- width += m_minAlloc.width() - extra; >- extra = height % m_minAlloc.height(); >- if (extra) >- height += m_minAlloc.height() - extra; >- >- return WebCore::IntSize(width, height); >-} >- >-GeneralAreaAllocator::GeneralAreaAllocator(const WebCore::IntSize& size) >- : AreaAllocator(WebCore::nextPowerOfTwo(size)) >-{ >- m_root = new Node(); >- m_root->rect = WebCore::IntRect(0, 0, m_size.width(), m_size.height()); >- m_root->largestFree = m_size; >- m_root->parent = 0; >- m_root->left = 0; >- m_root->right = 0; >- m_nodeCount = 1; >- setMinimumAllocation(WebCore::IntSize(8, 8)); >-} >- >-GeneralAreaAllocator::~GeneralAreaAllocator() >-{ >- freeNode(m_root); >-} >- >-void GeneralAreaAllocator::freeNode(Node* node) >-{ >- if (node) { >- freeNode(node->left); >- freeNode(node->right); >- } >- delete node; >-} >- >-void GeneralAreaAllocator::expand(const WebCore::IntSize& size) >-{ >- AreaAllocator::expand(WebCore::nextPowerOfTwo(size)); >- >- if (m_root->rect.size() == m_size) >- return; // No change. >- >- if (!m_root->left && m_root->largestFree.width() > 0) { >- // No allocations have occurred, so just adjust the root size. >- m_root->rect = WebCore::IntRect(0, 0, m_size.width(), m_size.height()); >- m_root->largestFree = m_size; >- return; >- } >- >- // Add extra nodes above the current root to expand the tree. >- Node* oldRoot = m_root; >- Split split; >- if (m_size.width() >= m_size.height()) >- split = SplitOnX; >- else >- split = SplitOnY; >- >- while (m_root->rect.size() != m_size) { >- if (m_root->rect.width() == m_size.width()) >- split = SplitOnY; >- else if (m_root->rect.height() == m_size.height()) >- split = SplitOnX; >- Node* parent = new Node(); >- Node* right = new Node(); >- m_nodeCount += 2; >- m_root->parent = parent; >- parent->parent = 0; >- parent->left = m_root; >- parent->right = right; >- parent->largestFree = m_root->rect.size(); >- right->parent = parent; >- right->left = 0; >- right->right = 0; >- right->largestFree = m_root->rect.size(); >- if (split == SplitOnX) { >- parent->rect = WebCore::IntRect(m_root->rect.x(), m_root->rect.y(), >- m_root->rect.width() * 2, m_root->rect.height()); >- right->rect = WebCore::IntRect(m_root->rect.x() + m_root->rect.width(), m_root->rect.y(), >- m_root->rect.width(), m_root->rect.height()); >- } else { >- parent->rect = WebCore::IntRect(m_root->rect.x(), m_root->rect.y(), >- m_root->rect.width(), m_root->rect.height() * 2); >- right->rect = WebCore::IntRect(m_root->rect.x(), m_root->rect.y() + m_root->rect.width(), >- m_root->rect.width(), m_root->rect.height()); >- } >- split = (split == SplitOnX ? SplitOnY : SplitOnX); >- m_root = parent; >- } >- updateLargestFree(oldRoot); >-} >- >-static inline bool fitsWithin(const WebCore::IntSize& size1, const WebCore::IntSize& size2) >-{ >- return size1.width() <= size2.width() && size1.height() <= size2.height(); >-} >- >-WebCore::IntRect GeneralAreaAllocator::allocate(const WebCore::IntSize& size) >-{ >- WebCore::IntSize rounded = roundAllocation(size); >- rounded = WebCore::nextPowerOfTwo(rounded); >- if (rounded.width() <= 0 || rounded.width() > m_size.width() >- || rounded.height() <= 0 || rounded.height() > m_size.height()) >- return WebCore::IntRect(); >- >- WebCore::IntPoint point = allocateFromNode(rounded, m_root); >- if (point.x() >= 0) >- return WebCore::IntRect(point, size); >- return WebCore::IntRect(); >-} >- >-WebCore::IntPoint GeneralAreaAllocator::allocateFromNode(const WebCore::IntSize& size, Node* node) >-{ >- // Find the best node to insert into, which should be >- // a node with the least amount of unused space that is >- // big enough to contain the requested size. >- while (node) { >- // Go down a level and determine if the left or right >- // sub-tree contains the best chance of allocation. >- Node* left = node->left; >- Node* right = node->right; >- if (left && fitsWithin(size, left->largestFree)) { >- if (right && fitsWithin(size, right->largestFree)) { >- if (left->largestFree.width() < right->largestFree.width() >- || left->largestFree.height() < right->largestFree.height()) { >- // The largestFree values may be a little oversized, >- // so try the left sub-tree and then the right sub-tree. >- WebCore::IntPoint point = allocateFromNode(size, left); >- if (point.x() >= 0) >- return point; >- return allocateFromNode(size, right); >- } >- node = right; >- } else >- node = left; >- } else if (right && fitsWithin(size, right->largestFree)) >- node = right; >- else if (left || right) { >- // Neither sub-node has enough space to allocate from. >- return WebCore::IntPoint(-1, -1); >- } else if (fitsWithin(size, node->largestFree)) { >- // Do we need to split this node into smaller pieces? >- Split split; >- if (fitsWithin(WebCore::IntSize(size.width() * 2, size.height() * 2), node->largestFree)) { >- // Split in either direction: choose the inverse of >- // the parent node's split direction to try to balance >- // out the wasted space as further subdivisions happen. >- if (node->parent >- && node->parent->left->rect.x() == node->parent->right->rect.x()) >- split = SplitOnX; >- else if (node->parent) >- split = SplitOnY; >- else if (node->rect.width() >= node->rect.height()) >- split = SplitOnX; >- else >- split = SplitOnY; >- } else if (fitsWithin(WebCore::IntSize(size.width() * 2, size.height()), node->largestFree)) { >- // Split along the X direction. >- split = SplitOnX; >- } else if (fitsWithin(WebCore::IntSize(size.width(), size.height() * 2), node->largestFree)) { >- // Split along the Y direction. >- split = SplitOnY; >- } else { >- // Cannot split further - allocate this node. >- node->largestFree = WebCore::IntSize(0, 0); >- updateLargestFree(node); >- return node->rect.location(); >- } >- >- // Split the node, then go around again using the left sub-tree. >- node = splitNode(node, split); >- } else { >- // Cannot possibly fit into this node. >- break; >- } >- } >- return WebCore::IntPoint(-1, -1); >-} >- >-GeneralAreaAllocator::Node* GeneralAreaAllocator::splitNode >- (Node* node, Split split) >-{ >- Node* left = new Node(); >- Node* right = new Node(); >- m_nodeCount += 2; >- left->parent = node; >- left->left = 0; >- left->right = 0; >- right->parent = node; >- right->left = 0; >- right->right = 0; >- node->left = left; >- node->right = right; >- >- if (split == SplitOnX) { >- left->rect = WebCore::IntRect(node->rect.x(), node->rect.y(), >- node->rect.width() / 2, node->rect.height()); >- right->rect = WebCore::IntRect(left->rect.maxX(), node->rect.y(), >- node->rect.width() / 2, node->rect.height()); >- } else { >- left->rect = WebCore::IntRect(node->rect.x(), node->rect.y(), >- node->rect.width(), node->rect.height() / 2); >- right->rect = WebCore::IntRect(node->rect.x(), left->rect.maxY(), >- node->rect.width(), node->rect.height() / 2); >- } >- >- left->largestFree = left->rect.size(); >- right->largestFree = right->rect.size(); >- node->largestFree = right->largestFree; >- return left; >-} >- >-void GeneralAreaAllocator::updateLargestFree(Node* node) >-{ >- while ((node = node->parent)) { >- node->largestFree = WebCore::IntSize( >- std::max(node->left->largestFree.width(), node->right->largestFree.width()), >- std::max(node->left->largestFree.height(), node->right->largestFree.height()) >- ); >- } >-} >- >-void GeneralAreaAllocator::release(const WebCore::IntRect& rect) >-{ >- // Locate the node that contains the allocated region. >- Node* node = m_root; >- WebCore::IntPoint point = rect.location(); >- while (node) { >- if (node->left && node->left->rect.contains(point)) >- node = node->left; >- else if (node->right && node->right->rect.contains(point)) >- node = node->right; >- else if (node->rect.contains(point)) >- break; >- else >- return; // Point is completely outside the tree. >- } >- if (!node) >- return; >- >- // Mark the node as free and then work upwards through the tree >- // recombining and deleting nodes until we reach a sibling >- // that is still allocated. >- node->largestFree = node->rect.size(); >- while (node->parent) { >- if (node->parent->left == node) { >- if (node->parent->right->largestFree != node->parent->right->rect.size()) >- break; >- } else { >- if (node->parent->left->largestFree != node->parent->left->rect.size()) >- break; >- } >- node = node->parent; >- freeNode(node->left); >- freeNode(node->right); >- m_nodeCount -= 2; >- node->left = 0; >- node->right = 0; >- node->largestFree = node->rect.size(); >- } >- >- // Make the rest of our ancestors have the correct "largest free size". >- updateLargestFree(node); >-} >- >-int GeneralAreaAllocator::overhead() const >-{ >- return m_nodeCount * sizeof(Node); >-} >- >-} // namespace >- >-#endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.h b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.h >deleted file mode 100644 >index 1656bb8ae100688a346626e4d3333c60b9e89387..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.h >+++ /dev/null >@@ -1,114 +0,0 @@ >-/* >- * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >- * >- * This library is free software; you can redistribute it and/or >- * modify it under the terms of the GNU Lesser General Public >- * License as published by the Free Software Foundation; either >- * version 2.1 of the License, or (at your option) any later version. >- * >- * This library is distributed in the hope that it will be useful, >- * but WITHOUT ANY WARRANTY; without even the implied warranty of >- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- * Lesser General Public License for more details. >- * >- * You should have received a copy of the GNU Lesser General Public >- * License along with this library; if not, write to the Free Software >- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA >- * >- */ >- >-#ifndef AreaAllocator_h >-#define AreaAllocator_h >- >-#include <IntPoint.h> >-#include <IntRect.h> >-#include <IntSize.h> >- >-#if USE(COORDINATED_GRAPHICS) >- >-namespace WebCore { >-inline int nextPowerOfTwo(int number) >-{ >- // This is a fast trick to get nextPowerOfTwo for an integer. >- --number; >- number |= number >> 1; >- number |= number >> 2; >- number |= number >> 4; >- number |= number >> 8; >- number |= number >> 16; >- number++; >- return number; >-} >- >-inline IntSize nextPowerOfTwo(const IntSize& size) >-{ >- return IntSize(nextPowerOfTwo(size.width()), nextPowerOfTwo(size.height())); >-} >-} // namespace WebCore >- >-namespace WebKit { >- >-class AreaAllocator { >-public: >- explicit AreaAllocator(const WebCore::IntSize&); >- virtual ~AreaAllocator(); >- >- WebCore::IntSize size() const { return m_size; } >- >- WebCore::IntSize minimumAllocation() const { return m_minAlloc; } >- void setMinimumAllocation(const WebCore::IntSize& size) { m_minAlloc = size; } >- >- WebCore::IntSize margin() const { return m_margin; } >- void setMargin(const WebCore::IntSize &margin) { m_margin = margin; } >- >- virtual void expand(const WebCore::IntSize&); >- void expandBy(const WebCore::IntSize&); >- >- virtual WebCore::IntRect allocate(const WebCore::IntSize&) = 0; >- virtual void release(const WebCore::IntRect&); >- >- virtual int overhead() const; >- >-protected: >- WebCore::IntSize m_size; >- WebCore::IntSize m_minAlloc; >- WebCore::IntSize m_margin; >- >- WebCore::IntSize roundAllocation(const WebCore::IntSize&) const; >-}; >- >-class GeneralAreaAllocator : public AreaAllocator { >-public: >- explicit GeneralAreaAllocator(const WebCore::IntSize&); >- virtual ~GeneralAreaAllocator(); >- >- void expand(const WebCore::IntSize&); >- WebCore::IntRect allocate(const WebCore::IntSize&); >- void release(const WebCore::IntRect&); >- int overhead() const; >- >-private: >- enum Split { SplitOnX, SplitOnY }; >- >- struct Node { >- WebCore::IntRect rect; >- WebCore::IntSize largestFree; >- Node* parent; >- Node* left; >- Node* right; >- }; >- >- Node* m_root; >- int m_nodeCount; >- >- static void freeNode(Node*); >- WebCore::IntPoint allocateFromNode(const WebCore::IntSize&, Node*); >- Node* splitNode(Node*, Split); >- static void updateLargestFree(Node*); >-}; >- >-} // namespace WebKit >- >-#endif // USE(COORDINATED_GRAPHICS) >- >-#endif // AreaAllocator_h >diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp >deleted file mode 100644 >index c3d78b18f1b08798e65a5918a4f204203af10054..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp >+++ /dev/null >@@ -1,1061 +0,0 @@ >-/* >- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) >- Copyright (C) 2010 Apple Inc. All rights reserved. >- Copyright (C) 2012 Company 100, Inc. >- Copyright (C) 2012 Intel Corporation. All rights reserved. >- >- This library is free software; you can redistribute it and/or >- modify it under the terms of the GNU Library General Public >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Library General Public License for more details. >- >- You should have received a copy of the GNU Library General Public License >- along with this library; see the file COPYING.LIB. If not, write to >- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >- >-#if USE(COORDINATED_GRAPHICS) >-#include "CoordinatedGraphicsLayer.h" >- >-#include "BackingStore.h" >-#include "CoordinatedLayerTreeHostProxyMessages.h" >-#include "CoordinatedTile.h" >-#include "FloatQuad.h" >-#include "Frame.h" >-#include "FrameView.h" >-#include "GraphicsContext.h" >-#include "GraphicsLayer.h" >-#include "Page.h" >-#include "TextureMapperPlatformLayer.h" >-#include "WebPage.h" >-#include <wtf/CurrentTime.h> >-#include <wtf/HashMap.h> >-#ifndef NDEBUG >-#include <wtf/TemporaryChange.h> >-#endif >-#include <wtf/text/CString.h> >- >-using namespace WebKit; >- >-namespace WebCore { >- >-static CoordinatedLayerID toCoordinatedLayerID(GraphicsLayer* layer) >-{ >- return layer ? toCoordinatedGraphicsLayer(layer)->id() : 0; >-} >- >-void CoordinatedGraphicsLayer::didChangeLayerState() >-{ >- m_shouldSyncLayerState = true; >- if (client()) >- client()->notifyFlushRequired(this); >-} >- >-void CoordinatedGraphicsLayer::didChangeAnimations() >-{ >- m_shouldSyncAnimations = true; >- if (client()) >- client()->notifyFlushRequired(this); >-} >- >-void CoordinatedGraphicsLayer::didChangeChildren() >-{ >- m_shouldSyncChildren = true; >- if (client()) >- client()->notifyFlushRequired(this); >-} >- >-#if ENABLE(CSS_FILTERS) >-void CoordinatedGraphicsLayer::didChangeFilters() >-{ >- m_shouldSyncFilters = true; >- if (client()) >- client()->notifyFlushRequired(this); >-} >-#endif >- >-void CoordinatedGraphicsLayer::didChangeImageBacking() >-{ >- m_shouldSyncImageBacking = true; >- if (client()) >- client()->notifyFlushRequired(this); >-} >- >-void CoordinatedGraphicsLayer::setShouldUpdateVisibleRect() >-{ >- m_shouldUpdateVisibleRect = true; >- for (size_t i = 0; i < children().size(); ++i) >- toCoordinatedGraphicsLayer(children()[i])->setShouldUpdateVisibleRect(); >- if (replicaLayer()) >- toCoordinatedGraphicsLayer(replicaLayer())->setShouldUpdateVisibleRect(); >-} >- >-void CoordinatedGraphicsLayer::didChangeGeometry() >-{ >- didChangeLayerState(); >- setShouldUpdateVisibleRect(); >-} >- >-CoordinatedGraphicsLayer::CoordinatedGraphicsLayer(GraphicsLayerClient* client) >- : GraphicsLayer(client) >-#ifndef NDEBUG >- , m_isPurging(false) >-#endif >- , m_shouldUpdateVisibleRect(true) >- , m_shouldSyncLayerState(true) >- , m_shouldSyncChildren(true) >- , m_shouldSyncFilters(true) >- , m_shouldSyncImageBacking(true) >- , m_shouldSyncAnimations(true) >- , m_fixedToViewport(false) >- , m_pendingContentsScaleAdjustment(false) >- , m_pendingVisibleRectAdjustment(false) >-#if USE(GRAPHICS_SURFACE) >- , m_isValidCanvas(false) >- , m_pendingCanvasOperation(None) >-#endif >- , m_coordinator(0) >- , m_compositedNativeImagePtr(0) >- , m_canvasPlatformLayer(0) >- , m_animationStartedTimer(this, &CoordinatedGraphicsLayer::animationStartedTimerFired) >-{ >- static CoordinatedLayerID nextLayerID = 1; >- m_id = nextLayerID++; >-} >- >-CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer() >-{ >- if (m_coordinator) { >- purgeBackingStores(); >- m_coordinator->detachLayer(this); >- } >- ASSERT(!m_coordinatedImageBacking && !m_mainBackingStore); >- willBeDestroyed(); >-} >- >-bool CoordinatedGraphicsLayer::setChildren(const Vector<GraphicsLayer*>& children) >-{ >- bool ok = GraphicsLayer::setChildren(children); >- if (!ok) >- return false; >- didChangeChildren(); >- return true; >-} >- >-void CoordinatedGraphicsLayer::addChild(GraphicsLayer* layer) >-{ >- GraphicsLayer::addChild(layer); >- didChangeChildren(); >-} >- >-void CoordinatedGraphicsLayer::addChildAtIndex(GraphicsLayer* layer, int index) >-{ >- GraphicsLayer::addChildAtIndex(layer, index); >- didChangeChildren(); >-} >- >-void CoordinatedGraphicsLayer::addChildAbove(GraphicsLayer* layer, GraphicsLayer* sibling) >-{ >- GraphicsLayer::addChildAbove(layer, sibling); >- didChangeChildren(); >-} >- >-void CoordinatedGraphicsLayer::addChildBelow(GraphicsLayer* layer, GraphicsLayer* sibling) >-{ >- GraphicsLayer::addChildBelow(layer, sibling); >- didChangeChildren(); >-} >- >-bool CoordinatedGraphicsLayer::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild) >-{ >- bool ok = GraphicsLayer::replaceChild(oldChild, newChild); >- if (!ok) >- return false; >- didChangeChildren(); >- return true; >-} >- >-void CoordinatedGraphicsLayer::removeFromParent() >-{ >- if (CoordinatedGraphicsLayer* parentLayer = toCoordinatedGraphicsLayer(parent())) >- parentLayer->didChangeChildren(); >- GraphicsLayer::removeFromParent(); >-} >- >-void CoordinatedGraphicsLayer::setPosition(const FloatPoint& p) >-{ >- if (position() == p) >- return; >- >- GraphicsLayer::setPosition(p); >- didChangeGeometry(); >-} >- >-void CoordinatedGraphicsLayer::setAnchorPoint(const FloatPoint3D& p) >-{ >- if (anchorPoint() == p) >- return; >- >- GraphicsLayer::setAnchorPoint(p); >- didChangeGeometry(); >-} >- >-void CoordinatedGraphicsLayer::setSize(const FloatSize& size) >-{ >- if (this->size() == size) >- return; >- >- GraphicsLayer::setSize(size); >- >- if (maskLayer()) >- maskLayer()->setSize(size); >- didChangeGeometry(); >-} >- >-void CoordinatedGraphicsLayer::setTransform(const TransformationMatrix& t) >-{ >- if (transform() == t) >- return; >- >- GraphicsLayer::setTransform(t); >- didChangeGeometry(); >-} >- >-void CoordinatedGraphicsLayer::setChildrenTransform(const TransformationMatrix& t) >-{ >- if (childrenTransform() == t) >- return; >- >- GraphicsLayer::setChildrenTransform(t); >- didChangeGeometry(); >-} >- >-void CoordinatedGraphicsLayer::setPreserves3D(bool b) >-{ >- if (preserves3D() == b) >- return; >- >- GraphicsLayer::setPreserves3D(b); >- didChangeGeometry(); >-} >- >-void CoordinatedGraphicsLayer::setMasksToBounds(bool b) >-{ >- if (masksToBounds() == b) >- return; >- GraphicsLayer::setMasksToBounds(b); >- didChangeGeometry(); >-} >- >-void CoordinatedGraphicsLayer::setDrawsContent(bool b) >-{ >- if (drawsContent() == b) >- return; >- GraphicsLayer::setDrawsContent(b); >- >- didChangeLayerState(); >-} >- >-void CoordinatedGraphicsLayer::setContentsVisible(bool b) >-{ >- if (contentsAreVisible() == b) >- return; >- GraphicsLayer::setContentsVisible(b); >- if (maskLayer()) >- maskLayer()->setContentsVisible(b); >- >- didChangeLayerState(); >-} >- >-void CoordinatedGraphicsLayer::setContentsOpaque(bool b) >-{ >- if (contentsOpaque() == b) >- return; >- if (m_mainBackingStore) >- m_mainBackingStore->setSupportsAlpha(!b); >- GraphicsLayer::setContentsOpaque(b); >- didChangeLayerState(); >-} >- >-void CoordinatedGraphicsLayer::setBackfaceVisibility(bool b) >-{ >- if (backfaceVisibility() == b) >- return; >- >- GraphicsLayer::setBackfaceVisibility(b); >- didChangeLayerState(); >-} >- >-void CoordinatedGraphicsLayer::setOpacity(float opacity) >-{ >- if (this->opacity() == opacity) >- return; >- >- GraphicsLayer::setOpacity(opacity); >- didChangeLayerState(); >-} >- >-void CoordinatedGraphicsLayer::setContentsRect(const IntRect& r) >-{ >- if (contentsRect() == r) >- return; >- >- GraphicsLayer::setContentsRect(r); >- didChangeLayerState(); >-} >- >-void CoordinatedGraphicsLayer::setContentsNeedsDisplay() >-{ >-#if USE(GRAPHICS_SURFACE) >- if (m_canvasPlatformLayer) >- m_pendingCanvasOperation |= SyncCanvas; >-#endif >- >- if (client()) >- client()->notifyFlushRequired(this); >- >- addRepaintRect(contentsRect()); >-} >- >-void CoordinatedGraphicsLayer::setContentsToCanvas(PlatformLayer* platformLayer) >-{ >-#if USE(GRAPHICS_SURFACE) >- if (m_canvasPlatformLayer) { >- ASSERT(m_canvasToken.isValid()); >- if (!platformLayer) { >- m_pendingCanvasOperation |= DestroyCanvas; >- m_pendingCanvasOperation &= ~CreateCanvas; >- } else if ((m_canvasSize != platformLayer->platformLayerSize()) || (m_canvasToken != platformLayer->graphicsSurfaceToken())) { >- // m_canvasToken can be different to platformLayer->graphicsSurfaceToken(), even if m_canvasPlatformLayer equals platformLayer. >- m_pendingCanvasOperation |= RecreateCanvas; >- } >- } else { >- if (platformLayer) >- m_pendingCanvasOperation |= CreateAndSyncCanvas; >- } >- >- m_canvasPlatformLayer = platformLayer; >- // m_canvasToken is updated only here. In detail, when GraphicsContext3D is changed or reshaped, m_canvasToken is changed and setContentsToCanvas() is always called. >- m_canvasSize = m_canvasPlatformLayer ? m_canvasPlatformLayer->platformLayerSize() : IntSize(); >- m_canvasToken = m_canvasPlatformLayer ? m_canvasPlatformLayer->graphicsSurfaceToken() : GraphicsSurfaceToken(); >- ASSERT(!(!m_canvasToken.isValid() && m_canvasPlatformLayer)); >- >- if (client()) >- client()->notifyFlushRequired(this); >-#else >- UNUSED_PARAM(platformLayer); >-#endif >-} >- >-#if ENABLE(CSS_FILTERS) >-bool CoordinatedGraphicsLayer::setFilters(const FilterOperations& newFilters) >-{ >- if (filters() == newFilters) >- return true; >- didChangeFilters(); >- return GraphicsLayer::setFilters(newFilters); >-} >-#endif >- >-void CoordinatedGraphicsLayer::setContentsToSolidColor(const Color& color) >-{ >- if (m_layerInfo.solidColor == color) >- return; >- m_layerInfo.solidColor = color; >- didChangeLayerState(); >-} >- >-void CoordinatedGraphicsLayer::setShowDebugBorder(bool show) >-{ >- if (isShowingDebugBorder() == show) >- return; >- >- GraphicsLayer::setShowDebugBorder(show); >- didChangeLayerState(); >-} >- >-void CoordinatedGraphicsLayer::setShowRepaintCounter(bool show) >-{ >- if (isShowingRepaintCounter() == show) >- return; >- >- GraphicsLayer::setShowRepaintCounter(show); >- didChangeLayerState(); >-} >- >-void CoordinatedGraphicsLayer::setContentsToImage(Image* image) >-{ >- NativeImagePtr newNativeImagePtr = image ? image->nativeImageForCurrentFrame() : 0; >- if (newNativeImagePtr) { >- // This code makes the assumption that pointer equality on a NativeImagePtr is a valid way to tell if the image is changed. >- // This assumption is true in Qt, GTK and EFL. >- if (newNativeImagePtr == m_compositedNativeImagePtr) >- return; >- >- m_compositedImage = image; >- m_compositedNativeImagePtr = newNativeImagePtr; >- } else { >- m_compositedImage = 0; >- m_compositedNativeImagePtr = 0; >- } >- >- GraphicsLayer::setContentsToImage(image); >- didChangeImageBacking(); >-} >- >-void CoordinatedGraphicsLayer::setMaskLayer(GraphicsLayer* layer) >-{ >- if (layer == maskLayer()) >- return; >- >- GraphicsLayer::setMaskLayer(layer); >- >- if (!layer) >- return; >- >- layer->setSize(size()); >- layer->setContentsVisible(contentsAreVisible()); >- CoordinatedGraphicsLayer* coordinatedLayer = toCoordinatedGraphicsLayer(layer); >- coordinatedLayer->didChangeLayerState(); >- didChangeLayerState(); >-} >- >-bool CoordinatedGraphicsLayer::shouldDirectlyCompositeImage(Image* image) const >-{ >- if (!image || !image->isBitmapImage()) >- return false; >- >- enum { kMaxDimenstionForDirectCompositing = 2000 }; >- if (image->width() > kMaxDimenstionForDirectCompositing || image->height() > kMaxDimenstionForDirectCompositing) >- return false; >- >- return true; >-} >- >-void CoordinatedGraphicsLayer::setReplicatedByLayer(GraphicsLayer* layer) >-{ >- if (layer == replicaLayer()) >- return; >- >- GraphicsLayer::setReplicatedByLayer(layer); >- didChangeLayerState(); >-} >- >-void CoordinatedGraphicsLayer::setNeedsDisplay() >-{ >- setNeedsDisplayInRect(FloatRect(FloatPoint(), size())); >-} >- >-void CoordinatedGraphicsLayer::setNeedsDisplayInRect(const FloatRect& rect) >-{ >- if (m_mainBackingStore) >- m_mainBackingStore->invalidate(IntRect(rect)); >- >- didChangeLayerState(); >- >- addRepaintRect(rect); >-} >- >-CoordinatedLayerID CoordinatedGraphicsLayer::id() const >-{ >- return m_id; >-} >- >-void CoordinatedGraphicsLayer::flushCompositingState(const FloatRect& rect) >-{ >- if (!m_coordinator->isFlushingLayerChanges()) { >- if (client()) >- client()->notifyFlushRequired(this); >- return; >- } >- >- if (CoordinatedGraphicsLayer* mask = toCoordinatedGraphicsLayer(maskLayer())) >- mask->flushCompositingStateForThisLayerOnly(); >- >- if (CoordinatedGraphicsLayer* replica = toCoordinatedGraphicsLayer(replicaLayer())) >- replica->flushCompositingStateForThisLayerOnly(); >- >- m_coordinator->syncFixedLayers(); >- >- flushCompositingStateForThisLayerOnly(); >- >- for (size_t i = 0; i < children().size(); ++i) >- children()[i]->flushCompositingState(rect); >-} >- >-CoordinatedGraphicsLayer* toCoordinatedGraphicsLayer(GraphicsLayer* layer) >-{ >- return static_cast<CoordinatedGraphicsLayer*>(layer); >-} >- >-void CoordinatedGraphicsLayer::syncChildren() >-{ >- if (!m_shouldSyncChildren) >- return; >- m_shouldSyncChildren = false; >- Vector<CoordinatedLayerID> childIDs; >- for (size_t i = 0; i < children().size(); ++i) >- childIDs.append(toCoordinatedLayerID(children()[i])); >- >- m_coordinator->syncLayerChildren(m_id, childIDs); >-} >- >-#if ENABLE(CSS_FILTERS) >-void CoordinatedGraphicsLayer::syncFilters() >-{ >- if (!m_shouldSyncFilters) >- return; >- m_shouldSyncFilters = false; >- m_coordinator->syncLayerFilters(m_id, filters()); >-} >-#endif >- >-void CoordinatedGraphicsLayer::syncImageBacking() >-{ >- if (!m_shouldSyncImageBacking) >- return; >- m_shouldSyncImageBacking = false; >- >- if (m_compositedNativeImagePtr) { >- ASSERT(!shouldHaveBackingStore()); >- ASSERT(m_compositedImage); >- >- bool imageInstanceReplaced = m_coordinatedImageBacking && (m_coordinatedImageBacking->id() != CoordinatedImageBacking::getCoordinatedImageBackingID(m_compositedImage.get())); >- if (imageInstanceReplaced) >- releaseImageBackingIfNeeded(); >- >- if (!m_coordinatedImageBacking) { >- m_coordinatedImageBacking = m_coordinator->createImageBackingIfNeeded(m_compositedImage.get()); >- m_coordinatedImageBacking->addHost(this); >- m_layerInfo.imageID = m_coordinatedImageBacking->id(); >- } >- >- m_coordinatedImageBacking->markDirty(); >- } else >- releaseImageBackingIfNeeded(); >- >- // syncImageBacking() changed m_layerInfo.imageID. >- didChangeLayerState(); >-} >- >-void CoordinatedGraphicsLayer::syncLayerState() >-{ >- if (!m_shouldSyncLayerState) >- return; >- m_shouldSyncLayerState = false; >- m_layerInfo.fixedToViewport = fixedToViewport(); >- >- m_layerInfo.backfaceVisible = backfaceVisibility(); >- m_layerInfo.childrenTransform = childrenTransform(); >- m_layerInfo.contentsOpaque = contentsOpaque(); >- m_layerInfo.contentsRect = contentsRect(); >- m_layerInfo.drawsContent = drawsContent(); >- m_layerInfo.contentsVisible = contentsAreVisible(); >- m_layerInfo.mask = toCoordinatedLayerID(maskLayer()); >- m_layerInfo.masksToBounds = masksToBounds(); >- m_layerInfo.opacity = opacity(); >- m_layerInfo.preserves3D = preserves3D(); >- m_layerInfo.replica = toCoordinatedLayerID(replicaLayer()); >- m_layerInfo.transform = transform(); >- >- m_layerInfo.anchorPoint = m_adjustedAnchorPoint; >- m_layerInfo.pos = m_adjustedPosition; >- m_layerInfo.size = m_adjustedSize; >- >- m_layerInfo.showDebugBorders = isShowingDebugBorder(); >- if (m_layerInfo.showDebugBorders) >- updateDebugIndicators(); >- m_layerInfo.showRepaintCounter = isShowingRepaintCounter(); >- >- m_coordinator->syncLayerState(m_id, m_layerInfo); >-} >- >-void CoordinatedGraphicsLayer::setDebugBorder(const Color& color, float width) >-{ >- ASSERT(m_layerInfo.showDebugBorders); >- m_layerInfo.debugBorderColor = color; >- m_layerInfo.debugBorderWidth = width; >-} >- >-void CoordinatedGraphicsLayer::syncAnimations() >-{ >- if (!m_shouldSyncAnimations) >- return; >- >- m_shouldSyncAnimations = false; >- >- m_coordinator->setLayerAnimations(m_id, m_animations); >-} >- >-#if USE(GRAPHICS_SURFACE) >-void CoordinatedGraphicsLayer::syncCanvas() >-{ >- destroyCanvasIfNeeded(); >- createCanvasIfNeeded(); >- >- if (!(m_pendingCanvasOperation & SyncCanvas)) >- return; >- >- m_pendingCanvasOperation &= ~SyncCanvas; >- >- if (!m_isValidCanvas) >- return; >- >- m_coordinator->syncCanvas(m_id, m_canvasPlatformLayer); >-} >- >-void CoordinatedGraphicsLayer::destroyCanvasIfNeeded() >-{ >- if (!(m_pendingCanvasOperation & DestroyCanvas)) >- return; >- >- if (m_isValidCanvas) { >- m_coordinator->destroyCanvas(m_id); >- m_isValidCanvas = false; >- } >- >- m_pendingCanvasOperation &= ~DestroyCanvas; >-} >- >-void CoordinatedGraphicsLayer::createCanvasIfNeeded() >-{ >- if (!(m_pendingCanvasOperation & CreateCanvas)) >- return; >- >- ASSERT(m_canvasPlatformLayer); >- if (!m_isValidCanvas) { >- m_coordinator->createCanvas(m_id, m_canvasPlatformLayer); >- m_isValidCanvas = true; >- } >- >- m_pendingCanvasOperation &= ~CreateCanvas; >-} >-#endif >- >-void CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly() >-{ >- ASSERT(m_coordinator->isFlushingLayerChanges()); >- >- // Sets the values. >- computePixelAlignment(m_adjustedPosition, m_adjustedSize, m_adjustedAnchorPoint, m_pixelAlignmentOffset); >- >- syncImageBacking(); >- syncLayerState(); >- syncAnimations(); >- computeTransformedVisibleRect(); >- syncChildren(); >-#if ENABLE(CSS_FILTERS) >- syncFilters(); >-#endif >- updateContentBuffers(); >-#if USE(GRAPHICS_SURFACE) >- syncCanvas(); >-#endif >-} >- >-bool CoordinatedGraphicsLayer::imageBackingVisible() >-{ >- ASSERT(m_coordinatedImageBacking); >- return tiledBackingStoreVisibleRect().intersects(contentsRect()); >-} >- >-void CoordinatedGraphicsLayer::releaseImageBackingIfNeeded() >-{ >- if (!m_coordinatedImageBacking) >- return; >- >- ASSERT(m_coordinator); >- m_coordinatedImageBacking->removeHost(this); >- m_coordinatedImageBacking.clear(); >- m_layerInfo.imageID = InvalidCoordinatedImageBackingID; >-} >- >-void CoordinatedGraphicsLayer::tiledBackingStorePaintBegin() >-{ >-} >- >-void CoordinatedGraphicsLayer::setRootLayer(bool isRoot) >-{ >- m_layerInfo.isRootLayer = isRoot; >- didChangeLayerState(); >-} >- >-void CoordinatedGraphicsLayer::setVisibleContentRectTrajectoryVector(const FloatPoint& trajectoryVector) >-{ >- if (!m_mainBackingStore) >- return; >- >- m_mainBackingStore->setTrajectoryVector(trajectoryVector); >- setNeedsVisibleRectAdjustment(); >-} >- >-void CoordinatedGraphicsLayer::deviceOrPageScaleFactorChanged() >-{ >- if (shouldHaveBackingStore()) >- m_pendingContentsScaleAdjustment = true; >-} >- >-float CoordinatedGraphicsLayer::effectiveContentsScale() >-{ >- return selfOrAncestorHaveNonAffineTransforms() ? 1 : deviceScaleFactor() * pageScaleFactor(); >-} >- >-void CoordinatedGraphicsLayer::adjustContentsScale() >-{ >- ASSERT(shouldHaveBackingStore()); >- if (!m_mainBackingStore || m_mainBackingStore->contentsScale() == effectiveContentsScale()) >- return; >- >- // Between creating the new backing store and painting the content, >- // we do not want to drop the previous one as that might result in >- // briefly seeing flickering as the old tiles may be dropped before >- // something replaces them. >- m_previousBackingStore = m_mainBackingStore.release(); >- >- // No reason to save the previous backing store for non-visible areas. >- m_previousBackingStore->removeAllNonVisibleTiles(); >-} >- >-void CoordinatedGraphicsLayer::createBackingStore() >-{ >- m_mainBackingStore = adoptPtr(new TiledBackingStore(this, CoordinatedTileBackend::create(this))); >- m_mainBackingStore->setSupportsAlpha(!contentsOpaque()); >- m_mainBackingStore->setContentsScale(effectiveContentsScale()); >-} >- >-void CoordinatedGraphicsLayer::tiledBackingStorePaint(GraphicsContext* context, const IntRect& rect) >-{ >- if (rect.isEmpty()) >- return; >- paintGraphicsLayerContents(*context, rect); >-} >- >-void CoordinatedGraphicsLayer::tiledBackingStorePaintEnd(const Vector<IntRect>& updatedRects) >-{ >- if (isShowingRepaintCounter() && !updatedRects.isEmpty()) >- m_coordinator->setLayerRepaintCount(id(), incrementRepaintCount()); >-} >- >-void CoordinatedGraphicsLayer::tiledBackingStoreHasPendingTileCreation() >-{ >- setNeedsVisibleRectAdjustment(); >- if (client()) >- client()->notifyFlushRequired(this); >-} >- >-IntRect CoordinatedGraphicsLayer::tiledBackingStoreContentsRect() >-{ >- return IntRect(0, 0, size().width(), size().height()); >-} >- >-static void clampToContentsRectIfRectIsInfinite(FloatRect& rect, const IntRect& contentsRect) >-{ >- if (rect.width() >= LayoutUnit::nearlyMax() || rect.width() <= LayoutUnit::nearlyMin()) { >- rect.setX(contentsRect.x()); >- rect.setWidth(contentsRect.width()); >- } >- >- if (rect.height() >= LayoutUnit::nearlyMax() || rect.height() <= LayoutUnit::nearlyMin()) { >- rect.setY(contentsRect.y()); >- rect.setHeight(contentsRect.height()); >- } >-} >- >-IntRect CoordinatedGraphicsLayer::tiledBackingStoreVisibleRect() >-{ >- // Non-invertible layers are not visible. >- if (!m_layerTransform.combined().isInvertible()) >- return IntRect(); >- >- // Return a projection of the visible rect (surface coordinates) onto the layer's plane (layer coordinates). >- // The resulting quad might be squewed and the visible rect is the bounding box of this quad, >- // so it might spread further than the real visible area (and then even more amplified by the cover rect multiplier). >- ASSERT(m_cachedInverseTransform == m_layerTransform.combined().inverse()); >- FloatRect rect = m_cachedInverseTransform.clampedBoundsOfProjectedQuad(FloatQuad(m_coordinator->visibleContentsRect())); >- clampToContentsRectIfRectIsInfinite(rect, tiledBackingStoreContentsRect()); >- return enclosingIntRect(rect); >-} >- >-Color CoordinatedGraphicsLayer::tiledBackingStoreBackgroundColor() const >-{ >- return contentsOpaque() ? Color::white : Color::transparent; >-} >- >-PassOwnPtr<GraphicsContext> CoordinatedGraphicsLayer::beginContentUpdate(const IntSize& size, uint32_t& atlas, IntPoint& offset) >-{ >- ASSERT(m_coordinator); >- ASSERT(m_coordinator->isFlushingLayerChanges()); >- return m_coordinator->beginContentUpdate(size, contentsOpaque() ? CoordinatedSurface::NoFlags : CoordinatedSurface::SupportsAlpha, atlas, offset); >-} >- >-void CoordinatedGraphicsLayer::createTile(uint32_t tileID, const SurfaceUpdateInfo& updateInfo, const WebCore::IntRect& tileRect) >-{ >- ASSERT(m_coordinator); >- ASSERT(m_coordinator->isFlushingLayerChanges()); >- m_coordinator->createTile(id(), tileID, updateInfo, tileRect); >-} >- >-void CoordinatedGraphicsLayer::updateTile(uint32_t tileID, const SurfaceUpdateInfo& updateInfo, const IntRect& tileRect) >-{ >- ASSERT(m_coordinator); >- ASSERT(m_coordinator->isFlushingLayerChanges()); >- m_coordinator->updateTile(id(), tileID, updateInfo, tileRect); >-} >- >-void CoordinatedGraphicsLayer::removeTile(uint32_t tileID) >-{ >- ASSERT(m_coordinator); >- ASSERT(m_coordinator->isFlushingLayerChanges() || m_isPurging); >- m_coordinator->removeTile(id(), tileID); >-} >- >-void CoordinatedGraphicsLayer::updateContentBuffers() >-{ >- if (!shouldHaveBackingStore()) { >- m_mainBackingStore.clear(); >- m_previousBackingStore.clear(); >- return; >- } >- >- if (m_pendingContentsScaleAdjustment) { >- adjustContentsScale(); >- m_pendingContentsScaleAdjustment = false; >- } >- >- // This is the only place we (re)create the main tiled backing store, once we >- // have a remote client and we are ready to send our data to the UI process. >- if (!m_mainBackingStore) >- createBackingStore(); >- >- if (m_pendingVisibleRectAdjustment) { >- m_pendingVisibleRectAdjustment = false; >- m_mainBackingStore->coverWithTilesIfNeeded(); >- } >- >- m_mainBackingStore->updateTileBuffers(); >- >- // The previous backing store is kept around to avoid flickering between >- // removing the existing tiles and painting the new ones. The first time >- // the visibleRect is full painted we remove the previous backing store. >- if (m_mainBackingStore->visibleAreaIsCovered()) >- m_previousBackingStore.clear(); >-} >- >-void CoordinatedGraphicsLayer::purgeBackingStores() >-{ >-#ifndef NDEBUG >- TemporaryChange<bool> updateModeProtector(m_isPurging, true); >-#endif >- m_mainBackingStore.clear(); >- m_previousBackingStore.clear(); >- >- releaseImageBackingIfNeeded(); >- >- didChangeLayerState(); >-} >- >-void CoordinatedGraphicsLayer::setCoordinator(WebKit::CoordinatedGraphicsLayerClient* coordinator) >-{ >- m_coordinator = coordinator; >-} >- >-void CoordinatedGraphicsLayer::setNeedsVisibleRectAdjustment() >-{ >- if (shouldHaveBackingStore()) >- m_pendingVisibleRectAdjustment = true; >-} >- >-bool CoordinatedGraphicsLayer::hasPendingVisibleChanges() >-{ >- if (opacity() < 0.01 && !m_animations.hasActiveAnimationsOfType(AnimatedPropertyOpacity)) >- return false; >- >- for (size_t i = 0; i < children().size(); ++i) { >- if (toCoordinatedGraphicsLayer(children()[i])->hasPendingVisibleChanges()) >- return true; >- } >- >- bool shouldSyncCanvas = false; >-#if USE(GRAPHICS_SURFACE) >- shouldSyncCanvas = m_pendingCanvasOperation & SyncCanvas; >-#endif >- >- if (!m_shouldSyncLayerState && !m_shouldSyncChildren && !m_shouldSyncFilters && !m_shouldSyncImageBacking && !m_shouldSyncAnimations && !shouldSyncCanvas) >- return false; >- >- return tiledBackingStoreVisibleRect().intersects(tiledBackingStoreContentsRect()); >-} >- >-static inline bool isIntegral(float value) >-{ >- return static_cast<int>(value) == value; >-} >- >-FloatPoint CoordinatedGraphicsLayer::computePositionRelativeToBase() >-{ >- FloatPoint offset; >- for (const GraphicsLayer* currLayer = this; currLayer; currLayer = currLayer->parent()) >- offset += currLayer->position(); >- >- return offset; >-} >- >-void CoordinatedGraphicsLayer::computePixelAlignment(FloatPoint& position, FloatSize& size, FloatPoint3D& anchorPoint, FloatSize& alignmentOffset) >-{ >- if (isIntegral(effectiveContentsScale())) { >- position = m_position; >- size = m_size; >- anchorPoint = m_anchorPoint; >- alignmentOffset = FloatSize(); >- return; >- } >- >- FloatPoint positionRelativeToBase = computePositionRelativeToBase(); >- >- FloatRect baseRelativeBounds(positionRelativeToBase, m_size); >- FloatRect scaledBounds = baseRelativeBounds; >- >- // Scale by the effective scale factor to compute the screen-relative bounds. >- scaledBounds.scale(effectiveContentsScale()); >- >- // Round to integer boundaries. >- // NOTE: When using enclosingIntRect (as mac) it will have different sizes depending on position. >- FloatRect alignedBounds = roundedIntRect(scaledBounds); >- >- // Convert back to layer coordinates. >- alignedBounds.scale(1 / effectiveContentsScale()); >- >- // Convert back to layer coordinates. >- alignmentOffset = baseRelativeBounds.location() - alignedBounds.location(); >- >- position = m_position - alignmentOffset; >- size = alignedBounds.size(); >- >- // Now we have to compute a new anchor point which compensates for rounding. >- float anchorPointX = m_anchorPoint.x(); >- float anchorPointY = m_anchorPoint.y(); >- >- if (alignedBounds.width()) >- anchorPointX = (baseRelativeBounds.width() * anchorPointX + alignmentOffset.width()) / alignedBounds.width(); >- >- if (alignedBounds.height()) >- anchorPointY = (baseRelativeBounds.height() * anchorPointY + alignmentOffset.height()) / alignedBounds.height(); >- >- anchorPoint = FloatPoint3D(anchorPointX, anchorPointY, m_anchorPoint.z() * effectiveContentsScale()); >-} >- >-void CoordinatedGraphicsLayer::computeTransformedVisibleRect() >-{ >- // When we have a transform animation, we need to update visible rect every frame to adjust the visible rect of a backing store. >- bool hasActiveTransformAnimation = selfOrAncestorHasActiveTransformAnimation(); >- if (!m_shouldUpdateVisibleRect && !hasActiveTransformAnimation) >- return; >- >- m_shouldUpdateVisibleRect = false; >- TransformationMatrix currentTransform = transform(); >- if (hasActiveTransformAnimation) >- client()->getCurrentTransform(this, currentTransform); >- m_layerTransform.setLocalTransform(currentTransform); >- >- m_layerTransform.setAnchorPoint(m_adjustedAnchorPoint); >- m_layerTransform.setPosition(m_adjustedPosition); >- m_layerTransform.setSize(m_adjustedSize); >- >- m_layerTransform.setFlattening(!preserves3D()); >- m_layerTransform.setChildrenTransform(childrenTransform()); >- m_layerTransform.combineTransforms(parent() ? toCoordinatedGraphicsLayer(parent())->m_layerTransform.combinedForChildren() : TransformationMatrix()); >- >- m_cachedInverseTransform = m_layerTransform.combined().inverse(); >- >- // The combined transform will be used in tiledBackingStoreVisibleRect. >- setNeedsVisibleRectAdjustment(); >-} >- >-bool CoordinatedGraphicsLayer::shouldHaveBackingStore() const >-{ >- return drawsContent() && contentsAreVisible() && !m_size.isEmpty(); >-} >- >-bool CoordinatedGraphicsLayer::selfOrAncestorHasActiveTransformAnimation() const >-{ >- if (m_animations.hasActiveAnimationsOfType(AnimatedPropertyWebkitTransform)) >- return true; >- >- if (!parent()) >- return false; >- >- return toCoordinatedGraphicsLayer(parent())->selfOrAncestorHasActiveTransformAnimation(); >-} >- >-bool CoordinatedGraphicsLayer::selfOrAncestorHaveNonAffineTransforms() >-{ >- if (m_animations.hasActiveAnimationsOfType(AnimatedPropertyWebkitTransform)) >- return true; >- >- if (!m_layerTransform.combined().isAffine()) >- return true; >- >- if (!parent()) >- return false; >- >- return toCoordinatedGraphicsLayer(parent())->selfOrAncestorHaveNonAffineTransforms(); >-} >- >-bool CoordinatedGraphicsLayer::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& keyframesName, double delayAsNegativeTimeOffset) >-{ >- ASSERT(!keyframesName.isEmpty()); >- >- if (!anim || anim->isEmptyOrZeroDuration() || valueList.size() < 2 || (valueList.property() != AnimatedPropertyWebkitTransform && valueList.property() != AnimatedPropertyOpacity)) >- return false; >- >- bool listsMatch = false; >- bool ignoredHasBigRotation; >- >- if (valueList.property() == AnimatedPropertyWebkitTransform) >- listsMatch = validateTransformOperations(valueList, ignoredHasBigRotation) >= 0; >- >- m_lastAnimationStartTime = WTF::currentTime() - delayAsNegativeTimeOffset; >- m_animations.add(GraphicsLayerAnimation(keyframesName, valueList, boxSize, anim, m_lastAnimationStartTime, listsMatch)); >- m_animationStartedTimer.startOneShot(0); >- didChangeAnimations(); >- return true; >-} >- >-void CoordinatedGraphicsLayer::pauseAnimation(const String& animationName, double time) >-{ >- m_animations.pause(animationName, time); >- didChangeAnimations(); >-} >- >-void CoordinatedGraphicsLayer::removeAnimation(const String& animationName) >-{ >- m_animations.remove(animationName); >- didChangeAnimations(); >-} >- >-void CoordinatedGraphicsLayer::suspendAnimations(double time) >-{ >- m_animations.suspend(time); >- didChangeAnimations(); >-} >- >-void CoordinatedGraphicsLayer::resumeAnimations() >-{ >- m_animations.resume(); >- didChangeAnimations(); >-} >- >-void CoordinatedGraphicsLayer::animationStartedTimerFired(Timer<CoordinatedGraphicsLayer>*) >-{ >- client()->notifyAnimationStarted(this, m_lastAnimationStartTime); >-} >-} >-#endif >diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h >deleted file mode 100644 >index dcfeeb02ded89ab90757934033f0c77bc3cec248..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h >+++ /dev/null >@@ -1,275 +0,0 @@ >-/* >- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) >- >- This library is free software; you can redistribute it and/or >- modify it under the terms of the GNU Library General Public >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Library General Public License for more details. >- >- You should have received a copy of the GNU Library General Public License >- along with this library; see the file COPYING.LIB. If not, write to >- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- Boston, MA 02110-1301, USA. >- */ >- >- >-#ifndef CoordinatedGraphicsLayer_h >-#define CoordinatedGraphicsLayer_h >- >-#include "CoordinatedImageBacking.h" >-#include "CoordinatedLayerInfo.h" >-#include "CoordinatedTile.h" >-#include "FloatPoint3D.h" >-#include "GraphicsLayer.h" >-#include "GraphicsLayerAnimation.h" >-#include "GraphicsLayerTransform.h" >-#include "Image.h" >-#include "IntSize.h" >-#include "TiledBackingStore.h" >-#include "TiledBackingStoreClient.h" >-#include "TransformationMatrix.h" >-#include "UpdateInfo.h" >-#include "WebProcess.h" >-#if USE(GRAPHICS_SURFACE) >-#include <WebCore/GraphicsSurfaceToken.h> >-#endif >-#include <WebCore/RunLoop.h> >-#include <wtf/text/StringHash.h> >- >-#if USE(COORDINATED_GRAPHICS) >-namespace WebCore { >-class CoordinatedGraphicsLayer; >-class GraphicsLayerAnimations; >-} >- >-namespace WebKit { >- >-class CoordinatedGraphicsLayerClient { >-public: >- virtual bool isFlushingLayerChanges() const = 0; >- >- // CoordinatedTileClient >- virtual void createTile(CoordinatedLayerID, uint32_t tileID, const SurfaceUpdateInfo&, const WebCore::IntRect&) = 0; >- virtual void updateTile(CoordinatedLayerID, uint32_t tileID, const SurfaceUpdateInfo&, const WebCore::IntRect&) = 0; >- virtual void removeTile(CoordinatedLayerID, uint32_t tileID) = 0; >- >- virtual WebCore::FloatRect visibleContentsRect() const = 0; >- virtual PassRefPtr<CoordinatedImageBacking> createImageBackingIfNeeded(WebCore::Image*) = 0; >- virtual void syncLayerState(CoordinatedLayerID, const CoordinatedLayerInfo&) = 0; >- virtual void syncLayerChildren(CoordinatedLayerID, const Vector<CoordinatedLayerID>&) = 0; >-#if ENABLE(CSS_FILTERS) >- virtual void syncLayerFilters(CoordinatedLayerID, const WebCore::FilterOperations&) = 0; >-#endif >-#if USE(GRAPHICS_SURFACE) >- virtual void createCanvas(CoordinatedLayerID, WebCore::PlatformLayer*) = 0; >- virtual void syncCanvas(CoordinatedLayerID, WebCore::PlatformLayer*) = 0; >- virtual void destroyCanvas(CoordinatedLayerID) = 0; >-#endif >- >- virtual void setLayerRepaintCount(CoordinatedLayerID, int) = 0; >- >- virtual void setLayerAnimations(CoordinatedLayerID, const WebCore::GraphicsLayerAnimations&) = 0; >- >- virtual void detachLayer(WebCore::CoordinatedGraphicsLayer*) = 0; >- virtual void syncFixedLayers() = 0; >- virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, CoordinatedSurface::Flags, uint32_t& atlasID, WebCore::IntPoint&) = 0; >-}; >-} >- >-namespace WebCore { >- >-class CoordinatedGraphicsLayer : public GraphicsLayer >- , public TiledBackingStoreClient >- , public WebKit::CoordinatedImageBacking::Host >- , public WebKit::CoordinatedTileClient { >-public: >- explicit CoordinatedGraphicsLayer(GraphicsLayerClient*); >- virtual ~CoordinatedGraphicsLayer(); >- >- // Reimplementations from GraphicsLayer.h. >- virtual bool setChildren(const Vector<GraphicsLayer*>&) OVERRIDE; >- virtual void addChild(GraphicsLayer*) OVERRIDE; >- virtual void addChildAtIndex(GraphicsLayer*, int) OVERRIDE; >- virtual void addChildAbove(GraphicsLayer*, GraphicsLayer*) OVERRIDE; >- virtual void addChildBelow(GraphicsLayer*, GraphicsLayer*) OVERRIDE; >- virtual bool replaceChild(GraphicsLayer*, GraphicsLayer*) OVERRIDE; >- virtual void removeFromParent() OVERRIDE; >- virtual void setPosition(const FloatPoint&) OVERRIDE; >- virtual void setAnchorPoint(const FloatPoint3D&) OVERRIDE; >- virtual void setSize(const FloatSize&) OVERRIDE; >- virtual void setTransform(const TransformationMatrix&) OVERRIDE; >- virtual void setChildrenTransform(const TransformationMatrix&) OVERRIDE; >- virtual void setPreserves3D(bool) OVERRIDE; >- virtual void setMasksToBounds(bool) OVERRIDE; >- virtual void setDrawsContent(bool) OVERRIDE; >- virtual void setContentsVisible(bool) OVERRIDE; >- virtual void setContentsOpaque(bool) OVERRIDE; >- virtual void setBackfaceVisibility(bool) OVERRIDE; >- virtual void setOpacity(float) OVERRIDE; >- virtual void setContentsRect(const IntRect&) OVERRIDE; >- virtual void setContentsToImage(Image*) OVERRIDE; >- virtual void setContentsToSolidColor(const Color&) OVERRIDE; >- virtual void setShowDebugBorder(bool) OVERRIDE; >- virtual void setShowRepaintCounter(bool) OVERRIDE; >- virtual bool shouldDirectlyCompositeImage(Image*) const OVERRIDE; >- virtual void setContentsToCanvas(PlatformLayer*) OVERRIDE; >- virtual void setMaskLayer(GraphicsLayer*) OVERRIDE; >- virtual void setReplicatedByLayer(GraphicsLayer*) OVERRIDE; >- virtual void setNeedsDisplay() OVERRIDE; >- virtual void setNeedsDisplayInRect(const FloatRect&) OVERRIDE; >- virtual void setContentsNeedsDisplay() OVERRIDE; >- virtual void deviceOrPageScaleFactorChanged() OVERRIDE; >- virtual void flushCompositingState(const FloatRect&) OVERRIDE; >- virtual void flushCompositingStateForThisLayerOnly() OVERRIDE; >-#if ENABLE(CSS_FILTERS) >- virtual bool setFilters(const FilterOperations&) OVERRIDE; >-#endif >- virtual bool addAnimation(const KeyframeValueList&, const IntSize&, const Animation*, const String&, double) OVERRIDE; >- virtual void pauseAnimation(const String&, double) OVERRIDE; >- virtual void removeAnimation(const String&) OVERRIDE; >- virtual void suspendAnimations(double time) OVERRIDE; >- virtual void resumeAnimations() OVERRIDE; >- >- FloatPoint computePositionRelativeToBase(); >- void computePixelAlignment(FloatPoint& position, FloatSize&, FloatPoint3D& anchorPoint, FloatSize& alignmentOffset); >- >- void setVisibleContentRectTrajectoryVector(const FloatPoint&); >- >- void setRootLayer(bool); >- >- WebKit::CoordinatedLayerID id() const; >- >- void setFixedToViewport(bool isFixed) { m_fixedToViewport = isFixed; } >- >- IntRect coverRect() const { return m_mainBackingStore ? m_mainBackingStore->mapToContents(m_mainBackingStore->coverRect()) : IntRect(); } >- >- // TiledBackingStoreClient >- virtual void tiledBackingStorePaintBegin() OVERRIDE; >- virtual void tiledBackingStorePaint(GraphicsContext*, const IntRect&) OVERRIDE; >- virtual void tiledBackingStorePaintEnd(const Vector<IntRect>& paintedArea) OVERRIDE; >- virtual void tiledBackingStoreHasPendingTileCreation() OVERRIDE; >- virtual IntRect tiledBackingStoreContentsRect() OVERRIDE; >- virtual IntRect tiledBackingStoreVisibleRect() OVERRIDE; >- virtual Color tiledBackingStoreBackgroundColor() const OVERRIDE; >- >- // CoordinatedTileClient >- virtual void createTile(uint32_t tileID, const WebKit::SurfaceUpdateInfo&, const IntRect&) OVERRIDE; >- virtual void updateTile(uint32_t tileID, const WebKit::SurfaceUpdateInfo&, const IntRect&) OVERRIDE; >- virtual void removeTile(uint32_t tileID) OVERRIDE; >- virtual PassOwnPtr<GraphicsContext> beginContentUpdate(const IntSize&, uint32_t& atlasID, IntPoint&) OVERRIDE; >- >- void setCoordinator(WebKit::CoordinatedGraphicsLayerClient*); >- >- void setNeedsVisibleRectAdjustment(); >- void purgeBackingStores(); >- bool hasPendingVisibleChanges(); >- >-private: >-#if USE(GRAPHICS_SURFACE) >- enum PendingCanvasOperation { >- None = 0x00, >- CreateCanvas = 0x01, >- DestroyCanvas = 0x02, >- SyncCanvas = 0x04, >- CreateAndSyncCanvas = CreateCanvas | SyncCanvas, >- RecreateCanvas = CreateAndSyncCanvas | DestroyCanvas >- }; >- >- void syncCanvas(); >- void destroyCanvasIfNeeded(); >- void createCanvasIfNeeded(); >-#endif >- >- virtual void setDebugBorder(const Color&, float width) OVERRIDE; >- >- bool fixedToViewport() const { return m_fixedToViewport; } >- >- void didChangeLayerState(); >- void didChangeAnimations(); >- void didChangeGeometry(); >- void didChangeChildren(); >-#if ENABLE(CSS_FILTERS) >- void didChangeFilters(); >-#endif >- void didChangeImageBacking(); >- >- void syncLayerState(); >- void syncAnimations(); >- void syncChildren(); >-#if ENABLE(CSS_FILTERS) >- void syncFilters(); >-#endif >- void syncImageBacking(); >- void computeTransformedVisibleRect(); >- void updateContentBuffers(); >- >- void createBackingStore(); >- void releaseImageBackingIfNeeded(); >- >- // CoordinatedImageBacking::Host >- virtual bool imageBackingVisible() OVERRIDE; >- bool shouldHaveBackingStore() const; >- bool selfOrAncestorHasActiveTransformAnimation() const; >- bool selfOrAncestorHaveNonAffineTransforms(); >- void adjustContentsScale(); >- >- void setShouldUpdateVisibleRect(); >- float effectiveContentsScale(); >- >- void animationStartedTimerFired(Timer<CoordinatedGraphicsLayer>*); >- >- WebKit::CoordinatedLayerID m_id; >- WebKit::CoordinatedLayerInfo m_layerInfo; >- GraphicsLayerTransform m_layerTransform; >- TransformationMatrix m_cachedInverseTransform; >- FloatSize m_pixelAlignmentOffset; >- FloatSize m_adjustedSize; >- FloatPoint m_adjustedPosition; >- FloatPoint3D m_adjustedAnchorPoint; >- >-#ifndef NDEBUG >- bool m_isPurging; >-#endif >- bool m_shouldUpdateVisibleRect: 1; >- bool m_shouldSyncLayerState: 1; >- bool m_shouldSyncChildren: 1; >- bool m_shouldSyncFilters: 1; >- bool m_shouldSyncImageBacking: 1; >- bool m_shouldSyncAnimations: 1; >- bool m_fixedToViewport : 1; >- bool m_pendingContentsScaleAdjustment : 1; >- bool m_pendingVisibleRectAdjustment : 1; >-#if USE(GRAPHICS_SURFACE) >- bool m_isValidCanvas : 1; >- unsigned m_pendingCanvasOperation : 3; >-#endif >- >- WebKit::CoordinatedGraphicsLayerClient* m_coordinator; >- OwnPtr<TiledBackingStore> m_mainBackingStore; >- OwnPtr<TiledBackingStore> m_previousBackingStore; >- >- RefPtr<Image> m_compositedImage; >- NativeImagePtr m_compositedNativeImagePtr; >- RefPtr<WebKit::CoordinatedImageBacking> m_coordinatedImageBacking; >- >- PlatformLayer* m_canvasPlatformLayer; >-#if USE(GRAPHICS_SURFACE) >- IntSize m_canvasSize; >- GraphicsSurfaceToken m_canvasToken; >-#endif >- Timer<CoordinatedGraphicsLayer> m_animationStartedTimer; >- GraphicsLayerAnimations m_animations; >- double m_lastAnimationStartTime; >-}; >- >-CoordinatedGraphicsLayer* toCoordinatedGraphicsLayer(GraphicsLayer*); >- >-} >-#endif >- >-#endif // CoordinatedGraphicsLayer_H >diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedImageBacking.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedImageBacking.cpp >deleted file mode 100644 >index 7043149325ca5a76dc95b4752cd6ed2ff9b6a6f4..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedImageBacking.cpp >+++ /dev/null >@@ -1,165 +0,0 @@ >-/* >- * Copyright (C) 2012 Company 100, Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >- >-#if USE(COORDINATED_GRAPHICS) >-#include "CoordinatedImageBacking.h" >- >-#include "GraphicsContext.h" >- >-using namespace WebCore; >- >-namespace WebKit { >- >-CoordinatedImageBackingID CoordinatedImageBacking::getCoordinatedImageBackingID(Image* image) >-{ >- // CoordinatedImageBacking keeps a RefPtr<Image> member, so the same Image pointer can not refer two different instances until CoordinatedImageBacking releases the member. >- return reinterpret_cast<CoordinatedImageBackingID>(image); >-} >- >-PassRefPtr<CoordinatedImageBacking> CoordinatedImageBacking::create(Coordinator* client, PassRefPtr<Image> image) >-{ >- return adoptRef(new CoordinatedImageBacking(client, image)); >-} >- >-CoordinatedImageBacking::CoordinatedImageBacking(Coordinator* client, PassRefPtr<Image> image) >- : m_coordinator(client) >- , m_image(image) >- , m_id(getCoordinatedImageBackingID(m_image.get())) >- , m_clearContentsTimer(this, &CoordinatedImageBacking::clearContentsTimerFired) >- , m_isDirty(false) >- , m_isVisible(false) >-{ >- // FIXME: We would need to decode a small image directly into a GraphicsSurface. >- // http://webkit.org/b/101426 >- >- m_coordinator->createImageBacking(id()); >-} >- >-CoordinatedImageBacking::~CoordinatedImageBacking() >-{ >-} >- >-void CoordinatedImageBacking::addHost(Host* host) >-{ >- ASSERT(!m_hosts.contains(host)); >- m_hosts.append(host); >-} >- >-void CoordinatedImageBacking::removeHost(Host* host) >-{ >- size_t position = m_hosts.find(host); >- ASSERT(position != notFound); >- m_hosts.remove(position); >- >- if (m_hosts.isEmpty()) >- m_coordinator->removeImageBacking(id()); >-} >- >-void CoordinatedImageBacking::markDirty() >-{ >- m_isDirty = true; >-} >- >-void CoordinatedImageBacking::update() >-{ >- releaseSurfaceIfNeeded(); >- >- bool changedToVisible; >- updateVisibilityIfNeeded(changedToVisible); >- if (!m_isVisible) >- return; >- >- if (!changedToVisible) { >- if (!m_isDirty) >- return; >- >- if (m_nativeImagePtr == m_image->nativeImageForCurrentFrame()) { >- m_isDirty = false; >- return; >- } >- } >- >- m_surface = CoordinatedSurface::create(m_image->size(), m_image->currentFrameHasAlpha() ? CoordinatedSurface::SupportsAlpha : CoordinatedSurface::NoFlags); >- if (!m_surface) { >- m_isDirty = false; >- return; >- } >- >- IntRect rect(IntPoint::zero(), m_image->size()); >- OwnPtr<GraphicsContext> context = m_surface->createGraphicsContext(rect); >- context->drawImage(m_image.get(), ColorSpaceDeviceRGB, rect, rect); >- >- m_nativeImagePtr = m_image->nativeImageForCurrentFrame(); >- >- // If sending the message fails, try again in the next update. >- bool success = m_coordinator->updateImageBacking(id(), m_surface); >- m_isDirty = !success; >-} >- >-void CoordinatedImageBacking::releaseSurfaceIfNeeded() >-{ >- // We must keep m_surface until UI Process reads m_surface. >- // If m_surface exists, it was created in the previous update. >- m_surface.clear(); >-} >- >-static const double clearContentsTimerInterval = 3; >- >-void CoordinatedImageBacking::updateVisibilityIfNeeded(bool& changedToVisible) >-{ >- bool previousIsVisible = m_isVisible; >- >- m_isVisible = false; >- for (size_t i = 0; i < m_hosts.size(); ++i) { >- if (m_hosts[i]->imageBackingVisible()) { >- m_isVisible = true; >- break; >- } >- } >- >- bool changedToInvisible = previousIsVisible && !m_isVisible; >- if (changedToInvisible) { >- ASSERT(!m_clearContentsTimer.isActive()); >- m_clearContentsTimer.startOneShot(clearContentsTimerInterval); >- } >- >- changedToVisible = !previousIsVisible && m_isVisible; >- >- if (m_isVisible && m_clearContentsTimer.isActive()) { >- m_clearContentsTimer.stop(); >- // We don't want to update the texture if we didn't remove the texture. >- changedToVisible = false; >- } >-} >- >-void CoordinatedImageBacking::clearContentsTimerFired(WebCore::Timer<CoordinatedImageBacking>*) >-{ >- m_coordinator->clearImageBackingContents(id()); >-} >- >-} >-#endif >diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedImageBacking.h b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedImageBacking.h >deleted file mode 100644 >index 2adb2a02eb82df27d910f5a9ccb0a70ce7434f41..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedImageBacking.h >+++ /dev/null >@@ -1,95 +0,0 @@ >-/* >- * Copyright (C) 2012 Company 100, Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >- >-#ifndef CoordinatedImageBacking_h >-#define CoordinatedImageBacking_h >- >-#if USE(COORDINATED_GRAPHICS) >-#include "CoordinatedLayerInfo.h" >-#include "CoordinatedSurface.h" >-#include "Image.h" >-#include <WebCore/Timer.h> >-#include <wtf/RefCounted.h> >-#include <wtf/Vector.h> >- >-namespace WebKit { >- >-class CoordinatedImageBacking : public RefCounted<CoordinatedImageBacking> { >-public: >- class Coordinator { >- public: >- virtual void createImageBacking(CoordinatedImageBackingID) = 0; >- virtual bool updateImageBacking(CoordinatedImageBackingID, PassRefPtr<CoordinatedSurface>) = 0; >- virtual void clearImageBackingContents(CoordinatedImageBackingID) = 0; >- virtual void removeImageBacking(CoordinatedImageBackingID) = 0; >- }; >- >- class Host { >- public: >- virtual bool imageBackingVisible() = 0; >- }; >- >- static PassRefPtr<CoordinatedImageBacking> create(Coordinator*, PassRefPtr<WebCore::Image>); >- virtual ~CoordinatedImageBacking(); >- >- static CoordinatedImageBackingID getCoordinatedImageBackingID(WebCore::Image*); >- CoordinatedImageBackingID id() const { return m_id; } >- >- void addHost(Host*); >- void removeHost(Host*); >- >- // When a new image is updated or an animated gif is progressed, CoordinatedGraphicsLayer calls markDirty(). >- void markDirty(); >- >- // Create, remove or update its backing. >- void update(); >- >-private: >- CoordinatedImageBacking(Coordinator*, PassRefPtr<WebCore::Image>); >- >- void releaseSurfaceIfNeeded(); >- void updateVisibilityIfNeeded(bool& changedToVisible); >- void clearContentsTimerFired(WebCore::Timer<CoordinatedImageBacking>*); >- >- Coordinator* m_coordinator; >- RefPtr<WebCore::Image> m_image; >- WebCore::NativeImagePtr m_nativeImagePtr; >- CoordinatedImageBackingID m_id; >- Vector<Host*> m_hosts; >- >- RefPtr<CoordinatedSurface> m_surface; >- >- WebCore::Timer<CoordinatedImageBacking> m_clearContentsTimer; >- >- bool m_isDirty; >- bool m_isVisible; >- >-}; >- >-} >-#endif >- >-#endif // CoordinatedImageBacking_H >diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp >index 1a4a997928154c65f86e7bfc1b8c545e2db5ebac..e8a5932f8e2bfc2eb49ec2dba0ad84c3eaed399a 100644 >--- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp >+++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp >@@ -31,12 +31,10 @@ > #include "CoordinatedLayerTreeHost.h" > > #include "CoordinatedGraphicsArgumentCoders.h" >-#include "CoordinatedGraphicsLayer.h" > #include "CoordinatedLayerTreeHostProxyMessages.h" > #include "DrawingAreaImpl.h" > #include "GraphicsContext.h" > #include "MessageID.h" >-#include "SurfaceUpdateInfo.h" > #include "WebCoordinatedSurface.h" > #include "WebCoreArgumentCoders.h" > #include "WebPage.h" >@@ -50,6 +48,7 @@ > #include <WebCore/RenderLayerCompositor.h> > #include <WebCore/RenderView.h> > #include <WebCore/Settings.h> >+#include <WebCore/SurfaceUpdateInfo.h> > #include <WebCore/TextureMapperPlatformLayer.h> > #include <wtf/TemporaryChange.h> > >@@ -708,13 +707,13 @@ bool LayerTreeHost::supportsAcceleratedCompositing() > return true; > } > >-void CoordinatedLayerTreeHost::createTile(CoordinatedLayerID layerID, uint32_t tileID, const SurfaceUpdateInfo& updateInfo, const WebCore::IntRect& tileRect) >+void CoordinatedLayerTreeHost::createTile(CoordinatedLayerID layerID, uint32_t tileID, const WebCore::SurfaceUpdateInfo& updateInfo, const WebCore::IntRect& tileRect) > { > m_shouldSyncFrame = true; > m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::CreateTileForLayer(layerID, tileID, tileRect, updateInfo)); > } > >-void CoordinatedLayerTreeHost::updateTile(CoordinatedLayerID layerID, uint32_t tileID, const SurfaceUpdateInfo& updateInfo, const WebCore::IntRect& tileRect) >+void CoordinatedLayerTreeHost::updateTile(CoordinatedLayerID layerID, uint32_t tileID, const WebCore::SurfaceUpdateInfo& updateInfo, const WebCore::IntRect& tileRect) > { > m_shouldSyncFrame = true; > m_webPage->send(Messages::CoordinatedLayerTreeHostProxy::UpdateTileForLayer(layerID, tileID, tileRect, updateInfo)); >diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h >index bd66e4a70c22c36725338a92fd0cf769036d4636..7297eed81e05a2ee0f005eea3df81885fec3f2b5 100644 >--- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h >+++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h >@@ -22,30 +22,32 @@ > > #if USE(COORDINATED_GRAPHICS) > >-#include "CoordinatedGraphicsLayer.h" >-#include "CoordinatedImageBacking.h" > #include "LayerTreeContext.h" > #include "LayerTreeHost.h" > #include "Timer.h" >-#include "UpdateAtlas.h" >+#include <WebCore/CoordinatedGraphicsLayer.h> >+#include <WebCore/CoordinatedImageBacking.h> > #include <WebCore/GraphicsLayerClient.h> > #include <WebCore/GraphicsLayerFactory.h> >+#include <WebCore/UpdateAtlas.h> > #include <wtf/OwnPtr.h> > > #if ENABLE(CSS_SHADERS) > #include "WebCustomFilterProgramProxy.h" > #endif > >+namespace WebCore { >+class CoordinatedSurface; >+} >+ > namespace WebKit { > >-class CoordinatedSurface; >-class UpdateInfo; > class WebPage; > > class CoordinatedLayerTreeHost : public LayerTreeHost, WebCore::GraphicsLayerClient >- , public CoordinatedGraphicsLayerClient >- , public CoordinatedImageBacking::Coordinator >- , public UpdateAtlasClient >+ , public WebCore::CoordinatedGraphicsLayerClient >+ , public WebCore::CoordinatedImageBacking::Coordinator >+ , public WebCore::UpdateAtlasClient > , public WebCore::GraphicsLayerFactory > #if ENABLE(CSS_SHADERS) > , WebCustomFilterProgramProxyClient >@@ -77,12 +79,12 @@ public: > virtual void pauseRendering() { m_isSuspended = true; } > virtual void resumeRendering() { m_isSuspended = false; scheduleLayerFlush(); } > virtual void deviceOrPageScaleFactorChanged() OVERRIDE; >- virtual PassRefPtr<CoordinatedImageBacking> createImageBackingIfNeeded(WebCore::Image*) OVERRIDE; >+ virtual PassRefPtr<WebCore::CoordinatedImageBacking> createImageBackingIfNeeded(WebCore::Image*) OVERRIDE; > > virtual bool isFlushingLayerChanges() const OVERRIDE { return m_isFlushingLayerChanges; } >- virtual void createTile(CoordinatedLayerID, uint32_t tileID, const SurfaceUpdateInfo&, const WebCore::IntRect&); >- virtual void updateTile(CoordinatedLayerID, uint32_t tileID, const SurfaceUpdateInfo&, const WebCore::IntRect&); >- virtual void removeTile(CoordinatedLayerID, uint32_t tileID); >+ virtual void createTile(WebCore::CoordinatedLayerID, uint32_t tileID, const WebCore::SurfaceUpdateInfo&, const WebCore::IntRect&); >+ virtual void updateTile(WebCore::CoordinatedLayerID, uint32_t tileID, const WebCore::SurfaceUpdateInfo&, const WebCore::IntRect&); >+ virtual void removeTile(WebCore::CoordinatedLayerID, uint32_t tileID); > virtual WebCore::FloatRect visibleContentsRect() const; > virtual void renderNextFrame(); > virtual void purgeBackingStores(); >@@ -90,25 +92,25 @@ public: > virtual void didReceiveCoordinatedLayerTreeHostMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&); > virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() OVERRIDE; > >- virtual void syncLayerState(CoordinatedLayerID, const CoordinatedLayerInfo&); >- virtual void syncLayerChildren(CoordinatedLayerID, const Vector<CoordinatedLayerID>&); >- virtual void setLayerAnimations(CoordinatedLayerID, const WebCore::GraphicsLayerAnimations&); >+ virtual void syncLayerState(WebCore::CoordinatedLayerID, const WebCore::CoordinatedLayerInfo&); >+ virtual void syncLayerChildren(WebCore::CoordinatedLayerID, const Vector<WebCore::CoordinatedLayerID>&); >+ virtual void setLayerAnimations(WebCore::CoordinatedLayerID, const WebCore::GraphicsLayerAnimations&); > #if ENABLE(CSS_FILTERS) >- virtual void syncLayerFilters(CoordinatedLayerID, const WebCore::FilterOperations&); >+ virtual void syncLayerFilters(WebCore::CoordinatedLayerID, const WebCore::FilterOperations&); > #endif > #if USE(GRAPHICS_SURFACE) >- virtual void createCanvas(CoordinatedLayerID, WebCore::PlatformLayer*) OVERRIDE; >- virtual void syncCanvas(CoordinatedLayerID, WebCore::PlatformLayer*) OVERRIDE; >- virtual void destroyCanvas(CoordinatedLayerID) OVERRIDE; >+ virtual void createCanvas(WebCore::CoordinatedLayerID, WebCore::PlatformLayer*) OVERRIDE; >+ virtual void syncCanvas(WebCore::CoordinatedLayerID, WebCore::PlatformLayer*) OVERRIDE; >+ virtual void destroyCanvas(WebCore::CoordinatedLayerID) OVERRIDE; > #endif >- virtual void setLayerRepaintCount(CoordinatedLayerID, int) OVERRIDE; >+ virtual void setLayerRepaintCount(WebCore::CoordinatedLayerID, int) OVERRIDE; > virtual void detachLayer(WebCore::CoordinatedGraphicsLayer*); > virtual void syncFixedLayers(); > >- virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, CoordinatedSurface::Flags, uint32_t& atlasID, WebCore::IntPoint&); >+ virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, WebCore::CoordinatedSurface::Flags, uint32_t& atlasID, WebCore::IntPoint&); > > // UpdateAtlasClient >- virtual bool createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface>) OVERRIDE; >+ virtual bool createUpdateAtlas(uint32_t atlasID, PassRefPtr<WebCore::CoordinatedSurface>) OVERRIDE; > virtual void removeUpdateAtlas(uint32_t atlasID); > > #if ENABLE(REQUEST_ANIMATION_FRAME) >@@ -116,7 +118,7 @@ public: > #endif > virtual void setBackgroundColor(const WebCore::Color&) OVERRIDE; > >- static PassRefPtr<CoordinatedSurface> createCoordinatedSurface(const WebCore::IntSize&, CoordinatedSurface::Flags); >+ static PassRefPtr<WebCore::CoordinatedSurface> createCoordinatedSurface(const WebCore::IntSize&, WebCore::CoordinatedSurface::Flags); > > protected: > explicit CoordinatedLayerTreeHost(WebPage*); >@@ -130,10 +132,10 @@ private: > virtual float pageScaleFactor() const OVERRIDE; > > // CoordinatedImageBacking::Coordinator >- virtual void createImageBacking(CoordinatedImageBackingID) OVERRIDE; >- virtual bool updateImageBacking(CoordinatedImageBackingID, PassRefPtr<CoordinatedSurface>) OVERRIDE; >- virtual void clearImageBackingContents(CoordinatedImageBackingID) OVERRIDE; >- virtual void removeImageBacking(CoordinatedImageBackingID) OVERRIDE; >+ virtual void createImageBacking(WebCore::CoordinatedImageBackingID) OVERRIDE; >+ virtual bool updateImageBacking(WebCore::CoordinatedImageBackingID, PassRefPtr<WebCore::CoordinatedSurface>) OVERRIDE; >+ virtual void clearImageBackingContents(WebCore::CoordinatedImageBackingID) OVERRIDE; >+ virtual void removeImageBacking(WebCore::CoordinatedImageBackingID) OVERRIDE; > > void flushPendingImageBackingChanges(); > >@@ -180,11 +182,11 @@ private: > OwnPtr<WebCore::GraphicsLayer> m_pageOverlayLayer; > > HashSet<WebCore::CoordinatedGraphicsLayer*> m_registeredLayers; >- Vector<CoordinatedLayerID> m_layersToCreate; >- Vector<CoordinatedLayerID> m_layersToDelete; >- typedef HashMap<CoordinatedImageBackingID, RefPtr<CoordinatedImageBacking> > ImageBackingMap; >+ Vector<WebCore::CoordinatedLayerID> m_layersToCreate; >+ Vector<WebCore::CoordinatedLayerID> m_layersToDelete; >+ typedef HashMap<WebCore::CoordinatedImageBackingID, RefPtr<WebCore::CoordinatedImageBacking> > ImageBackingMap; > ImageBackingMap m_imageBackings; >- Vector<OwnPtr<UpdateAtlas> > m_updateAtlases; >+ Vector<OwnPtr<WebCore::UpdateAtlas> > m_updateAtlases; > > #if ENABLE(CSS_SHADERS) > HashSet<WebCustomFilterProgramProxy*> m_customFilterPrograms; >@@ -211,8 +213,8 @@ private: > bool m_animationsLocked; > }; > >-} >+} // namespace WebKit > >-#endif >+#endif // USE(COORDINATED_GRAPHICS) > > #endif // CoordinatedLayerTreeHost_h >diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.cpp >deleted file mode 100644 >index ac0b56626e81f10b18762b98f365804f8e326167..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.cpp >+++ /dev/null >@@ -1,143 +0,0 @@ >-/* >- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "CoordinatedTile.h" >- >-#if USE(TILED_BACKING_STORE) >- >-#include "GraphicsContext.h" >-#include "ImageBuffer.h" >-#include "SurfaceUpdateInfo.h" >-#include "TiledBackingStoreClient.h" >- >-using namespace WebCore; >- >-namespace WebKit { >- >-static const uint32_t InvalidCoordinatedTileID = 0; >- >-CoordinatedTile::CoordinatedTile(CoordinatedTileClient* client, TiledBackingStore* tiledBackingStore, const Coordinate& tileCoordinate) >- : m_client(client) >- , m_tiledBackingStore(tiledBackingStore) >- , m_coordinate(tileCoordinate) >- , m_rect(tiledBackingStore->tileRectForCoordinate(tileCoordinate)) >- , m_ID(InvalidCoordinatedTileID) >- , m_dirtyRect(m_rect) >-{ >-} >- >-CoordinatedTile::~CoordinatedTile() >-{ >- if (m_ID != InvalidCoordinatedTileID) >- m_client->removeTile(m_ID); >-} >- >-bool CoordinatedTile::isDirty() const >-{ >- return !m_dirtyRect.isEmpty(); >-} >- >-void CoordinatedTile::invalidate(const IntRect& dirtyRect) >-{ >- IntRect tileDirtyRect = intersection(dirtyRect, m_rect); >- if (tileDirtyRect.isEmpty()) >- return; >- >- m_dirtyRect.unite(tileDirtyRect); >-} >- >-Vector<IntRect> CoordinatedTile::updateBackBuffer() >-{ >- if (!isDirty()) >- return Vector<IntRect>(); >- >- SurfaceUpdateInfo updateInfo; >- OwnPtr<GraphicsContext> graphicsContext = m_client->beginContentUpdate(m_dirtyRect.size(), updateInfo.atlasID, updateInfo.surfaceOffset); >- if (!graphicsContext) >- return Vector<IntRect>(); >- graphicsContext->translate(-m_dirtyRect.x(), -m_dirtyRect.y()); >- graphicsContext->scale(FloatSize(m_tiledBackingStore->contentsScale(), m_tiledBackingStore->contentsScale())); >- m_tiledBackingStore->client()->tiledBackingStorePaint(graphicsContext.get(), m_tiledBackingStore->mapToContents(m_dirtyRect)); >- >- updateInfo.updateRect = m_dirtyRect; >- updateInfo.updateRect.move(-m_rect.x(), -m_rect.y()); >- updateInfo.scaleFactor = m_tiledBackingStore->contentsScale(); >- graphicsContext.release(); >- >- static uint32_t id = 1; >- if (m_ID == InvalidCoordinatedTileID) { >- m_ID = id++; >- // We may get an invalid ID due to wrap-around on overflow. >- if (m_ID == InvalidCoordinatedTileID) >- m_ID = id++; >- m_client->createTile(m_ID, updateInfo, m_rect); >- } else >- m_client->updateTile(m_ID, updateInfo, m_rect); >- >- Vector<IntRect> updatedRects; >- updatedRects.append(m_dirtyRect); >- m_dirtyRect = IntRect(); >- return updatedRects; >-} >- >-void CoordinatedTile::swapBackBufferToFront() >-{ >- // Handled by tiledBackingStorePaintEnd. >-} >- >-bool CoordinatedTile::isReadyToPaint() const >-{ >- return m_ID != InvalidCoordinatedTileID; >-} >- >-void CoordinatedTile::paint(GraphicsContext*, const IntRect&) >-{ >- ASSERT_NOT_REACHED(); >-} >- >-void CoordinatedTile::resize(const IntSize& newSize) >-{ >- m_rect = IntRect(m_rect.location(), newSize); >- m_dirtyRect = m_rect; >-} >- >-CoordinatedTileBackend::CoordinatedTileBackend(CoordinatedTileClient* client) >- : m_client(client) >-{ >-} >- >-PassRefPtr<WebCore::Tile> CoordinatedTileBackend::createTile(WebCore::TiledBackingStore* tiledBackingStore, const WebCore::Tile::Coordinate& tileCoordinate) >-{ >- return CoordinatedTile::create(m_client, tiledBackingStore, tileCoordinate); >-} >- >-void CoordinatedTileBackend::paintCheckerPattern(WebCore::GraphicsContext*, const WebCore::FloatRect&) >-{ >-} >- >-} // namespace WebKit >- >-#endif // USE(TILED_BACKING_STORE) >diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.h b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.h >deleted file mode 100644 >index 6e15cc772b531ea1a4a7341c1d046b6508f6ccfc..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedTile.h >+++ /dev/null >@@ -1,100 +0,0 @@ >-/* >- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#ifndef CoordinatedTile_h >-#define CoordinatedTile_h >- >-#if USE(TILED_BACKING_STORE) >- >-#include "Tile.h" >-#include "TiledBackingStore.h" >-#include "WebCore/IntRect.h" >- >-namespace WebCore { >-class ImageBuffer; >-class TiledBackingStore; >-} >- >-namespace WebKit { >- >-class CoordinatedTileClient; >-class SurfaceUpdateInfo; >- >-class CoordinatedTile : public WebCore::Tile { >-public: >- static PassRefPtr<Tile> create(CoordinatedTileClient* client, WebCore::TiledBackingStore* tiledBackingStore, const Coordinate& tileCoordinate) { return adoptRef(new CoordinatedTile(client, tiledBackingStore, tileCoordinate)); } >- ~CoordinatedTile(); >- >- bool isDirty() const; >- void invalidate(const WebCore::IntRect&); >- Vector<WebCore::IntRect> updateBackBuffer(); >- void swapBackBufferToFront(); >- bool isReadyToPaint() const; >- void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); >- >- const Coordinate& coordinate() const { return m_coordinate; } >- const WebCore::IntRect& rect() const { return m_rect; } >- void resize(const WebCore::IntSize&); >- >-private: >- CoordinatedTile(CoordinatedTileClient*, WebCore::TiledBackingStore*, const Coordinate&); >- >- CoordinatedTileClient* m_client; >- WebCore::TiledBackingStore* m_tiledBackingStore; >- Coordinate m_coordinate; >- WebCore::IntRect m_rect; >- >- uint32_t m_ID; >- WebCore::IntRect m_dirtyRect; >- >- OwnPtr<WebCore::ImageBuffer> m_localBuffer; >-}; >- >-class CoordinatedTileClient { >-public: >- virtual ~CoordinatedTileClient() { } >- virtual void createTile(uint32_t tileID, const SurfaceUpdateInfo&, const WebCore::IntRect&) = 0; >- virtual void updateTile(uint32_t tileID, const SurfaceUpdateInfo&, const WebCore::IntRect&) = 0; >- virtual void removeTile(uint32_t tileID) = 0; >- virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, uint32_t& atlasID, WebCore::IntPoint&) = 0; >-}; >- >-class CoordinatedTileBackend : public WebCore::TiledBackingStoreBackend { >-public: >- static PassOwnPtr<WebCore::TiledBackingStoreBackend> create(CoordinatedTileClient* client) { return adoptPtr(new CoordinatedTileBackend(client)); } >- PassRefPtr<WebCore::Tile> createTile(WebCore::TiledBackingStore*, const WebCore::Tile::Coordinate&); >- void paintCheckerPattern(WebCore::GraphicsContext*, const WebCore::FloatRect&); >- >-private: >- explicit CoordinatedTileBackend(CoordinatedTileClient*); >- CoordinatedTileClient* m_client; >-}; >- >- >-} // namespace WebKit >- >-#endif // USE(TILED_BACKING_STORE) >- >-#endif // CoordinatedTile >diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp >deleted file mode 100644 >index d82d32fc6ffc102cf6d4a643f5c328784d6b571c..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp >+++ /dev/null >@@ -1,96 +0,0 @@ >-/* >- Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >- Copyright (C) 2012 Company 100, Inc. >- >- This library is free software; you can redistribute it and/or >- modify it under the terms of the GNU Library General Public >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Library General Public License for more details. >- >- You should have received a copy of the GNU Library General Public License >- along with this library; see the file COPYING.LIB. If not, write to >- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- Boston, MA 02110-1301, USA. >- */ >- >-#include "config.h" >-#include "UpdateAtlas.h" >- >-#if USE(COORDINATED_GRAPHICS) >- >-#include "GraphicsContext.h" >-#include "IntRect.h" >-#include <wtf/MathExtras.h> >- >-using namespace WebCore; >- >-namespace WebKit { >- >-UpdateAtlas::UpdateAtlas(UpdateAtlasClient* client, int dimension, CoordinatedSurface::Flags flags) >- : m_client(client) >- , m_inactivityInSeconds(0) >-{ >- static uint32_t nextID = 0; >- m_ID = ++nextID; >- IntSize size = nextPowerOfTwo(IntSize(dimension, dimension)); >- m_surface = CoordinatedSurface::create(size, flags); >- >- // FIXME: Currently, if sending the message fails, UpdateAtlas gives up drawing anything implicitly. >- if (!m_client->createUpdateAtlas(m_ID, m_surface)) >- m_surface.clear(); >-} >- >-UpdateAtlas::~UpdateAtlas() >-{ >- if (m_surface) >- m_client->removeUpdateAtlas(m_ID); >-} >- >-void UpdateAtlas::buildLayoutIfNeeded() >-{ >- if (!m_areaAllocator) { >- m_areaAllocator = adoptPtr(new GeneralAreaAllocator(size())); >- m_areaAllocator->setMinimumAllocation(IntSize(32, 32)); >- } >-} >- >-void UpdateAtlas::didSwapBuffers() >-{ >- m_areaAllocator.clear(); >-} >- >-PassOwnPtr<GraphicsContext> UpdateAtlas::beginPaintingOnAvailableBuffer(uint32_t& atlasID, const WebCore::IntSize& size, IntPoint& offset) >-{ >- m_inactivityInSeconds = 0; >- buildLayoutIfNeeded(); >- IntRect rect = m_areaAllocator->allocate(size); >- >- // No available buffer was found, returning null. >- if (rect.isEmpty()) >- return PassOwnPtr<GraphicsContext>(); >- >- if (!m_surface) >- return PassOwnPtr<GraphicsContext>(); >- >- atlasID = m_ID; >- >- // FIXME: Use tri-state buffers, to allow faster updates. >- offset = rect.location(); >- OwnPtr<GraphicsContext> graphicsContext = m_surface->createGraphicsContext(rect); >- >- if (supportsAlpha()) { >- graphicsContext->setCompositeOperation(CompositeCopy); >- graphicsContext->fillRect(IntRect(IntPoint::zero(), size), Color::transparent, ColorSpaceDeviceRGB); >- graphicsContext->setCompositeOperation(CompositeSourceOver); >- } >- >- return graphicsContext.release(); >-} >- >-} >-#endif >diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h >deleted file mode 100644 >index ed5863b84d0d8dbaccbae39b12e234148338762c..0000000000000000000000000000000000000000 >--- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h >+++ /dev/null >@@ -1,80 +0,0 @@ >-/* >- Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) >- Copyright (C) 2012 Company 100, Inc. >- >- This library is free software; you can redistribute it and/or >- modify it under the terms of the GNU Library General Public >- License as published by the Free Software Foundation; either >- version 2 of the License, or (at your option) any later version. >- >- This library is distributed in the hope that it will be useful, >- but WITHOUT ANY WARRANTY; without even the implied warranty of >- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >- Library General Public License for more details. >- >- You should have received a copy of the GNU Library General Public License >- along with this library; see the file COPYING.LIB. If not, write to >- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >- Boston, MA 02110-1301, USA. >- */ >- >-#ifndef UpdateAtlas_h >-#define UpdateAtlas_h >- >-#include "AreaAllocator.h" >-#include "CoordinatedSurface.h" >-#include "IntSize.h" >- >-#if USE(COORDINATED_GRAPHICS) >-namespace WebCore { >-class GraphicsContext; >-class IntPoint; >-} >- >-namespace WebKit { >- >-class UpdateAtlasClient { >-public: >- virtual bool createUpdateAtlas(uint32_t atlasID, PassRefPtr<CoordinatedSurface>) = 0; >- virtual void removeUpdateAtlas(uint32_t atlasID) = 0; >-}; >- >-class UpdateAtlas { >- WTF_MAKE_NONCOPYABLE(UpdateAtlas); >-public: >- UpdateAtlas(UpdateAtlasClient*, int dimension, CoordinatedSurface::Flags); >- ~UpdateAtlas(); >- >- inline WebCore::IntSize size() const { return m_surface->size(); } >- >- // Returns a null pointer of there is no available buffer. >- PassOwnPtr<WebCore::GraphicsContext> beginPaintingOnAvailableBuffer(uint32_t& atlasID, const WebCore::IntSize&, WebCore::IntPoint& offset); >- void didSwapBuffers(); >- bool supportsAlpha() const { return m_surface->supportsAlpha(); } >- >- void addTimeInactive(double seconds) >- { >- ASSERT(!isInUse()); >- m_inactivityInSeconds += seconds; >- } >- bool isInactive() const >- { >- const double inactiveSecondsTolerance = 3; >- return m_inactivityInSeconds > inactiveSecondsTolerance; >- } >- bool isInUse() const { return m_areaAllocator; } >- >-private: >- void buildLayoutIfNeeded(); >- >-private: >- UpdateAtlasClient* m_client; >- OwnPtr<GeneralAreaAllocator> m_areaAllocator; >- RefPtr<CoordinatedSurface> m_surface; >- double m_inactivityInSeconds; >- uint32_t m_ID; >-}; >- >-} >-#endif >-#endif // UpdateAtlas_h
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 108149
:
185162
|
185693
|
185714
|
185722
|
185922