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

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 1999143002: Add CanvasSurfaceLayerBridge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 static inline bool isAcceleratedCanvas(const LayoutObject* layoutObject) 116 static inline bool isAcceleratedCanvas(const LayoutObject* layoutObject)
117 { 117 {
118 if (layoutObject->isCanvas()) { 118 if (layoutObject->isCanvas()) {
119 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node()); 119 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node());
120 if (CanvasRenderingContext* context = canvas->renderingContext()) 120 if (CanvasRenderingContext* context = canvas->renderingContext())
121 return context->isAccelerated(); 121 return context->isAccelerated();
122 } 122 }
123 return false; 123 return false;
124 } 124 }
125 125
126 static inline bool isCanvasTransferedFromOffscreen(const LayoutObject* layoutObj ect)
Justin Novosad 2016/05/20 19:58:26 isCanvasControlledByOffscreen
127 {
128 if (layoutObject->isCanvas()) {
129 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node());
130 if (!!canvas->surfaceLayerBridge())
Justin Novosad 2016/05/20 19:58:26 "!!" is not necessary
131 return true;
132 }
133 return false;
134 }
135
126 static bool hasBoxDecorationsOrBackgroundImage(const ComputedStyle& style) 136 static bool hasBoxDecorationsOrBackgroundImage(const ComputedStyle& style)
127 { 137 {
128 return style.hasBoxDecorations() || style.hasBackgroundImage(); 138 return style.hasBoxDecorations() || style.hasBackgroundImage();
129 } 139 }
130 140
131 static bool contentLayerSupportsDirectBackgroundComposition(const LayoutObject* layoutObject) 141 static bool contentLayerSupportsDirectBackgroundComposition(const LayoutObject* layoutObject)
132 { 142 {
133 // No support for decorations - border, border-radius or outline. 143 // No support for decorations - border, border-radius or outline.
134 // Only simple background - solid color or transparent. 144 // Only simple background - solid color or transparent.
135 if (hasBoxDecorationsOrBackgroundImage(layoutObject->styleRef())) 145 if (hasBoxDecorationsOrBackgroundImage(layoutObject->styleRef()))
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 m_graphicsLayer->setContentsToPlatformLayer(layer); 541 m_graphicsLayer->setContentsToPlatformLayer(layer);
532 } else if (layoutObject->node() && layoutObject->node()->isFrameOwnerElement () && toHTMLFrameOwnerElement(layoutObject->node())->contentFrame()) { 542 } else if (layoutObject->node() && layoutObject->node()->isFrameOwnerElement () && toHTMLFrameOwnerElement(layoutObject->node())->contentFrame()) {
533 Frame* frame = toHTMLFrameOwnerElement(layoutObject->node())->contentFra me(); 543 Frame* frame = toHTMLFrameOwnerElement(layoutObject->node())->contentFra me();
534 if (frame->isRemoteFrame()) { 544 if (frame->isRemoteFrame()) {
535 WebLayer* layer = toRemoteFrame(frame)->remotePlatformLayer(); 545 WebLayer* layer = toRemoteFrame(frame)->remotePlatformLayer();
536 m_graphicsLayer->setContentsToPlatformLayer(layer); 546 m_graphicsLayer->setContentsToPlatformLayer(layer);
537 } 547 }
538 } else if (layoutObject->isVideo()) { 548 } else if (layoutObject->isVideo()) {
539 HTMLMediaElement* mediaElement = toHTMLMediaElement(layoutObject->node() ); 549 HTMLMediaElement* mediaElement = toHTMLMediaElement(layoutObject->node() );
540 m_graphicsLayer->setContentsToPlatformLayer(mediaElement->platformLayer( )); 550 m_graphicsLayer->setContentsToPlatformLayer(mediaElement->platformLayer( ));
551 } else if (isCanvasTransferedFromOffscreen(layoutObject)) {
552 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node());
553 m_graphicsLayer->setContentsToPlatformLayer(canvas->surfaceLayerBridge() ->getWebLayer());
554 layerConfigChanged = true;
541 } else if (isAcceleratedCanvas(layoutObject)) { 555 } else if (isAcceleratedCanvas(layoutObject)) {
542 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node()); 556 HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node());
543 if (CanvasRenderingContext* context = canvas->renderingContext()) 557 if (CanvasRenderingContext* context = canvas->renderingContext())
544 m_graphicsLayer->setContentsToPlatformLayer(context->platformLayer() ); 558 m_graphicsLayer->setContentsToPlatformLayer(context->platformLayer() );
545 layerConfigChanged = true; 559 layerConfigChanged = true;
546 } 560 }
547 if (layoutObject->isLayoutPart()) { 561 if (layoutObject->isLayoutPart()) {
548 if (PaintLayerCompositor::attachFrameContentLayersToIframeLayer(toLayout Part(layoutObject))) 562 if (PaintLayerCompositor::attachFrameContentLayersToIframeLayer(toLayout Part(layoutObject)))
549 layerConfigChanged = true; 563 layerConfigChanged = true;
550 } 564 }
(...skipping 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after
2573 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2587 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2574 name = "Scrolling Contents Layer"; 2588 name = "Scrolling Contents Layer";
2575 } else { 2589 } else {
2576 ASSERT_NOT_REACHED(); 2590 ASSERT_NOT_REACHED();
2577 } 2591 }
2578 2592
2579 return name; 2593 return name;
2580 } 2594 }
2581 2595
2582 } // namespace blink 2596 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698