OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 Loading... |
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 if (!child->isStackingContext()) |
| 1158 child->updateDescendantDependentFlags(); |
| 1159 |
| 1160 bool childLayerHasBlendMode = child->hasBlendMode() || (child->m_chi
ldLayerHasBlendMode && !child->isStackingContext()); |
| 1161 m_childLayerHasBlendMode |= childLayerHasBlendMode; |
| 1162 |
| 1163 if (m_childLayerHasBlendMode) |
| 1164 break; |
| 1165 } |
| 1166 m_childLayerHasBlendModeStatusDirty = false; |
| 1167 } |
| 1168 |
1120 if (m_visibleContentStatusDirty) { | 1169 if (m_visibleContentStatusDirty) { |
1121 if (renderer()->style()->visibility() == VISIBLE) | 1170 if (renderer()->style()->visibility() == VISIBLE) |
1122 m_hasVisibleContent = true; | 1171 m_hasVisibleContent = true; |
1123 else { | 1172 else { |
1124 // layer may be hidden but still have some visible content, check fo
r this | 1173 // layer may be hidden but still have some visible content, check fo
r this |
1125 m_hasVisibleContent = false; | 1174 m_hasVisibleContent = false; |
1126 RenderObject* r = renderer()->firstChild(); | 1175 RenderObject* r = renderer()->firstChild(); |
1127 while (r) { | 1176 while (r) { |
1128 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { | 1177 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { |
1129 m_hasVisibleContent = true; | 1178 m_hasVisibleContent = true; |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1685 return clipRect; | 1734 return clipRect; |
1686 } | 1735 } |
1687 | 1736 |
1688 LayoutRect RenderLayer::paintingExtent(const RenderLayer* rootLayer, const Layou
tRect& paintDirtyRect, PaintBehavior paintBehavior) | 1737 LayoutRect RenderLayer::paintingExtent(const RenderLayer* rootLayer, const Layou
tRect& paintDirtyRect, PaintBehavior paintBehavior) |
1689 { | 1738 { |
1690 return intersection(transparencyClipBox(this, rootLayer, PaintingTransparenc
yClipBox, RootOfTransparencyClipBox, paintBehavior), paintDirtyRect); | 1739 return intersection(transparencyClipBox(this, rootLayer, PaintingTransparenc
yClipBox, RootOfTransparencyClipBox, paintBehavior), paintDirtyRect); |
1691 } | 1740 } |
1692 | 1741 |
1693 void RenderLayer::beginTransparencyLayers(GraphicsContext* context, const Render
Layer* rootLayer, const LayoutRect& paintDirtyRect, PaintBehavior paintBehavior) | 1742 void RenderLayer::beginTransparencyLayers(GraphicsContext* context, const Render
Layer* rootLayer, const LayoutRect& paintDirtyRect, PaintBehavior paintBehavior) |
1694 { | 1743 { |
1695 if (context->paintingDisabled() || (paintsWithTransparency(paintBehavior) &&
m_usedTransparency)) | 1744 bool createTransparencyLayerForBlendMode = isStackingContext() && m_childLay
erHasBlendMode; |
| 1745 if (context->paintingDisabled() || ((paintsWithTransparency(paintBehavior) |
| hasBlendMode() || createTransparencyLayerForBlendMode) && m_usedTransparency)) |
1696 return; | 1746 return; |
1697 | 1747 |
1698 RenderLayer* ancestor = transparentPaintingAncestor(); | 1748 RenderLayer* ancestor = transparentPaintingAncestor(); |
1699 if (ancestor) | 1749 if (ancestor) |
1700 ancestor->beginTransparencyLayers(context, rootLayer, paintDirtyRect, pa
intBehavior); | 1750 ancestor->beginTransparencyLayers(context, rootLayer, paintDirtyRect, pa
intBehavior); |
1701 | 1751 |
1702 if (paintsWithTransparency(paintBehavior)) { | 1752 if (paintsWithTransparency(paintBehavior) || hasBlendMode() || createTranspa
rencyLayerForBlendMode) { |
1703 m_usedTransparency = true; | 1753 m_usedTransparency = true; |
1704 context->save(); | 1754 context->save(); |
1705 LayoutRect clipRect = paintingExtent(rootLayer, paintDirtyRect, paintBeh
avior); | 1755 LayoutRect clipRect = paintingExtent(rootLayer, paintDirtyRect, paintBeh
avior); |
1706 context->clip(clipRect); | 1756 context->clip(clipRect); |
| 1757 if (hasBlendMode()) |
| 1758 context->setCompositeOperation(context->compositeOperation(), m_blen
dMode); |
| 1759 |
1707 context->beginTransparencyLayer(renderer()->opacity()); | 1760 context->beginTransparencyLayer(renderer()->opacity()); |
1708 #ifdef REVEAL_TRANSPARENCY_LAYERS | 1761 #ifdef REVEAL_TRANSPARENCY_LAYERS |
1709 context->setFillColor(Color(0.0f, 0.0f, 0.5f, 0.2f)); | 1762 context->setFillColor(Color(0.0f, 0.0f, 0.5f, 0.2f)); |
1710 context->fillRect(clipRect); | 1763 context->fillRect(clipRect); |
1711 #endif | 1764 #endif |
1712 } | 1765 } |
1713 } | 1766 } |
1714 | 1767 |
1715 void* RenderLayer::operator new(size_t sz) | 1768 void* RenderLayer::operator new(size_t sz) |
1716 { | 1769 { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1751 child->dirtyStackingContainerZOrderLists(); | 1804 child->dirtyStackingContainerZOrderLists(); |
1752 } | 1805 } |
1753 | 1806 |
1754 child->updateDescendantDependentFlags(); | 1807 child->updateDescendantDependentFlags(); |
1755 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) | 1808 if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) |
1756 setAncestorChainHasVisibleDescendant(); | 1809 setAncestorChainHasVisibleDescendant(); |
1757 | 1810 |
1758 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) | 1811 if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) |
1759 setAncestorChainHasSelfPaintingLayerDescendant(); | 1812 setAncestorChainHasSelfPaintingLayerDescendant(); |
1760 | 1813 |
| 1814 if (child->hasBlendMode() || child->childLayerHasBlendMode()) |
| 1815 setAncestorChainBlendedDescendant(); |
| 1816 |
1761 if (subtreeContainsOutOfFlowPositionedLayer(child)) { | 1817 if (subtreeContainsOutOfFlowPositionedLayer(child)) { |
1762 // Now that the out of flow positioned descendant is in the tree, we | 1818 // Now that the out of flow positioned descendant is in the tree, we |
1763 // need to tell the compositor to reevaluate the compositing | 1819 // need to tell the compositor to reevaluate the compositing |
1764 // requirements since we may be able to mark more layers as having | 1820 // requirements since we may be able to mark more layers as having |
1765 // an 'unclipped' descendant. | 1821 // an 'unclipped' descendant. |
1766 compositor()->setNeedsUpdateCompositingRequirementsState(); | 1822 compositor()->setNeedsUpdateCompositingRequirementsState(); |
1767 setAncestorChainHasOutOfFlowPositionedDescendant(); | 1823 setAncestorChainHasOutOfFlowPositionedDescendant(); |
1768 } | 1824 } |
1769 | 1825 |
1770 // When we first dirty a layer, we will also dirty all the siblings in that | 1826 // 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 Loading... |
1812 compositor()->setNeedsUpdateCompositingRequirementsState(); | 1868 compositor()->setNeedsUpdateCompositingRequirementsState(); |
1813 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); | 1869 dirtyAncestorChainHasOutOfFlowPositionedDescendantStatus(); |
1814 } | 1870 } |
1815 | 1871 |
1816 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) | 1872 if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant) |
1817 dirtyAncestorChainVisibleDescendantStatus(); | 1873 dirtyAncestorChainVisibleDescendantStatus(); |
1818 | 1874 |
1819 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend
ant()) | 1875 if (oldChild->isSelfPaintingLayer() || oldChild->hasSelfPaintingLayerDescend
ant()) |
1820 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 1876 dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
1821 | 1877 |
| 1878 if (oldChild->hasBlendMode() || oldChild->childLayerHasBlendMode()) |
| 1879 dirtyAncestorChainBlendedDescendantStatus(); |
| 1880 |
1822 return oldChild; | 1881 return oldChild; |
1823 } | 1882 } |
1824 | 1883 |
1825 void RenderLayer::removeOnlyThisLayer() | 1884 void RenderLayer::removeOnlyThisLayer() |
1826 { | 1885 { |
1827 if (!m_parent) | 1886 if (!m_parent) |
1828 return; | 1887 return; |
1829 | 1888 |
1830 // Mark that we are about to lose our layer. This makes render tree | 1889 // Mark that we are about to lose our layer. This makes render tree |
1831 // walks ignore this layer while we're removing it. | 1890 // walks ignore this layer while we're removing it. |
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3211 | 3270 |
3212 resourceClipper = toRenderSVGResourceClipper(element->renderer()
->toRenderSVGResourceContainer()); | 3271 resourceClipper = toRenderSVGResourceClipper(element->renderer()
->toRenderSVGResourceContainer()); |
3213 if (!resourceClipper->applyClippingToContext(renderer(), rootRel
ativeBounds, paintingInfo.paintDirtyRect, context)) { | 3272 if (!resourceClipper->applyClippingToContext(renderer(), rootRel
ativeBounds, paintingInfo.paintDirtyRect, context)) { |
3214 // No need to post-apply the clipper if this failed. | 3273 // No need to post-apply the clipper if this failed. |
3215 resourceClipper = 0; | 3274 resourceClipper = 0; |
3216 } | 3275 } |
3217 } | 3276 } |
3218 } | 3277 } |
3219 } | 3278 } |
3220 | 3279 |
| 3280 // Blending operations must be performed only with the nearest ancestor stac
king context. |
| 3281 bool createTransparencyLayerForBlendMode = isStackingContext() && m_childLay
erHasBlendMode; |
| 3282 |
| 3283 if (createTransparencyLayerForBlendMode) |
| 3284 beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.pa
intDirtyRect, paintingInfo.paintBehavior); |
| 3285 |
3221 LayerPaintingInfo localPaintingInfo(paintingInfo); | 3286 LayerPaintingInfo localPaintingInfo(paintingInfo); |
3222 FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilte
rs()); | 3287 FilterEffectRendererHelper filterPainter(filterRenderer() && paintsWithFilte
rs()); |
3223 if (filterPainter.haveFilterEffect() && !context->paintingDisabled()) { | 3288 if (filterPainter.haveFilterEffect() && !context->paintingDisabled()) { |
3224 RenderLayerFilterInfo* filterInfo = this->filterInfo(); | 3289 RenderLayerFilterInfo* filterInfo = this->filterInfo(); |
3225 ASSERT(filterInfo); | 3290 ASSERT(filterInfo); |
3226 LayoutRect filterRepaintRect = filterInfo->dirtySourceRect(); | 3291 LayoutRect filterRepaintRect = filterInfo->dirtySourceRect(); |
3227 filterRepaintRect.move(offsetFromRoot.x(), offsetFromRoot.y()); | 3292 filterRepaintRect.move(offsetFromRoot.x(), offsetFromRoot.y()); |
3228 | 3293 |
3229 if (!rootRelativeBoundsComputed) { | 3294 if (!rootRelativeBoundsComputed) { |
3230 rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, &o
ffsetFromRoot, 0); | 3295 rootRelativeBounds = calculateLayerBounds(paintingInfo.rootLayer, &o
ffsetFromRoot, 0); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3332 | 3397 |
3333 if (shouldPaintMask) | 3398 if (shouldPaintMask) |
3334 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti
ngRootForRenderer); | 3399 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti
ngRootForRenderer); |
3335 | 3400 |
3336 if (shouldPaintClippingMask) { | 3401 if (shouldPaintClippingMask) { |
3337 // Paint the border radius mask for the fragments. | 3402 // Paint the border radius mask for the fragments. |
3338 paintChildClippingMaskForFragments(layerFragments, context, localPaintin
gInfo, paintingRootForRenderer); | 3403 paintChildClippingMaskForFragments(layerFragments, context, localPaintin
gInfo, paintingRootForRenderer); |
3339 } | 3404 } |
3340 | 3405 |
3341 // End our transparency layer | 3406 // End our transparency layer |
3342 if (haveTransparency && m_usedTransparency && !m_paintingInsideReflection) { | 3407 if ((haveTransparency || hasBlendMode() || createTransparencyLayerForBlendMo
de) && m_usedTransparency && !m_paintingInsideReflection) { |
3343 context->endLayer(); | 3408 context->endLayer(); |
3344 context->restore(); | 3409 context->restore(); |
3345 m_usedTransparency = false; | 3410 m_usedTransparency = false; |
3346 } | 3411 } |
3347 | 3412 |
3348 if (resourceClipper) | 3413 if (resourceClipper) |
3349 resourceClipper->postApplyResource(renderer(), context, ApplyToDefaultMo
de, 0, 0); | 3414 resourceClipper->postApplyResource(renderer(), context, ApplyToDefaultMo
de, 0, 0); |
3350 | 3415 |
3351 if (hasClipPath) | 3416 if (hasClipPath) |
3352 context->restore(); | 3417 context->restore(); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3517 void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragmen
ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, | 3582 void RenderLayer::paintBackgroundForFragments(const LayerFragments& layerFragmen
ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, |
3518 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L
ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, | 3583 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L
ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, |
3519 RenderObject* paintingRootForRenderer) | 3584 RenderObject* paintingRootForRenderer) |
3520 { | 3585 { |
3521 for (size_t i = 0; i < layerFragments.size(); ++i) { | 3586 for (size_t i = 0; i < layerFragments.size(); ++i) { |
3522 const LayerFragment& fragment = layerFragments.at(i); | 3587 const LayerFragment& fragment = layerFragments.at(i); |
3523 if (!fragment.shouldPaintContent) | 3588 if (!fragment.shouldPaintContent) |
3524 continue; | 3589 continue; |
3525 | 3590 |
3526 // Begin transparency layers lazily now that we know we have to paint so
mething. | 3591 // Begin transparency layers lazily now that we know we have to paint so
mething. |
3527 if (haveTransparency) | 3592 if (haveTransparency || hasBlendMode()) |
3528 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.
rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior); | 3593 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.
rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior); |
3529 | 3594 |
3530 if (localPaintingInfo.clipToDirtyRect) { | 3595 if (localPaintingInfo.clipToDirtyRect) { |
3531 // Paint our background first, before painting any child layers. | 3596 // Paint our background first, before painting any child layers. |
3532 // Establish the clip used to paint our background. | 3597 // 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. | 3598 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p
aintDirtyRect, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Bac
kground painting will handle clipping to self. |
3534 } | 3599 } |
3535 | 3600 |
3536 // Paint the background. | 3601 // Paint the background. |
3537 // FIXME: Eventually we will collect the region from the fragment itself
instead of just from the paint info. | 3602 // 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()); | 3603 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)); | 3604 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r
enderBoxLocation() + localPaintingInfo.subPixelAccumulation)); |
3540 | 3605 |
3541 if (localPaintingInfo.clipToDirtyRect) | 3606 if (localPaintingInfo.clipToDirtyRect) |
3542 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back
groundRect); | 3607 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back
groundRect); |
3543 } | 3608 } |
3544 } | 3609 } |
3545 | 3610 |
3546 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen
ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, | 3611 void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen
ts, GraphicsContext* context, GraphicsContext* transparencyLayerContext, |
3547 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L
ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, | 3612 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L
ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, |
3548 RenderObject* paintingRootForRenderer, bool selectionOnly, bool forceBlackTe
xt) | 3613 RenderObject* paintingRootForRenderer, bool selectionOnly, bool forceBlackTe
xt) |
3549 { | 3614 { |
3550 // Begin transparency if we have something to paint. | 3615 // Begin transparency if we have something to paint. |
3551 if (haveTransparency) { | 3616 if (haveTransparency || hasBlendMode()) { |
3552 for (size_t i = 0; i < layerFragments.size(); ++i) { | 3617 for (size_t i = 0; i < layerFragments.size(); ++i) { |
3553 const LayerFragment& fragment = layerFragments.at(i); | 3618 const LayerFragment& fragment = layerFragments.at(i); |
3554 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty(
)) { | 3619 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty(
)) { |
3555 beginTransparencyLayers(transparencyLayerContext, localPaintingI
nfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior); | 3620 beginTransparencyLayers(transparencyLayerContext, localPaintingI
nfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.paintBehavior); |
3556 break; | 3621 break; |
3557 } | 3622 } |
3558 } | 3623 } |
3559 } | 3624 } |
3560 | 3625 |
3561 PaintBehavior localPaintBehavior = forceBlackText ? (PaintBehavior)PaintBeha
viorForceBlackText : paintBehavior; | 3626 PaintBehavior localPaintBehavior = forceBlackText ? (PaintBehavior)PaintBeha
viorForceBlackText : paintBehavior; |
(...skipping 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5623 removeReflection(); | 5688 removeReflection(); |
5624 else if (hasReflection()) { | 5689 else if (hasReflection()) { |
5625 if (!m_reflection) | 5690 if (!m_reflection) |
5626 createReflection(); | 5691 createReflection(); |
5627 UseCounter::count(&renderer()->document(), UseCounter::Reflection); | 5692 UseCounter::count(&renderer()->document(), UseCounter::Reflection); |
5628 updateReflectionStyle(); | 5693 updateReflectionStyle(); |
5629 } | 5694 } |
5630 | 5695 |
5631 updateResizerStyle(); | 5696 updateResizerStyle(); |
5632 | 5697 |
| 5698 if (RuntimeEnabledFeatures::cssCompositingEnabled()) |
| 5699 updateBlendMode(); |
| 5700 |
5633 updateDescendantDependentFlags(); | 5701 updateDescendantDependentFlags(); |
5634 updateTransform(); | 5702 updateTransform(); |
5635 | 5703 |
5636 if (RuntimeEnabledFeatures::cssCompositingEnabled()) | |
5637 updateBlendMode(); | |
5638 | |
5639 bool didPaintWithFilters = false; | 5704 bool didPaintWithFilters = false; |
5640 | 5705 |
5641 if (paintsWithFilters()) | 5706 if (paintsWithFilters()) |
5642 didPaintWithFilters = true; | 5707 didPaintWithFilters = true; |
5643 updateFilters(oldStyle, renderer()->style()); | 5708 updateFilters(oldStyle, renderer()->style()); |
5644 | 5709 |
5645 const RenderStyle* newStyle = renderer()->style(); | 5710 const RenderStyle* newStyle = renderer()->style(); |
5646 if (compositor()->updateLayerCompositingState(this) | 5711 if (compositor()->updateLayerCompositingState(this) |
5647 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) | 5712 || needsCompositingLayersRebuiltForClip(oldStyle, newStyle) |
5648 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) | 5713 || needsCompositingLayersRebuiltForOverflow(oldStyle, newStyle) |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6021 } | 6086 } |
6022 } | 6087 } |
6023 | 6088 |
6024 void showLayerTree(const WebCore::RenderObject* renderer) | 6089 void showLayerTree(const WebCore::RenderObject* renderer) |
6025 { | 6090 { |
6026 if (!renderer) | 6091 if (!renderer) |
6027 return; | 6092 return; |
6028 showLayerTree(renderer->enclosingLayer()); | 6093 showLayerTree(renderer->enclosingLayer()); |
6029 } | 6094 } |
6030 #endif | 6095 #endif |
OLD | NEW |