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

Side by Side Diff: Source/core/rendering/RenderLayerBacking.cpp

Issue 19315005: Introduce toHTMLCanvasElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 namespace WebCore { 68 namespace WebCore {
69 69
70 using namespace HTMLNames; 70 using namespace HTMLNames;
71 71
72 static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle*); 72 static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle*);
73 static IntRect clipBox(RenderBox* renderer); 73 static IntRect clipBox(RenderBox* renderer);
74 74
75 static inline bool isAcceleratedCanvas(RenderObject* renderer) 75 static inline bool isAcceleratedCanvas(RenderObject* renderer)
76 { 76 {
77 if (renderer->isCanvas()) { 77 if (renderer->isCanvas()) {
78 HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(renderer->no de()); 78 HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node());
79 if (CanvasRenderingContext* context = canvas->renderingContext()) 79 if (CanvasRenderingContext* context = canvas->renderingContext())
80 return context->isAccelerated(); 80 return context->isAccelerated();
81 } 81 }
82 return false; 82 return false;
83 } 83 }
84 84
85 // Get the scrolling coordinator in a way that works inside RenderLayerBacking's destructor. 85 // Get the scrolling coordinator in a way that works inside RenderLayerBacking's destructor.
86 static ScrollingCoordinator* scrollingCoordinatorFromLayer(RenderLayer* layer) 86 static ScrollingCoordinator* scrollingCoordinatorFromLayer(RenderLayer* layer)
87 { 87 {
88 Page* page = layer->renderer()->frame()->page(); 88 Page* page = layer->renderer()->frame()->page();
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 if (isDirectlyCompositedImage()) 400 if (isDirectlyCompositedImage())
401 updateImageContents(); 401 updateImageContents();
402 402
403 if (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allows AcceleratedCompositing()) { 403 if (renderer->isEmbeddedObject() && toRenderEmbeddedObject(renderer)->allows AcceleratedCompositing()) {
404 PluginView* pluginView = toPluginView(toRenderWidget(renderer)->widget() ); 404 PluginView* pluginView = toPluginView(toRenderWidget(renderer)->widget() );
405 m_graphicsLayer->setContentsToMedia(pluginView->platformLayer()); 405 m_graphicsLayer->setContentsToMedia(pluginView->platformLayer());
406 } else if (renderer->isVideo()) { 406 } else if (renderer->isVideo()) {
407 HTMLMediaElement* mediaElement = toMediaElement(renderer->node()); 407 HTMLMediaElement* mediaElement = toMediaElement(renderer->node());
408 m_graphicsLayer->setContentsToMedia(mediaElement->platformLayer()); 408 m_graphicsLayer->setContentsToMedia(mediaElement->platformLayer());
409 } else if (isAcceleratedCanvas(renderer)) { 409 } else if (isAcceleratedCanvas(renderer)) {
410 HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(renderer->no de()); 410 HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node());
411 if (CanvasRenderingContext* context = canvas->renderingContext()) 411 if (CanvasRenderingContext* context = canvas->renderingContext())
412 m_graphicsLayer->setContentsToCanvas(context->platformLayer()); 412 m_graphicsLayer->setContentsToCanvas(context->platformLayer());
413 layerConfigChanged = true; 413 layerConfigChanged = true;
414 } 414 }
415 if (renderer->isRenderPart()) 415 if (renderer->isRenderPart())
416 layerConfigChanged = RenderLayerCompositor::parentFrameContentLayers(toR enderPart(renderer)); 416 layerConfigChanged = RenderLayerCompositor::parentFrameContentLayers(toR enderPart(renderer));
417 417
418 return layerConfigChanged; 418 return layerConfigChanged;
419 } 419 }
420 420
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 info.addMember(m_childContainmentLayer, "childContainmentLayer"); 1885 info.addMember(m_childContainmentLayer, "childContainmentLayer");
1886 info.addMember(m_maskLayer, "maskLayer"); 1886 info.addMember(m_maskLayer, "maskLayer");
1887 info.addMember(m_layerForHorizontalScrollbar, "layerForHorizontalScrollbar") ; 1887 info.addMember(m_layerForHorizontalScrollbar, "layerForHorizontalScrollbar") ;
1888 info.addMember(m_layerForVerticalScrollbar, "layerForVerticalScrollbar"); 1888 info.addMember(m_layerForVerticalScrollbar, "layerForVerticalScrollbar");
1889 info.addMember(m_layerForScrollCorner, "layerForScrollCorner"); 1889 info.addMember(m_layerForScrollCorner, "layerForScrollCorner");
1890 info.addMember(m_scrollingLayer, "scrollingLayer"); 1890 info.addMember(m_scrollingLayer, "scrollingLayer");
1891 info.addMember(m_scrollingContentsLayer, "scrollingContentsLayer"); 1891 info.addMember(m_scrollingContentsLayer, "scrollingContentsLayer");
1892 } 1892 }
1893 1893
1894 } // namespace WebCore 1894 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderHTMLCanvas.cpp ('k') | Source/core/rendering/RenderLayerCompositor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698