Source/Platform/ChangeLog

 12012-06-08 David Reveman <reveman@chromium.org>
 2
 3 [Chromium] Compositor doesn't support translucent root layers.
 4 https://bugs.webkit.org/show_bug.cgi?id=87821
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * chromium/public/WebLayer.h:
 9 (WebLayer):
 10 * chromium/public/WebLayerTreeView.h:
 11 (WebLayerTreeView):
 12
1132012-06-06 Mark Pilgrim <pilgrim@chromium.org>
214
315 [Chromium] Move createMessagePortChannel to Platform.h

Source/WebCore/ChangeLog

 12012-06-08 David Reveman <reveman@chromium.org>
 2
 3 [Chromium] Compositor doesn't support translucent root layers.
 4 https://bugs.webkit.org/show_bug.cgi?id=87821
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Forward the isTransparent WebView setting to WebLayerTreeView,
 9 CCLayerTreeHost and CCLayerTreeHostImpl as hasTransparentBackground.
 10 Use hasTransparentBackground setting to determine how to clear the
 11 root render pass and draw the background. Set opaque flag correctly
 12 on the NonCompositedContentHost's graphics layer to make sure
 13 sub-pixel rendering is not used with a transparent WebView.
 14
 15 Unit tests: CCLayerTreeHostImplTest.hasTransparentBackground
 16 LayerRendererChromiumTest2.opaqueRenderPass
 17 LayerRendererChromiumTest2.transparentRenderPass
 18
 19 * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp:
 20 (WebCore::BitmapCanvasLayerTextureUpdater::prepareToUpdate):
 21 * platform/graphics/chromium/LayerRendererChromium.cpp:
 22 (WebCore::LayerRendererChromium::clearRenderPass):
 23 (WebCore::LayerRendererChromium::drawRenderPass):
 24 (WebCore::LayerRendererChromium::drawBackgroundFilters):
 25 * platform/graphics/chromium/LayerRendererChromium.h:
 26 (LayerRendererChromium):
 27 * platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp:
 28 (WebCore::SkPictureCanvasLayerTextureUpdater::prepareToUpdate):
 29 * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
 30 (WebCore::CCLayerTreeHost::CCLayerTreeHost):
 31 (WebCore::CCLayerTreeHost::finishCommitOnImplThread):
 32 * platform/graphics/chromium/cc/CCLayerTreeHost.h:
 33 (WebCore::CCLayerTreeHost::setHasTransparentBackground):
 34 (CCLayerTreeHost):
 35 * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
 36 (WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
 37 (WebCore::CCLayerTreeHostImpl::calculateRenderPasses):
 38 * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:
 39 (WebCore::CCLayerTreeHostImpl::hasTransparentBackground):
 40 (WebCore::CCLayerTreeHostImpl::setHasTransparentBackground):
 41 (CCLayerTreeHostImpl):
 42 * platform/graphics/chromium/cc/CCRenderPass.cpp:
 43 (WebCore::CCRenderPass::CCRenderPass):
 44 * platform/graphics/chromium/cc/CCRenderPass.h:
 45 (WebCore::CCRenderPass::hasTransparentBackground):
 46 (WebCore::CCRenderPass::setHasTransparentBackground):
 47 (CCRenderPass):
 48
1492012-06-08 Erik Arvidsson <arv@chromium.org>
250
351 [V8] Keep TextTrackList alive as long as its owner is alive

Source/WebKit/chromium/ChangeLog

 12012-06-08 David Reveman <reveman@chromium.org>
 2
 3 [Chromium] Compositor doesn't support translucent root layers.
 4 https://bugs.webkit.org/show_bug.cgi?id=87821
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * src/NonCompositedContentHost.cpp:
 9 (WebKit::NonCompositedContentHost::setOpaque):
 10 (WebKit):
 11 * src/NonCompositedContentHost.h:
 12 (NonCompositedContentHost):
 13 * src/WebLayerTreeView.cpp:
 14 (WebKit::WebLayerTreeView::setHasTransparentBackground):
 15 (WebKit):
 16 * src/WebViewImpl.cpp:
 17 (WebKit::WebViewImpl::setIsTransparent):
 18 (WebKit::WebViewImpl::setIsAcceleratedCompositingActive):
 19 * tests/CCLayerTreeHostImplTest.cpp:
 20 * tests/LayerRendererChromiumTest.cpp:
 21 (ClearCountingContext):
 22 (ClearCountingContext::ClearCountingContext):
 23 (ClearCountingContext::clear):
 24 (ClearCountingContext::clearCount):
 25 (TEST):
 26
1272012-06-08 Jochen Eisinger <jochen@chromium.org>
228
329 Unreviewed. Rolled DEPS.

Source/Platform/chromium/public/WebLayer.h

@@public:
116116
117117 // Apply filters to pixels that show through the background of this layer.
118118 // Note: These filters are only possible on layers that are drawn directly
119  // to the root render surface. This means if an ancestor of the background-
120  // filtered layer sets certain properties (opacity, transforms), it may
121  // conflict and hide the background filters.
 119 // to a root render surface with an opaque background. This means if an
 120 // ancestor of the background-filtered layer sets certain properties
 121 // (opacity, transforms), it may conflict and hide the background filters.
122122 WEBKIT_EXPORT void setBackgroundFilters(const WebFilterOperations&);
123123
124124 WEBKIT_EXPORT void setDebugBorderColor(const WebColor&);

Source/Platform/chromium/public/WebLayerTreeView.h

@@public:
118118 // Sets the background color for the viewport.
119119 WEBKIT_EXPORT void setBackgroundColor(WebColor);
120120
 121 // Sets the background transparency for the viewport. The default is 'false'.
 122 WEBKIT_EXPORT void setHasTransparentBackground(bool);
 123
121124 // Sets whether this view is visible. In threaded mode, a view that is not visible will not
122125 // composite or trigger updateAnimations() or layout() calls until it becomes visible.
123126 WEBKIT_EXPORT void setVisible(bool);

Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp

@@void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect
8888 // Assumption: if a tiler is using border texels, then it is because the
8989 // layer is likely to be filtered or transformed. Because of it might be
9090 // transformed, draw the text in grayscale instead of subpixel antialiasing.
 91 bool useGrayscaleText = borderTexels || !layerIsOpaque;
9192 PlatformCanvas::Painter::TextOption textOption =
92  borderTexels ? PlatformCanvas::Painter::GrayscaleText : PlatformCanvas::Painter::SubpixelText;
 93 useGrayscaleText ? PlatformCanvas::Painter::GrayscaleText : PlatformCanvas::Painter::SubpixelText;
9394 PlatformCanvas::Painter canvasPainter(&m_canvas, textOption);
9495 canvasPainter.skiaContext()->setTrackOpaqueRegion(!layerIsOpaque);
9596 paintContents(*canvasPainter.context(), *canvasPainter.skiaContext(), contentRect, contentsScale, resultingOpaqueRect);

Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp

@@void LayerRendererChromium::viewportChanged()
402402 m_currentRenderPass = 0;
403403}
404404
405 void LayerRendererChromium::clearRenderPass(const CCRenderPass* renderPass, const CCRenderPass* rootRenderPass, const FloatRect& framebufferDamageRect)
 405void LayerRendererChromium::clearRenderPass(const CCRenderPass* renderPass, const FloatRect& framebufferDamageRect)
