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

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

Issue 23503046: [CSS Blending] Implement mix-blend-mode in software. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years, 2 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
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/RenderLayerCompositor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 , m_hasUnclippedDescendant(false) 114 , m_hasUnclippedDescendant(false)
115 , m_isUnclippedDescendant(false) 115 , m_isUnclippedDescendant(false)
116 , m_needsCompositedScrolling(false) 116 , m_needsCompositedScrolling(false)
117 , m_needsCompositedScrollingHasBeenRecorded(false) 117 , m_needsCompositedScrollingHasBeenRecorded(false)
118 , m_willUseCompositedScrollingHasBeenRecorded(false) 118 , m_willUseCompositedScrollingHasBeenRecorded(false)
119 , m_isScrollableAreaHasBeenRecorded(false) 119 , m_isScrollableAreaHasBeenRecorded(false)
120 , m_canBePromotedToStackingContainer(false) 120 , m_canBePromotedToStackingContainer(false)
121 , m_canBePromotedToStackingContainerDirty(true) 121 , m_canBePromotedToStackingContainerDirty(true)
122 , m_isRootLayer(renderer->isRenderView()) 122 , m_isRootLayer(renderer->isRenderView())
123 , m_usedTransparency(false) 123 , m_usedTransparency(false)
124 , m_childLayerHasBlendMode(false)
125 , m_childLayerHasBlendModeStatusDirty(false)
124 , m_paintingInsideReflection(false) 126 , m_paintingInsideReflection(false)
125 , m_visibleContentStatusDirty(true) 127 , m_visibleContentStatusDirty(true)
126 , m_hasVisibleContent(false) 128 , m_hasVisibleContent(false)
127 , m_visibleDescendantStatusDirty(false) 129 , m_visibleDescendantStatusDirty(false)
128 , m_hasVisibleDescendant(false) 130 , m_hasVisibleDescendant(false)
129 , m_isPaginated(false) 131 , m_isPaginated(false)
130 , m_3DTransformedDescendantStatusDirty(true) 132 , m_3DTransformedDescendantStatusDirty(true)
131 , m_has3DTransformedDescendant(false) 133 , m_has3DTransformedDescendant(false)
132 , m_containsDirtyOverlayScrollbars(false) 134 , m_containsDirtyOverlayScrollbars(false)
133 #if !ASSERT_DISABLED 135 #if !ASSERT_DISABLED
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 bool RenderLayer::hasBlendMode() const 720 bool RenderLayer::hasBlendMode() const
719 { 721 {
720 return RuntimeEnabledFeatures::cssCompositingEnabled() && renderer()->hasBle ndMode(); 722 return RuntimeEnabledFeatures::cssCompositingEnabled() && renderer()->hasBle ndMode();
721 } 723 }
722 724
723 void RenderLayer::updateBlendMode() 725 void RenderLayer::updateBlendMode()
724 { 726 {
725 if (!RuntimeEnabledFeatures::cssCompositingEnabled()) 727 if (!RuntimeEnabledFeatures::cssCompositingEnabled())
726 return; 728 return;
727 729
730 bool hadBlendMode = m_blendMode != BlendModeNormal;
728 BlendMode newBlendMode = renderer()->style()->blendMode(); 731 BlendMode newBlendMode = renderer()->style()->blendMode();
729 if (newBlendMode != m_blendMode) { 732 if (newBlendMode != m_blendMode) {
730 m_blendMode = newBlendMode; 733 m_blendMode = newBlendMode;
734
735 // Only update the flag if a blend mode is set or unset.
736 if (!hadBlendMode || !hasBlendMode())
737 dirtyAncestorChainBlendedDescendantStatus();
738
731 if (compositedLayerMapping()) 739 if (compositedLayerMapping())
732 compositedLayerMapping()->setBlendMode(newBlendMode); 740 compositedLayerMapping()->setBlendMode(newBlendMode);
733 } 741 }
734 } 742 }
735 743
736 void RenderLayer::updateTransform() 744 void RenderLayer::updateTransform()
737 { 745 {
738 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set, 746 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set,
739 // so check style too. 747 // so check style too.
740 bool hasTransform = renderer()->hasTransform() && renderer()->style()->hasTr ansform(); 748 bool hasTransform = renderer()->hasTransform() && renderer()->style()->hasTr ansform();
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 { 961 {
954 for (RenderLayer* layer = this; layer; layer = layer->parent()) { 962 for (RenderLayer* layer = this; layer; layer = layer->parent()) {
955 if (!layer->m_visibleDescendantStatusDirty && layer->hasVisibleDescendan t()) 963 if (!layer->m_visibleDescendantStatusDirty && layer->hasVisibleDescendan t())
956 break; 964 break;
957 965
958 layer->m_hasVisibleDescendant = true; 966 layer->m_hasVisibleDescendant = true;
959 layer->m_visibleDescendantStatusDirty = false; 967 layer->m_visibleDescendantStatusDirty = false;
960 } 968 }
961 } 969 }
962 970
971 void RenderLayer::dirtyAncestorChainBlendedDescendantStatus()
972 {
973 for (RenderLayer* layer = this; layer; layer = layer->parent()) {
974 if (layer->m_childLayerHasBlendModeStatusDirty)
975 break;
976
977 layer->m_childLayerHasBlendModeStatusDirty = true;
978
979 if (layer->isStackingContext())
980 break;
981 }
982 }
983
984 void RenderLayer::setAncestorChainBlendedDescendant()
985 {
986 for (RenderLayer* layer = this; layer; layer = layer->parent()) {
987 if (!layer->m_childLayerHasBlendModeStatusDirty && layer->childLayerHasB lendMode())
988 break;
989
990 layer->m_childLayerHasBlendMode = true;
991 layer->m_childLayerHasBlendModeStatusDirty = false;
992
993 if (layer->isStackingContext())
994 break;
995 }
996 }
997
963 void RenderLayer::updateHasUnclippedDescendant() 998 void RenderLayer::updateHasUnclippedDescendant()
964 { 999 {
965 TRACE_EVENT0("blink_rendering", "RenderLayer::updateHasUnclippedDescendant") ; 1000 TRACE_EVENT0("blink_rendering", "RenderLayer::updateHasUnclippedDescendant") ;
966 ASSERT(renderer()->isOutOfFlowPositioned()); 1001 ASSERT(renderer()->isOutOfFlowPositioned());
967 if (!m_hasVisibleContent && !m_hasVisibleDescendant) 1002 if (!m_hasVisibleContent && !m_hasVisibleDescendant)
968 return; 1003 return;
969 1004
970 FrameView* frameView = renderer()->view()->frameView(); 1005 FrameView* frameView = renderer()->view()->frameView();
971 if (!frameView) 1006 if (!frameView)
972 return; 1007 return;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 1047
1013 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && ha sOutOfFlowPositionedDescendant) 1048 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && ha sOutOfFlowPositionedDescendant)
1014 break; 1049 break;
1015 } 1050 }
1016 1051
1017 m_visibleDescendantStatusDirty = false; 1052 m_visibleDescendantStatusDirty = false;
1018 m_hasSelfPaintingLayerDescendantDirty = false; 1053 m_hasSelfPaintingLayerDescendantDirty = false;
1019 m_hasOutOfFlowPositionedDescendantDirty = false; 1054 m_hasOutOfFlowPositionedDescendantDirty = false;
1020 } 1055 }
1021 1056
1057 if (m_childLayerHasBlendModeStatusDirty) {
1058 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) {
1059 if (!child->isStackingContext())
1060 child->updateDescendantDependentFlags();
1061
1062 bool childLayerHasBlendMode = child->hasBlendMode() || (child->m_chi ldLayerHasBlendMode && !child->isStackingContext());
1063 m_childLayerHasBlendMode |= childLayerHasBlendMode;
1064
1065 if (m_childLayerHasBlendMode)
1066 break;
1067 }
1068 m_childLayerHasBlendModeStatusDirty = false;
1069 }
1070
1022 if (m_visibleContentStatusDirty) { 1071 if (m_visibleContentStatusDirty) {
1023 if (renderer()->style()->visibility() == VISIBLE) 1072 if (renderer()->style()->visibility() == VISIBLE)
1024 m_hasVisibleContent = true; 1073 m_hasVisibleContent = true;
1025 else { 1074 else {
1026 // layer may be hidden but still have some visible content, check fo r this 1075 // layer may be hidden but still have some visible content, check fo r this
1027 m_hasVisibleContent = false; 1076 m_hasVisibleContent = false;
1028 RenderObject* r = renderer()->firstChild(); 1077 RenderObject* r = renderer()->firstChild();
1029 while (r) { 1078 while (r) {
1030 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { 1079 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) {
1031 m_hasVisibleContent = true; 1080 m_hasVisibleContent = true;
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 return clipRect; 1589 return clipRect;
1541 } 1590 }
1542 1591
1543 LayoutRect RenderLayer::paintingExtent(const RenderLayer* rootLayer, const Layou tRect& paintDirtyRect, PaintBehavior paintBehavior) 1592 LayoutRect RenderLayer::paintingExtent(const RenderLayer* rootLayer, const Layou tRect& paintDirtyRect, PaintBehavior paintBehavior)
1544 { 1593 {
1545 return intersection(transparencyClipBox(this, rootLayer, PaintingTransparenc yClipBox, RootOfTransparencyClipBox, paintBehavior), paintDirtyRect); 1594 return intersection(transparencyClipBox(this, rootLayer, PaintingTransparenc yClipBox, RootOfTransparencyClipBox, paintBehavior), paintDirtyRect);
1546 } 1595 }
1547 1596
1548 void RenderLayer::beginTransparencyLayers(GraphicsContext* context, const Render Layer* rootLayer, const LayoutRect& paintDirtyRect, PaintBehavior paintBehavior) 1597 void RenderLayer::beginTransparencyLayers(GraphicsContext* context, const Render Layer* rootLayer, const LayoutRect& paintDirtyRect, PaintBehavior paintBehavior)
1549 { 1598 {
1550 if (context->paintingDisabled() || (paintsWithTransparency(paintBehavior) && m_usedTransparency)) 1599 bool createTransparencyLayerForBlendMode = isStackingContext() && m_childLay erHasBlendMode;
1600 if (context->paintingDisabled() || ((paintsWithTransparency(paintBehavior) | | hasBlendMode() || createTransparencyLayerForBlendMode) && m_usedTransparency))
1551 return; 1601 return;
1552 1602
1553 RenderLayer* ancestor = transparentPaintingAncestor(); 1603 RenderLayer* ancestor = transparentPaintingAncestor();
1554 if (ancestor) 1604 if (ancestor)
1555 ancestor->beginTransparencyLayers(context, rootLayer, paintDirtyRect, pa intBehavior); 1605 ancestor->beginTransparencyLayers(context, rootLayer, paintDirtyRect, pa intBehavior);
1556 1606
1557 if (paintsWithTransparency(paintBehavior)) { 1607 if (paintsWithTransparency(paintBehavior) || hasBlendMode() || createTranspa rencyLayerForBlendMode) {
1558 m_usedTransparency = true; 1608 m_usedTransparency = true;
1559 context->save(); 1609 context->save();
1560 LayoutRect clipRect = paintingExtent(rootLayer, paintDirtyRect, paintBeh avior); 1610 LayoutRect clipRect = paintingExtent(rootLayer, paintDirtyRect, paintBeh avior);
1561 context->clip(clipRect); 1611 context->clip(clipRect);
1612 if (hasBlendMode())
1613 context->setCompositeOperation(context->compositeOperation(), m_blen dMode);
1614
1562 context->beginTransparencyLayer(renderer()->opacity()); 1615 context->beginTransparencyLayer(renderer()->opacity());
1563 #ifdef REVEAL_TRANSPARENCY_LAYERS 1616 #ifdef REVEAL_TRANSPARENCY_LAYERS
1564 context->setFillColor(Color(0.0f, 0.0f, 0.5f, 0.2f)); 1617 context->setFillColor(Color(0.0f, 0.0f, 0.5f, 0.2f));
1565 context->fillRect(clipRect); 1618 context->fillRect(clipRect);
1566 #endif 1619 #endif
1567 } 1620 }
1568 } 1621 }
1569 1622
1570 void* RenderLayer::operator new(size_t sz) 1623 void* RenderLayer::operator new(size_t sz)
1571 { 1624 {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 child->dirtyStackingContainerZOrderLists(); 1659 child->dirtyStackingContainerZOrderLists();
1607 } 1660 }
1608 1661
1609 child->updateDescendantDependentFlags(); 1662 child->updateDescendantDependentFlags();
1610 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) 1663 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant)
1611 setAncestorChainHasVisibleDescendant(); 1664 setAncestorChainHasVisibleDescendant();
1612 1665
1613 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) 1666 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant())
1614 setAncestorChainHasSelfPaintingLayerDescendant(); 1667 setAncestorChainHasSelfPaintingLayerDescendant();
1615 1668
1669 if (child->hasBlendMode() || child->childLayerHasBlendMode())
1670 setAncestorChainBlendedDescendant();
1671
1616 if (subtreeContainsOutOfFlowPositionedLayer(child)) { 1672 if (subtreeContainsOutOfFlowPositionedLayer(child)) {
1617 // Now that the out of flow positioned descendant is in the tree, we 1673 // Now that the out of flow positioned descendant is in the tree, we
1618 // need to tell the compositor to reevaluate the compositing 1674 // need to tell the compositor to reevaluate the compositing
1619 // requirements since we may be able to mark more layers as having 1675 // requirements since we may be able to mark more layers as having
1620 // an 'unclipped' descendant. 1676 // an 'unclipped' descendant.
1621 compositor()->setNeedsUpdateCompositingRequirementsState(); 1677 compositor()->setNeedsUpdateCompositingRequirementsState();
1622 setAncestorChainHasOutOfFlowPositionedDescendant(); 1678 setAncestorChainHasOutOfFlowPositionedDescendant();
1623 } 1679 }
1624 1680
1625 // When we first dirty a layer, we will also dirty all the siblings in that 1681 // When we first dirty a layer, we will also dirty all the siblings in that
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 // It may now be the case that a layer no longer has an unclipped 1720 // It may now be the case that a layer no longer has an unclipped
1665 // descendant. Let the compositor know that it needs to reevaluate 1721 // descendant. Let the compositor know that it needs to reevaluate
1666 // its compositing requirements to check this. 1722 // its compositing requirements to check this.
1667 compositor()->setNeedsUpdateCompositingRequirementsState(); 1723 compositor()->setNeedsUpdateCompositingRequirementsState();
1668 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); 1724 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
1669 } 1725 }
1670 1726
1671 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) 1727 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant)
1672 dirtyAncestorChainVisibleDescendantStatus(); 1728 dirtyAncestorChainVisibleDescendantStatus();
1673 1729
1730 if (oldChild->hasBlendMode() || oldChild->childLayerHasBlendMode())
1731 dirtyAncestorChainBlendedDescendantStatus();
1732
1674 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant()) 1733 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant())
1675 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 1734 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
1676 1735
1677 return oldChild; 1736 return oldChild;
1678 } 1737 }
1679 1738
1680 void RenderLayer::removeOnlyThisLayer() 1739 void RenderLayer::removeOnlyThisLayer()
1681 { 1740 {
1682 if (!m_parent) 1741 if (!m_parent)
1683 return; 1742 return;
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
2682 resourceClipper = toRenderSVGResourceClipper(element->renderer() ->toRenderSVGResourceContainer()); 2741 resourceClipper = toRenderSVGResourceClipper(element->renderer() ->toRenderSVGResourceContainer());
2683 if (!resourceClipper->applyClippingToContext(renderer(), rootRel ativeBounds, 2742 if (!resourceClipper->applyClippingToContext(renderer(), rootRel ativeBounds,
2684 paintingInfo.paintDirtyRect, context, clipperContext)) { 2743 paintingInfo.paintDirtyRect, context, clipperContext)) {
2685 // No need to post-apply the clipper if this failed. 2744 // No need to post-apply the clipper if this failed.
2686 resourceClipper = 0; 2745 resourceClipper = 0;
2687 } 2746 }
2688 } 2747 }
2689 } 2748 }
2690 } 2749 }
2691 2750
2751 // Blending operations must be performed only with the nearest ancestor stac king context.
2752 bool createTransparencyLayerForBlendMode = isStackingContext() && m_childLay erHasBlendMode;
2753
2754 if (createTransparencyLayerForBlendMode)
2755 beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.pa intDirtyRect, paintingInfo.paintBehavior);
2756
2692 LayerPaintingInfo localPaintingInfo(paintingInfo); 2757 LayerPaintingInfo localPaintingInfo(paintingInfo);
2693 FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilte rs()); 2758 FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilte rs());
2694 if (filterPainter.haveFilterEffect() && !context->paintingDisabled()) { 2759 if (filterPainter.haveFilterEffect() && !context->paintingDisabled()) {
2695 RenderLayerFilterInfo* filterInfo = this->filterInfo(); 2760 RenderLayerFilterInfo* filterInfo = this->filterInfo();
2696 ASSERT(filterInfo); 2761 ASSERT(filterInfo);
2697 LayoutRect filterRepaintRect = filterInfo->dirtySourceRect(); 2762 LayoutRect filterRepaintRect = filterInfo->dirtySourceRect();
2698 filterRepaintRect.move(offsetFromRoot.x(), offsetFromRoot.y()); 2763 filterRepaintRect.move(offsetFromRoot.x(), offsetFromRoot.y());
2699 2764
2700 if (!rootRelativeBoundsComputed) { 2765 if (!rootRelativeBoundsComputed) {
2701 rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, &o ffsetFromRoot, 0); 2766 rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, &o ffsetFromRoot, 0);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2803 2868
2804 if (shouldPaintMask) 2869 if (shouldPaintMask)
2805 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti ngRootForRenderer); 2870 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti ngRootForRenderer);
2806 2871
2807 if (shouldPaintClippingMask) { 2872 if (shouldPaintClippingMask) {
2808 // Paint the border radius mask for the fragments. 2873 // Paint the border radius mask for the fragments.
2809 paintChildClippingMaskForFragments(layerFragments, context, localPaintin gInfo, paintingRootForRenderer); 2874 paintChildClippingMaskForFragments(layerFragments, context, localPaintin gInfo, paintingRootForRenderer);
2810 } 2875 }
2811 2876
2812 // End our transparency layer 2877 // End our transparency layer
2813 if (haveTransparency && m_usedTransparency && !m_paintingInsideReflection) { 2878 if ((haveTransparency || hasBlendMode() || createTransparencyLayerForBlendMo de) && m_usedTransparency && !m_paintingInsideReflection) {
2814 context->endLayer(); 2879 context->endLayer();
2815 context->restore(); 2880 context->restore();
2816 m_usedTransparency = false; 2881 m_usedTransparency = false;
2817 } 2882 }
2818 2883
2819 if (resourceClipper) 2884 if (resourceClipper)
2820 resourceClipper->postApplyStatefulResource(renderer(), context, clipperC ontext); 2885 resourceClipper->postApplyStatefulResource(renderer(), context, clipperC ontext);
2821 2886
2822 if (hasClipPath) 2887 if (hasClipPath)
2823 context->restore(); 2888 context->restore();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
2988 void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, 3053 void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext,
2989 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 3054 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior,
2990 RenderObject* paintingRootForRenderer) 3055 RenderObject* paintingRootForRenderer)
2991 { 3056 {
2992 for (size_t i = 0; i < layerFragments.size(); ++i) { 3057 for (size_t i = 0; i < layerFragments.size(); ++i) {
2993 const LayerFragment& fragment = layerFragments.at(i); 3058 const LayerFragment& fragment = layerFragments.at(i);
2994 if (!fragment.shouldPaintContent) 3059 if (!fragment.shouldPaintContent)
2995 continue; 3060 continue;
2996 3061
2997 // Begin transparency layers lazily now that we know we have to paint so mething. 3062 // Begin transparency layers lazily now that we know we have to paint so mething.
2998 if (haveTransparency) 3063 if (haveTransparency || hasBlendMode())
2999 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo. rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior); 3064 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo. rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior);
3000 3065
3001 if (localPaintingInfo.clipToDirtyRect) { 3066 if (localPaintingInfo.clipToDirtyRect) {
3002 // Paint our background first, before painting any child layers. 3067 // Paint our background first, before painting any child layers.
3003 // Establish the clip used to paint our background. 3068 // Establish the clip used to paint our background.
3004 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Bac kground painting will handle clipping to self. 3069 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Bac kground painting will handle clipping to self.
3005 } 3070 }
3006 3071
3007 // Paint the background. 3072 // Paint the background.
3008 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 3073 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
3009 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, loc alPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); 3074 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, loc alPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());
3010 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation)); 3075 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation));
3011 3076
3012 if (localPaintingInfo.clipToDirtyRect) 3077 if (localPaintingInfo.clipToDirtyRect)
3013 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect); 3078 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect);
3014 } 3079 }
3015 } 3080 }
3016 3081
3017 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, 3082 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext,
3018 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 3083 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior,
3019 RenderObject* paintingRootForRenderer, bool selectionOnly, bool forceBlackTe xt) 3084 RenderObject* paintingRootForRenderer, bool selectionOnly, bool forceBlackTe xt)
3020 { 3085 {
3021 // Begin transparency if we have something to paint. 3086 // Begin transparency if we have something to paint.
3022 if (haveTransparency) { 3087 if (haveTransparency || hasBlendMode()) {
3023 for (size_t i = 0; i < layerFragments.size(); ++i) { 3088 for (size_t i = 0; i < layerFragments.size(); ++i) {
3024 const LayerFragment& fragment = layerFragments.at(i); 3089 const LayerFragment& fragment = layerFragments.at(i);
3025 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty( )) { 3090 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty( )) {
3026 beginTransparencyLayers(transparencyLayerContext, localPaintingI nfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior); 3091 beginTransparencyLayers(transparencyLayerContext, localPaintingI nfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior);
3027 break; 3092 break;
3028 } 3093 }
3029 } 3094 }
3030 } 3095 }
3031 3096
3032 PaintBehavior localPaintBehavior = forceBlackText ? (PaintBehavior)PaintBeha viorForceBlackText : paintBehavior; 3097 PaintBehavior localPaintBehavior = forceBlackText ? (PaintBehavior)PaintBeha viorForceBlackText : paintBehavior;
(...skipping 2034 matching lines...) Expand 10 before | Expand all | Expand 10 after
5067 5132
5068 if (!hasReflection() && m_reflection) 5133 if (!hasReflection() && m_reflection)
5069 removeReflection(); 5134 removeReflection();
5070 else if (hasReflection()) { 5135 else if (hasReflection()) {
5071 if (!m_reflection) 5136 if (!m_reflection)
5072 createReflection(); 5137 createReflection();
5073 UseCounter::count(&renderer()->document(), UseCounter::Reflection); 5138 UseCounter::count(&renderer()->document(), UseCounter::Reflection);
5074 updateReflectionStyle(); 5139 updateReflectionStyle();
5075 } 5140 }
5076 5141
5142 if (RuntimeEnabledFeatures::cssCompositingEnabled())
5143 updateBlendMode();
5144
5077 updateDescendantDependentFlags(); 5145 updateDescendantDependentFlags();
5078 updateTransform(); 5146 updateTransform();
5079 5147
5080 if (RuntimeEnabledFeatures::cssCompositingEnabled())
5081 updateBlendMode();
5082
5083 bool didPaintWithFilters = false; 5148 bool didPaintWithFilters = false;
5084 5149
5085 if (paintsWithFilters()) 5150 if (paintsWithFilters())
5086 didPaintWithFilters = true; 5151 didPaintWithFilters = true;
5087 updateFilters(oldStyle, renderer()->style()); 5152 updateFilters(oldStyle, renderer()->style());
5088 5153
5089 const RenderStyle* newStyle = renderer()->style(); 5154 const RenderStyle* newStyle = renderer()->style();
5090 if (compositor()->updateLayerCompositingState(this) 5155 if (compositor()->updateLayerCompositingState(this)
5091 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) 5156 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle)
5092 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) 5157 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle)
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
5490 } 5555 }
5491 } 5556 }
5492 5557
5493 void showLayerTree(const WebCore::RenderObject* renderer) 5558 void showLayerTree(const WebCore::RenderObject* renderer)
5494 { 5559 {
5495 if (!renderer) 5560 if (!renderer)
5496 return; 5561 return;
5497 showLayerTree(renderer->enclosingLayer()); 5562 showLayerTree(renderer->enclosingLayer());
5498 } 5563 }
5499 #endif 5564 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/RenderLayerCompositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698