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

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: Renamed a variable 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 m_graphicsLayer->setIsRootForIsolatedGroup(
282 m_owningLayer->requiresIsolationForCompositedStackingContext()
283 && m_owningLayer->stackingNode()->isStackingContext());
274 } 284 }
275 285
276 void CompositedLayerMapping::updateContentsOpaque() 286 void CompositedLayerMapping::updateContentsOpaque()
277 { 287 {
278 // For non-root layers, background is always painted by the primary graphics layer. 288 // For non-root layers, background is always painted by the primary graphics layer.
279 ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer); 289 ASSERT(m_isMainFrameRenderViewLayer || !m_backgroundLayer);
280 if (m_backgroundLayer) { 290 if (m_backgroundLayer) {
281 m_graphicsLayer->setContentsOpaque(false); 291 m_graphicsLayer->setContentsOpaque(false);
282 m_backgroundLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToB eOpaqueInRect(compositedBounds())); 292 m_backgroundLayer->setContentsOpaque(m_owningLayer->backgroundIsKnownToB eOpaqueInRect(compositedBounds()));
283 } else { 293 } else {
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 525
516 // Set transform property, if it is not animating. We have to do this here b ecause the transform 526 // 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. 527 // is affected by the layer dimensions.
518 if (!renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rendere r(), CSSPropertyWebkitTransform)) 528 if (!renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rendere r(), CSSPropertyWebkitTransform))
519 updateTransform(renderer()->style()); 529 updateTransform(renderer()->style());
520 530
521 // Set opacity, if it is not animating. 531 // Set opacity, if it is not animating.
522 if (!renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rendere r(), CSSPropertyOpacity)) 532 if (!renderer()->animation().isRunningAcceleratedAnimationOnRenderer(rendere r(), CSSPropertyOpacity))
523 updateOpacity(renderer()->style()); 533 updateOpacity(renderer()->style());
524 534
525 if (RuntimeEnabledFeatures::cssCompositingEnabled()) 535 if (RuntimeEnabledFeatures::cssCompositingEnabled()) {
526 updateLayerBlendMode(renderer()->style()); 536 updateLayerBlendMode(renderer()->style());
537 updateIsRootForIsolatedGroup();
538 }
527 539
528 bool isSimpleContainer = isSimpleContainerCompositingLayer(); 540 bool isSimpleContainer = isSimpleContainerCompositingLayer();
529 541
530 m_owningLayer->updateDescendantDependentFlags(); 542 m_owningLayer->updateDescendantDependentFlags();
531 543
532 // m_graphicsLayer is the corresponding GraphicsLayer for this RenderLayer a nd its non-compositing 544 // 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 545 // descendants. So, the visibility flag for m_graphicsLayer should be true i f there are any
534 // non-compositing visible layers. 546 // non-compositing visible layers.
535 bool contentsVisible = m_owningLayer->hasVisibleContent() || hasVisibleNonCo mpositingDescendantLayers(); 547 bool contentsVisible = m_owningLayer->hasVisibleContent() || hasVisibleNonCo mpositingDescendantLayers();
536 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->i sVideo()) { 548 if (RuntimeEnabledFeatures::overlayFullscreenVideoEnabled() && renderer()->i sVideo()) {
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 void CompositedLayerMapping::paintsIntoCompositedAncestorChanged() 1591 void CompositedLayerMapping::paintsIntoCompositedAncestorChanged()
1580 { 1592 {
1581 // The answer to paintsIntoCompositedAncestor() affects cached clip rects, s o when 1593 // The answer to paintsIntoCompositedAncestor() affects cached clip rects, s o when
1582 // it changes we have to clear clip rects on descendants. 1594 // it changes we have to clear clip rects on descendants.
1583 m_owningLayer->clipper().clearClipRectsIncludingDescendants(PaintingClipRect s); 1595 m_owningLayer->clipper().clearClipRectsIncludingDescendants(PaintingClipRect s);
1584 m_owningLayer->repainter().computeRepaintRectsIncludingDescendants(); 1596 m_owningLayer->repainter().computeRepaintRectsIncludingDescendants();
1585 1597
1586 compositor()->repaintInCompositedAncestor(m_owningLayer, compositedBounds()) ; 1598 compositor()->repaintInCompositedAncestor(m_owningLayer, compositedBounds()) ;
1587 } 1599 }
1588 1600
1589 void CompositedLayerMapping::setBlendMode(BlendMode) 1601 void CompositedLayerMapping::setBlendMode(BlendMode blendMode)
1590 { 1602 {
1603 if (m_ancestorClippingLayer) {
1604 ASSERT(childForSuperlayers() == m_ancestorClippingLayer.get());
1605 m_graphicsLayer->setBlendMode(BlendModeNormal);
1606 } else {
1607 ASSERT(childForSuperlayers() == m_graphicsLayer.get());
1608 }
1609 childForSuperlayers()->setBlendMode(blendMode);
1591 } 1610 }
1592 1611
1593 void CompositedLayerMapping::setContentsNeedDisplay() 1612 void CompositedLayerMapping::setContentsNeedDisplay()
1594 { 1613 {
1595 ASSERT(!paintsIntoCompositedAncestor()); 1614 ASSERT(!paintsIntoCompositedAncestor());
1596 1615
1597 if (m_graphicsLayer && m_graphicsLayer->drawsContent()) 1616 if (m_graphicsLayer && m_graphicsLayer->drawsContent())
1598 m_graphicsLayer->setNeedsDisplay(); 1617 m_graphicsLayer->setNeedsDisplay();
1599 1618
1600 if (m_foregroundLayer && m_foregroundLayer->drawsContent()) 1619 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()) { 2039 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2021 name = "Scrolling Contents Layer"; 2040 name = "Scrolling Contents Layer";
2022 } else { 2041 } else {
2023 ASSERT_NOT_REACHED(); 2042 ASSERT_NOT_REACHED();
2024 } 2043 }
2025 2044
2026 return name; 2045 return name;
2027 } 2046 }
2028 2047
2029 } // namespace WebCore 2048 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698