406406{
407  // Non-root layers should clear their entire contents to transparent. On DEBUG builds, the root layer
408  // is cleared to blue to easily see regions that were not drawn on the screen. If we
 407 // On DEBUG builds, opaque render passes are cleared to blue to easily see regions that were not drawn on the screen. If we
409408 // are using partial swap / scissor optimization, then the surface should only
410409 // clear the damaged region, so that we don't accidentally clear un-changed portions
411410 // of the screen.
412411
413  if (renderPass != rootRenderPass)
 412 if (renderPass->hasTransparentBackground())
414413 GLC(m_context, m_context->clearColor(0, 0, 0, 0));
415414 else
416415 GLC(m_context, m_context->clearColor(0, 0, 1, 1));

@@void LayerRendererChromium::clearRenderPass(const CCRenderPass* renderPass, cons
421420 GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST));
422421
423422#if defined(NDEBUG)
424  if (renderPass != rootRenderPass)
 423 if (renderPass->hasTransparentBackground())
425424#endif
426425 m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
427426

@@void LayerRendererChromium::drawRenderPass(const CCRenderPass* renderPass, const
475474 if (!useRenderPass(renderPass))
476475 return;
477476
478  clearRenderPass(renderPass, m_defaultRenderPass, framebufferDamageRect);
 477 clearRenderPass(renderPass, framebufferDamageRect);
479478
480479 const CCQuadList& quadList = renderPass->quadList();
481480 for (CCQuadList::constBackToFrontIterator it = quadList.backToFrontBegin(); it != quadList.backToFrontEnd(); ++it)

@@void LayerRendererChromium::drawBackgroundFilters(const CCRenderPassDrawQuad* qu
615614 if (quad->backgroundFilters().isEmpty())
616615 return;
617616
618  // FIXME: We only allow background filters on the root render surface because other surfaces may contain
 617 // FIXME: We only allow background filters on an opaque render surface because other surfaces may contain
619618 // translucent pixels, and the contents behind those translucent pixels wouldn't have the filter applied.
620  if (!isCurrentRenderPass(m_defaultRenderPass))
 619 if (m_currentRenderPass->hasTransparentBackground())
621620 return;
 621 ASSERT(!m_currentManagedTexture);
622622
623623 // FIXME: Do a single readback for both the surface and replica and cache the filtered results (once filter textures are not reused).
624624 IntRect deviceRect = enclosingIntRect(CCMathUtil::mapClippedRect(contentsDeviceTransform, sharedGeometryQuad().boundingBox()));

Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h

@@private:
152152
153153 bool bindFramebufferToTexture(ManagedTexture*, const IntRect& viewportRect);
154154
155  void clearRenderPass(const CCRenderPass*, const CCRenderPass* rootRenderPass, const FloatRect& framebufferDamageRect);
 155 void clearRenderPass(const CCRenderPass*, const FloatRect& framebufferDamageRect);
156156
157157 void releaseRenderPassTextures();
158158

Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp

@@void SkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentR
5858 // layer is likely to be filtered or transformed. Because it might be
5959 // transformed, set image buffer flag to draw the text in grayscale
6060 // instead of using subpixel antialiasing.
61  platformContext.setDrawingToImageBuffer(borderTexels ? true : false);
 61 bool useGrayscaleText = borderTexels || !m_layerIsOpaque;
 62 platformContext.setDrawingToImageBuffer(useGrayscaleText);
6263 GraphicsContext graphicsContext(&platformContext);
6364 paintContents(graphicsContext, platformContext, contentRect, contentsScale, resultingOpaqueRect);
6465 m_picture.endRecording();

Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp

@@CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCSettings
8686 , m_maxPageScaleFactor(1)
8787 , m_triggerIdlePaints(true)
8888 , m_backgroundColor(Color::white)
 89 , m_hasTransparentBackground(false)
8990 , m_partialTextureUpdateRequests(0)
9091{
9192 ASSERT(CCProxy::isMainThread());

@@void CCLayerTreeHost::finishCommitOnImplThread(CCLayerTreeHostImpl* hostImpl)
252253 hostImpl->setViewportSize(viewportSize());
253254 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFactor, m_maxPageScaleFactor);
254255 hostImpl->setBackgroundColor(m_backgroundColor);
 256 hostImpl->setHasTransparentBackground(m_hasTransparentBackground);
255257 hostImpl->setVisible(m_visible);
256258 hostImpl->setSourceFrameCanBeDrawn(m_frameIsForDisplay);
257259

Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h

@@public:
231231
232232 void setBackgroundColor(const Color& color) { m_backgroundColor = color; }
233233
 234 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; }
 235
234236 TextureManager* contentsTextureManager() const;
235237 void setContentsMemoryAllocationLimitBytes(size_t);
236238

@@private:
309311 float m_minPageScaleFactor, m_maxPageScaleFactor;
310312 bool m_triggerIdlePaints;
311313 Color m_backgroundColor;
 314 bool m_hasTransparentBackground;
312315
313316 TextureList m_deleteTextureAfterCommitList;
314317 size_t m_partialTextureUpdateRequests;

Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp

@@CCLayerTreeHostImpl::CCLayerTreeHostImpl(const CCSettings& settings, CCLayerTree
124124 , m_sentPageScaleDelta(1)
125125 , m_minPageScale(0)
126126 , m_maxPageScale(0)
 127 , m_hasTransparentBackground(false)
127128 , m_needsAnimateLayers(false)
128129 , m_pinchGestureActive(false)
129130 , m_fpsCounter(CCFrameRateCounter::create())

@@bool CCLayerTreeHostImpl::calculateRenderPasses(CCRenderPassList& passes, CCLaye
324325 occlusionTracker.leaveLayer(it);
325326 }
326327
327  passes.last()->appendQuadsToFillScreen(m_rootLayerImpl.get(), m_backgroundColor, occlusionTracker);
 328 if (!m_hasTransparentBackground) {
 329 passes.last()->setHasTransparentBackground(false);
 330 passes.last()->appendQuadsToFillScreen(m_rootLayerImpl.get(), m_backgroundColor, occlusionTracker);
 331 }
328332
329333 if (drawFrame)
330334 occlusionTracker.overdrawMetrics().recordMetrics(this);

Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h

@@public:
159159 const Color& backgroundColor() const { return m_backgroundColor; }
160160 void setBackgroundColor(const Color& color) { m_backgroundColor = color; }
161161
 162 bool hasTransparentBackground() const { return m_hasTransparentBackground; }
 163 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; }
 164
162165 bool needsAnimateLayers() const { return m_needsAnimateLayers; }
163166 void setNeedsAnimateLayers() { m_needsAnimateLayers = true; }
164167

@@private:
227230 float m_minPageScale, m_maxPageScale;
228231
229232 Color m_backgroundColor;
 233 bool m_hasTransparentBackground;
230234
231235 // If this is true, it is necessary to traverse the layer tree ticking the animators.
232236 bool m_needsAnimateLayers;

Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp

@@PassOwnPtr<CCRenderPass> CCRenderPass::create(CCRenderSurface* targetSurface)
4545CCRenderPass::CCRenderPass(CCRenderSurface* targetSurface)
4646 : m_targetSurface(targetSurface)
4747 , m_framebufferOutputRect(targetSurface->contentRect())
 48 , m_hasTransparentBackground(true)
4849{
4950 ASSERT(m_targetSurface);
5051}

Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h

@@public:
6464 // This denotes the bounds in physical pixels of the output generated by this RenderPass.
6565 const IntRect& framebufferOutputRect() const { return m_framebufferOutputRect; }
6666
 67 bool hasTransparentBackground() const { return m_hasTransparentBackground; }
 68 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; }
 69
