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

Unified Diff: third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp

Issue 2047283002: Avoid touching z-index in StyleAdjuster by using an isStackingContext flag instead (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Animation expectation Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
index 5d363848d3c5ab03df6601b0635173eddeff537e..d64edeca9e1b51268e8f85e80454e168f11fb8fb 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
@@ -119,35 +119,6 @@ static bool parentStyleForcesZIndexToCreateStackingContext(const ComputedStyle&
return parentStyle.isDisplayFlexibleOrGridBox();
}
-static bool hasWillChangeThatCreatesStackingContext(const ComputedStyle& style)
-{
- for (size_t i = 0; i < style.willChangeProperties().size(); ++i) {
- switch (style.willChangeProperties()[i]) {
- case CSSPropertyOpacity:
- case CSSPropertyTransform:
- case CSSPropertyAliasWebkitTransform:
- case CSSPropertyTransformStyle:
- case CSSPropertyAliasWebkitTransformStyle:
- case CSSPropertyPerspective:
- case CSSPropertyAliasWebkitPerspective:
- case CSSPropertyWebkitMask:
- case CSSPropertyWebkitMaskBoxImage:
- case CSSPropertyWebkitClipPath:
- case CSSPropertyWebkitBoxReflect:
- case CSSPropertyWebkitFilter:
- case CSSPropertyBackdropFilter:
- case CSSPropertyZIndex:
- case CSSPropertyPosition:
- case CSSPropertyMixBlendMode:
- case CSSPropertyIsolation:
- return true;
- default:
- break;
- }
- }
- return false;
-}
-
void StyleAdjuster::adjustComputedStyle(ComputedStyle& style, const ComputedStyle& parentStyle, Element* element)
{
if (style.display() != NONE) {
@@ -180,26 +151,14 @@ void StyleAdjuster::adjustComputedStyle(ComputedStyle& style, const ComputedStyl
style.setHasCompositorProxy(true);
// Make sure our z-index value is only applied if the object is positioned.
- if (style.position() == StaticPosition && !parentStyleForcesZIndexToCreateStackingContext(parentStyle))
- style.setHasAutoZIndex();
-
- // Auto z-index becomes 0 for the root element and transparent objects. This prevents
- // cases where objects that should be blended as a single unit end up with a non-transparent
- // object wedged in between them. Auto z-index also becomes 0 for objects that specify transforms/masks/reflections.
- if (style.hasAutoZIndex() && ((element && element->document().documentElement() == element)
- || style.hasOpacity()
- || style.hasTransformRelatedProperty()
- || style.hasMask()
- || style.clipPath()
- || style.boxReflect()
- || style.hasFilterInducingProperty()
- || style.hasBlendMode()
- || style.hasIsolation()
- || style.hasViewportConstrainedPosition()
- || isInTopLayer(element, style)
- || hasWillChangeThatCreatesStackingContext(style)
- || style.containsPaint()))
- style.setZIndex(0);
+ if (style.position() == StaticPosition && !parentStyleForcesZIndexToCreateStackingContext(parentStyle)) {
+ style.setIsStackingContext(false);
+ // TODO(alancutter): Avoid altering z-index here.
rune 2016/06/10 12:25:52 Could you add the crbug issue here as well? I've a
+ if (!style.hasAutoZIndex())
+ style.setZIndex(0);
+ } else if (!style.hasAutoZIndex()) {
+ style.setIsStackingContext(true);
+ }
if (doesNotInheritTextDecoration(style, element))
style.clearAppliedTextDecorations();

Powered by Google App Engine
This is Rietveld 408576698