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

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

Issue 175263002: Implement will-change-based creation of layers, stacking contexts, and containing blocks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Always create a stacking context for will-change:position Created 6 years, 10 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: 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());

Powered by Google App Engine
This is Rietveld 408576698