[chromium] Change WebLayer from a concrete type to a pure virtual interface
authorjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Aug 2012 21:57:44 +0000 (21:57 +0000)
committerjamesr@google.com <jamesr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Aug 2012 21:57:44 +0000 (21:57 +0000)
commitc70e65ce103f56738c3cc3b7d980447f5ae5f0d6
tree35d63566c7e22b7b0c8296fbcaa155073cf76931
parent021642aeb84adc9fb3fd5c828e6fb09713e4a2a8
[chromium] Change WebLayer from a concrete type to a pure virtual interface
https://bugs.webkit.org/show_bug.cgi?id=94174

Reviewed by Adrienne Walker.

Source/Platform:

This changes WebLayer from a value type to a pure virtual interface and changes Web*Layers from subtypes to
standalone types that have a WebLayer. This better isolates the implementation from the interface and, since
it's not possible to re-wrap an existing layer, makes cleanup explicit instead of requiring the caller to invoke
special cleanup methods before shutdown.

* chromium/public/WebContentLayer.h:
(WebContentLayer):
* chromium/public/WebExternalTextureLayer.h:
(WebExternalTextureLayer):
* chromium/public/WebIOSurfaceLayer.h:
(WebIOSurfaceLayer):
* chromium/public/WebImageLayer.h:
(WebImageLayer):
* chromium/public/WebLayer.h:
(WebKit):
(WebLayer):
(WebKit::WebLayer::~WebLayer):
* chromium/public/WebScrollableLayer.h:
(WebScrollableLayer):
* chromium/public/WebScrollbarLayer.h:
(WebScrollbarLayer):
* chromium/public/WebSolidColorLayer.h:
(WebKit):
(WebSolidColorLayer):
(WebKit::WebSolidColorLayer::~WebSolidColorLayer):
* chromium/public/WebVideoLayer.h:
(WebVideoLayer):

Source/WebCore:

This updates WebCore code for the WebLayer interface changes. Classes that have ownership of specific layer
types (such as DrawingBufferChromium, Canvas2DLayerBridge and ScrollingCoordinatorChromium) hold ownership
of a specific type and a pointer to the WebLayer to GraphicsLayerChromium to be included in the final layer
tree. GraphicsLayerChromium holds a WebContentLayer and (optionally) a WebImageLayer and WebLayer (for
m_transformLayer) and assembles the final layer tree.

