Chromium Code Reviews| Index: Source/core/css/resolver/StyleAdjuster.cpp |
| diff --git a/Source/core/css/resolver/StyleAdjuster.cpp b/Source/core/css/resolver/StyleAdjuster.cpp |
| index 7e8b3ee4309acba66f1e09e6ec046b116d58e71b..e36ddb44a284537bb00f255ff2d83997dd6af387 100644 |
| --- a/Source/core/css/resolver/StyleAdjuster.cpp |
| +++ b/Source/core/css/resolver/StyleAdjuster.cpp |
| @@ -44,6 +44,7 @@ |
| #include "core/rendering/style/RenderStyle.h" |
| #include "core/rendering/style/RenderStyleConstants.h" |
| #include "platform/Length.h" |
| +#include "platform/transforms/TransformOperations.h" |
| #include "wtf/Assertions.h" |
| namespace WebCore { |
| @@ -158,6 +159,38 @@ static bool parentStyleForcesZIndexToCreateStackingContext(const RenderStyle* pa |
| return isDisplayFlexibleBox(parentStyle->display()) || isDisplayGridBox(parentStyle->display()); |
| } |
| +static bool hasWillChangeThatCreatesStackingContext(const RenderStyle* style, Element* e) |
| +{ |
| + for (size_t i = 0; i < style->willChangeProperties().size(); ++i) { |
| + switch (style->willChangeProperties()[i]) { |
| + case CSSPropertyOpacity: |
| + case CSSPropertyWebkitTransform: |
| + case CSSPropertyWebkitTransformStyle: |
| + case CSSPropertyWebkitPerspective: |
| + case CSSPropertyWebkitMask: |
| + case CSSPropertyWebkitMaskBoxImage: |
| + case CSSPropertyWebkitClipPath: |
| + case CSSPropertyWebkitBoxReflect: |
| + case CSSPropertyWebkitFilter: |
| + case CSSPropertyZIndex: |
|
Ian Vollick
2014/02/26 16:21:12
z-index only creates a sc if the element is also p
ajuma
2014/02/26 17:00:30
I took a look at what Mozilla's implementation doe
|
| + return true; |
| + case CSSPropertyMixBlendMode: |
| + case CSSPropertyIsolation: |
| + if (RuntimeEnabledFeatures::cssCompositingEnabled()) |
| + return true; |
| + break; |
| + case CSSPropertyPosition: |
| + if (RuntimeEnabledFeatures::cssStickyPositionEnabled() |
| + || (e && e->document().settings() && e->document().settings()->fixedPositionCreatesStackingContext())) |
| + return true; |
| + break; |
| + default: |
| + break; |
| + } |
| + } |
| + return false; |
| +} |
| + |
| void StyleAdjuster::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e) |
| { |
| ASSERT(parentStyle); |
| @@ -275,9 +308,15 @@ void StyleAdjuster::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty |
| || style->position() == StickyPosition |
| || (style->position() == FixedPosition && e && e->document().settings() && e->document().settings()->fixedPositionCreatesStackingContext()) |
| || isInTopLayer(e, style) |
| + || hasWillChangeThatCreatesStackingContext(style, e) |
| )) |
| style->setZIndex(0); |
| + // will-change:transform should result in the same rendering behavior as having a transform, |
| + // including the creation of a containing block for fixed position descendants. |
| + if (!style->hasTransform() && style->willChangeProperties().contains(CSSPropertyWebkitTransform)) |
| + style->setTransform(TransformOperations(true)); |
| + |
| // Textarea considers overflow visible as auto. |
| if (e && e->hasTagName(textareaTag)) { |
| style->setOverflowX(style->overflowX() == OVISIBLE ? OAUTO : style->overflowX()); |