Title: [272987] trunk/Source
Revision
272987
Author
wei...@apple.com
Date
2021-02-16 22:47:27 -0800 (Tue, 16 Feb 2021)

Log Message

Add CSS property to enable separated bit on GraphicsLayer
https://bugs.webkit.org/show_bug.cgi?id=222010

Reviewed by Dean Jackson.

Add internal access to the separated bit on graphics layer via a
new "optimized-3d" transform-style. This is all off by default and
is expected to change, but is useful and non-invasive for experimentation.

Source/WebCore:

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator TransformStyle3D const):
* css/CSSProperties.json:
* css/CSSValueKeywords.in:
* css/parser/CSSParserContext.cpp:
(WebCore::operator==):
* css/parser/CSSParserContext.h:
(WebCore::CSSParserContextHash::hash):
* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGeometry):
* rendering/style/RenderStyleConstants.cpp:
(WebCore::operator<<):
* rendering/style/RenderStyleConstants.h:
* rendering/style/StyleRareNonInheritedData.h:
Plumb optimized-3d all the way to graphics layer. Currently we are just mapping
optimized-3d to separated, but I expect to change this a bit to make it a bit
more useful for experimentation.

Source/WTF:

* Scripts/Preferences/WebPreferencesExperimental.yaml:
* wtf/PlatformEnable.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (272986 => 272987)


--- trunk/Source/WTF/ChangeLog	2021-02-17 06:16:28 UTC (rev 272986)
+++ trunk/Source/WTF/ChangeLog	2021-02-17 06:47:27 UTC (rev 272987)
@@ -1,3 +1,17 @@
+2021-02-16  Sam Weinig  <wei...@apple.com>
+
+        Add CSS property to enable separated bit on GraphicsLayer
+        https://bugs.webkit.org/show_bug.cgi?id=222010
+
+        Reviewed by Dean Jackson.
+
+        Add internal access to the separated bit on graphics layer via a 
+        new "optimized-3d" transform-style. This is all off by default and
+        is expected to change, but is useful and non-invasive for experimentation.
+
+        * Scripts/Preferences/WebPreferencesExperimental.yaml:
+        * wtf/PlatformEnable.h:
+
 2021-02-16  Chris Dumez  <cdu...@apple.com>
 
         Clients of ARC-dependent WTF functions may get incorrect/crashy behavior

Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferences.yaml (272986 => 272987)


--- trunk/Source/WTF/Scripts/Preferences/WebPreferences.yaml	2021-02-17 06:16:28 UTC (rev 272986)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferences.yaml	2021-02-17 06:47:27 UTC (rev 272987)
@@ -1,4 +1,4 @@
-# Copyright (c) 2020 Apple Inc. All rights reserved.
+# Copyright (c) 2020-2021 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -383,6 +383,17 @@
     WebCore:
       default: false
 
+CSSTransformStyleOptimized3DEnabled:
+  type: bool
+  condition: ENABLE(CSS_TRANSFORM_STYLE_OPTIMIZED_3D)
+  defaultValue:
+    WebKitLegacy:
+      default: false
+    WebKit:
+      default: true
+    WebCore:
+      default: true
+
 # FIXME: This is not relevent for WebKitLegacy, so should be excluded from WebKitLegacy entirely (though we should still set the default value to false when initializing settings).
 CacheAPIEnabled:
   type: bool

Modified: trunk/Source/WTF/wtf/PlatformEnable.h (272986 => 272987)


--- trunk/Source/WTF/wtf/PlatformEnable.h	2021-02-17 06:16:28 UTC (rev 272986)
+++ trunk/Source/WTF/wtf/PlatformEnable.h	2021-02-17 06:47:27 UTC (rev 272987)
@@ -225,6 +225,10 @@
 #define ENABLE_CSS_CONIC_GRADIENTS 0
 #endif
 
+#if !defined(ENABLE_CSS_TRANSFORM_STYLE_OPTIMIZED_3D)
+#define ENABLE_CSS_TRANSFORM_STYLE_OPTIMIZED_3D 0
+#endif
+
 #if !defined(ENABLE_CUSTOM_CURSOR_SUPPORT)
 #define ENABLE_CUSTOM_CURSOR_SUPPORT 1
 #endif

