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..d426be1465e3c5f3da4b3018b2e93a78889e052e 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,34 @@ 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: |
| + case CSSPropertyPosition: |
|
jamesr
2014/02/26 23:56:22
this is supposed to be a set of all CSS properties
ajuma
2014/02/27 00:05:47
Yes, this is supposed to be all CSS properties tha
esprehn
2014/02/27 20:58:31
This just begs for a unit test, but I suppose it'l
|
| + return true; |
| + case CSSPropertyMixBlendMode: |
| + case CSSPropertyIsolation: |
| + if (RuntimeEnabledFeatures::cssCompositingEnabled()) |
| + return true; |
| + break; |
| + default: |
| + break; |
| + } |
| + } |
| + return false; |
| +} |
| + |
| void StyleAdjuster::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e) |
| { |
| ASSERT(parentStyle); |
| @@ -275,9 +304,17 @@ 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. |
|
esprehn
2014/02/27 22:05:27
This is observable from script. If you do getCompu
|
| + if (!style->hasTransform() && style->willChangeProperties().contains(CSSPropertyWebkitTransform)) { |
| + bool makeIdentity = true; |
| + style->setTransform(TransformOperations(makeIdentity)); |
| + } |
| + |
| // Textarea considers overflow visible as auto. |
| if (e && e->hasTagName(textareaTag)) { |
| style->setOverflowX(style->overflowX() == OVISIBLE ? OAUTO : style->overflowX()); |