Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: WebKit/chromium/src/WebViewImpl.cpp

Issue 5592002: Merge 73079 - 2010-12-01 Alexey Marinichev <amarinichev@chromium.org>... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/597/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « WebKit/chromium/ChangeLog ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2254 matching lines...) Expand 10 before | Expand all | Expand 10 after
2265 } 2265 }
2266 2266
2267 #if USE(ACCELERATED_COMPOSITING) 2267 #if USE(ACCELERATED_COMPOSITING)
2268 bool WebViewImpl::allowsAcceleratedCompositing() 2268 bool WebViewImpl::allowsAcceleratedCompositing()
2269 { 2269 {
2270 return !m_compositorCreationFailed; 2270 return !m_compositorCreationFailed;
2271 } 2271 }
2272 2272
2273 void WebViewImpl::setRootGraphicsLayer(WebCore::PlatformLayer* layer) 2273 void WebViewImpl::setRootGraphicsLayer(WebCore::PlatformLayer* layer)
2274 { 2274 {
2275 bool wasActive = m_isAcceleratedCompositingActive;
2276 setIsAcceleratedCompositingActive(layer ? true : false); 2275 setIsAcceleratedCompositingActive(layer ? true : false);
2277 if (m_layerRenderer) 2276 if (m_layerRenderer)
2278 m_layerRenderer->setRootLayer(layer); 2277 m_layerRenderer->setRootLayer(layer);
2279 if (wasActive != m_isAcceleratedCompositingActive) { 2278
2280 IntRect damagedRect(0, 0, m_size.width, m_size.height); 2279 IntRect damagedRect(0, 0, m_size.width, m_size.height);
2281 if (m_isAcceleratedCompositingActive) 2280 if (m_isAcceleratedCompositingActive)
2282 invalidateRootLayerRect(damagedRect); 2281 invalidateRootLayerRect(damagedRect);
2283 else 2282 else
2284 m_client->didInvalidateRect(damagedRect); 2283 m_client->didInvalidateRect(damagedRect);
2285 }
2286 } 2284 }
2287 2285
2288 void WebViewImpl::setRootLayerNeedsDisplay() 2286 void WebViewImpl::setRootLayerNeedsDisplay()
2289 { 2287 {
2290 m_client->scheduleComposite(); 2288 m_client->scheduleComposite();
2291 } 2289 }
2292 2290
2293 2291
2294 void WebViewImpl::scrollRootLayerRect(const IntSize& scrollDelta, const IntRect& clipRect) 2292 void WebViewImpl::scrollRootLayerRect(const IntSize& scrollDelta, const IntRect& clipRect)
2295 { 2293 {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2374 } 2372 }
2375 2373
2376 2374
2377 void WebViewImpl::setIsAcceleratedCompositingActive(bool active) 2375 void WebViewImpl::setIsAcceleratedCompositingActive(bool active)
2378 { 2376 {
2379 if (m_isAcceleratedCompositingActive == active) 2377 if (m_isAcceleratedCompositingActive == active)
2380 return; 2378 return;
2381 2379
2382 if (!active) { 2380 if (!active) {
2383 m_isAcceleratedCompositingActive = false; 2381 m_isAcceleratedCompositingActive = false;
2384 m_layerRenderer->finish(); // finish all GL rendering before we hide the window? 2382 if (m_layerRenderer)
2383 m_layerRenderer->finish(); // finish all GL rendering before we hide the window?
2385 m_client->didActivateAcceleratedCompositing(false); 2384 m_client->didActivateAcceleratedCompositing(false);
2386 return; 2385 return;
2387 } 2386 }
2388 2387
2389 if (m_layerRenderer) { 2388 if (m_layerRenderer) {
2390 m_isAcceleratedCompositingActive = true; 2389 m_isAcceleratedCompositingActive = true;
2391 m_layerRenderer->resizeOnscreenContent(WebCore::IntSize(std::max(1, m_si ze.width), 2390 m_layerRenderer->resizeOnscreenContent(WebCore::IntSize(std::max(1, m_si ze.width),
2392 std::max(1, m_si ze.height))); 2391 std::max(1, m_si ze.height)));
2393 2392
2394 m_client->didActivateAcceleratedCompositing(true); 2393 m_client->didActivateAcceleratedCompositing(true);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
2511 RefPtr<GraphicsContext3D> newContext = GraphicsContext3D::create(context->ge tContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostW indow); 2510 RefPtr<GraphicsContext3D> newContext = GraphicsContext3D::create(context->ge tContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirectlyToHostW indow);
2512 // GraphicsContext3D::create might fail and return 0, in that case LayerRend ererChromium::create will also return 0. 2511 // GraphicsContext3D::create might fail and return 0, in that case LayerRend ererChromium::create will also return 0.
2513 RefPtr<LayerRendererChromium> layerRenderer = LayerRendererChromium::create( newContext); 2512 RefPtr<LayerRendererChromium> layerRenderer = LayerRendererChromium::create( newContext);
2514 2513
2515 // Reattach the root layer. Child layers will get reattached as a side effe ct of updateLayersRecursive. 2514 // Reattach the root layer. Child layers will get reattached as a side effe ct of updateLayersRecursive.
2516 if (layerRenderer) 2515 if (layerRenderer)
2517 m_layerRenderer->transferRootLayer(layerRenderer.get()); 2516 m_layerRenderer->transferRootLayer(layerRenderer.get());
2518 m_layerRenderer = layerRenderer; 2517 m_layerRenderer = layerRenderer;
2519 2518
2520 // Enable or disable accelerated compositing and request a refresh. 2519 // Enable or disable accelerated compositing and request a refresh.
2521 m_isAcceleratedCompositingActive = false;
2522 setRootGraphicsLayer(m_layerRenderer ? m_layerRenderer->rootLayer() : 0); 2520 setRootGraphicsLayer(m_layerRenderer ? m_layerRenderer->rootLayer() : 0);
2523 } 2521 }
2524 #endif 2522 #endif
2525 2523
2526 2524
2527 WebGraphicsContext3D* WebViewImpl::graphicsContext3D() 2525 WebGraphicsContext3D* WebViewImpl::graphicsContext3D()
2528 { 2526 {
2529 #if USE(ACCELERATED_COMPOSITING) 2527 #if USE(ACCELERATED_COMPOSITING)
2530 if (m_page->settings()->acceleratedCompositingEnabled() && allowsAccelerated Compositing()) { 2528 if (m_page->settings()->acceleratedCompositingEnabled() && allowsAccelerated Compositing()) {
2531 GraphicsContext3D* context = 0; 2529 GraphicsContext3D* context = 0;
2532 if (m_layerRenderer) 2530 if (m_layerRenderer)
2533 context = m_layerRenderer->context(); 2531 context = m_layerRenderer->context();
2534 else if (m_temporaryOnscreenGraphicsContext3D) 2532 else if (m_temporaryOnscreenGraphicsContext3D)
2535 context = m_temporaryOnscreenGraphicsContext3D.get(); 2533 context = m_temporaryOnscreenGraphicsContext3D.get();
2536 else { 2534 else {
2537 m_temporaryOnscreenGraphicsContext3D = GraphicsContext3D::create(get CompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirect lyToHostWindow); 2535 m_temporaryOnscreenGraphicsContext3D = GraphicsContext3D::create(get CompositorContextAttributes(), m_page->chrome(), GraphicsContext3D::RenderDirect lyToHostWindow);
2538 if (m_temporaryOnscreenGraphicsContext3D) 2536 if (m_temporaryOnscreenGraphicsContext3D)
2539 m_temporaryOnscreenGraphicsContext3D->reshape(std::max(1, m_size .width), std::max(1, m_size.height)); 2537 m_temporaryOnscreenGraphicsContext3D->reshape(std::max(1, m_size .width), std::max(1, m_size.height));
2540 context = m_temporaryOnscreenGraphicsContext3D.get(); 2538 context = m_temporaryOnscreenGraphicsContext3D.get();
2541 } 2539 }
2542 return GraphicsContext3DInternal::extractWebGraphicsContext3D(context); 2540 return GraphicsContext3DInternal::extractWebGraphicsContext3D(context);
2543 } 2541 }
2544 #endif 2542 #endif
2545 return 0; 2543 return 0;
2546 } 2544 }
2547 2545
2548 } // namespace WebKit 2546 } // namespace WebKit
OLDNEW
« no previous file with comments | « WebKit/chromium/ChangeLog ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698