From 2d4b939cad26e24660da83276bda1a185c55338a Mon Sep 17 00:00:00 2001 From: "commit-queue@webkit.org" Date: Wed, 18 Jan 2012 21:03:19 +0000 Subject: [PATCH] [chromium] Refactor canvas, plugin, and video drawing to be more data-driven https://bugs.webkit.org/show_bug.cgi?id=76274 Patch by Tim Dresser on 2012-01-18 Reviewed by James Robinson. Source/WebCore: This is the first step in refactoring canvas, plugin, and video drawing. The CCCustomLayerDrawQuad implementation has been copied to CCCanvasDrawQuad, CCPluginDrawQuad and CCVideoDrawQuad. All references to CustomLayer have been removed. As this is a refactor, no new tests were added. CCLayerTreeHostImplTest.blendingOffWhenDrawingOpaqueLayers was modified to no longer test culling. * WebCore.gypi: * platform/graphics/chromium/LayerRendererChromium.cpp: (WebCore::LayerRendererChromium::drawQuad): (WebCore::LayerRendererChromium::drawCanvasQuad): (WebCore::LayerRendererChromium::drawVideoQuad): (WebCore::LayerRendererChromium::drawPluginQuad): * platform/graphics/chromium/LayerRendererChromium.h: * platform/graphics/chromium/cc/CCCanvasDrawQuad.cpp: Copied from Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.cpp. (WebCore::CCCanvasDrawQuad::create): (WebCore::CCCanvasDrawQuad::CCCanvasDrawQuad): * platform/graphics/chromium/cc/CCCanvasDrawQuad.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.h. (WebCore::CCCanvasDrawQuad::layer): * platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp: (WebCore::CCCanvasLayerImpl::appendQuads): * platform/graphics/chromium/cc/CCCanvasLayerImpl.h: * platform/graphics/chromium/cc/CCDrawQuad.cpp: (WebCore::CCDrawQuad::toCanvasDrawQuad): (WebCore::CCDrawQuad::toVideoDrawQuad): (WebCore::CCDrawQuad::toPluginDrawQuad): * platform/graphics/chromium/cc/CCDrawQuad.h: * platform/graphics/chromium/cc/CCLayerImpl.cpp: (WebCore::CCLayerImpl::appendQuads): * platform/graphics/chromium/cc/CCPluginDrawQuad.cpp: Copied from Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.cpp. (WebCore::CCPluginDrawQuad::create): (WebCore::CCPluginDrawQuad::CCPluginDrawQuad): * platform/graphics/chromium/cc/CCPluginDrawQuad.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.h. (WebCore::CCPluginDrawQuad::layer): * platform/graphics/chromium/cc/CCPluginLayerImpl.cpp: (WebCore::CCPluginLayerImpl::appendQuads): * platform/graphics/chromium/cc/CCPluginLayerImpl.h: * platform/graphics/chromium/cc/CCQuadCuller.cpp: * platform/graphics/chromium/cc/CCVideoDrawQuad.cpp: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.cpp. (WebCore::CCVideoDrawQuad::create): (WebCore::CCVideoDrawQuad::CCVideoDrawQuad): * platform/graphics/chromium/cc/CCVideoDrawQuad.h: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.h. (WebCore::CCVideoDrawQuad::layer): * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: (WebCore::CCVideoLayerImpl::appendQuads): * platform/graphics/chromium/cc/CCVideoLayerImpl.h: Source/WebKit/chromium: No longer test culling in CCLayerTreeHostImplTest.blendingOffWhenDrawingLayers. * tests/CCLayerTreeHostImplTest.cpp: (WebKit::BlendStateCheckLayer::appendQuads): (WebKit::BlendStateCheckLayer::setExpectation): (WebKit::BlendStateCheckLayer::quadsAppended): (WebKit::BlendStateCheckLayer::BlendStateCheckLayer): (WebKit::TEST_F): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105311 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 54 ++++++++++++++++++++++ Source/WebCore/WebCore.gypi | 8 +++- .../graphics/chromium/LayerRendererChromium.cpp | 28 +++++++++-- .../graphics/chromium/LayerRendererChromium.h | 4 +- ...ustomLayerDrawQuad.cpp => CCCanvasDrawQuad.cpp} | 12 ++--- .../graphics/chromium/cc/CCCanvasDrawQuad.h | 50 ++++++++++++++++++++ .../graphics/chromium/cc/CCCanvasLayerImpl.cpp | 6 +++ .../graphics/chromium/cc/CCCanvasLayerImpl.h | 2 + .../platform/graphics/chromium/cc/CCDrawQuad.cpp | 22 +++++++-- .../platform/graphics/chromium/cc/CCDrawQuad.h | 14 ++++-- .../platform/graphics/chromium/cc/CCLayerImpl.cpp | 3 -- .../graphics/chromium/cc/CCPluginDrawQuad.cpp | 44 ++++++++++++++++++ ...{CCCustomLayerDrawQuad.h => CCPluginDrawQuad.h} | 17 +++---- .../graphics/chromium/cc/CCPluginLayerImpl.cpp | 6 +++ .../graphics/chromium/cc/CCPluginLayerImpl.h | 2 + .../platform/graphics/chromium/cc/CCQuadCuller.cpp | 1 - .../graphics/chromium/cc/CCVideoDrawQuad.cpp | 44 ++++++++++++++++++ .../graphics/chromium/cc/CCVideoDrawQuad.h | 50 ++++++++++++++++++++ .../graphics/chromium/cc/CCVideoLayerImpl.cpp | 9 +++- .../graphics/chromium/cc/CCVideoLayerImpl.h | 2 + Source/WebKit/chromium/ChangeLog | 16 +++++++ .../chromium/tests/CCLayerTreeHostImplTest.cpp | 44 +++++++++--------- 22 files changed, 380 insertions(+), 58 deletions(-) rename Source/WebCore/platform/graphics/chromium/cc/{CCCustomLayerDrawQuad.cpp => CCCanvasDrawQuad.cpp} (72%) create mode 100644 Source/WebCore/platform/graphics/chromium/cc/CCCanvasDrawQuad.h create mode 100644 Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.cpp rename Source/WebCore/platform/graphics/chromium/cc/{CCCustomLayerDrawQuad.h => CCPluginDrawQuad.h} (71%) create mode 100644 Source/WebCore/platform/graphics/chromium/cc/CCVideoDrawQuad.cpp create mode 100644 Source/WebCore/platform/graphics/chromium/cc/CCVideoDrawQuad.h diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 594583a..9bfb485 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,57 @@ +2012-01-18 Tim Dresser + + [chromium] Refactor canvas, plugin, and video drawing to be more data-driven + https://bugs.webkit.org/show_bug.cgi?id=76274 + + Reviewed by James Robinson. + + This is the first step in refactoring canvas, plugin, and video drawing. + The CCCustomLayerDrawQuad implementation has been copied to CCCanvasDrawQuad, CCPluginDrawQuad and CCVideoDrawQuad. + All references to CustomLayer have been removed. + + As this is a refactor, no new tests were added. CCLayerTreeHostImplTest.blendingOffWhenDrawingOpaqueLayers was modified to + no longer test culling. + + * WebCore.gypi: + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawQuad): + (WebCore::LayerRendererChromium::drawCanvasQuad): + (WebCore::LayerRendererChromium::drawVideoQuad): + (WebCore::LayerRendererChromium::drawPluginQuad): + * platform/graphics/chromium/LayerRendererChromium.h: + * platform/graphics/chromium/cc/CCCanvasDrawQuad.cpp: Copied from Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.cpp. + (WebCore::CCCanvasDrawQuad::create): + (WebCore::CCCanvasDrawQuad::CCCanvasDrawQuad): + * platform/graphics/chromium/cc/CCCanvasDrawQuad.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.h. + (WebCore::CCCanvasDrawQuad::layer): + * platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp: + (WebCore::CCCanvasLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCCanvasLayerImpl.h: + * platform/graphics/chromium/cc/CCDrawQuad.cpp: + (WebCore::CCDrawQuad::toCanvasDrawQuad): + (WebCore::CCDrawQuad::toVideoDrawQuad): + (WebCore::CCDrawQuad::toPluginDrawQuad): + * platform/graphics/chromium/cc/CCDrawQuad.h: + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::CCLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCPluginDrawQuad.cpp: Copied from Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.cpp. + (WebCore::CCPluginDrawQuad::create): + (WebCore::CCPluginDrawQuad::CCPluginDrawQuad): + * platform/graphics/chromium/cc/CCPluginDrawQuad.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.h. + (WebCore::CCPluginDrawQuad::layer): + * platform/graphics/chromium/cc/CCPluginLayerImpl.cpp: + (WebCore::CCPluginLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCPluginLayerImpl.h: + * platform/graphics/chromium/cc/CCQuadCuller.cpp: + * platform/graphics/chromium/cc/CCVideoDrawQuad.cpp: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.cpp. + (WebCore::CCVideoDrawQuad::create): + (WebCore::CCVideoDrawQuad::CCVideoDrawQuad): + * platform/graphics/chromium/cc/CCVideoDrawQuad.h: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.h. + (WebCore::CCVideoDrawQuad::layer): + * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: + (WebCore::CCVideoLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCVideoLayerImpl.h: + 2012-01-18 Vsevolod Vlasov Web Inspector: Unsafe cross origin access errors should show stack trace in console. diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index cddae39..553a36a 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -3605,10 +3605,10 @@ 'platform/graphics/chromium/VideoLayerChromium.h', 'platform/graphics/chromium/WebGLLayerChromium.cpp', 'platform/graphics/chromium/WebGLLayerChromium.h', + 'platform/graphics/chromium/cc/CCCanvasDrawQuad.cpp', + 'platform/graphics/chromium/cc/CCCanvasDrawQuad.h', 'platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp', 'platform/graphics/chromium/cc/CCCanvasLayerImpl.h', - 'platform/graphics/chromium/cc/CCCustomLayerDrawQuad.cpp', - 'platform/graphics/chromium/cc/CCCustomLayerDrawQuad.h', 'platform/graphics/chromium/cc/CCDamageTracker.cpp', 'platform/graphics/chromium/cc/CCDamageTracker.h', 'platform/graphics/chromium/cc/CCDebugBorderDrawQuad.cpp', @@ -3641,6 +3641,8 @@ 'platform/graphics/chromium/cc/CCLayerTreeHostImpl.h', 'platform/graphics/chromium/cc/CCPageScaleAnimation.cpp', 'platform/graphics/chromium/cc/CCPageScaleAnimation.h', + 'platform/graphics/chromium/cc/CCPluginDrawQuad.cpp', + 'platform/graphics/chromium/cc/CCPluginDrawQuad.h', 'platform/graphics/chromium/cc/CCPluginLayerImpl.cpp', 'platform/graphics/chromium/cc/CCPluginLayerImpl.h', 'platform/graphics/chromium/cc/CCProxy.cpp', @@ -3677,6 +3679,8 @@ 'platform/graphics/chromium/cc/CCTimer.cpp', 'platform/graphics/chromium/cc/CCTimer.h', 'platform/graphics/chromium/cc/CCTimeSource.h', + 'platform/graphics/chromium/cc/CCVideoDrawQuad.cpp', + 'platform/graphics/chromium/cc/CCVideoDrawQuad.h', 'platform/graphics/chromium/cc/CCVideoLayerImpl.cpp', 'platform/graphics/chromium/cc/CCVideoLayerImpl.h', 'platform/graphics/cocoa/FontPlatformDataCocoa.mm', diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp index 933e782..eec179b 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp @@ -52,16 +52,18 @@ #include "TrackingTextureAllocator.h" #include "TreeSynchronizer.h" #include "WebGLLayerChromium.h" -#include "cc/CCCustomLayerDrawQuad.h" +#include "cc/CCCanvasDrawQuad.h" #include "cc/CCDamageTracker.h" #include "cc/CCDebugBorderDrawQuad.h" #include "cc/CCLayerImpl.h" #include "cc/CCLayerTreeHostCommon.h" +#include "cc/CCPluginDrawQuad.h" #include "cc/CCProxy.h" #include "cc/CCRenderPass.h" #include "cc/CCRenderSurfaceDrawQuad.h" #include "cc/CCSolidColorDrawQuad.h" #include "cc/CCTileDrawQuad.h" +#include "cc/CCVideoDrawQuad.h" #if USE(SKIA) #include "Extensions3D.h" #include "GrContext.h" @@ -422,8 +424,14 @@ void LayerRendererChromium::drawQuad(const CCDrawQuad* quad, const FloatRect& su case CCDrawQuad::TiledContent: drawTileQuad(quad->toTileDrawQuad()); break; - case CCDrawQuad::CustomLayer: - drawCustomLayerQuad(quad->toCustomLayerDrawQuad()); + case CCDrawQuad::CanvasContent: + drawCanvasQuad(quad->toCanvasDrawQuad()); + break; + case CCDrawQuad::VideoContent: + drawVideoQuad(quad->toVideoDrawQuad()); + break; + case CCDrawQuad::PluginContent: + drawPluginQuad(quad->toPluginDrawQuad()); break; } } @@ -659,7 +667,19 @@ void LayerRendererChromium::drawTileQuad(const CCTileDrawQuad* quad) drawTexturedQuad(quad->quadTransform(), tileRect.width(), tileRect.height(), quad->opacity(), localQuad, uniforms.matrixLocation, uniforms.alphaLocation, uniforms.pointLocation); } -void LayerRendererChromium::drawCustomLayerQuad(const CCCustomLayerDrawQuad* quad) +void LayerRendererChromium::drawCanvasQuad(const CCCanvasDrawQuad* quad) +{ + CCLayerImpl* layer = quad->layer(); + layer->draw(this); +} + +void LayerRendererChromium::drawVideoQuad(const CCVideoDrawQuad* quad) +{ + CCLayerImpl* layer = quad->layer(); + layer->draw(this); +} + +void LayerRendererChromium::drawPluginQuad(const CCPluginDrawQuad* quad) { CCLayerImpl* layer = quad->layer(); layer->draw(this); diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h index 2bb0146..c896b1d 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h @@ -167,7 +167,9 @@ private: void drawRenderSurfaceQuad(const CCRenderSurfaceDrawQuad*); void drawSolidColorQuad(const CCSolidColorDrawQuad*); void drawTileQuad(const CCTileDrawQuad*); - void drawCustomLayerQuad(const CCCustomLayerDrawQuad*); + void drawCanvasQuad(const CCCanvasDrawQuad*); + void drawVideoQuad(const CCVideoDrawQuad*); + void drawPluginQuad(const CCPluginDrawQuad*); ManagedTexture* getOffscreenLayerTexture(); void copyOffscreenTextureToDisplay(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCCanvasDrawQuad.cpp similarity index 72% rename from Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.cpp rename to Source/WebCore/platform/graphics/chromium/cc/CCCanvasDrawQuad.cpp index 8580b10..a5c768f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCCanvasDrawQuad.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,17 +25,17 @@ #include "config.h" -#include "cc/CCCustomLayerDrawQuad.h" +#include "cc/CCCanvasDrawQuad.h" namespace WebCore { -PassOwnPtr CCCustomLayerDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCLayerImpl* layer) +PassOwnPtr CCCanvasDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCLayerImpl* layer) { - return adoptPtr(new CCCustomLayerDrawQuad(sharedQuadState, quadRect, layer)); + return adoptPtr(new CCCanvasDrawQuad(sharedQuadState, quadRect, layer)); } -CCCustomLayerDrawQuad::CCCustomLayerDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCLayerImpl* layer) - : CCDrawQuad(sharedQuadState, CCDrawQuad::CustomLayer, quadRect) +CCCanvasDrawQuad::CCCanvasDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCLayerImpl* layer) + : CCDrawQuad(sharedQuadState, CCDrawQuad::CanvasContent, quadRect) , m_layer(layer) { ASSERT(m_layer); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCCanvasDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCCanvasDrawQuad.h new file mode 100644 index 0000000..65b4c8a --- /dev/null +++ b/Source/WebCore/platform/graphics/chromium/cc/CCCanvasDrawQuad.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2012 Google 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 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 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 CCCanvasDrawQuad_h +#define CCCanvasDrawQuad_h + +#include "cc/CCDrawQuad.h" +#include + +namespace WebCore { + +class CCLayerImpl; +class CCCanvasDrawQuad : public CCDrawQuad { + WTF_MAKE_NONCOPYABLE(CCCanvasDrawQuad); +public: + static PassOwnPtr create(const CCSharedQuadState*, const IntRect&, CCLayerImpl*); + + CCLayerImpl* layer() const { return m_layer; } + +private: + CCCanvasDrawQuad(const CCSharedQuadState*, const IntRect&, CCLayerImpl*); + + CCLayerImpl* m_layer; +}; + +} + +#endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp index 6ecdd90..ac18366 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp @@ -31,6 +31,7 @@ #include "GraphicsContext3D.h" #include "LayerRendererChromium.h" +#include "cc/CCCanvasDrawQuad.h" #include "cc/CCProxy.h" #include @@ -77,6 +78,11 @@ void CCCanvasLayerImpl::draw(LayerRendererChromium* layerRenderer) context->enable(GraphicsContext3D::BLEND); } +void CCCanvasLayerImpl::appendQuads(CCQuadList& quadList, const CCSharedQuadState* sharedQuadState) +{ + IntRect quadRect(IntPoint(), bounds()); + quadList.append(CCCanvasDrawQuad::create(sharedQuadState, quadRect, this)); +} void CCCanvasLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const { diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.h index 275bf7c..35b89e6 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.h @@ -40,6 +40,8 @@ public: } virtual ~CCCanvasLayerImpl(); + virtual void appendQuads(CCQuadList&, const CCSharedQuadState*); + typedef ProgramBinding Program; virtual void draw(LayerRendererChromium*); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.cpp index 8fcf449..1bbfbb6 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.cpp @@ -27,12 +27,14 @@ #include "cc/CCDrawQuad.h" -#include "cc/CCCustomLayerDrawQuad.h" +#include "cc/CCCanvasDrawQuad.h" #include "cc/CCDebugBorderDrawQuad.h" #include "cc/CCLayerImpl.h" +#include "cc/CCPluginDrawQuad.h" #include "cc/CCRenderSurfaceDrawQuad.h" #include "cc/CCSolidColorDrawQuad.h" #include "cc/CCTileDrawQuad.h" +#include "cc/CCVideoDrawQuad.h" namespace WebCore { @@ -71,10 +73,22 @@ const CCTileDrawQuad* CCDrawQuad::toTileDrawQuad() const return static_cast(this); } -const CCCustomLayerDrawQuad* CCDrawQuad::toCustomLayerDrawQuad() const +const CCCanvasDrawQuad* CCDrawQuad::toCanvasDrawQuad() const { - ASSERT(m_material == CustomLayer); - return static_cast(this); + ASSERT(m_material == CanvasContent); + return static_cast(this); +} + +const CCVideoDrawQuad* CCDrawQuad::toVideoDrawQuad() const +{ + ASSERT(m_material == VideoContent); + return static_cast(this); +} + +const CCPluginDrawQuad* CCDrawQuad::toPluginDrawQuad() const +{ + ASSERT(m_material == PluginContent); + return static_cast(this); } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h index b56913b3..acc7c02 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h @@ -34,7 +34,9 @@ class CCDebugBorderDrawQuad; class CCRenderSurfaceDrawQuad; class CCSolidColorDrawQuad; class CCTileDrawQuad; -class CCCustomLayerDrawQuad; +class CCCanvasDrawQuad; +class CCVideoDrawQuad; +class CCPluginDrawQuad; // CCDrawQuad is a bag of data used for drawing a quad. Because different // materials need different bits of per-quad data to render, classes that derive @@ -60,9 +62,9 @@ public: RenderSurface, SolidColor, TiledContent, - - // FIXME: remove this and add proper material types for all layer types - CustomLayer, + CanvasContent, + VideoContent, + PluginContent, }; Material material() const { return m_material; } @@ -71,7 +73,9 @@ public: const CCRenderSurfaceDrawQuad* toRenderSurfaceDrawQuad() const; const CCSolidColorDrawQuad* toSolidColorDrawQuad() const; const CCTileDrawQuad* toTileDrawQuad() const; - const CCCustomLayerDrawQuad* toCustomLayerDrawQuad() const; + const CCCanvasDrawQuad* toCanvasDrawQuad() const; + const CCVideoDrawQuad* toVideoDrawQuad() const; + const CCPluginDrawQuad* toPluginDrawQuad() const; protected: CCDrawQuad(const CCSharedQuadState*, Material, const IntRect&); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp index 6837f0a..de38a0a 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp @@ -32,7 +32,6 @@ #include "GraphicsContext3D.h" #include "LayerChromium.h" #include "LayerRendererChromium.h" -#include "cc/CCCustomLayerDrawQuad.h" #include "cc/CCDebugBorderDrawQuad.h" #include "cc/CCLayerSorter.h" #include @@ -129,8 +128,6 @@ PassOwnPtr CCLayerImpl::createSharedQuadState() const void CCLayerImpl::appendQuads(CCQuadList& quadList, const CCSharedQuadState* sharedQuadState) { - IntRect quadRect(IntPoint(), bounds()); - quadList.append(CCCustomLayerDrawQuad::create(sharedQuadState, quadRect, this)); } void CCLayerImpl::appendDebugBorderQuad(CCQuadList& quadList, const CCSharedQuadState* sharedQuadState) const diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.cpp new file mode 100644 index 0000000..fd2ae4b --- /dev/null +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2012 Google 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 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 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 "cc/CCPluginDrawQuad.h" + +namespace WebCore { + +PassOwnPtr CCPluginDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCLayerImpl* layer) +{ + return adoptPtr(new CCPluginDrawQuad(sharedQuadState, quadRect, layer)); +} + +CCPluginDrawQuad::CCPluginDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCLayerImpl* layer) + : CCDrawQuad(sharedQuadState, CCDrawQuad::PluginContent, quadRect) + , m_layer(layer) +{ + ASSERT(m_layer); +} + +} diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.h similarity index 71% rename from Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.h rename to Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.h index a9bd462..ca52abe 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCCustomLayerDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,8 +23,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef CCCustomLayerDrawQuad_h -#define CCCustomLayerDrawQuad_h +#ifndef CCPluginDrawQuad_h +#define CCPluginDrawQuad_h #include "cc/CCDrawQuad.h" #include @@ -33,18 +33,15 @@ namespace WebCore { class CCLayerImpl; -// FIXME: This class is a temporary way to access CCLayerImpl::draw. This class -// should be converted to a set of draw quads for each layer material type and -// then removed. -class CCCustomLayerDrawQuad : public CCDrawQuad { - WTF_MAKE_NONCOPYABLE(CCCustomLayerDrawQuad); +class CCPluginDrawQuad : public CCDrawQuad { + WTF_MAKE_NONCOPYABLE(CCPluginDrawQuad); public: - static PassOwnPtr create(const CCSharedQuadState*, const IntRect&, CCLayerImpl*); + static PassOwnPtr create(const CCSharedQuadState*, const IntRect&, CCLayerImpl*); CCLayerImpl* layer() const { return m_layer; } private: - CCCustomLayerDrawQuad(const CCSharedQuadState*, const IntRect&, CCLayerImpl*); + CCPluginDrawQuad(const CCSharedQuadState*, const IntRect&, CCLayerImpl*); CCLayerImpl* m_layer; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp index bc105bb..b20a2f5 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp @@ -32,6 +32,7 @@ #include "Extensions3DChromium.h" #include "GraphicsContext3D.h" #include "LayerRendererChromium.h" +#include "cc/CCPluginDrawQuad.h" #include "cc/CCProxy.h" #include @@ -176,6 +177,11 @@ void CCPluginLayerImpl::draw(LayerRendererChromium* layerRenderer) } } +void CCPluginLayerImpl::appendQuads(CCQuadList& quadList, const CCSharedQuadState* sharedQuadState) +{ + IntRect quadRect(IntPoint(), bounds()); + quadList.append(CCPluginDrawQuad::create(sharedQuadState, quadRect, this)); +} void CCPluginLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const { diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h index e09826a..9b4d5a4 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h @@ -41,6 +41,8 @@ public: } virtual ~CCPluginLayerImpl(); + virtual void appendQuads(CCQuadList&, const CCSharedQuadState*); + typedef ProgramBinding Program; typedef ProgramBinding ProgramFlip; typedef ProgramBinding TexRectProgram; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp index 4a8b851..079aa7f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp @@ -31,7 +31,6 @@ #include "Region.h" #include "TransformationMatrix.h" -#include "cc/CCCustomLayerDrawQuad.h" #include "cc/CCLayerImpl.h" #include "cc/CCRenderPass.h" #include "cc/CCRenderSurfaceDrawQuad.h" diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCVideoDrawQuad.cpp new file mode 100644 index 0000000..3de38e9 --- /dev/null +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoDrawQuad.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2012 Google 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 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 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 "cc/CCVideoDrawQuad.h" + +namespace WebCore { + +PassOwnPtr CCVideoDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCLayerImpl* layer) +{ + return adoptPtr(new CCVideoDrawQuad(sharedQuadState, quadRect, layer)); +} + +CCVideoDrawQuad::CCVideoDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCLayerImpl* layer) + : CCDrawQuad(sharedQuadState, CCDrawQuad::VideoContent, quadRect) + , m_layer(layer) +{ + ASSERT(m_layer); +} + +} diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCVideoDrawQuad.h new file mode 100644 index 0000000..b18bc55 --- /dev/null +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoDrawQuad.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2012 Google 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 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 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 CCVideoDrawQuad_h +#define CCVideoDrawQuad_h + +#include "cc/CCDrawQuad.h" +#include + +namespace WebCore { + +class CCLayerImpl; +class CCVideoDrawQuad : public CCDrawQuad { + WTF_MAKE_NONCOPYABLE(CCVideoDrawQuad); +public: + static PassOwnPtr create(const CCSharedQuadState*, const IntRect&, CCLayerImpl*); + + CCLayerImpl* layer() const { return m_layer; } + +private: + CCVideoDrawQuad(const CCSharedQuadState*, const IntRect&, CCLayerImpl*); + + CCLayerImpl* m_layer; +}; + +} + +#endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp index 99e7e11..ba1290e 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp @@ -32,9 +32,10 @@ #include "Extensions3DChromium.h" #include "GraphicsContext3D.h" #include "LayerRendererChromium.h" -#include "ProgramBinding.h" #include "NotImplemented.h" +#include "ProgramBinding.h" #include "cc/CCProxy.h" +#include "cc/CCVideoDrawQuad.h" #include namespace WebCore { @@ -150,6 +151,12 @@ void CCVideoLayerImpl::draw(LayerRendererChromium* layerRenderer) m_provider->putCurrentFrame(frame); } +void CCVideoLayerImpl::appendQuads(CCQuadList& quadList, const CCSharedQuadState* sharedQuadState) +{ + IntRect quadRect(IntPoint(), bounds()); + quadList.append(CCVideoDrawQuad::create(sharedQuadState, quadRect, this)); +} + bool CCVideoLayerImpl::copyFrameToTextures(const VideoFrameChromium* frame, GC3Denum format, LayerRendererChromium* layerRenderer) { if (frame->format() == VideoFrameChromium::NativeTexture) { diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h index cc4cc82..182f7b5 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h @@ -46,6 +46,8 @@ public: } virtual ~CCVideoLayerImpl(); + virtual void appendQuads(CCQuadList&, const CCSharedQuadState*); + typedef ProgramBinding RGBAProgram; typedef ProgramBinding YUVProgram; typedef ProgramBinding NativeTextureProgram; diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index b678d6c..6215de1 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,19 @@ +2012-01-18 Tim Dresser + + [chromium] Refactor canvas, plugin, and video drawing to be more data-driven + https://bugs.webkit.org/show_bug.cgi?id=76274 + + Reviewed by James Robinson. + + No longer test culling in CCLayerTreeHostImplTest.blendingOffWhenDrawingLayers. + + * tests/CCLayerTreeHostImplTest.cpp: + (WebKit::BlendStateCheckLayer::appendQuads): + (WebKit::BlendStateCheckLayer::setExpectation): + (WebKit::BlendStateCheckLayer::quadsAppended): + (WebKit::BlendStateCheckLayer::BlendStateCheckLayer): + (WebKit::TEST_F): + 2012-01-18 Dominic Mazzoni Accessibility: Chromium needs methods to scroll an object into view or to a specific location. diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp index 9b87d00..5227892 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp @@ -31,6 +31,7 @@ #include "LayerRendererChromium.h" #include "cc/CCLayerImpl.h" #include "cc/CCSingleThreadProxy.h" +#include "cc/CCSolidColorDrawQuad.h" #include using namespace WebCore; @@ -183,11 +184,12 @@ class BlendStateCheckLayer : public CCLayerImpl { public: static PassRefPtr create(int id) { return adoptRef(new BlendStateCheckLayer(id)); } - virtual void draw(LayerRendererChromium* renderer) + virtual void appendQuads(CCQuadList& quadList, const CCSharedQuadState* sharedQuadState) { - m_drawn = true; - BlendStateTrackerContext* context = static_cast(GraphicsContext3DPrivate::extractWebGraphicsContext3D(renderer->context())); - EXPECT_EQ(m_blend, context->blend()); + m_quadsAppended = true; + + OwnPtr testBlendingDrawQuad = CCSolidColorDrawQuad::create(sharedQuadState, IntRect(5, 5, 5, 5), Color::white); + EXPECT_EQ(m_blend, testBlendingDrawQuad->needsBlending()); EXPECT_EQ(m_hasRenderSurface, !!renderSurface()); } @@ -195,17 +197,17 @@ public: { m_blend = blend; m_hasRenderSurface = hasRenderSurface; - m_drawn = false; + m_quadsAppended = false; } - bool drawn() const { return m_drawn; } + bool quadsAppended() const { return m_quadsAppended; } private: explicit BlendStateCheckLayer(int id) : CCLayerImpl(id) , m_blend(false) , m_hasRenderSurface(false) - , m_drawn(false) + , m_quadsAppended(false) { setAnchorPoint(FloatPoint(0, 0)); setBounds(IntSize(10, 10)); @@ -214,7 +216,7 @@ private: bool m_blend; bool m_hasRenderSurface; - bool m_drawn; + bool m_quadsAppended; }; // https://bugs.webkit.org/show_bug.cgi?id=75783 @@ -238,20 +240,20 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) layer1->setOpaque(true); layer1->setExpectation(false, false); m_hostImpl->drawLayers(); - EXPECT_TRUE(layer1->drawn()); + EXPECT_TRUE(layer1->quadsAppended()); // Layer with translucent content, drawn with blending. layer1->setOpaque(false); layer1->setExpectation(true, false); m_hostImpl->drawLayers(); - EXPECT_TRUE(layer1->drawn()); + EXPECT_TRUE(layer1->quadsAppended()); // Layer with translucent opacity, drawn with blending. layer1->setOpaque(true); layer1->setOpacity(0.5); layer1->setExpectation(true, false); m_hostImpl->drawLayers(); - EXPECT_TRUE(layer1->drawn()); + EXPECT_TRUE(layer1->quadsAppended()); RefPtr layer2 = BlendStateCheckLayer::create(2); layer1->addChild(layer2); @@ -264,8 +266,8 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) layer2->setOpacity(1); layer2->setExpectation(false, false); m_hostImpl->drawLayers(); - EXPECT_FALSE(layer1->drawn()); - EXPECT_TRUE(layer2->drawn()); + EXPECT_TRUE(layer1->quadsAppended()); + EXPECT_TRUE(layer2->quadsAppended()); // Parent layer with translucent content, drawn with blending. // Child layer with opaque content, drawn without blending. @@ -273,8 +275,8 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) layer1->setExpectation(true, false); layer2->setExpectation(false, false); m_hostImpl->drawLayers(); - EXPECT_FALSE(layer1->drawn()); - EXPECT_TRUE(layer2->drawn()); + EXPECT_TRUE(layer1->quadsAppended()); + EXPECT_TRUE(layer2->quadsAppended()); // Parent layer with translucent opacity and opaque content. Since it has a // drawing child, it's drawn to a render surface which carries the opacity, @@ -286,8 +288,8 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) layer1->setExpectation(false, true); layer2->setExpectation(false, false); m_hostImpl->drawLayers(); - EXPECT_FALSE(layer1->drawn()); - EXPECT_TRUE(layer2->drawn()); + EXPECT_TRUE(layer1->quadsAppended()); + EXPECT_TRUE(layer2->quadsAppended()); // Draw again, but with child non-opaque, to make sure // layer1 not culled. @@ -298,8 +300,8 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) layer2->setOpacity(0.5); layer2->setExpectation(true, false); m_hostImpl->drawLayers(); - EXPECT_TRUE(layer1->drawn()); - EXPECT_TRUE(layer2->drawn()); + EXPECT_TRUE(layer1->quadsAppended()); + EXPECT_TRUE(layer2->quadsAppended()); // A second way of making the child non-opaque. layer1->setOpaque(true); @@ -309,8 +311,8 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) layer2->setOpacity(1); layer2->setExpectation(true, false); m_hostImpl->drawLayers(); - EXPECT_TRUE(layer1->drawn()); - EXPECT_TRUE(layer2->drawn()); + EXPECT_TRUE(layer1->quadsAppended()); + EXPECT_TRUE(layer2->quadsAppended()); } class ReshapeTrackerContext: public FakeWebGraphicsContext3D { -- 2.7.4