Modified: trunk/Source/WebCore/ChangeLog (272986 => 272987)


--- trunk/Source/WebCore/ChangeLog	2021-02-17 06:16:28 UTC (rev 272986)
+++ trunk/Source/WebCore/ChangeLog	2021-02-17 06:47:27 UTC (rev 272987)
@@ -1,3 +1,37 @@
+2021-02-16  Sam Weinig  <wei...@apple.com>
+
+        Add CSS property to enable separated bit on GraphicsLayer
+        https://bugs.webkit.org/show_bug.cgi?id=222010
+
+        Reviewed by Dean Jackson.
+
+        Add internal access to the separated bit on graphics layer via a 
+        new "optimized-3d" transform-style. This is all off by default and
+        is expected to change, but is useful and non-invasive for experimentation.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+        (WebCore::CSSPrimitiveValue::operator TransformStyle3D const):
+        * css/CSSProperties.json:
+        * css/CSSValueKeywords.in:
+        * css/parser/CSSParserContext.cpp:
+        (WebCore::operator==):
+        * css/parser/CSSParserContext.h:
+        (WebCore::CSSParserContextHash::hash):
+        * css/parser/CSSParserFastPaths.cpp:
+        (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateGeometry):
+        * rendering/style/RenderStyleConstants.cpp:
+        (WebCore::operator<<):
+        * rendering/style/RenderStyleConstants.h:
+        * rendering/style/StyleRareNonInheritedData.h:
+        Plumb optimized-3d all the way to graphics layer. Currently we are just mapping
+        optimized-3d to separated, but I expect to change this a bit to make it a bit
+        more useful for experimentation.
+
 2021-02-16  Manuel Rego Casasnovas  <r...@igalia.com>
 
         [selectors] :focus-visible parsing and experimental flag

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (272986 => 272987)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2021-02-17 06:16:28 UTC (rev 272986)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2021-02-17 06:47:27 UTC (rev 272987)
@@ -3610,7 +3610,16 @@
         }
         case CSSPropertyTransformStyle:
         case CSSPropertyWebkitTransformStyle:
-            return cssValuePool.createIdentifierValue((style.transformStyle3D() == TransformStyle3D::Preserve3D) ? CSSValuePreserve3d : CSSValueFlat);
+            switch (style.transformStyle3D()) {
+            case TransformStyle3D::Flat:
+                return cssValuePool.createIdentifierValue(CSSValueFlat);
+            case TransformStyle3D::Preserve3D:
+                return cssValuePool.createIdentifierValue(CSSValuePreserve3d);
+#if ENABLE(CSS_TRANSFORM_STYLE_OPTIMIZED_3D)
+            case TransformStyle3D::Optimized3D:
+                return cssValuePool.createIdentifierValue(CSSValueOptimized3d);
+#endif
+            }
         case CSSPropertyTranslate:
             if (renderer && !renderer->settings().cssIndividualTransformPropertiesEnabled())
                 return nullptr;

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (272986 => 272987)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2021-02-17 06:16:28 UTC (rev 272986)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2021-02-17 06:47:27 UTC (rev 272987)
@@ -4397,6 +4397,11 @@
     case TransformStyle3D::Preserve3D:
         m_value.valueID = CSSValuePreserve3d;
         break;
+#if ENABLE(CSS_TRANSFORM_STYLE_OPTIMIZED_3D)
+    case TransformStyle3D::Optimized3D:
+        m_value.valueID = CSSValueOptimized3d;
+        break;
+#endif
     }
 }
 
@@ -4409,6 +4414,10 @@
         return TransformStyle3D::Flat;
     case CSSValuePreserve3d:
         return TransformStyle3D::Preserve3D;
+#if ENABLE(CSS_TRANSFORM_STYLE_OPTIMIZED_3D)
+    case CSSValueOptimized3d:
+        return TransformStyle3D::Optimized3D;
+#endif
     default:
         break;
     }

Modified: trunk/Source/WebCore/css/CSSProperties.json (272986 => 272987)


