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

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: Add blended child as a descendant dependent flag 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 , m_hasUnclippedDescendant(false) 125 , m_hasUnclippedDescendant(false)
126 , m_isUnclippedDescendant(false) 126 , m_isUnclippedDescendant(false)
127 , m_needsCompositedScrolling(false) 127 , m_needsCompositedScrolling(false)
128 , m_needsCompositedScrollingHasBeenRecorded(false) 128 , m_needsCompositedScrollingHasBeenRecorded(false)
129 , m_willUseCompositedScrollingHasBeenRecorded(false) 129 , m_willUseCompositedScrollingHasBeenRecorded(false)
130 , m_isScrollableAreaHasBeenRecorded(false) 130 , m_isScrollableAreaHasBeenRecorded(false)
131 , m_canBePromotedToStackingContainer(false) 131 , m_canBePromotedToStackingContainer(false)
132 , m_canBePromotedToStackingContainerDirty(true) 132 , m_canBePromotedToStackingContainerDirty(true)
133 , m_isRootLayer(renderer->isRenderView()) 133 , m_isRootLayer(renderer->isRenderView())
134 , m_usedTransparency(false) 134 , m_usedTransparency(false)
135 , m_childLayerHasBlendMode(false)
136 , m_childLayerHasBlendModeStatusDirty(false)
135 , m_paintingInsideReflection(false) 137 , m_paintingInsideReflection(false)
136 , m_repaintStatus(NeedsNormalRepaint) 138 , m_repaintStatus(NeedsNormalRepaint)
137 , m_visibleContentStatusDirty(true) 139 , m_visibleContentStatusDirty(true)
138 , m_hasVisibleContent(false) 140 , m_hasVisibleContent(false)
139 , m_visibleDescendantStatusDirty(false) 141 , m_visibleDescendantStatusDirty(false)
140 , m_hasVisibleDescendant(false) 142 , m_hasVisibleDescendant(false)
141 , m_isPaginated(false) 143 , m_isPaginated(false)
142 , m_3DTransformedDescendantStatusDirty(true) 144 , m_3DTransformedDescendantStatusDirty(true)
143 , m_has3DTransformedDescendant(false) 145 , m_has3DTransformedDescendant(false)
144 , m_containsDirtyOverlayScrollbars(false) 146 , m_containsDirtyOverlayScrollbars(false)
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 bool RenderLayer::hasBlendMode() const 818 bool RenderLayer::hasBlendMode() const
817 { 819 {
818 return RuntimeEnabledFeatures::cssCompositingEnabled() && renderer()->hasBle ndMode(); 820 return RuntimeEnabledFeatures::cssCompositingEnabled() && renderer()->hasBle ndMode();
819 } 821 }
820 822
821 void RenderLayer::updateBlendMode() 823 void RenderLayer::updateBlendMode()
822 { 824 {
823 if (!RuntimeEnabledFeatures::cssCompositingEnabled()) 825 if (!RuntimeEnabledFeatures::cssCompositingEnabled())
824 return; 826 return;
825 827
828 bool hadBlendMode = m_blendMode != BlendModeNormal;
Julien - ping for review 2013/09/30 17:59:11 Unused variable.
829
826 BlendMode newBlendMode = renderer()->style()->blendMode(); 830 BlendMode newBlendMode = renderer()->style()->blendMode();
827 if (newBlendMode != m_blendMode) { 831 if (newBlendMode != m_blendMode) {
828 m_blendMode = newBlendMode; 832 m_blendMode = newBlendMode;
833
834 setAncestorChainBlendedDescendant();
Julien - ping for review 2013/09/30 17:59:11 I don't think this logic is right: you should only
mitica 2013/10/01 13:14:37 You are right, I missed this. The new approach wil
835
829 if (backing()) 836 if (backing())
830 backing()->setBlendMode(newBlendMode); 837 backing()->setBlendMode(newBlendMode);
831 } 838 }
832 } 839 }
833 840
834 void RenderLayer::updateTransform() 841 void RenderLayer::updateTransform()
835 { 842 {
836 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set, 843 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set,
837 // so check style too. 844 // so check style too.
838 bool hasTransform = renderer()->hasTransform() && renderer()->style()->hasTr ansform(); 845 bool hasTransform = renderer()->hasTransform() && renderer()->style()->hasTr ansform();
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 { 1058 {
1052 for (RenderLayer* layer = this; layer; layer = layer->parent()) { 1059 for (RenderLayer* layer = this; layer; layer = layer->parent()) {
1053 if (!layer->m_visibleDescendantStatusDirty && layer->hasVisibleDescendan t()) 1060 if (!layer->m_visibleDescendantStatusDirty && layer->hasVisibleDescendan t())
1054 break; 1061 break;
1055 1062
1056 layer->m_hasVisibleDescendant = true; 1063 layer->m_hasVisibleDescendant = true;
1057 layer->m_visibleDescendantStatusDirty = false; 1064 layer->m_visibleDescendantStatusDirty = false;
1058 } 1065 }
1059 } 1066 }
1060 1067
1068 void RenderLayer::dirtyAncestorChainBlendedDescendantStatus()
1069 {
1070 for (RenderLayer* layer = this; layer; layer = layer->parent()) {
1071 if (layer->m_childLayerHasBlendModeStatusDirty)
1072 break;
1073
1074 layer->m_childLayerHasBlendModeStatusDirty = true;
1075
1076 if (layer->isStackingContext())
1077 break;
1078 }
1079 }
1080
1081 void RenderLayer::setAncestorChainBlendedDescendant()
1082 {
1083 for (RenderLayer* layer = this; layer; layer = layer->parent()) {
1084 if (!layer->m_childLayerHasBlendModeStatusDirty && layer->m_childLayerHa sBlendMode)
1085 break;
1086
1087 layer->m_childLayerHasBlendMode = true;
1088 layer->m_childLayerHasBlendModeStatusDirty = false;
1089
1090 if (layer->isStackingContext())
1091 break;
1092 }
1093 }
1094
1061 void RenderLayer::updateHasUnclippedDescendant() 1095 void RenderLayer::updateHasUnclippedDescendant()
1062 { 1096 {
1063 TRACE_EVENT0("blink_rendering", "RenderLayer::updateHasUnclippedDescendant") ; 1097 TRACE_EVENT0("blink_rendering", "RenderLayer::updateHasUnclippedDescendant") ;
1064 ASSERT(renderer()->isOutOfFlowPositioned()); 1098 ASSERT(renderer()->isOutOfFlowPositioned());
1065 if (!m_hasVisibleContent && !m_hasVisibleDescendant) 1099 if (!m_hasVisibleContent && !m_hasVisibleDescendant)
1066 return; 1100 return;
1067 1101
1068 FrameView* frameView = renderer()->view()->frameView(); 1102 FrameView* frameView = renderer()->view()->frameView();
1069 if (!frameView) 1103 if (!frameView)
1070 return; 1104 return;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 1144
1111 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && ha sOutOfFlowPositionedDescendant) 1145 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && ha sOutOfFlowPositionedDescendant)
1112 break; 1146 break;
1113 } 1147 }
1114 1148
1115 m_visibleDescendantStatusDirty = false; 1149 m_visibleDescendantStatusDirty = false;
1116 m_hasSelfPaintingLayerDescendantDirty = false; 1150 m_hasSelfPaintingLayerDescendantDirty = false;
1117 m_hasOutOfFlowPositionedDescendantDirty = false; 1151 m_hasOutOfFlowPositionedDescendantDirty = false;
1118 } 1152 }
1119 1153
1154 if (m_childLayerHasBlendModeStatusDirty) {
1155 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) {
1156 child->updateDescendantDependentFlags();
1157 if (child->hasBlendMode() || child->isStackingContext())
1158 break;
1159
1160 bool childLayerHasBlendMode = child->hasBlendMode() || child->m_chil dLayerHasBlendMode;
1161 m_childLayerHasBlendMode |= childLayerHasBlendMode;
1162 }
1163 m_childLayerHasBlendModeStatusDirty = false;
1164 }
1165
1120 if (m_visibleContentStatusDirty) { 1166 if (m_visibleContentStatusDirty) {
1121 if (renderer()->style()->visibility() == VISIBLE) 1167 if (renderer()->style()->visibility() == VISIBLE)
1122 m_hasVisibleContent = true; 1168 m_hasVisibleContent = true;
1123 else { 1169 else {
1124 // layer may be hidden but still have some visible content, check fo r this 1170 // layer may be hidden but still have some visible content, check fo r this
1125 m_hasVisibleContent = false; 1171 m_hasVisibleContent = false;
1126 RenderObject* r = renderer()->firstChild(); 1172 RenderObject* r = renderer()->firstChild();
1127 while (r) { 1173 while (r) {
1128 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { 1174 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) {
1129 m_hasVisibleContent = true; 1175 m_hasVisibleContent = true;
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 return clipRect; 1731 return clipRect;
1686 } 1732 }
1687 1733
1688 LayoutRect RenderLayer::paintingExtent(const RenderLayer* rootLayer, const Layou tRect& paintDirtyRect, PaintBehavior paintBehavior) 1734 LayoutRect RenderLayer::paintingExtent(const RenderLayer* rootLayer, const Layou tRect& paintDirtyRect, PaintBehavior paintBehavior)
1689 { 1735 {
1690 return intersection(transparencyClipBox(this, rootLayer, PaintingTransparenc yClipBox, RootOfTransparencyClipBox, paintBehavior), paintDirtyRect); 1736 return intersection(transparencyClipBox(this, rootLayer, PaintingTransparenc yClipBox, RootOfTransparencyClipBox, paintBehavior), paintDirtyRect);
1691 } 1737 }
1692 1738
1693 void RenderLayer::beginTransparencyLayers(GraphicsContext* context, const Render Layer* rootLayer, const LayoutRect& paintDirtyRect, PaintBehavior paintBehavior) 1739 void RenderLayer::beginTransparencyLayers(GraphicsContext* context, const Render Layer* rootLayer, const LayoutRect& paintDirtyRect, PaintBehavior paintBehavior)
1694 { 1740 {
1695 if (context->paintingDisabled() || (paintsWithTransparency(paintBehavior) && m_usedTransparency)) 1741 bool createTransparencyLayerForBlendMode = isStackingContext() && m_childLay erHasBlendMode;
1742 if (context->paintingDisabled() || ((paintsWithTransparency(paintBehavior) | | hasBlendMode() || createTransparencyLayerForBlendMode) && m_usedTransparency))
1696 return; 1743 return;
1697 1744
1698 RenderLayer* ancestor = transparentPaintingAncestor(); 1745 RenderLayer* ancestor = transparentPaintingAncestor();
1699 if (ancestor) 1746 if (ancestor)
1700 ancestor->beginTransparencyLayers(context, rootLayer, paintDirtyRect, pa intBehavior); 1747 ancestor->beginTransparencyLayers(context, rootLayer, paintDirtyRect, pa intBehavior);
1701 1748
1702 if (paintsWithTransparency(paintBehavior)) { 1749 if (paintsWithTransparency(paintBehavior) || hasBlendMode() || createTranspa rencyLayerForBlendMode) {
1703 m_usedTransparency = true; 1750 m_usedTransparency = true;
1704 context->save(); 1751 context->save();
1705 LayoutRect clipRect = paintingExtent(rootLayer, paintDirtyRect, paintBeh avior); 1752 LayoutRect clipRect = paintingExtent(rootLayer, paintDirtyRect, paintBeh avior);
1706 context->clip(clipRect); 1753 context->clip(clipRect);
1754 if (hasBlendMode())
1755 context->setCompositeOperation(context->compositeOperation(), m_blen dMode);
1756
1707 context->beginTransparencyLayer(renderer()->opacity()); 1757 context->beginTransparencyLayer(renderer()->opacity());
1708 #ifdef REVEAL_TRANSPARENCY_LAYERS 1758 #ifdef REVEAL_TRANSPARENCY_LAYERS
1709 context->setFillColor(Color(0.0f, 0.0f, 0.5f, 0.2f)); 1759 context->setFillColor(Color(0.0f, 0.0f, 0.5f, 0.2f));
1710 context->fillRect(clipRect); 1760 context->fillRect(clipRect);
1711 #endif 1761 #endif
1712 } 1762 }
1713 } 1763 }
1714 1764
1715 void* RenderLayer::operator new(size_t sz) 1765 void* RenderLayer::operator new(size_t sz)
1716 { 1766 {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 child->dirtyStackingContainerZOrderLists(); 1801 child->dirtyStackingContainerZOrderLists();
1752 } 1802 }
1753 1803
1754 child->updateDescendantDependentFlags(); 1804 child->updateDescendantDependentFlags();
1755 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) 1805 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant)
1756 setAncestorChainHasVisibleDescendant(); 1806 setAncestorChainHasVisibleDescendant();
1757 1807
1758 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) 1808 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant())
1759 setAncestorChainHasSelfPaintingLayerDescendant(); 1809 setAncestorChainHasSelfPaintingLayerDescendant();
1760 1810
1811 if (child->hasBlendMode() || child->m_childLayerHasBlendMode)
Julien - ping for review 2013/09/30 17:59:11 You can potentially check a dirty value here. You
mitica 2013/10/01 13:14:37 Indeed, thanks for pointing this out, I'll add the
1812 setAncestorChainBlendedDescendant();
1813
1761 if (subtreeContainsOutOfFlowPositionedLayer(child)) { 1814 if (subtreeContainsOutOfFlowPositionedLayer(child)) {
1762 // Now that the out of flow positioned descendant is in the tree, we 1815 // Now that the out of flow positioned descendant is in the tree, we
1763 // need to tell the compositor to reevaluate the compositing 1816 // need to tell the compositor to reevaluate the compositing
1764 // requirements since we may be able to mark more layers as having 1817 // requirements since we may be able to mark more layers as having
1765 // an 'unclipped' descendant. 1818 // an 'unclipped' descendant.
1766 compositor()->setNeedsUpdateCompositingRequirementsState(); 1819 compositor()->setNeedsUpdateCompositingRequirementsState();
1767 setAncestorChainHasOutOfFlowPositionedDescendant(); 1820 setAncestorChainHasOutOfFlowPositionedDescendant();
1768 } 1821 }
1769 1822
1770 // When we first dirty a layer, we will also dirty all the siblings in that 1823 // When we first dirty a layer, we will also dirty all the siblings in that
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1812 compositor()->setNeedsUpdateCompositingRequirementsState(); 1865 compositor()->setNeedsUpdateCompositingRequirementsState();
1813 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); 1866 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
1814 } 1867 }
1815 1868
1816 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) 1869 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant)
1817 dirtyAncestorChainVisibleDescendantStatus(); 1870 dirtyAncestorChainVisibleDescendantStatus();
1818 1871
1819 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant()) 1872 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant())
1820 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 1873 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
1821 1874
1875 if (oldChild->hasBlendMode() || oldChild->m_childLayerHasBlendMode)
Julien - ping for review 2013/09/30 17:59:11 Ditto.
1876 dirtyAncestorChainBlendedDescendantStatus();
1877
1822 return oldChild; 1878 return oldChild;
1823 } 1879 }
1824 1880
1825 void RenderLayer::removeOnlyThisLayer() 1881 void RenderLayer::removeOnlyThisLayer()
1826 { 1882 {
1827 if (!m_parent) 1883 if (!m_parent)
1828 return; 1884 return;
1829 1885
1830 // Mark that we are about to lose our layer. This makes render tree 1886 // Mark that we are about to lose our layer. This makes render tree
1831 // walks ignore this layer while we're removing it. 1887 // walks ignore this layer while we're removing it.
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
3211 3267
3212 resourceClipper = toRenderSVGResourceClipper(element->renderer() ->toRenderSVGResourceContainer()); 3268 resourceClipper = toRenderSVGResourceClipper(element->renderer() ->toRenderSVGResourceContainer());
3213 if (!resourceClipper->applyClippingToContext(renderer(), rootRel ativeBounds, paintingInfo.paintDirtyRect, context)) { 3269 if (!resourceClipper->applyClippingToContext(renderer(), rootRel ativeBounds, paintingInfo.paintDirtyRect, context)) {
3214 // No need to post-apply the clipper if this failed. 3270 // No need to post-apply the clipper if this failed.
3215 resourceClipper = 0; 3271 resourceClipper = 0;
3216 } 3272 }
3217 } 3273 }
3218 } 3274 }
3219 } 3275 }
3220 3276
3277 // Blending operations must be performed only with the nearest ancestor stac king context.
3278 bool createTransparencyLayerForBlendMode = isStackingContext() && m_childLay erHasBlendMode;
3279
3280 if (createTransparencyLayerForBlendMode)
3281 beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.pa intDirtyRect, paintingInfo.paintBehavior);
3282
3221 LayerPaintingInfo localPaintingInfo(paintingInfo); 3283 LayerPaintingInfo localPaintingInfo(paintingInfo);
3222 FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilte rs()); 3284 FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilte rs());
3223 if (filterPainter.haveFilterEffect() && !context->paintingDisabled()) { 3285 if (filterPainter.haveFilterEffect() && !context->paintingDisabled()) {
3224 RenderLayerFilterInfo* filterInfo = this->filterInfo(); 3286 RenderLayerFilterInfo* filterInfo = this->filterInfo();
3225 ASSERT(filterInfo); 3287 ASSERT(filterInfo);
3226 LayoutRect filterRepaintRect = filterInfo->dirtySourceRect(); 3288 LayoutRect filterRepaintRect = filterInfo->dirtySourceRect();
3227 filterRepaintRect.move(offsetFromRoot.x(), offsetFromRoot.y()); 3289 filterRepaintRect.move(offsetFromRoot.x(), offsetFromRoot.y());
3228 3290
3229 if (!rootRelativeBoundsComputed) { 3291 if (!rootRelativeBoundsComputed) {
3230 rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, &o ffsetFromRoot, 0); 3292 rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, &o ffsetFromRoot, 0);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
3332 3394
3333 if (shouldPaintMask) 3395 if (shouldPaintMask)
3334 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti ngRootForRenderer); 3396 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti ngRootForRenderer);
3335 3397
3336 if (shouldPaintClippingMask) { 3398 if (shouldPaintClippingMask) {
3337 // Paint the border radius mask for the fragments. 3399 // Paint the border radius mask for the fragments.
3338 paintChildClippingMaskForFragments(layerFragments, context, localPaintin gInfo, paintingRootForRenderer); 3400 paintChildClippingMaskForFragments(layerFragments, context, localPaintin gInfo, paintingRootForRenderer);
3339 } 3401 }
3340 3402
3341 // End our transparency layer 3403 // End our transparency layer
3342 if (haveTransparency && m_usedTransparency && !m_paintingInsideReflection) { 3404 if ((haveTransparency || hasBlendMode() || createTransparencyLayerForBlendMo de) && m_usedTransparency && !m_paintingInsideReflection) {
3343 context->endLayer(); 3405 context->endLayer();
3344 context->restore(); 3406 context->restore();
3345 m_usedTransparency = false; 3407 m_usedTransparency = false;
3346 } 3408 }
3347 3409
3348 if (resourceClipper) 3410 if (resourceClipper)
3349 resourceClipper->postApplyResource(renderer(), context, ApplyToDefaultMo de, 0, 0); 3411 resourceClipper->postApplyResource(renderer(), context, ApplyToDefaultMo de, 0, 0);
3350 3412
3351 if (hasClipPath) 3413 if (hasClipPath)
3352 context->restore(); 3414 context->restore();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
3517 void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, 3579 void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext,
3518 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 3580 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior,
3519 RenderObject* paintingRootForRenderer) 3581 RenderObject* paintingRootForRenderer)
3520 { 3582 {
3521 for (size_t i = 0; i < layerFragments.size(); ++i) { 3583 for (size_t i = 0; i < layerFragments.size(); ++i) {
3522 const LayerFragment& fragment = layerFragments.at(i); 3584 const LayerFragment& fragment = layerFragments.at(i);
3523 if (!fragment.shouldPaintContent) 3585 if (!fragment.shouldPaintContent)
3524 continue; 3586 continue;
3525 3587
3526 // Begin transparency layers lazily now that we know we have to paint so mething. 3588 // Begin transparency layers lazily now that we know we have to paint so mething.
3527 if (haveTransparency) 3589 if (haveTransparency || hasBlendMode())
3528 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo. rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior); 3590 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo. rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior);
3529 3591
3530 if (localPaintingInfo.clipToDirtyRect) { 3592 if (localPaintingInfo.clipToDirtyRect) {
3531 // Paint our background first, before painting any child layers. 3593 // Paint our background first, before painting any child layers.
3532 // Establish the clip used to paint our background. 3594 // Establish the clip used to paint our background.
3533 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Bac kground painting will handle clipping to self. 3595 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Bac kground painting will handle clipping to self.
3534 } 3596 }
3535 3597
3536 // Paint the background. 3598 // Paint the background.
3537 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 3599 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
3538 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, loc alPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); 3600 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, loc alPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());
3539 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation)); 3601 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation));
3540 3602
3541 if (localPaintingInfo.clipToDirtyRect) 3603 if (localPaintingInfo.clipToDirtyRect)
3542 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect); 3604 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect);
3543 } 3605 }
3544 } 3606 }
3545 3607
3546 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, 3608 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext,
3547 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 3609 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior,
3548 RenderObject* paintingRootForRenderer, bool selectionOnly, bool forceBlackTe xt) 3610 RenderObject* paintingRootForRenderer, bool selectionOnly, bool forceBlackTe xt)
3549 { 3611 {
3550 // Begin transparency if we have something to paint. 3612 // Begin transparency if we have something to paint.
3551 if (haveTransparency) { 3613 if (haveTransparency || hasBlendMode()) {
3552 for (size_t i = 0; i < layerFragments.size(); ++i) { 3614 for (size_t i = 0; i < layerFragments.size(); ++i) {
3553 const LayerFragment& fragment = layerFragments.at(i); 3615 const LayerFragment& fragment = layerFragments.at(i);
3554 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty( )) { 3616 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty( )) {
3555 beginTransparencyLayers(transparencyLayerContext, localPaintingI nfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior); 3617 beginTransparencyLayers(transparencyLayerContext, localPaintingI nfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior);
3556 break; 3618 break;
3557 } 3619 }
3558 } 3620 }
3559 } 3621 }
3560 3622
3561 PaintBehavior localPaintBehavior = forceBlackText ? (PaintBehavior)PaintBeha viorForceBlackText : paintBehavior; 3623 PaintBehavior localPaintBehavior = forceBlackText ? (PaintBehavior)PaintBeha viorForceBlackText : paintBehavior;
(...skipping 2459 matching lines...) Expand 10 before | Expand all | Expand 10 after
6021 } 6083 }
6022 } 6084 }
6023 6085
6024 void showLayerTree(const WebCore::RenderObject* renderer) 6086 void showLayerTree(const WebCore::RenderObject* renderer)
6025 { 6087 {
6026 if (!renderer) 6088 if (!renderer)
6027 return; 6089 return;
6028 showLayerTree(renderer->enclosingLayer()); 6090 showLayerTree(renderer->enclosingLayer());
6029 } 6091 }
6030 #endif 6092 #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