6770private:
6871 explicit CCRenderPass(CCRenderSurface*);
6972

@@private:
7174 CCQuadList m_quadList;
7275 IntRect m_framebufferOutputRect;
7376 Vector<OwnPtr<CCSharedQuadState> > m_sharedQuadStateList;
 77 bool m_hasTransparentBackground;
7478};
7579
7680typedef Vector<OwnPtr<CCRenderPass> > CCRenderPassList;

Source/WebKit/chromium/src/NonCompositedContentHost.cpp

@@void NonCompositedContentHost::setBackgroundColor(const WebCore::Color& color)
6262 m_graphicsLayer->platformLayer()->setBackgroundColor(color);
6363}
6464
 65void NonCompositedContentHost::setOpaque(bool opaque)
 66{
 67 m_graphicsLayer->platformLayer()->setOpaque(opaque);
 68}
 69
6570void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer)
6671{
6772 m_graphicsLayer->setNeedsDisplay();

Source/WebKit/chromium/src/NonCompositedContentHost.h

@@public:
5656
5757 void invalidateRect(const WebCore::IntRect&);
5858 void setBackgroundColor(const WebCore::Color&);
 59 void setOpaque(bool);
5960 void setScrollLayer(WebCore::GraphicsLayer*);
6061 void setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float deviceScale, int layerAdjustX);
6162 WebCore::GraphicsLayer* topLevelRootLayer() const { return m_graphicsLayer.get(); }

