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

Unified Diff: third_party/WebKit/Source/core/style/ComputedStyle.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: Update comments Created 4 years, 5 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/style/ComputedStyle.cpp
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
index 166d5ce705f17e22163d50a1858dff4089abccf0..9f09270405b2c46ce0974e908f7fe9a6e81f44bc 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -554,7 +554,7 @@ bool ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation(const ComputedStyle&
// We only need do layout for opacity changes if adding or losing opacity could trigger a change
// in us being a stacking context.
- if (hasAutoZIndex() != other.hasAutoZIndex() && rareNonInheritedData->hasOpacity() != other.rareNonInheritedData->hasOpacity()) {
+ if (isStackingContext() != other.isStackingContext() && rareNonInheritedData->hasOpacity() != other.rareNonInheritedData->hasOpacity()) {
// FIXME: We would like to use SimplifiedLayout here, but we can't quite do that yet.
// We need to make sure SimplifiedLayout can operate correctly on LayoutInlines (we will need
// to add a selfNeedsSimplifiedLayout bit in order to not get confused and taint every line).
@@ -813,8 +813,7 @@ bool ComputedStyle::diffNeedsPaintInvalidationObjectForPaintImage(const StyleIma
void ComputedStyle::updatePropertySpecificDifferences(const ComputedStyle& other, StyleDifference& diff) const
{
- // StyleAdjuster has ensured that zIndex is non-auto only if it's applicable.
- if (m_box->zIndex() != other.m_box->zIndex() || m_box->hasAutoZIndex() != other.m_box->hasAutoZIndex())
+ if (m_box->zIndex() != other.m_box->zIndex() || isStackingContext() != other.isStackingContext())
diff.setZIndexChanged();
if (rareNonInheritedData.get() != other.rareNonInheritedData.get()) {
@@ -895,6 +894,59 @@ void ComputedStyle::clearCursorList()
rareInheritedData.access()->cursorData = nullptr;
}
+static bool hasPropertyThatCreatesStackingContext(const Vector<CSSPropertyID>& properties)
+{
+ for (CSSPropertyID property : properties) {
+ switch (property) {
+ case CSSPropertyOpacity:
+ case CSSPropertyTransform:
+ case CSSPropertyAliasWebkitTransform:
+ case CSSPropertyTransformStyle:
+ case CSSPropertyAliasWebkitTransformStyle:
+ case CSSPropertyPerspective:
+ case CSSPropertyAliasWebkitPerspective:
+ case CSSPropertyWebkitMask:
+ case CSSPropertyWebkitMaskBoxImage:
+ case CSSPropertyWebkitClipPath:
+ case CSSPropertyWebkitBoxReflect:
+ case CSSPropertyFilter:
+ case CSSPropertyAliasWebkitFilter:
+ case CSSPropertyBackdropFilter:
+ case CSSPropertyZIndex:
+ case CSSPropertyPosition:
+ case CSSPropertyMixBlendMode:
+ case CSSPropertyIsolation:
+ return true;
+ default:
+ break;
+ }
+ }
+ return false;
+}
+
+void ComputedStyle::updateIsStackingContext(bool isDocumentElement, bool isInTopLayer)
+{
+ if (isStackingContext())
+ return;
+
+ if (isDocumentElement
+ || isInTopLayer
+ || styleType() == PseudoIdBackdrop
+ || hasOpacity()
+ || hasTransformRelatedProperty()
+ || hasMask()
+ || clipPath()
+ || boxReflect()
+ || hasFilterInducingProperty()
+ || hasBlendMode()
+ || hasIsolation()
+ || hasViewportConstrainedPosition()
+ || hasPropertyThatCreatesStackingContext(willChangeProperties())
+ || containsPaint()) {
+ setIsStackingContext(true);
+ }
+}
+
void ComputedStyle::addCallbackSelector(const String& selector)
{
if (!rareNonInheritedData->m_callbackSelectors.contains(selector))
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | third_party/WebKit/Source/core/style/StyleRareNonInheritedData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698