* page/scrolling/chromium/ScrollingCoordinatorChromium.cpp:
(WebCore::ScrollingCoordinatorPrivate::ScrollingCoordinatorPrivate):
(ScrollingCoordinatorPrivate):
(WebCore::ScrollingCoordinatorPrivate::setScrollLayer):
(WebCore::ScrollingCoordinatorPrivate::setHorizontalScrollbarLayer):
(WebCore::ScrollingCoordinatorPrivate::setVerticalScrollbarLayer):
(WebCore::ScrollingCoordinatorPrivate::scrollLayer):
(WebCore::scrollableLayerForGraphicsLayer):
(WebCore):
(WebCore::createScrollbarLayer):
(WebCore::ScrollingCoordinator::setScrollLayer):
(WebCore::ScrollingCoordinator::setNonFastScrollableRegion):
(WebCore::ScrollingCoordinator::setWheelEventHandlerCount):
(WebCore::ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread):
(WebCore::ScrollingCoordinator::setLayerIsContainerForFixedPositionLayers):
(WebCore::ScrollingCoordinator::setLayerIsFixedToContainerLayer):
* platform/graphics/chromium/Canvas2DLayerBridge.cpp:
(WebCore::AcceleratedDeviceContext::AcceleratedDeviceContext):
(WebCore::AcceleratedDeviceContext::clearLayer):
(AcceleratedDeviceContext):
(WebCore::AcceleratedDeviceContext::prepareForDraw):
(WebCore::Canvas2DLayerBridge::Canvas2DLayerBridge):
(WebCore::Canvas2DLayerBridge::~Canvas2DLayerBridge):
(WebCore::Canvas2DLayerBridge::skCanvas):
(WebCore::Canvas2DLayerBridge::layer):
(WebCore::Canvas2DLayerBridge::contextAcquired):
* platform/graphics/chromium/Canvas2DLayerBridge.h:
(WebCore):
(Canvas2DLayerBridge):
* platform/graphics/chromium/DrawingBufferChromium.cpp:
(WebCore::DrawingBufferPrivate::DrawingBufferPrivate):
(WebCore::DrawingBufferPrivate::~DrawingBufferPrivate):
(WebCore::DrawingBufferPrivate::layer):
(DrawingBufferPrivate):
* platform/graphics/chromium/GraphicsLayerChromium.cpp:
(WebCore::GraphicsLayerChromium::GraphicsLayerChromium):
(WebCore::GraphicsLayerChromium::~GraphicsLayerChromium):
(WebCore::GraphicsLayerChromium::updateNames):
(WebCore::GraphicsLayerChromium::removeFromParent):
(WebCore::GraphicsLayerChromium::setSize):
(WebCore::GraphicsLayerChromium::clearBackgroundColor):
(WebCore::GraphicsLayerChromium::setContentsOpaque):
(WebCore::GraphicsLayerChromium::setFilters):
(WebCore::GraphicsLayerChromium::setBackgroundFilters):
(WebCore::GraphicsLayerChromium::setMaskLayer):
(WebCore::GraphicsLayerChromium::setBackfaceVisibility):
(WebCore::GraphicsLayerChromium::setOpacity):
(WebCore::GraphicsLayerChromium::setReplicatedByLayer):
(WebCore::GraphicsLayerChromium::setContentsNeedsDisplay):
(WebCore::GraphicsLayerChromium::setNeedsDisplay):
(WebCore::GraphicsLayerChromium::setNeedsDisplayInRect):
(WebCore::GraphicsLayerChromium::setContentsToImage):
(WebCore::GraphicsLayerChromium::setContentsToCanvas):
(WebCore):
(WebCore::GraphicsLayerChromium::setContentsToMedia):
(WebCore::GraphicsLayerChromium::setContentsTo):
(WebCore::GraphicsLayerChromium::addAnimation):
(WebCore::GraphicsLayerChromium::pauseAnimation):
(WebCore::GraphicsLayerChromium::removeAnimation):
(WebCore::GraphicsLayerChromium::suspendAnimations):
(WebCore::GraphicsLayerChromium::resumeAnimations):
(WebCore::GraphicsLayerChromium::addLinkHighlight):
(WebCore::GraphicsLayerChromium::didFinishLinkHighlight):
(WebCore::GraphicsLayerChromium::platformLayer):
(WebCore::GraphicsLayerChromium::setDebugBackgroundColor):
(WebCore::GraphicsLayerChromium::setDebugBorder):
(WebCore::GraphicsLayerChromium::updateChildList):
(WebCore::GraphicsLayerChromium::updateLayerPosition):
(WebCore::GraphicsLayerChromium::updateLayerSize):
(WebCore::GraphicsLayerChromium::updateAnchorPoint):
(WebCore::GraphicsLayerChromium::updateTransform):
(WebCore::GraphicsLayerChromium::updateChildrenTransform):
(WebCore::GraphicsLayerChromium::updateMasksToBounds):
(WebCore::GraphicsLayerChromium::updateLayerPreserves3D):
(WebCore::GraphicsLayerChromium::updateLayerIsDrawable):
(WebCore::GraphicsLayerChromium::updateLayerBackgroundColor):
(WebCore::GraphicsLayerChromium::updateContentsRect):
(WebCore::GraphicsLayerChromium::updateContentsScale):
(WebCore::GraphicsLayerChromium::setupContentsLayer):
* platform/graphics/chromium/GraphicsLayerChromium.h:
(WebCore::GraphicsLayerChromium::hasContentsLayer):
(WebCore::GraphicsLayerChromium::contentLayer):
(GraphicsLayerChromium):
(WebCore::GraphicsLayerChromium::contentsLayer):
* platform/graphics/chromium/LayerChromium.cpp:
(WebCore::LayerChromium::rootLayer):
* platform/graphics/chromium/LayerChromium.h:

