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

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: More tests 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 #if !OS(ANDROID) 205 #if !OS(ANDROID)
206 if (m_isMainFrameRenderViewLayer) 206 if (m_isMainFrameRenderViewLayer)
207 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true ); 207 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(true );
208 #endif 208 #endif
209 209
210 updateOpacity(renderer()->style()); 210 updateOpacity(renderer()->style());
211 updateTransform(renderer()->style()); 211 updateTransform(renderer()->style());
212 updateFilters(renderer()->style()); 212 updateFilters(renderer()->style());
213 213
214 if (RuntimeEnabledFeatures::cssCompositingEnabled()) 214 if (RuntimeEnabledFeatures::cssCompositingEnabled()) {
215 updateLayerBlendMode(renderer()->style()); 215 updateLayerBlendMode(renderer()->style());
216 updateIsRootForIsolatedGroup();
217 }
216 } 218 }
217 219
218 void CompositedLayerMapping::destroyGraphicsLayers() 220 void CompositedLayerMapping::destroyGraphicsLayers()
219 { 221 {
220 if (m_graphicsLayer) 222 if (m_graphicsLayer)
221 m_graphicsLayer->removeFromParent(); 223 m_graphicsLayer->removeFromParent();
222 224
223 m_ancestorClippingLayer = nullptr; 225 m_ancestorClippingLayer = nullptr;
224 m_graphicsLayer = nullptr; 226 m_graphicsLayer = nullptr;
225 m_foregroundLayer = nullptr; 227 m_foregroundLayer = nullptr;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // 264 //
263 // Similarly, if filters used to be painted in the compositor and are no w painted in software, we need to: 265 // Similarly, if filters used to be painted in the compositor and are no w painted in software, we need to:
264 // (1) Create a FilterEffectRenderer. 266 // (1) Create a FilterEffectRenderer.
265 // (2) Repaint the layer contents to apply a software filter because the compositor won't apply it. 267 // (2) Repaint the layer contents to apply a software filter because the compositor won't apply it.
266 // 268 //
267 m_owningLayer->updateOrRemoveFilterEffectRenderer(); 269 m_owningLayer->updateOrRemoveFilterEffectRenderer();
268 setContentsNeedDisplay(); 270 setContentsNeedDisplay();
269 } 271 }
270 } 272 }
271 273
272 void CompositedLayerMapping::updateLayerBlendMode(const RenderStyle*) 274 void CompositedLayerMapping::updateLayerBlendMode(const RenderStyle* style)
273 { 275 {
276 setBlendMode(style->blendMode());
277 }
278
279 void CompositedLayerMapping::updateIsRootForIsolatedGroup()
280 {
281 bool isolate = m_owningLayer->shouldIsolateCompositedDescendants();
282
283 // non stacking context layers should never isolate
284 ASSERT(m_owningLayer->stackingNode()->isStackingContext() || !isolate);
285
286 m_graphicsLayer->setIsRootForIsolatedGroup(isolate);
274 } 287 }
275 288
276 void CompositedLayerMapping::updateContentsOpaque() 289 void CompositedLayerMapping::updateContentsOpaque()
277 { 290 {
278 // 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.
279 ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer); 292 ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer);
280 if (m_backgroundLayer) { 293 if (m_backgroundLayer) {
281 m_graphicsLayer->setContentsOpaque(false); 294 m_graphicsLayer->setContentsOpaque(false);
282 m_backgroundLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToB eOpaqueInRect(compositedBounds())); 295 m_backgroundLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToB eOpaqueInRect(compositedBounds()));
283 } else { 296 } else {
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 528
516 // Set transform property, if it is not animating. We have to do this here b ecause the transform 529 // Set transform property, if it is not animating. We have to do this here b ecause the transform
517 // is affected by the layer dimensions. 530 // is affected by the layer dimensions.
518 if (!renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rendere r(), CSSPropertyWebkitTransform)) 531 if (!renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rendere r(), CSSPropertyWebkitTransform))
519 updateTransform(renderer()->style()); 532 updateTransform(renderer()->style());
520 533
521 // Set opacity, if it is not animating. 534 // Set opacity, if it is not animating.
522 if (!renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rendere r(), CSSPropertyOpacity)) 535 if (!renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rendere r(), CSSPropertyOpacity))
523 updateOpacity(renderer()->style()); 536 updateOpacity(renderer()->style());
524 537
525 if (RuntimeEnabledFeatures::cssCompositingEnabled()) 538 if (RuntimeEnabledFeatures::cssCompositingEnabled()) {
shawnsingh 2013/11/23 00:38:13 I think it would be equivalent to move these down
rosca 2013/11/25 21:11:41 It should be the same. Done.
526 updateLayerBlendMode(renderer()->style()); 539 updateLayerBlendMode(renderer()->style());
540 updateIsRootForIsolatedGroup();
541 }
527 542
528 bool isSimpleContainer = isSimpleContainerCompositingLayer(); 543 bool isSimpleContainer = isSimpleContainerCompositingLayer();
529 544
530 m_owningLayer->updateDescendantDependentFlags(); 545 m_owningLayer->updateDescendantDependentFlags();
531 546
532 // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer a nd its non-compositing 547 // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer a nd its non-compositing
533 // descendants. So, the visibility flag for m_graphicsLayer should be true i f there are any 548 // descendants. So, the visibility flag for m_graphicsLayer should be true i f there are any
534 // non-compositing visible layers. 549 // non-compositing visible layers.
535 bool contentsVisible = m_owningLayer->hasVisibleContent() || hasVisibleNonCo mpositingDescendantLayers(); 550 bool contentsVisible = m_owningLayer->hasVisibleContent() || hasVisibleNonCo mpositingDescendantLayers();
536 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->i sVideo()) { 551 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->i sVideo()) {
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 void CompositedLayerMapping::paintsIntoCompositedAncestorChanged() 1594 void CompositedLayerMapping::paintsIntoCompositedAncestorChanged()
1580 { 1595 {
1581 // The answer to paintsIntoCompositedAncestor() affects cached clip rects, s o when 1596 // The answer to paintsIntoCompositedAncestor() affects cached clip rects, s o when
1582 // it changes we have to clear clip rects on descendants. 1597 // it changes we have to clear clip rects on descendants.
1583 m_owningLayer->clipper().clearClipRectsIncludingDescendants(PaintingClipRect s); 1598 m_owningLayer->clipper().clearClipRectsIncludingDescendants(PaintingClipRect s);
1584 m_owningLayer->repainter().computeRepaintRectsIncludingDescendants(); 1599 m_owningLayer->repainter().computeRepaintRectsIncludingDescendants();
1585 1600
1586 compositor()->repaintInCompositedAncestor(m_owningLayer, compositedBounds()) ; 1601 compositor()->repaintInCompositedAncestor(m_owningLayer, compositedBounds()) ;
1587 } 1602 }
1588 1603
1589 void CompositedLayerMapping::setBlendMode(BlendMode) 1604 void CompositedLayerMapping::setBlendMode(BlendMode blendMode)
1590 { 1605 {
1606 if (m_ancestorClippingLayer) {
shawnsingh 2013/11/23 00:38:13 lately we are adding more layers in the Composited
rosca 2013/11/25 21:11:41 The same approach is used by scrolling coordinator
1607 ASSERT(childForSuperlayers() == m_ancestorClippingLayer.get());
1608 m_graphicsLayer->setBlendMode(BlendModeNormal);
1609 } else {
1610 ASSERT(childForSuperlayers() == m_graphicsLayer.get());
1611 }
1612 childForSuperlayers()->setBlendMode(blendMode);
1591 } 1613 }
1592 1614
1593 void CompositedLayerMapping::setContentsNeedDisplay() 1615 void CompositedLayerMapping::setContentsNeedDisplay()
1594 { 1616 {
1595 ASSERT(!paintsIntoCompositedAncestor()); 1617 ASSERT(!paintsIntoCompositedAncestor());
1596 1618
1597 if (m_graphicsLayer && m_graphicsLayer->drawsContent()) 1619 if (m_graphicsLayer && m_graphicsLayer->drawsContent())
1598 m_graphicsLayer->setNeedsDisplay(); 1620 m_graphicsLayer->setNeedsDisplay();
1599 1621
1600 if (m_foregroundLayer && m_foregroundLayer->drawsContent()) 1622 if (m_foregroundLayer && m_foregroundLayer->drawsContent())
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2042 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2021 name = "Scrolling Contents Layer"; 2043 name = "Scrolling Contents Layer";
2022 } else { 2044 } else {
2023 ASSERT_NOT_REACHED(); 2045 ASSERT_NOT_REACHED();
2024 } 2046 }
2025 2047
2026 return name; 2048 return name;
2027 } 2049 }
2028 2050
2029 } // namespace WebCore 2051 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698