Source/WebKit/chromium/src/WebLayerTreeView.cpp

@@void WebLayerTreeView::setBackgroundColor(WebColor color)
107107 m_private->layerTreeHost()->setBackgroundColor(color);
108108}
109109
 110void WebLayerTreeView::setHasTransparentBackground(bool transparent)
 111{
 112 m_private->layerTreeHost()->setHasTransparentBackground(transparent);
 113}
 114
110115void WebLayerTreeView::setVisible(bool visible)
111116{
112117 m_private->layerTreeHost()->setVisible(visible);

Source/WebKit/chromium/src/WebViewImpl.cpp

@@void WebViewImpl::setIsTransparent(bool isTransparent)
30263026
30273027 // Future frames check this to know whether to be transparent.
30283028 m_isTransparent = isTransparent;
 3029
 3030 if (m_nonCompositedContentHost)
 3031 m_nonCompositedContentHost->setOpaque(!isTransparent);
 3032
 3033 m_layerTreeView.setHasTransparentBackground(isTransparent);
30293034}
30303035
30313036bool WebViewImpl::isTransparent() const

@@void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
34753480
34763481 m_nonCompositedContentHost = NonCompositedContentHost::create(WebViewImplContentPainter::create(this));
34773482 m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders());
 3483 m_nonCompositedContentHost->setOpaque(!isTransparent());