--- trunk/Source/WebCore/css/CSSProperties.json	2021-02-17 06:16:28 UTC (rev 272986)
+++ trunk/Source/WebCore/css/CSSProperties.json	2021-02-17 06:47:27 UTC (rev 272987)
@@ -6542,7 +6542,11 @@
         "transform-style": {
             "values": [
                 "flat",
-                "preserve-3d"
+                "preserve-3d",
+                {
+                    "value": "optimized-3d",
+                    "status": "internal"
+                }
             ],
             "codegen-properties": {
                 "name-for-methods": "TransformStyle3D"
@@ -6555,7 +6559,11 @@
         "-webkit-transform-style": {
             "values": [
                 "flat",
-                "preserve-3d"
+                "preserve-3d",
+                {
+                    "value": "optimized-3d",
+                    "status": "internal"
+                }
             ],
             "codegen-properties": {
                 "name-for-methods": "TransformStyle3D",

Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (272986 => 272987)


--- trunk/Source/WebCore/css/CSSValueKeywords.in	2021-02-17 06:16:28 UTC (rev 272986)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in	2021-02-17 06:47:27 UTC (rev 272987)
@@ -969,6 +969,9 @@
 //
 flat
 preserve-3d
+#if defined(ENABLE_CSS_TRANSFORM_STYLE_OPTIMIZED_3D) && ENABLE_CSS_TRANSFORM_STYLE_OPTIMIZED_3D
+optimized-3d
+#endif
 
 //
 // CSS_PROP__WEBKIT_TRANSITION_TIMING_FUNCTION

Modified: trunk/Source/WebCore/css/parser/CSSParserContext.cpp (272986 => 272987)


--- trunk/Source/WebCore/css/parser/CSSParserContext.cpp	2021-02-17 06:16:28 UTC (rev 272986)
+++ trunk/Source/WebCore/css/parser/CSSParserContext.cpp	2021-02-17 06:47:27 UTC (rev 272987)
@@ -82,6 +82,9 @@
 #if ENABLE(TEXT_AUTOSIZING)
     , textAutosizingEnabled { document.settings().textAutosizingEnabled() }
 #endif
+#if ENABLE(CSS_TRANSFORM_STYLE_OPTIMIZED_3D)
+    , transformStyleOptimized3DEnabled { document.settings().cssTransformStyleOptimized3DEnabled() }
+#endif
     , useLegacyBackgroundSizeShorthandBehavior { document.settings().useLegacyBackgroundSizeShorthandBehavior() }
     , focusVisibleEnabled { document.settings().focusVisibleEnabled() }
 #if ENABLE(ATTACHMENT_ELEMENT)
@@ -115,6 +118,9 @@
 #if ENABLE(TEXT_AUTOSIZING)
         && a.textAutosizingEnabled == b.textAutosizingEnabled
 #endif
+#if ENABLE(CSS_TRANSFORM_STYLE_OPTIMIZED_3D)
+        && a.transformStyleOptimized3DEnabled == b.transformStyleOptimized3DEnabled
+#endif
         && a.useLegacyBackgroundSizeShorthandBehavior == b.useLegacyBackgroundSizeShorthandBehavior
         && a.focusVisibleEnabled == b.focusVisibleEnabled
 #if ENABLE(ATTACHMENT_ELEMENT)

Modified: trunk/Source/WebCore/css/parser/CSSParserContext.h (272986 => 272987)


--- trunk/Source/WebCore/css/parser/CSSParserContext.h	2021-02-17 06:16:28 UTC (rev 272986)
+++ trunk/Source/WebCore/css/parser/CSSParserContext.h	2021-02-17 06:47:27 UTC (rev 272987)
@@ -72,6 +72,9 @@
 #if ENABLE(TEXT_AUTOSIZING)
     bool textAutosizingEnabled { false };
 #endif
+#if ENABLE(CSS_TRANSFORM_STYLE_OPTIMIZED_3D)
+    bool transformStyleOptimized3DEnabled { false };
+#endif
     bool useLegacyBackgroundSizeShorthandBehavior { false };
     bool focusVisibleEnabled { false };
 
@@ -119,7 +122,10 @@
             & key.scrollBehaviorEnabled                     << 12
             & key.individualTransformPropertiesEnabled      << 13
             & key.overscrollBehaviorEnabled                 << 14
-            & key.mode                                      << 15; // Keep this last.
+#if ENABLE(CSS_TRANSFORM_STYLE_OPTIMIZED_3D)
+            & key.transformStyleOptimized3DEnabled          << 15
+#endif
+            & key.mode                                      << 16; // Keep this last.
         hash ^= WTF::intHash(bits);
         return hash;
     }

Modified: trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp (272986 => 272987)


--- trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2021-02-17 06:16:28 UTC (rev 272986)
+++ trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2021-02-17 06:47:27 UTC (rev 272987)
@@ -818,7 +818,12 @@
         return valueID == CSSValueDisc || valueID == CSSValueCircle || valueID == CSSValueSquare || valueID == CSSValueNone;
     case CSSPropertyTransformStyle:
     case CSSPropertyWebkitTransformStyle:
-        return valueID == CSSValueFlat || valueID == CSSValuePreserve3d;
+        return valueID == CSSValueFlat
+            || valueID == CSSValuePreserve3d
+#if ENABLE(CSS_TRANSFORM_STYLE_OPTIMIZED_3D)
+            || (valueID == CSSValueOptimized3d && context.transformStyleOptimized3DEnabled)
+#endif
+        ;
     case CSSPropertyWebkitUserDrag: // auto | none | element
         return valueID == CSSValueAuto || valueID == CSSValueNone || valueID == CSSValueElement;
     case CSSPropertyWebkitUserModify: // read-only | read-write

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (272986 => 272987)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2021-02-17 06:16:28 UTC (rev 272986)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2021-02-17 06:47:27 UTC (rev 272987)
@@ -1305,6 +1305,11 @@
     m_graphicsLayer->setPosition(primaryLayerPosition);
     m_graphicsLayer->setSize(primaryGraphicsLayerRect.size());
 
+#if ENABLE(CSS_TRANSFORM_STYLE_OPTIMIZED_3D)
+    // FIXME: Take ancestry into account and remove unnecessary structural layers.
+    m_graphicsLayer->setSeparated(style.transformStyle3D() == TransformStyle3D::Optimized3D);
+#endif
+
     // Compute renderer offset from primary graphics layer. Note that primaryGraphicsLayerRect is in parentGraphicsLayer's coordinate system which is not necessarily
     // the same as the ancestor graphics layer.
     OffsetFromRenderer primaryGraphicsLayerOffsetFromRenderer;

Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.cpp (272986 => 272987)


--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.cpp	2021-02-17 06:16:28 UTC (rev 272986)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.cpp	2021-02-17 06:47:27 UTC (rev 272987)
@@ -1262,6 +1262,9 @@
     switch (transformStyle) {
     case TransformStyle3D::Flat: ts << "flat"; break;
     case TransformStyle3D::Preserve3D: ts << "preserve-3d"; break;
+#if ENABLE(CSS_TRANSFORM_STYLE_OPTIMIZED_3D)
+    case TransformStyle3D::Optimized3D: ts << "optimized-3d"; break;
+#endif
     }
     return ts;
 }

Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (272986 => 272987)


--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2021-02-17 06:16:28 UTC (rev 272986)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2021-02-17 06:47:27 UTC (rev 272987)
@@ -920,7 +920,10 @@
 
 enum class TransformStyle3D : uint8_t {
     Flat,
-    Preserve3D
+    Preserve3D,
+#if ENABLE(CSS_TRANSFORM_STYLE_OPTIMIZED_3D)
+    Optimized3D
+#endif
 };
 
 enum class BackfaceVisibility : uint8_t {

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (272986 => 272987)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2021-02-17 06:16:28 UTC (rev 272986)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2021-02-17 06:47:27 UTC (rev 272987)
@@ -195,7 +195,7 @@
     OptionSet<TouchAction> touchActions;
 
     unsigned pageSizeType : 2; // PageSizeType
-    unsigned transformStyle3D : 1; // TransformStyle3D
+    unsigned transformStyle3D : 2; // TransformStyle3D
     unsigned backfaceVisibility : 1; // BackfaceVisibility
 
     unsigned userDrag : 2; // UserDrag
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to