Source/WebKit/chromium:

This updates the implementation of the Web*Layer family to the new design and updates callers in WebViewImpl /
NonCompositedContentHost.

* WebKit.gyp:
* src/NonCompositedContentHost.cpp:
(WebKit::NonCompositedContentHost::NonCompositedContentHost):
(WebKit::NonCompositedContentHost::setScrollLayer):
(WebKit::NonCompositedContentHost::setViewport):
(WebKit::NonCompositedContentHost::scrollLayer):
* src/NonCompositedContentHost.h:
* src/WebContentLayerImpl.cpp:
(WebKit::WebContentLayer::create):
(WebKit::WebContentLayerImpl::WebContentLayerImpl):
(WebKit::WebContentLayerImpl::~WebContentLayerImpl):
(WebKit::WebContentLayerImpl::layer):
(WebKit):
(WebKit::WebContentLayerImpl::clearClient):
(WebKit::WebContentLayerImpl::setDoubleSided):
(WebKit::WebContentLayerImpl::setContentsScale):
(WebKit::WebContentLayerImpl::setUseLCDText):
(WebKit::WebContentLayerImpl::setDrawCheckerboardForMissingTiles):
(WebKit::WebContentLayerImpl::paintContents):
* src/WebContentLayerImpl.h:
(WebContentLayerImpl):
* src/WebExternalTextureLayer.cpp: Removed.
* src/WebExternalTextureLayerImpl.cpp: Added.
(WebKit):
(WebKit::WebExternalTextureLayer::create):
(WebKit::WebExternalTextureLayerImpl::WebExternalTextureLayerImpl):
(WebKit::WebExternalTextureLayerImpl::~WebExternalTextureLayerImpl):
(WebKit::WebExternalTextureLayerImpl::layer):
(WebKit::WebExternalTextureLayerImpl::clearClient):
(WebKit::WebExternalTextureLayerImpl::setTextureId):
(WebKit::WebExternalTextureLayerImpl::setFlipped):
(WebKit::WebExternalTextureLayerImpl::setUVRect):
(WebKit::WebExternalTextureLayerImpl::setOpaque):
(WebKit::WebExternalTextureLayerImpl::setPremultipliedAlpha):
(WebKit::WebExternalTextureLayerImpl::willModifyTexture):
(WebKit::WebExternalTextureLayerImpl::setRateLimitContext):
(WebTextureUpdaterImpl):
(WebKit::WebTextureUpdaterImpl::WebTextureUpdaterImpl):
(WebKit::WebExternalTextureLayerImpl::prepareTexture):
(WebKit::WebExternalTextureLayerImpl::context):
* src/WebExternalTextureLayerImpl.h: Renamed from Source/WebKit/chromium/src/WebContentLayer.cpp.
(WebKit):
(WebExternalTextureLayerImpl):
* src/WebIOSurfaceLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp.
(WebKit):
(WebKit::WebIOSurfaceLayer::create):
(WebKit::WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl):
(WebKit::WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl):
(WebKit::WebIOSurfaceLayerImpl::setIOSurfaceProperties):
(WebKit::WebIOSurfaceLayerImpl::layer):
* src/WebIOSurfaceLayerImpl.h: Copied from Source/Platform/chromium/public/WebImageLayer.h.
(WebCore):
(WebKit):
(WebIOSurfaceLayerImpl):
* src/WebImageLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebSolidColorLayer.cpp.
(WebKit):
(WebKit::WebImageLayer::create):
(WebKit::WebImageLayerImpl::WebImageLayerImpl):
(WebKit::WebImageLayerImpl::~WebImageLayerImpl):
(WebKit::WebImageLayerImpl::layer):
(WebKit::WebImageLayerImpl::setBitmap):
* src/WebImageLayerImpl.h: Renamed from Source/WebKit/chromium/src/WebImageLayer.cpp.
(WebCore):
(WebKit):
(WebImageLayerImpl):
* src/WebLayer.cpp: Removed.
* src/WebLayerImpl.cpp:
(WebKit::WebLayer::create):
(WebKit::WebLayerImpl::WebLayerImpl):
(WebKit::WebLayerImpl::~WebLayerImpl):
(WebKit):
(WebKit::WebLayerImpl::invalidateRect):
(WebKit::WebLayerImpl::invalidate):
(WebKit::WebLayerImpl::addChild):
(WebKit::WebLayerImpl::insertChild):
(WebKit::WebLayerImpl::replaceChild):
(WebKit::WebLayerImpl::setChildren):
(WebKit::WebLayerImpl::removeFromParent):
(WebKit::WebLayerImpl::removeAllChildren):
(WebKit::WebLayerImpl::setAnchorPoint):
(WebKit::WebLayerImpl::anchorPoint):
(WebKit::WebLayerImpl::setAnchorPointZ):
(WebKit::WebLayerImpl::anchorPointZ):
(WebKit::WebLayerImpl::setBounds):
(WebKit::WebLayerImpl::bounds):
(WebKit::WebLayerImpl::setMasksToBounds):
(WebKit::WebLayerImpl::masksToBounds):
(WebKit::WebLayerImpl::setMaskLayer):
(WebKit::WebLayerImpl::setReplicaLayer):
(WebKit::WebLayerImpl::setOpacity):
(WebKit::WebLayerImpl::opacity):
(WebKit::WebLayerImpl::setOpaque):
(WebKit::WebLayerImpl::opaque):
(WebKit::WebLayerImpl::setPosition):
(WebKit::WebLayerImpl::position):
(WebKit::WebLayerImpl::setSublayerTransform):
(WebKit::WebLayerImpl::sublayerTransform):
(WebKit::WebLayerImpl::setTransform):
(WebKit::WebLayerImpl::transform):
(WebKit::WebLayerImpl::setDrawsContent):
(WebKit::WebLayerImpl::drawsContent):
(WebKit::WebLayerImpl::setPreserves3D):
(WebKit::WebLayerImpl::setUseParentBackfaceVisibility):
(WebKit::WebLayerImpl::setBackgroundColor):
(WebKit::WebLayerImpl::setFilters):
(WebKit::WebLayerImpl::setBackgroundFilters):
(WebKit::WebLayerImpl::setDebugBorderColor):
(WebKit::WebLayerImpl::setDebugBorderWidth):
(WebKit::WebLayerImpl::setDebugName):
(WebKit::WebLayerImpl::setAnimationDelegate):
(WebKit::WebLayerImpl::addAnimation):
(WebKit::WebLayerImpl::removeAnimation):
(WebKit::WebLayerImpl::pauseAnimation):
(WebKit::WebLayerImpl::suspendAnimations):
(WebKit::WebLayerImpl::resumeAnimations):
(WebKit::WebLayerImpl::hasActiveAnimation):
(WebKit::WebLayerImpl::transferAnimationsTo):
(WebKit::WebLayerImpl::setForceRenderSurface):
(WebKit::WebLayerImpl::clearRenderSurface):
(WebKit::WebLayerImpl::setScrollPosition):
(WebKit::WebLayerImpl::setScrollable):
(WebKit::WebLayerImpl::setHaveWheelEventHandlers):
(WebKit::WebLayerImpl::setShouldScrollOnMainThread):
(WebKit::WebLayerImpl::setNonFastScrollableRegion):
(WebKit::WebLayerImpl::setIsContainerForFixedPositionLayers):
(WebKit::WebLayerImpl::setFixedToContainerLayer):
(WebKit::WebLayerImpl::layer):
* src/WebLayerImpl.h:
(WebCore):
(WebLayerImpl):
* src/WebLayerTreeView.cpp:
(WebKit::WebLayerTreeView::setRootLayer):
* src/WebLayerTreeViewImpl.cpp:
(WebKit::WebLayerTreeViewImpl::create):
* src/WebMediaPlayerClientImpl.cpp:
(WebKit::WebMediaPlayerClientImpl::readyStateChanged):
(WebKit::WebMediaPlayerClientImpl::repaint):
(WebKit::WebMediaPlayerClientImpl::setOpaque):
(WebKit::WebMediaPlayerClientImpl::platformLayer):
(WebKit::WebMediaPlayerClientImpl::acceleratedRenderingInUse):
* src/WebMediaPlayerClientImpl.h:
(WebMediaPlayerClientImpl):
* src/WebPluginContainerImpl.cpp:
(WebKit::WebPluginContainerImpl::setBackingTextureId):
(WebKit::WebPluginContainerImpl::setBackingIOSurfaceId):
(WebKit::WebPluginContainerImpl::commitBackingTexture):
(WebKit::WebPluginContainerImpl::setOpaque):
(WebKit::WebPluginContainerImpl::platformLayer):
* src/WebPluginContainerImpl.h:
(WebPluginContainerImpl):
* src/WebScrollableLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebScrollableLayer.cpp.
(WebKit):
(WebKit::WebScrollableLayer::setScrollPosition):
(WebKit::WebScrollableLayer::setScrollable):
(WebKit::WebScrollableLayer::setHaveWheelEventHandlers):
(WebKit::WebScrollableLayer::setShouldScrollOnMainThread):
(WebKit::WebScrollableLayer::setNonFastScrollableRegion):
(WebKit::WebScrollableLayer::setIsContainerForFixedPositionLayers):
(WebKit::WebScrollableLayer::setFixedToContainerLayer):
* src/WebScrollbarLayerImpl.cpp: Renamed from Source/WebKit/chromium/src/WebScrollbarLayer.cpp.
(WebKit):
(WebKit::WebScrollbarLayer::create):
(WebKit::WebScrollbarLayerImpl::WebScrollbarLayerImpl):
(WebKit::WebScrollbarLayerImpl::~WebScrollbarLayerImpl):
(WebKit::WebScrollbarLayerImpl::layer):
(WebKit::WebScrollbarLayerImpl::setScrollLayer):
* src/WebScrollbarLayerImpl.h: Copied from Source/WebKit/chromium/src/WebSolidColorLayerImpl.h.
(WebCore):
(WebKit):
(WebScrollbarLayerImpl):
* src/WebSolidColorLayerImpl.cpp:
(WebKit::WebSolidColorLayer::create):
(WebKit::WebSolidColorLayerImpl::WebSolidColorLayerImpl):
(WebKit::WebSolidColorLayerImpl::layer):
(WebKit):
(WebKit::WebSolidColorLayerImpl::setBackgroundColor):
* src/WebSolidColorLayerImpl.h:
(WebCore):
(WebKit):
(WebSolidColorLayerImpl):
* src/WebVideoLayerImpl.cpp: Copied from Source/WebKit/chromium/src/WebVideoLayer.cpp.
(WebKit):
(WebKit::WebVideoLayer::create):
(WebKit::WebVideoLayerImpl::WebVideoLayerImpl):
(WebKit::WebVideoLayerImpl::~WebVideoLayerImpl):
(WebKit::WebVideoLayerImpl::layer):
(WebKit::WebVideoLayerImpl::active):
* src/WebVideoLayerImpl.h: Renamed from Source/WebKit/chromium/src/WebVideoLayer.cpp.
(WebCore):
(WebKit):
(WebVideoLayerImpl):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::WebViewImpl):
(WebKit::WebViewImpl::setRootGraphicsLayer):
(WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
(WebKit):
* src/WebViewImpl.h:
* tests/ImageLayerChromiumTest.cpp:
(WebCore::TEST):
* tests/WebLayerTest.cpp:
* tests/WebLayerTreeViewTest.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126076 268f45cc-cd09-0410-ab3c-d52691b4dbfc
52 files changed:
Source/Platform/ChangeLog
Source/Platform/chromium/public/WebContentLayer.h
Source/Platform/chromium/public/WebExternalTextureLayer.h
Source/Platform/chromium/public/WebIOSurfaceLayer.h
Source/Platform/chromium/public/WebImageLayer.h
Source/Platform/chromium/public/WebLayer.h
Source/Platform/chromium/public/WebScrollableLayer.h [deleted file]
Source/Platform/chromium/public/WebScrollbarLayer.h
Source/Platform/chromium/public/WebSolidColorLayer.h
Source/Platform/chromium/public/WebVideoLayer.h
Source/WebCore/ChangeLog
Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp
Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp
Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.h
Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp
Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h
Source/WebCore/platform/graphics/chromium/LayerChromium.cpp
Source/WebCore/platform/graphics/chromium/LayerChromium.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/WebKit.gypi
Source/WebKit/chromium/src/NonCompositedContentHost.cpp
Source/WebKit/chromium/src/NonCompositedContentHost.h
Source/WebKit/chromium/src/WebContentLayerImpl.cpp
Source/WebKit/chromium/src/WebContentLayerImpl.h
Source/WebKit/chromium/src/WebExternalTextureLayerImpl.cpp [moved from Source/WebKit/chromium/src/WebExternalTextureLayer.cpp with 50% similarity]
Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h [moved from Source/WebKit/chromium/src/WebContentLayer.cpp with 53% similarity]
Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp [moved from Source/WebKit/chromium/src/WebIOSurfaceLayer.cpp with 70% similarity]
Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h [new file with mode: 0644]
Source/WebKit/chromium/src/WebImageLayerImpl.cpp [moved from Source/WebKit/chromium/src/WebSolidColorLayer.cpp with 70% similarity]
Source/WebKit/chromium/src/WebImageLayerImpl.h [moved from Source/WebKit/chromium/src/WebImageLayer.cpp with 73% similarity]
Source/WebKit/chromium/src/WebLayer.cpp [deleted file]
Source/WebKit/chromium/src/WebLayerImpl.cpp
Source/WebKit/chromium/src/WebLayerImpl.h
Source/WebKit/chromium/src/WebLayerTreeView.cpp
Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp
Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h
Source/WebKit/chromium/src/WebPluginContainerImpl.cpp
Source/WebKit/chromium/src/WebPluginContainerImpl.h
Source/WebKit/chromium/src/WebScrollableLayer.cpp [deleted file]
Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp [moved from Source/WebKit/chromium/src/WebScrollbarLayer.cpp with 61% similarity]
Source/WebKit/chromium/src/WebScrollbarLayerImpl.h [new file with mode: 0644]
Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp
Source/WebKit/chromium/src/WebSolidColorLayerImpl.h
Source/WebKit/chromium/src/WebVideoLayerImpl.cpp [new file with mode: 0644]
Source/WebKit/chromium/src/WebVideoLayerImpl.h [moved from Source/WebKit/chromium/src/WebVideoLayer.cpp with 74% similarity]
Source/WebKit/chromium/src/WebViewImpl.cpp
Source/WebKit/chromium/src/WebViewImpl.h
Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp
Source/WebKit/chromium/tests/WebLayerTest.cpp
Source/WebKit/chromium/tests/WebLayerTreeViewTest.cpp