34783484
34793485 if (m_webSettings->applyDefaultDeviceScaleFactorInCompositor() && page()->deviceScaleFactor() != 1) {
34803486 ASSERT(page()->deviceScaleFactor());

@@void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
34893495 m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor);
34903496 if (m_compositorSurfaceReady)
34913497 m_layerTreeView.setSurfaceReady();
 3498 m_layerTreeView.setHasTransparentBackground(isTransparent());
34923499 updateLayerTreeViewport();
34933500 m_client->didActivateCompositor(m_layerTreeView.compositorIdentifier());
34943501 m_isAcceleratedCompositingActive = true;

Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp

@@TEST_F(CCLayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
17341734 m_hostImpl->swapBuffers();
17351735}
17361736
 1737class MockDrawQuadsToFillScreenContext : public FakeWebGraphicsContext3D {
 1738public:
 1739 MOCK_METHOD1(useProgram, void(WebGLId program));
 1740 MOCK_METHOD4(drawElements, void(WGC3Denum mode, WGC3Dsizei count, WGC3Denum type, WGC3Dintptr offset));
 1741};
 1742
 1743TEST_F(CCLayerTreeHostImplTest, hasTransparentBackground)
 1744{
 1745 MockDrawQuadsToFillScreenContext* mockContext = new MockDrawQuadsToFillScreenContext();
 1746 RefPtr<CCGraphicsContext> context = CCGraphicsContext::create3D(GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(mockContext), GraphicsContext3D::RenderDirectlyToHostWindow));
 1747
 1748 // Run test case
 1749 OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context, CCLayerImpl::create(1));
 1750 myHostImpl->setBackgroundColor(Color::white);
 1751
 1752 // Verify one quad is drawn when transparent background set is not set.
 1753 myHostImpl->setHasTransparentBackground(false);
 1754 EXPECT_CALL(*mockContext, useProgram(_))
 1755 .Times(1);
 1756 EXPECT_CALL(*mockContext, drawElements(_, _, _, _))
 1757 .Times(1);
 1758 CCLayerTreeHostImpl::FrameData frame;
 1759 EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
 1760 myHostImpl->drawLayers(frame);
 1761 myHostImpl->didDrawAllLayers(frame);
 1762 Mock::VerifyAndClearExpectations(&mockContext);
 1763
 1764 // Verify no quads are drawn when transparent background is set.
 1765 myHostImpl->setHasTransparentBackground(true);
 1766 EXPECT_TRUE(myHostImpl->prepareToDraw(frame));
 1767 myHostImpl->drawLayers(frame);
 1768 myHostImpl->didDrawAllLayers(frame);
 1769 Mock::VerifyAndClearExpectations(&mockContext);
 1770}
 1771
