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

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

Issue 23511004: mix-blend-mode implementation for accelerated layers - blink part (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: adding the rendering part Created 7 years, 3 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 if (m_isMainFrameRenderViewLayer) 201 if (m_isMainFrameRenderViewLayer)
202 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true ); 202 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true );
203 #endif 203 #endif
204 204
205 updateOpacity(renderer()->style()); 205 updateOpacity(renderer()->style());
206 updateTransform(renderer()->style()); 206 updateTransform(renderer()->style());
207 updateFilters(renderer()->style()); 207 updateFilters(renderer()->style());
208 208
209 if (RuntimeEnabledFeatures::cssCompositingEnabled()) 209 if (RuntimeEnabledFeatures::cssCompositingEnabled())
210 updateLayerBlendMode(renderer()->style()); 210 updateLayerBlendMode(renderer()->style());
211 if (RuntimeEnabledFeatures::cssCompositingEnabled())
212 updateIsolatedGroupRoot();
211 } 213 }
212 214
213 void RenderLayerBacking::destroyGraphicsLayers() 215 void RenderLayerBacking::destroyGraphicsLayers()
214 { 216 {
215 if (m_graphicsLayer) 217 if (m_graphicsLayer)
216 m_graphicsLayer->removeFromParent(); 218 m_graphicsLayer->removeFromParent();
217 219
218 m_ancestorClippingLayer = nullptr; 220 m_ancestorClippingLayer = nullptr;
219 m_graphicsLayer = nullptr; 221 m_graphicsLayer = nullptr;
220 m_foregroundLayer = nullptr; 222 m_foregroundLayer = nullptr;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 // 258 //
257 // Similarly, if filters used to be painted in the compositor and are no w painted in software, we need to: 259 // Similarly, if filters used to be painted in the compositor and are no w painted in software, we need to:
258 // (1) Create a FilterEffectRenderer. 260 // (1) Create a FilterEffectRenderer.
259 // (2) Repaint the layer contents to apply a software filter because the compositor won't apply it. 261 // (2) Repaint the layer contents to apply a software filter because the compositor won't apply it.
260 // 262 //
261 m_owningLayer->updateOrRemoveFilterEffectRenderer(); 263 m_owningLayer->updateOrRemoveFilterEffectRenderer();
262 setContentsNeedDisplay(); 264 setContentsNeedDisplay();
263 } 265 }
264 } 266 }
265 267
266 void RenderLayerBacking::updateLayerBlendMode(const RenderStyle*) 268 void RenderLayerBacking::updateLayerBlendMode(const RenderStyle* style)
267 { 269 {
270 setBlendMode(style->blendMode());
271 }
272
273 void RenderLayerBacking::updateIsolatedGroupRoot()
274 {
275 const RenderLayer* layer = m_owningLayer;
276 ASSERT(!layer->shouldIsolateCompositedBlendingDescendants() || layer->isStac kingContext());
277 childForSuperlayers()->setIsIsolatedGroupRoot(layer->shouldIsolateComposited BlendingDescendants());
268 } 278 }
269 279
270 void RenderLayerBacking::updateContentsOpaque() 280 void RenderLayerBacking::updateContentsOpaque()
271 { 281 {
272 // For non-root layers, background is always painted by the primary graphics layer. 282 // For non-root layers, background is always painted by the primary graphics layer.
273 ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer); 283 ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer);
274 if (m_backgroundLayer) { 284 if (m_backgroundLayer) {
275 m_graphicsLayer->setContentsOpaque(false); 285 m_graphicsLayer->setContentsOpaque(false);
276 m_backgroundLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToB eOpaqueInRect(compositedBounds())); 286 m_backgroundLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToB eOpaqueInRect(compositedBounds()));
277 } else { 287 } else {
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 // is affected by the layer dimensions. 496 // is affected by the layer dimensions.
487 if (!renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(render er(), CSSPropertyWebkitTransform)) 497 if (!renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(render er(), CSSPropertyWebkitTransform))
488 updateTransform(renderer()->style()); 498 updateTransform(renderer()->style());
489 499
490 // Set opacity, if it is not animating. 500 // Set opacity, if it is not animating.
491 if (!renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(render er(), CSSPropertyOpacity)) 501 if (!renderer()->animation()->isRunningAcceleratedAnimationOnRenderer(render er(), CSSPropertyOpacity))
492 updateOpacity(renderer()->style()); 502 updateOpacity(renderer()->style());
493 503
494 if (RuntimeEnabledFeatures::cssCompositingEnabled()) 504 if (RuntimeEnabledFeatures::cssCompositingEnabled())
495 updateLayerBlendMode(renderer()->style()); 505 updateLayerBlendMode(renderer()->style());
506 if (RuntimeEnabledFeatures::cssCompositingEnabled())
507 updateIsolatedGroupRoot();
496 508
497 bool isSimpleContainer = isSimpleContainerCompositingLayer(); 509 bool isSimpleContainer = isSimpleContainerCompositingLayer();
498 510
499 m_owningLayer->updateDescendantDependentFlags(); 511 m_owningLayer->updateDescendantDependentFlags();
500 512
501 // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer a nd its non-compositing 513 // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer a nd its non-compositing
502 // descendants. So, the visibility flag for m_graphicsLayer should be true i f there are any 514 // descendants. So, the visibility flag for m_graphicsLayer should be true i f there are any
503 // non-compositing visible layers. 515 // non-compositing visible layers.
504 m_graphicsLayer->setContentsVisible(m_owningLayer->hasVisibleContent() || ha sVisibleNonCompositingDescendantLayers()); 516 m_graphicsLayer->setContentsVisible(m_owningLayer->hasVisibleContent() || ha sVisibleNonCompositingDescendantLayers());
505 517
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 m_requiresOwnBackingStore = requiresOwnBacking; 1468 m_requiresOwnBackingStore = requiresOwnBacking;
1457 1469
1458 // This affects the answer to paintsIntoCompositedAncestor(), which in turn affects 1470 // This affects the answer to paintsIntoCompositedAncestor(), which in turn affects
1459 // cached clip rects, so when it changes we have to clear clip rects on desc endants. 1471 // cached clip rects, so when it changes we have to clear clip rects on desc endants.
1460 m_owningLayer->clearClipRectsIncludingDescendants(PaintingClipRects); 1472 m_owningLayer->clearClipRectsIncludingDescendants(PaintingClipRects);
1461 m_owningLayer->computeRepaintRectsIncludingDescendants(); 1473 m_owningLayer->computeRepaintRectsIncludingDescendants();
1462 1474
1463 compositor()->repaintInCompositedAncestor(m_owningLayer, compositedBounds()) ; 1475 compositor()->repaintInCompositedAncestor(m_owningLayer, compositedBounds()) ;
1464 } 1476 }
1465 1477
1466 void RenderLayerBacking::setBlendMode(BlendMode) 1478 void RenderLayerBacking::setBlendMode(BlendMode blendMode)
1467 { 1479 {
1480 childForSuperlayers()->setBlendMode(blendMode);
1468 } 1481 }
1469 1482
1470 void RenderLayerBacking::setContentsNeedDisplay() 1483 void RenderLayerBacking::setContentsNeedDisplay()
1471 { 1484 {
1472 ASSERT(!paintsIntoCompositedAncestor()); 1485 ASSERT(!paintsIntoCompositedAncestor());
1473 1486
1474 if (m_graphicsLayer && m_graphicsLayer->drawsContent()) 1487 if (m_graphicsLayer && m_graphicsLayer->drawsContent())
1475 m_graphicsLayer->setNeedsDisplay(); 1488 m_graphicsLayer->setNeedsDisplay();
1476 1489
1477 if (m_foregroundLayer && m_foregroundLayer->drawsContent()) 1490 if (m_foregroundLayer && m_foregroundLayer->drawsContent())
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
1929 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 1942 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
1930 name = "Scrolling Contents Layer"; 1943 name = "Scrolling Contents Layer";
1931 } else { 1944 } else {
1932 ASSERT_NOT_REACHED(); 1945 ASSERT_NOT_REACHED();
1933 } 1946 }
1934 1947
1935 return name; 1948 return name;
1936 } 1949 }
1937 1950
1938 } // namespace WebCore 1951 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698