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

Unified Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp

Issue 2564193002: [SPv2] Add CSS mix-blend-mode support (Closed)
Patch Set: fix msvc warning Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
index c60fd266c1d15a278ee85f5070a2bb1a1fb92523..d6842c36767e7f3e29447ce388f2d69f520308a7 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -368,6 +368,9 @@ void PaintPropertyTreeBuilder::updateEffect(
PaintPropertyTreeBuilderContext& context) {
const ComputedStyle& style = object.styleRef();
+ // TODO(crbug.com/673500): style.isStackingContext() is only meaningful for
+ // HTML elements. What we really want to ask is whether the element starts
+ // an isolated group, and SVGs use a different rule.
if (!style.isStackingContext()) {
if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) {
if (auto* properties = object.getMutableForPainting().paintProperties())
@@ -377,10 +380,26 @@ void PaintPropertyTreeBuilder::updateEffect(
}
// TODO(trchen): Can't omit effect node if we have 3D children.
- // TODO(trchen): Can't omit effect node if we have blending children.
if (object.needsPaintPropertyUpdate() || context.forceSubtreeUpdate) {
bool effectNodeNeeded = false;
+ // Can't omit effect node if we have paint children with exotic blending.
+ if (object.isSVG()) {
+ // Yes, including LayoutSVGRoot, because SVG layout objects don't create
+ // PaintLayer so PaintLayer::hasNonIsolatedDescendantWithBlendMode()
+ // doesn't catch SVG descendants.
+ if (object.hasNonIsolatedBlendingDescendants())
+ effectNodeNeeded = true;
+ } else if (PaintLayer* layer = toLayoutBoxModelObject(object).layer()) {
+ if (layer->hasNonIsolatedDescendantWithBlendMode())
+ effectNodeNeeded = true;
+ }
+
+ SkBlendMode blendMode =
+ WebCoreCompositeToSkiaComposite(CompositeSourceOver, style.blendMode());
+ if (blendMode != SkBlendMode::kSrcOver)
+ effectNodeNeeded = true;
+
float opacity = style.opacity();
if (opacity != 1.0f)
effectNodeNeeded = true;
@@ -425,7 +444,7 @@ void PaintPropertyTreeBuilder::updateEffect(
auto& properties = object.getMutableForPainting().ensurePaintProperties();
context.forceSubtreeUpdate |= properties.updateEffect(
context.currentEffect, context.current.transform, outputClip,
- std::move(filter), opacity);
+ std::move(filter), opacity, blendMode);
} else {
if (auto* properties = object.getMutableForPainting().paintProperties())
context.forceSubtreeUpdate |= properties->clearEffect();

Powered by Google App Engine
This is Rietveld 408576698