17371772} // namespace

Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp

@@TEST(LayerRendererChromiumTest2, initializationWithoutGpuMemoryManagerExtensionS
357357
358358 EXPECT_GT(mockClient.memoryAllocationLimitBytes(), 0ul);
359359}
 360
 361class ClearCountingContext : public FakeWebGraphicsContext3D {
 362public:
 363 ClearCountingContext() : m_clear(0) { }
 364
 365 virtual void clear(WGC3Dbitfield)
 366 {
 367 m_clear++;
 368 }
 369
 370 int clearCount() const { return m_clear; }
 371
 372private:
 373 int m_clear;
 374};
 375
 376TEST(LayerRendererChromiumTest2, opaqueBackground)
 377{
 378 FakeCCRendererClient mockClient;
 379 RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ClearCountingContext), GraphicsContext3D::RenderDirectlyToHostWindow);
 380 FakeLayerRendererChromium layerRendererChromium(&mockClient, context);
 381
 382 mockClient.rootRenderPass()->setHasTransparentBackground(false);
 383
 384 EXPECT_TRUE(layerRendererChromium.initialize());
 385
 386 layerRendererChromium.beginDrawingFrame(mockClient.rootRenderPass());
 387 layerRendererChromium.drawRenderPass(mockClient.rootRenderPass(), FloatRect());
 388 layerRendererChromium.finishDrawingFrame();
 389
 390 // On DEBUG builds, render passes with opaque background clear to blue to
 391 // easily see regions that were not drawn on the screen.
 392#if defined(NDEBUG)
 393 EXPECT_EQ(0, static_cast<ClearCountingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()))->clearCount());
 394#else
 395 EXPECT_EQ(1, static_cast<ClearCountingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()))->clearCount());
 396#endif
 397}
 398
 399TEST(LayerRendererChromiumTest2, transparentBackground)
 400{
 401 FakeCCRendererClient mockClient;
 402 RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ClearCountingContext), GraphicsContext3D::RenderDirectlyToHostWindow);
 403 FakeLayerRendererChromium layerRendererChromium(&mockClient, context);
 404
 405 mockClient.rootRenderPass()->setHasTransparentBackground(true);
 406
 407 EXPECT_TRUE(layerRendererChromium.initialize());
 408
 409 layerRendererChromium.beginDrawingFrame(mockClient.rootRenderPass());
 410 layerRendererChromium.drawRenderPass(mockClient.rootRenderPass(), FloatRect());
 411 layerRendererChromium.finishDrawingFrame();
 412
 413 EXPECT_EQ(1, static_cast<ClearCountingContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get()))->clearCount());
 414}