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

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: 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
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;
826 BlendMode newBlendMode = renderer()->style()->blendMode(); 829 BlendMode newBlendMode = renderer()->style()->blendMode();
827 if (newBlendMode != m_blendMode) { 830 if (newBlendMode != m_blendMode) {
828 m_blendMode = newBlendMode; 831 m_blendMode = newBlendMode;
832
833 // Only update the flag if a blend mode is set or unset.
834 if (!hadBlendMode || !hasBlendMode())
835 dirtyAncestorChainBlendedDescendantStatus();
836
829 if (backing()) 837 if (backing())
830 backing()->setBlendMode(newBlendMode); 838 backing()->setBlendMode(newBlendMode);
831 } 839 }
832 } 840 }
833 841
834 void RenderLayer::updateTransform() 842 void RenderLayer::updateTransform()
835 { 843 {
836 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set, 844 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set,
837 // so check style too. 845 // so check style too.
838 bool hasTransform = renderer()->hasTransform() && renderer()->style()->hasTr ansform(); 846 bool hasTransform = renderer()->hasTransform() && renderer()->style()->hasTr ansform();
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 { 1059 {
1052 for (RenderLayer* layer = this; layer; layer = layer->parent()) { 1060 for (RenderLayer* layer = this; layer; layer = layer->parent()) {
1053 if (!layer->m_visibleDescendantStatusDirty && layer->hasVisibleDescendan t()) 1061 if (!layer->m_visibleDescendantStatusDirty && layer->hasVisibleDescendan t())
1054 break; 1062 break;
1055 1063
1056 layer->m_hasVisibleDescendant = true; 1064 layer->m_hasVisibleDescendant = true;
1057 layer->m_visibleDescendantStatusDirty = false; 1065 layer->m_visibleDescendantStatusDirty = false;
1058 } 1066 }
1059 } 1067 }
1060 1068
1069 void RenderLayer::dirtyAncestorChainBlendedDescendantStatus()
1070 {
1071 for (RenderLayer* layer = this; layer; layer = layer->parent()) {
1072 if (layer->m_childLayerHasBlendModeStatusDirty)
1073 break;
1074
1075 layer->m_childLayerHasBlendModeStatusDirty = true;
1076
1077 if (layer->isStackingContext())
1078 break;
1079 }
1080 }
1081
1082 void RenderLayer::setAncestorChainBlendedDescendant()
1083 {
1084 for (RenderLayer* layer = this; layer; layer = layer->parent()) {
1085 if (!layer->m_childLayerHasBlendModeStatusDirty && layer->childLayerHasB lendMode())
1086 break;
1087
1088 layer->m_childLayerHasBlendMode = true;
1089 layer->m_childLayerHasBlendModeStatusDirty = false;
1090
1091 if (layer->isStackingContext())
1092 break;
1093 }
1094 }
1095
1061 void RenderLayer::updateHasUnclippedDescendant() 1096 void RenderLayer::updateHasUnclippedDescendant()
1062 { 1097 {
1063 TRACE_EVENT0("blink_rendering", "RenderLayer::updateHasUnclippedDescendant") ; 1098 TRACE_EVENT0("blink_rendering", "RenderLayer::updateHasUnclippedDescendant") ;
1064 ASSERT(renderer()->isOutOfFlowPositioned()); 1099 ASSERT(renderer()->isOutOfFlowPositioned());
1065 if (!m_hasVisibleContent && !m_hasVisibleDescendant) 1100 if (!m_hasVisibleContent && !m_hasVisibleDescendant)
1066 return; 1101 return;
1067 1102
1068 FrameView* frameView = renderer()->view()->frameView(); 1103 FrameView* frameView = renderer()->view()->frameView();
1069 if (!frameView) 1104 if (!frameView)
1070 return; 1105 return;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 1145
1111 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && ha sOutOfFlowPositionedDescendant) 1146 if (m_hasVisibleDescendant && m_hasSelfPaintingLayerDescendant && ha sOutOfFlowPositionedDescendant)
1112 break; 1147 break;
1113 } 1148 }
1114 1149
1115 m_visibleDescendantStatusDirty = false; 1150 m_visibleDescendantStatusDirty = false;
1116 m_hasSelfPaintingLayerDescendantDirty = false; 1151 m_hasSelfPaintingLayerDescendantDirty = false;
1117 m_hasOutOfFlowPositionedDescendantDirty = false; 1152 m_hasOutOfFlowPositionedDescendantDirty = false;
1118 } 1153 }
1119 1154
1155 if (m_childLayerHasBlendModeStatusDirty) {
1156 for (RenderLayer* child = firstChild(); child; child = child->nextSiblin g()) {
1157 child->updateDescendantDependentFlags();
1158 if (child->hasBlendMode() || child->isStackingContext())
1159 break;
1160
1161 bool childLayerHasBlendMode = child->hasBlendMode() || child->m_chil dLayerHasBlendMode;
1162 m_childLayerHasBlendMode |= childLayerHasBlendMode;
Julien - ping for review 2013/10/03 21:38:28 Normally we bail out if m_childLayerHasBlendMode b
mitica 2013/10/07 10:56:03 Good point, I've modified this function to break a
1163 }
1164 m_childLayerHasBlendModeStatusDirty = false;
1165 }
1166
1120 if (m_visibleContentStatusDirty) { 1167 if (m_visibleContentStatusDirty) {
1121 if (renderer()->style()->visibility() == VISIBLE) 1168 if (renderer()->style()->visibility() == VISIBLE)
1122 m_hasVisibleContent = true; 1169 m_hasVisibleContent = true;
1123 else { 1170 else {
1124 // layer may be hidden but still have some visible content, check fo r this 1171 // layer may be hidden but still have some visible content, check fo r this
1125 m_hasVisibleContent = false; 1172 m_hasVisibleContent = false;
1126 RenderObject* r = renderer()->firstChild(); 1173 RenderObject* r = renderer()->firstChild();
1127 while (r) { 1174 while (r) {
1128 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { 1175 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) {
1129 m_hasVisibleContent = true; 1176 m_hasVisibleContent = true;
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 return clipRect; 1732 return clipRect;
1686 } 1733 }
1687 1734
1688 LayoutRect RenderLayer::paintingExtent(const RenderLayer* rootLayer, const Layou tRect& paintDirtyRect, PaintBehavior paintBehavior) 1735 LayoutRect RenderLayer::paintingExtent(const RenderLayer* rootLayer, const Layou tRect& paintDirtyRect, PaintBehavior paintBehavior)
1689 { 1736 {
1690 return intersection(transparencyClipBox(this, rootLayer, PaintingTransparenc yClipBox, RootOfTransparencyClipBox, paintBehavior), paintDirtyRect); 1737 return intersection(transparencyClipBox(this, rootLayer, PaintingTransparenc yClipBox, RootOfTransparencyClipBox, paintBehavior), paintDirtyRect);
1691 } 1738 }
1692 1739
1693 void RenderLayer::beginTransparencyLayers(GraphicsContext* context, const Render Layer* rootLayer, const LayoutRect& paintDirtyRect, PaintBehavior paintBehavior) 1740 void RenderLayer::beginTransparencyLayers(GraphicsContext* context, const Render Layer* rootLayer, const LayoutRect& paintDirtyRect, PaintBehavior paintBehavior)
1694 { 1741 {
1695 if (context->paintingDisabled() || (paintsWithTransparency(paintBehavior) && m_usedTransparency)) 1742 bool createTransparencyLayerForBlendMode = isStackingContext() && m_childLay erHasBlendMode;
1743 if (context->paintingDisabled() || ((paintsWithTransparency(paintBehavior) | | hasBlendMode() || createTransparencyLayerForBlendMode) && m_usedTransparency))
1696 return; 1744 return;
1697 1745
1698 RenderLayer* ancestor = transparentPaintingAncestor(); 1746 RenderLayer* ancestor = transparentPaintingAncestor();
1699 if (ancestor) 1747 if (ancestor)
1700 ancestor->beginTransparencyLayers(context, rootLayer, paintDirtyRect, pa intBehavior); 1748 ancestor->beginTransparencyLayers(context, rootLayer, paintDirtyRect, pa intBehavior);
1701 1749
1702 if (paintsWithTransparency(paintBehavior)) { 1750 if (paintsWithTransparency(paintBehavior) || hasBlendMode() || createTranspa rencyLayerForBlendMode) {
1703 m_usedTransparency = true; 1751 m_usedTransparency = true;
1704 context->save(); 1752 context->save();
1705 LayoutRect clipRect = paintingExtent(rootLayer, paintDirtyRect, paintBeh avior); 1753 LayoutRect clipRect = paintingExtent(rootLayer, paintDirtyRect, paintBeh avior);
1706 context->clip(clipRect); 1754 context->clip(clipRect);
1755 if (hasBlendMode())
1756 context->setCompositeOperation(context->compositeOperation(), m_blen dMode);
1757
1707 context->beginTransparencyLayer(renderer()->opacity()); 1758 context->beginTransparencyLayer(renderer()->opacity());
1708 #ifdef REVEAL_TRANSPARENCY_LAYERS 1759 #ifdef REVEAL_TRANSPARENCY_LAYERS
1709 context->setFillColor(Color(0.0f, 0.0f, 0.5f, 0.2f)); 1760 context->setFillColor(Color(0.0f, 0.0f, 0.5f, 0.2f));
1710 context->fillRect(clipRect); 1761 context->fillRect(clipRect);
1711 #endif 1762 #endif
1712 } 1763 }
1713 } 1764 }
1714 1765
1715 void* RenderLayer::operator new(size_t sz) 1766 void* RenderLayer::operator new(size_t sz)
1716 { 1767 {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 child->dirtyStackingContainerZOrderLists(); 1802 child->dirtyStackingContainerZOrderLists();
1752 } 1803 }
1753 1804
1754 child->updateDescendantDependentFlags(); 1805 child->updateDescendantDependentFlags();
1755 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) 1806 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant)
1756 setAncestorChainHasVisibleDescendant(); 1807 setAncestorChainHasVisibleDescendant();
1757 1808
1758 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) 1809 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant())
1759 setAncestorChainHasSelfPaintingLayerDescendant(); 1810 setAncestorChainHasSelfPaintingLayerDescendant();
1760 1811
1812 if (child->hasBlendMode() || child->childLayerHasBlendMode())
1813 setAncestorChainBlendedDescendant();
1814
1761 if (subtreeContainsOutOfFlowPositionedLayer(child)) { 1815 if (subtreeContainsOutOfFlowPositionedLayer(child)) {
1762 // Now that the out of flow positioned descendant is in the tree, we 1816 // Now that the out of flow positioned descendant is in the tree, we
1763 // need to tell the compositor to reevaluate the compositing 1817 // need to tell the compositor to reevaluate the compositing
1764 // requirements since we may be able to mark more layers as having 1818 // requirements since we may be able to mark more layers as having
1765 // an 'unclipped' descendant. 1819 // an 'unclipped' descendant.
1766 compositor()->setNeedsUpdateCompositingRequirementsState(); 1820 compositor()->setNeedsUpdateCompositingRequirementsState();
1767 setAncestorChainHasOutOfFlowPositionedDescendant(); 1821 setAncestorChainHasOutOfFlowPositionedDescendant();
1768 } 1822 }
1769 1823
1770 // When we first dirty a layer, we will also dirty all the siblings in that 1824 // 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(); 1866 compositor()->setNeedsUpdateCompositingRequirementsState();
1813 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); 1867 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus();
1814 } 1868 }
1815 1869
1816 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) 1870 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant)
1817 dirtyAncestorChainVisibleDescendantStatus(); 1871 dirtyAncestorChainVisibleDescendantStatus();
1818 1872
1819 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant()) 1873 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend ant())
1820 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); 1874 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
1821 1875
1876 if (oldChild->hasBlendMode() || oldChild->childLayerHasBlendMode())
1877 dirtyAncestorChainBlendedDescendantStatus();
1878
1822 return oldChild; 1879 return oldChild;
1823 } 1880 }
1824 1881
1825 void RenderLayer::removeOnlyThisLayer() 1882 void RenderLayer::removeOnlyThisLayer()
1826 { 1883 {
1827 if (!m_parent) 1884 if (!m_parent)
1828 return; 1885 return;
1829 1886
1830 // Mark that we are about to lose our layer. This makes render tree 1887 // Mark that we are about to lose our layer. This makes render tree
1831 // walks ignore this layer while we're removing it. 1888 // walks ignore this layer while we're removing it.
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after
3211 3268
3212 resourceClipper = toRenderSVGResourceClipper(element->renderer() ->toRenderSVGResourceContainer()); 3269 resourceClipper = toRenderSVGResourceClipper(element->renderer() ->toRenderSVGResourceContainer());
3213 if (!resourceClipper->applyClippingToContext(renderer(), rootRel ativeBounds, paintingInfo.paintDirtyRect, context)) { 3270 if (!resourceClipper->applyClippingToContext(renderer(), rootRel ativeBounds, paintingInfo.paintDirtyRect, context)) {
3214 // No need to post-apply the clipper if this failed. 3271 // No need to post-apply the clipper if this failed.
3215 resourceClipper = 0; 3272 resourceClipper = 0;
3216 } 3273 }
3217 } 3274 }
3218 } 3275 }
3219 } 3276 }
3220 3277
3278 // Blending operations must be performed only with the nearest ancestor stac king context.
3279 bool createTransparencyLayerForBlendMode = isStackingContext() && m_childLay erHasBlendMode;
3280
3281 if (createTransparencyLayerForBlendMode)
3282 beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.pa intDirtyRect, paintingInfo.paintBehavior);
3283
3221 LayerPaintingInfo localPaintingInfo(paintingInfo); 3284 LayerPaintingInfo localPaintingInfo(paintingInfo);
3222 FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilte rs()); 3285 FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilte rs());
3223 if (filterPainter.haveFilterEffect() && !context->paintingDisabled()) { 3286 if (filterPainter.haveFilterEffect() && !context->paintingDisabled()) {
3224 RenderLayerFilterInfo* filterInfo = this->filterInfo(); 3287 RenderLayerFilterInfo* filterInfo = this->filterInfo();
3225 ASSERT(filterInfo); 3288 ASSERT(filterInfo);
3226 LayoutRect filterRepaintRect = filterInfo->dirtySourceRect(); 3289 LayoutRect filterRepaintRect = filterInfo->dirtySourceRect();
3227 filterRepaintRect.move(offsetFromRoot.x(), offsetFromRoot.y()); 3290 filterRepaintRect.move(offsetFromRoot.x(), offsetFromRoot.y());
3228 3291
3229 if (!rootRelativeBoundsComputed) { 3292 if (!rootRelativeBoundsComputed) {
3230 rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, &o ffsetFromRoot, 0); 3293 rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, &o ffsetFromRoot, 0);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
3332 3395
3333 if (shouldPaintMask) 3396 if (shouldPaintMask)
3334 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti ngRootForRenderer); 3397 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti ngRootForRenderer);
3335 3398
3336 if (shouldPaintClippingMask) { 3399 if (shouldPaintClippingMask) {
3337 // Paint the border radius mask for the fragments. 3400 // Paint the border radius mask for the fragments.
3338 paintChildClippingMaskForFragments(layerFragments, context, localPaintin gInfo, paintingRootForRenderer); 3401 paintChildClippingMaskForFragments(layerFragments, context, localPaintin gInfo, paintingRootForRenderer);
3339 } 3402 }
3340 3403
3341 // End our transparency layer 3404 // End our transparency layer
3342 if (haveTransparency && m_usedTransparency && !m_paintingInsideReflection) { 3405 if ((haveTransparency || hasBlendMode() || createTransparencyLayerForBlendMo de) && m_usedTransparency && !m_paintingInsideReflection) {
3343 context->endLayer(); 3406 context->endLayer();
3344 context->restore(); 3407 context->restore();
3345 m_usedTransparency = false; 3408 m_usedTransparency = false;
3346 } 3409 }
3347 3410
3348 if (resourceClipper) 3411 if (resourceClipper)
3349 resourceClipper->postApplyResource(renderer(), context, ApplyToDefaultMo de, 0, 0); 3412 resourceClipper->postApplyResource(renderer(), context, ApplyToDefaultMo de, 0, 0);
3350 3413
3351 if (hasClipPath) 3414 if (hasClipPath)
3352 context->restore(); 3415 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, 3580 void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext,
3518 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 3581 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior,
3519 RenderObject* paintingRootForRenderer) 3582 RenderObject* paintingRootForRenderer)
3520 { 3583 {
3521 for (size_t i = 0; i < layerFragments.size(); ++i) { 3584 for (size_t i = 0; i < layerFragments.size(); ++i) {
3522 const LayerFragment& fragment = layerFragments.at(i); 3585 const LayerFragment& fragment = layerFragments.at(i);
3523 if (!fragment.shouldPaintContent) 3586 if (!fragment.shouldPaintContent)
3524 continue; 3587 continue;
3525 3588
3526 // Begin transparency layers lazily now that we know we have to paint so mething. 3589 // Begin transparency layers lazily now that we know we have to paint so mething.
3527 if (haveTransparency) 3590 if (haveTransparency || hasBlendMode())
3528 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo. rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior); 3591 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo. rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior);
3529 3592
3530 if (localPaintingInfo.clipToDirtyRect) { 3593 if (localPaintingInfo.clipToDirtyRect) {
3531 // Paint our background first, before painting any child layers. 3594 // Paint our background first, before painting any child layers.
3532 // Establish the clip used to paint our background. 3595 // 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. 3596 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Bac kground painting will handle clipping to self.
3534 } 3597 }
3535 3598
3536 // Paint the background. 3599 // Paint the background.
3537 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 3600 // 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()); 3601 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)); 3602 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation));
3540 3603
3541 if (localPaintingInfo.clipToDirtyRect) 3604 if (localPaintingInfo.clipToDirtyRect)
3542 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect); 3605 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect);
3543 } 3606 }
3544 } 3607 }
3545 3608
3546 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, 3609 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext,
3547 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 3610 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior,
3548 RenderObject* paintingRootForRenderer, bool selectionOnly, bool forceBlackTe xt) 3611 RenderObject* paintingRootForRenderer, bool selectionOnly, bool forceBlackTe xt)
3549 { 3612 {
3550 // Begin transparency if we have something to paint. 3613 // Begin transparency if we have something to paint.
3551 if (haveTransparency) { 3614 if (haveTransparency || hasBlendMode()) {
3552 for (size_t i = 0; i < layerFragments.size(); ++i) { 3615 for (size_t i = 0; i < layerFragments.size(); ++i) {
3553 const LayerFragment& fragment = layerFragments.at(i); 3616 const LayerFragment& fragment = layerFragments.at(i);
3554 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty( )) { 3617 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty( )) {
3555 beginTransparencyLayers(transparencyLayerContext, localPaintingI nfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior); 3618 beginTransparencyLayers(transparencyLayerContext, localPaintingI nfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior);
3556 break; 3619 break;
3557 } 3620 }
3558 } 3621 }
3559 } 3622 }
3560 3623
3561 PaintBehavior localPaintBehavior = forceBlackText ? (PaintBehavior)PaintBeha viorForceBlackText : paintBehavior; 3624 PaintBehavior localPaintBehavior = forceBlackText ? (PaintBehavior)PaintBeha viorForceBlackText : paintBehavior;
(...skipping 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after
5623 removeReflection(); 5686 removeReflection();
5624 else if (hasReflection()) { 5687 else if (hasReflection()) {
5625 if (!m_reflection) 5688 if (!m_reflection)
5626 createReflection(); 5689 createReflection();
5627 UseCounter::count(&renderer()->document(), UseCounter::Reflection); 5690 UseCounter::count(&renderer()->document(), UseCounter::Reflection);
5628 updateReflectionStyle(); 5691 updateReflectionStyle();
5629 } 5692 }
5630 5693
5631 updateResizerStyle(); 5694 updateResizerStyle();
5632 5695
5696 if (RuntimeEnabledFeatures::cssCompositingEnabled())
5697 updateBlendMode();
5698
5633 updateDescendantDependentFlags(); 5699 updateDescendantDependentFlags();
5634 updateTransform(); 5700 updateTransform();
5635 5701
5636 if (RuntimeEnabledFeatures::cssCompositingEnabled())
5637 updateBlendMode();
5638
5639 bool didPaintWithFilters = false; 5702 bool didPaintWithFilters = false;
5640 5703
5641 if (paintsWithFilters()) 5704 if (paintsWithFilters())
5642 didPaintWithFilters = true; 5705 didPaintWithFilters = true;
5643 updateFilters(oldStyle, renderer()->style()); 5706 updateFilters(oldStyle, renderer()->style());
5644 5707
5645 const RenderStyle* newStyle = renderer()->style(); 5708 const RenderStyle* newStyle = renderer()->style();
5646 if (compositor()->updateLayerCompositingState(this) 5709 if (compositor()->updateLayerCompositingState(this)
5647 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) 5710 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle)
5648 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) 5711 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle)
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
6021 } 6084 }
6022 } 6085 }
6023 6086
6024 void showLayerTree(const WebCore::RenderObject* renderer) 6087 void showLayerTree(const WebCore::RenderObject* renderer)
6025 { 6088 {
6026 if (!renderer) 6089 if (!renderer)
6027 return; 6090 return;
6028 showLayerTree(renderer->enclosingLayer()); 6091 showLayerTree(renderer->enclosingLayer());
6029 } 6092 }
6030 #endif 6093 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698