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

Side by Side Diff: Source/core/rendering/CompositedLayerMapping.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: rebased Created 7 years, 1 month 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 if (m_isMainFrameRenderViewLayer) 210 if (m_isMainFrameRenderViewLayer)
211 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true ); 211 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true );
212 #endif 212 #endif
213 213
214 updateOpacity(renderer()->style()); 214 updateOpacity(renderer()->style());
215 updateTransform(renderer()->style()); 215 updateTransform(renderer()->style());
216 updateFilters(renderer()->style()); 216 updateFilters(renderer()->style());
217 217
218 if (RuntimeEnabledFeatures::cssCompositingEnabled()) 218 if (RuntimeEnabledFeatures::cssCompositingEnabled())
219 updateLayerBlendMode(renderer()->style()); 219 updateLayerBlendMode(renderer()->style());
220 if (RuntimeEnabledFeatures::cssCompositingEnabled())
enne (OOO) 2013/11/07 22:59:07 Put these under the same conditional.
rosca 2013/11/08 15:36:32 Done.
221 updateIsRootForIsolatedGroup();
220 } 222 }
221 223
222 void CompositedLayerMapping::destroyGraphicsLayers() 224 void CompositedLayerMapping::destroyGraphicsLayers()
223 { 225 {
224 if (m_graphicsLayer) 226 if (m_graphicsLayer)
225 m_graphicsLayer->removeFromParent(); 227 m_graphicsLayer->removeFromParent();
226 228
227 m_ancestorClippingLayer = nullptr; 229 m_ancestorClippingLayer = nullptr;
228 m_graphicsLayer = nullptr; 230 m_graphicsLayer = nullptr;
229 m_foregroundLayer = nullptr; 231 m_foregroundLayer = nullptr;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // 268 //
267 // Similarly, if filters used to be painted in the compositor and are no w painted in software, we need to: 269 // Similarly, if filters used to be painted in the compositor and are no w painted in software, we need to:
268 // (1) Create a FilterEffectRenderer. 270 // (1) Create a FilterEffectRenderer.
269 // (2) Repaint the layer contents to apply a software filter because the compositor won't apply it. 271 // (2) Repaint the layer contents to apply a software filter because the compositor won't apply it.
270 // 272 //
271 m_owningLayer->updateOrRemoveFilterEffectRenderer(); 273 m_owningLayer->updateOrRemoveFilterEffectRenderer();
272 setContentsNeedDisplay(); 274 setContentsNeedDisplay();
273 } 275 }
274 } 276 }
275 277
276 void CompositedLayerMapping::updateLayerBlendMode(const RenderStyle*) 278 void CompositedLayerMapping::updateLayerBlendMode(const RenderStyle* style)
277 { 279 {
280 setBlendMode(style->blendMode());
281 }
282
283 void CompositedLayerMapping::updateIsRootForIsolatedGroup()
284 {
285 m_graphicsLayer->setIsRootForIsolatedGroup(m_owningLayer->hasCompositedBlend ingDescendants()
enne (OOO) 2013/11/07 22:59:07 Whoa there. If you have a tree of RenderLayers cr
rosca 2013/11/08 15:36:32 No. hasCompositedBlendingDescendants is true only
286 && m_owningLayer->stackingNode()->isStackingContext());
278 } 287 }
279 288
280 void CompositedLayerMapping::updateContentsOpaque() 289 void CompositedLayerMapping::updateContentsOpaque()
281 { 290 {
282 // For non-root layers, background is always painted by the primary graphics layer. 291 // For non-root layers, background is always painted by the primary graphics layer.
283 ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer); 292 ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer);
284 if (m_backgroundLayer) { 293 if (m_backgroundLayer) {
285 m_graphicsLayer->setContentsOpaque(false); 294 m_graphicsLayer->setContentsOpaque(false);
286 m_backgroundLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToB eOpaqueInRect(compositedBounds())); 295 m_backgroundLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToB eOpaqueInRect(compositedBounds()));
287 } else { 296 } else {
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 // is affected by the layer dimensions. 523 // is affected by the layer dimensions.
515 if (!renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rendere r(), CSSPropertyWebkitTransform)) 524 if (!renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rendere r(), CSSPropertyWebkitTransform))
516 updateTransform(renderer()->style()); 525 updateTransform(renderer()->style());
517 526
518 // Set opacity, if it is not animating. 527 // Set opacity, if it is not animating.
519 if (!renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rendere r(), CSSPropertyOpacity)) 528 if (!renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rendere r(), CSSPropertyOpacity))
520 updateOpacity(renderer()->style()); 529 updateOpacity(renderer()->style());
521 530
522 if (RuntimeEnabledFeatures::cssCompositingEnabled()) 531 if (RuntimeEnabledFeatures::cssCompositingEnabled())
523 updateLayerBlendMode(renderer()->style()); 532 updateLayerBlendMode(renderer()->style());
533 if (RuntimeEnabledFeatures::cssCompositingEnabled())
534 updateIsRootForIsolatedGroup();
524 535
525 bool isSimpleContainer = isSimpleContainerCompositingLayer(); 536 bool isSimpleContainer = isSimpleContainerCompositingLayer();
526 537
527 m_owningLayer->updateDescendantDependentFlags(); 538 m_owningLayer->updateDescendantDependentFlags();
528 539
529 // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer a nd its non-compositing 540 // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer a nd its non-compositing
530 // descendants. So, the visibility flag for m_graphicsLayer should be true i f there are any 541 // descendants. So, the visibility flag for m_graphicsLayer should be true i f there are any
531 // non-compositing visible layers. 542 // non-compositing visible layers.
532 bool contentsVisible = m_owningLayer->hasVisibleContent() || hasVisibleNonCo mpositingDescendantLayers(); 543 bool contentsVisible = m_owningLayer->hasVisibleContent() || hasVisibleNonCo mpositingDescendantLayers();
533 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->i sVideo()) { 544 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->i sVideo()) {
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 m_requiresOwnBackingStore = requiresOwnBacking; 1556 m_requiresOwnBackingStore = requiresOwnBacking;
1546 1557
1547 // This affects the answer to paintsIntoCompositedAncestor(), which in turn affects 1558 // This affects the answer to paintsIntoCompositedAncestor(), which in turn affects
1548 // cached clip rects, so when it changes we have to clear clip rects on desc endants. 1559 // cached clip rects, so when it changes we have to clear clip rects on desc endants.
1549 m_owningLayer->clipper().clearClipRectsIncludingDescendants(PaintingClipRect s); 1560 m_owningLayer->clipper().clearClipRectsIncludingDescendants(PaintingClipRect s);
1550 m_owningLayer->repainter().computeRepaintRectsIncludingDescendants(); 1561 m_owningLayer->repainter().computeRepaintRectsIncludingDescendants();
1551 1562
1552 compositor()->repaintInCompositedAncestor(m_owningLayer, compositedBounds()) ; 1563 compositor()->repaintInCompositedAncestor(m_owningLayer, compositedBounds()) ;
1553 } 1564 }
1554 1565
1555 void CompositedLayerMapping::setBlendMode(BlendMode) 1566 void CompositedLayerMapping::setBlendMode(BlendMode blendMode)
1556 { 1567 {
1568 if (m_ancestorClippingLayer) {
1569 ASSERT(childForSuperlayers() == m_ancestorClippingLayer.get());
1570 m_graphicsLayer->setBlendMode(BlendModeNormal);
1571 } else {
1572 ASSERT(childForSuperlayers() == m_graphicsLayer.get());
1573 }
1574 childForSuperlayers()->setBlendMode(blendMode);
1557 } 1575 }
1558 1576
1559 void CompositedLayerMapping::setContentsNeedDisplay() 1577 void CompositedLayerMapping::setContentsNeedDisplay()
1560 { 1578 {
1561 ASSERT(!paintsIntoCompositedAncestor()); 1579 ASSERT(!paintsIntoCompositedAncestor());
1562 1580
1563 if (m_graphicsLayer && m_graphicsLayer->drawsContent()) 1581 if (m_graphicsLayer && m_graphicsLayer->drawsContent())
1564 m_graphicsLayer->setNeedsDisplay(); 1582 m_graphicsLayer->setNeedsDisplay();
1565 1583
1566 if (m_foregroundLayer && m_foregroundLayer->drawsContent()) 1584 if (m_foregroundLayer && m_foregroundLayer->drawsContent())
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1969 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 1987 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
1970 name = "Scrolling Contents Layer"; 1988 name = "Scrolling Contents Layer";
1971 } else { 1989 } else {
1972 ASSERT_NOT_REACHED(); 1990 ASSERT_NOT_REACHED();
1973 } 1991 }
1974 1992
1975 return name; 1993 return name;
1976 } 1994 }
1977 1995
1978 } // namespace WebCore 1996 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698