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

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: Created 7 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
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 206
207 #if !OS(ANDROID) 207 #if !OS(ANDROID)
208 if (m_isMainFrameRenderViewLayer) 208 if (m_isMainFrameRenderViewLayer)
209 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true ); 209 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true );
210 #endif 210 #endif
211 211
212 updateOpacity(renderer()->style()); 212 updateOpacity(renderer()->style());
213 updateTransform(renderer()->style()); 213 updateTransform(renderer()->style());
214 updateFilters(renderer()->style()); 214 updateFilters(renderer()->style());
215 215
216 if (RuntimeEnabledFeatures::cssCompositingEnabled()) 216 if (RuntimeEnabledFeatures::cssCompositingEnabled()) {
217 updateLayerBlendMode(renderer()->style()); 217 updateLayerBlendMode(renderer()->style());
218 updateIsRootForIsolatedGroup();
219 }
218 } 220 }
219 221
220 void CompositedLayerMapping::destroyGraphicsLayers() 222 void CompositedLayerMapping::destroyGraphicsLayers()
221 { 223 {
222 if (m_graphicsLayer) 224 if (m_graphicsLayer)
223 m_graphicsLayer->removeFromParent(); 225 m_graphicsLayer->removeFromParent();
224 226
225 m_ancestorClippingLayer = nullptr; 227 m_ancestorClippingLayer = nullptr;
226 m_graphicsLayer = nullptr; 228 m_graphicsLayer = nullptr;
227 m_foregroundLayer = nullptr; 229 m_foregroundLayer = nullptr;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // 266 //
265 // Similarly, if filters used to be painted in the compositor and are no w painted in software, we need to: 267 // Similarly, if filters used to be painted in the compositor and are no w painted in software, we need to:
266 // (1) Create a FilterEffectRenderer. 268 // (1) Create a FilterEffectRenderer.
267 // (2) Repaint the layer contents to apply a software filter because the compositor won't apply it. 269 // (2) Repaint the layer contents to apply a software filter because the compositor won't apply it.
268 // 270 //
269 m_owningLayer->updateOrRemoveFilterEffectRenderer(); 271 m_owningLayer->updateOrRemoveFilterEffectRenderer();
270 setContentsNeedDisplay(); 272 setContentsNeedDisplay();
271 } 273 }
272 } 274 }
273 275
274 void CompositedLayerMapping::updateLayerBlendMode(const RenderStyle*) 276 void CompositedLayerMapping::updateLayerBlendMode(const RenderStyle* style)
275 { 277 {
278 setBlendMode(style->blendMode());
279 }
280
281 void CompositedLayerMapping::updateIsRootForIsolatedGroup()
282 {
283 bool isolate = m_owningLayer->shouldIsolateCompositedDescendants();
284
285 // non stacking context layers should never isolate
286 ASSERT(m_owningLayer->stackingNode()->isStackingContext() || !isolate);
287
288 m_graphicsLayer->setIsRootForIsolatedGroup(isolate);
276 } 289 }
277 290
278 void CompositedLayerMapping::updateContentsOpaque() 291 void CompositedLayerMapping::updateContentsOpaque()
279 { 292 {
280 // For non-root layers, background is always painted by the primary graphics layer. 293 // For non-root layers, background is always painted by the primary graphics layer.
281 ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer); 294 ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer);
282 if (m_backgroundLayer) { 295 if (m_backgroundLayer) {
283 m_graphicsLayer->setContentsOpaque(false); 296 m_graphicsLayer->setContentsOpaque(false);
284 m_backgroundLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToB eOpaqueInRect(compositedBounds())); 297 m_backgroundLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToB eOpaqueInRect(compositedBounds()));
285 } else { 298 } else {
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 ? !hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyWebkitTransfo rm) 538 ? !hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyWebkitTransfo rm)
526 : !renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rende rer(), CSSPropertyWebkitTransform)) 539 : !renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rende rer(), CSSPropertyWebkitTransform))
527 updateTransform(renderer()->style()); 540 updateTransform(renderer()->style());
528 541
529 // Set opacity, if it is not animating. 542 // Set opacity, if it is not animating.
530 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled() 543 if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()
531 ? !hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyOpacity) 544 ? !hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyOpacity)
532 : !renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rende rer(), CSSPropertyOpacity)) 545 : !renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rende rer(), CSSPropertyOpacity))
533 updateOpacity(renderer()->style()); 546 updateOpacity(renderer()->style());
534 547
535 if (RuntimeEnabledFeatures::cssCompositingEnabled())
536 updateLayerBlendMode(renderer()->style());
537
538 bool isSimpleContainer = isSimpleContainerCompositingLayer(); 548 bool isSimpleContainer = isSimpleContainerCompositingLayer();
539 549
540 m_owningLayer->updateDescendantDependentFlags(); 550 m_owningLayer->updateDescendantDependentFlags();
541 551
542 // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer a nd its non-compositing 552 // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer a nd its non-compositing
543 // descendants. So, the visibility flag for m_graphicsLayer should be true i f there are any 553 // descendants. So, the visibility flag for m_graphicsLayer should be true i f there are any
544 // non-compositing visible layers. 554 // non-compositing visible layers.
545 bool contentsVisible = m_owningLayer->hasVisibleContent() || hasVisibleNonCo mpositingDescendantLayers(); 555 bool contentsVisible = m_owningLayer->hasVisibleContent() || hasVisibleNonCo mpositingDescendantLayers();
546 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->i sVideo()) { 556 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->i sVideo()) {
547 HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer()->node()); 557 HTMLMediaElement* mediaElement = toHTMLMediaElement(renderer()->node());
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 } 785 }
776 } 786 }
777 787
778 if (m_owningLayer->scrollableArea()) 788 if (m_owningLayer->scrollableArea())
779 m_owningLayer->scrollableArea()->positionOverflowControls(); 789 m_owningLayer->scrollableArea()->positionOverflowControls();
780 790
781 // We can't make this call in RenderLayerCompositor::allocateOrClearComposit edLayerMapping 791 // We can't make this call in RenderLayerCompositor::allocateOrClearComposit edLayerMapping
782 // since it depends on whether compAncestor draws content, which gets update d later. 792 // since it depends on whether compAncestor draws content, which gets update d later.
783 updateRequiresOwnBackingStoreForAncestorReasons(compAncestor); 793 updateRequiresOwnBackingStoreForAncestorReasons(compAncestor);
784 794
795 if (RuntimeEnabledFeatures::cssCompositingEnabled()) {
796 updateLayerBlendMode(style);
797 updateIsRootForIsolatedGroup();
798 }
799
785 updateContentsRect(isSimpleContainer); 800 updateContentsRect(isSimpleContainer);
786 updateBackgroundColor(isSimpleContainer); 801 updateBackgroundColor(isSimpleContainer);
787 updateDrawsContent(isSimpleContainer); 802 updateDrawsContent(isSimpleContainer);
788 updateContentsOpaque(); 803 updateContentsOpaque();
789 updateAfterWidgetResize(); 804 updateAfterWidgetResize();
790 registerScrollingLayers(); 805 registerScrollingLayers();
791 806
792 updateCompositingReasons(); 807 updateCompositingReasons();
793 } 808 }
794 809
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
1583 void CompositedLayerMapping::paintsIntoCompositedAncestorChanged() 1598 void CompositedLayerMapping::paintsIntoCompositedAncestorChanged()
1584 { 1599 {
1585 // The answer to paintsIntoCompositedAncestor() affects cached clip rects, s o when 1600 // The answer to paintsIntoCompositedAncestor() affects cached clip rects, s o when
1586 // it changes we have to clear clip rects on descendants. 1601 // it changes we have to clear clip rects on descendants.
1587 m_owningLayer->clipper().clearClipRectsIncludingDescendants(PaintingClipRect s); 1602 m_owningLayer->clipper().clearClipRectsIncludingDescendants(PaintingClipRect s);
1588 m_owningLayer->repainter().computeRepaintRectsIncludingDescendants(); 1603 m_owningLayer->repainter().computeRepaintRectsIncludingDescendants();
1589 1604
1590 compositor()->repaintInCompositedAncestor(m_owningLayer, compositedBounds()) ; 1605 compositor()->repaintInCompositedAncestor(m_owningLayer, compositedBounds()) ;
1591 } 1606 }
1592 1607
1593 void CompositedLayerMapping::setBlendMode(BlendMode) 1608 void CompositedLayerMapping::setBlendMode(BlendMode blendMode)
1594 { 1609 {
1610 if (m_ancestorClippingLayer) {
1611 ASSERT(childForSuperlayers() == m_ancestorClippingLayer.get());
1612 m_graphicsLayer->setBlendMode(BlendModeNormal);
1613 } else {
1614 ASSERT(childForSuperlayers() == m_graphicsLayer.get());
1615 }
1616 childForSuperlayers()->setBlendMode(blendMode);
1595 } 1617 }
1596 1618
1597 void CompositedLayerMapping::setContentsNeedDisplay() 1619 void CompositedLayerMapping::setContentsNeedDisplay()
1598 { 1620 {
1599 ASSERT(!paintsIntoCompositedAncestor()); 1621 ASSERT(!paintsIntoCompositedAncestor());
1600 1622
1601 if (m_graphicsLayer && m_graphicsLayer->drawsContent()) 1623 if (m_graphicsLayer && m_graphicsLayer->drawsContent())
1602 m_graphicsLayer->setNeedsDisplay(); 1624 m_graphicsLayer->setNeedsDisplay();
1603 1625
1604 if (m_foregroundLayer && m_foregroundLayer->drawsContent()) 1626 if (m_foregroundLayer && m_foregroundLayer->drawsContent())
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
2003 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2025 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2004 name = "Scrolling Contents Layer"; 2026 name = "Scrolling Contents Layer";
2005 } else { 2027 } else {
2006 ASSERT_NOT_REACHED(); 2028 ASSERT_NOT_REACHED();
2007 } 2029 }
2008 2030
2009 return name; 2031 return name;
2010 } 2032 }
2011 2033
2012 } // namespace WebCore 2034 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698