Remove constant() in favor of env()
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Sep 2017 20:03:07 +0000 (20:03 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Sep 2017 20:03:07 +0000 (20:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177581
<rdar://problem/34701321>

Reviewed by Dean Jackson.

Source/WebCore:

No new tests, removing a feature.

* css/CSSValueKeywords.in:
* css/CSSVariableData.cpp:
(WebCore::CSSVariableData::checkVariablesForCyclesWithRange const):
(WebCore::CSSVariableData::resolveTokenRange const):
* css/parser/CSSVariableParser.cpp:
(WebCore::classifyBlock):

Source/WebInspectorUI:

* UserInterface/Models/CSSCompletions.js:
* UserInterface/Models/CSSKeywordCompletions.js:
(WI.CSSKeywordCompletions.forProperty):
(WI.CSSKeywordCompletions.forFunction):

LayoutTests:

* fast/css/variables/constants/invalid-constant-name-fallback-expected.html: Removed.
* fast/css/variables/constants/invalid-constant-name-fallback.html: Removed.
* fast/css/variables/constants/ios/safe-area-inset-set-expected.html: Removed.
* fast/css/variables/constants/ios/safe-area-inset-set.html: Removed.
* fast/css/variables/constants/safe-area-inset-cannot-override-expected.html: Removed.
* fast/css/variables/constants/safe-area-inset-cannot-override.html: Removed.
* fast/css/variables/constants/safe-area-inset-zero-expected.html: Removed.
* fast/css/variables/constants/safe-area-inset-zero.html: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222627 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/css/variables/constants/invalid-constant-name-fallback-expected.html [deleted file]
LayoutTests/fast/css/variables/constants/invalid-constant-name-fallback.html [deleted file]
LayoutTests/fast/css/variables/constants/ios/safe-area-inset-set-expected.html [deleted file]
LayoutTests/fast/css/variables/constants/ios/safe-area-inset-set.html [deleted file]
LayoutTests/fast/css/variables/constants/safe-area-inset-cannot-override-expected.html [deleted file]
LayoutTests/fast/css/variables/constants/safe-area-inset-cannot-override.html [deleted file]
LayoutTests/fast/css/variables/constants/safe-area-inset-zero-expected.html [deleted file]
LayoutTests/fast/css/variables/constants/safe-area-inset-zero.html [deleted file]
LayoutTests/platform/ios/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/CSSVariableData.cpp
Source/WebCore/css/parser/CSSVariableParser.cpp
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js
Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js

index ebf261b..725c3b0 100644 (file)
@@ -1,3 +1,20 @@
+2017-09-28  Tim Horton  <timothy_horton@apple.com>
+
+        Remove constant() in favor of env()
+        https://bugs.webkit.org/show_bug.cgi?id=177581
+        <rdar://problem/34701321>
+
+        Reviewed by Dean Jackson.
+
+        * fast/css/variables/constants/invalid-constant-name-fallback-expected.html: Removed.
+        * fast/css/variables/constants/invalid-constant-name-fallback.html: Removed.
+        * fast/css/variables/constants/ios/safe-area-inset-set-expected.html: Removed.
+        * fast/css/variables/constants/ios/safe-area-inset-set.html: Removed.
+        * fast/css/variables/constants/safe-area-inset-cannot-override-expected.html: Removed.
+        * fast/css/variables/constants/safe-area-inset-cannot-override.html: Removed.
+        * fast/css/variables/constants/safe-area-inset-zero-expected.html: Removed.
+        * fast/css/variables/constants/safe-area-inset-zero.html: Removed.
+
 2017-09-28  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, fix a test name in TestExpectations.
index dc92265..57d4b09 100644 (file)
@@ -34,7 +34,6 @@ media/mac [ Skip ]
 media/ios [ Skip ]
 media/controls/ipad [ Skip ]
 fast/text-autosizing [ Skip ]
-fast/css/variables/constants/ios [ Skip ]
 fast/css/variables/env/ios [ Skip ]
 http/tests/preload/viewport [ Skip ]
 
diff --git a/LayoutTests/fast/css/variables/constants/invalid-constant-name-fallback-expected.html b/LayoutTests/fast/css/variables/constants/invalid-constant-name-fallback-expected.html
deleted file mode 100644 (file)
index 5cb46a9..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<style>
-div {
-    position: absolute;
-    left: 100px;
-    top: 100px;
-    width: 100px;
-    height: 100px;
-    background-color: green;
-}
-</style>
-<body>
-<div></div>
-<p>The box should be at 100, 100.</p>
-
diff --git a/LayoutTests/fast/css/variables/constants/invalid-constant-name-fallback.html b/LayoutTests/fast/css/variables/constants/invalid-constant-name-fallback.html
deleted file mode 100644 (file)
index e12fc66..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<script>
-if (window.internals)
-    internals.settings.setConstantPropertiesEnabled(true);
-</script>
-<style>
-div {
-    position: absolute;
-    width: 100px;
-    height: 100px;
-    background-color: green;
-
-    --valid-fallback: 100px;
-
-    top: constant(some-unknown-name, var(--valid-fallback));
-    left: constant(--some-invalid-name, var(--valid-fallback));
-}
-</style>
-<body>
-<div></div>
-<p>The box should be at 100, 100.</p>
-
diff --git a/LayoutTests/fast/css/variables/constants/ios/safe-area-inset-set-expected.html b/LayoutTests/fast/css/variables/constants/ios/safe-area-inset-set-expected.html
deleted file mode 100644 (file)
index c4dee78..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
-<head>
-    <script>
-    if (window.internals)
-        internals.settings.setViewportFitEnabled(true);
-    </script>
-    <meta name="viewport" content="initial-scale=1, viewport-fit=cover">
-    <style>
-    #a {
-        position: absolute;
-        left: 25px;
-        top: 50px;
-        width: 100px;
-        height: 100px;
-        background-color: green;
-    }
-
-    #b {
-        position: absolute;
-        left: 75px;
-        top: 100px;
-        width: 100px;
-        height: 100px;
-        background-color: blue;
-    }
-    </style>
-</head>
-<body>
-    <div id="a"></div>
-    <div id="b"></div>
-    <p>The boxes should be at 25, 50 and 75, 100.</p>
-</body>
\ No newline at end of file
diff --git a/LayoutTests/fast/css/variables/constants/ios/safe-area-inset-set.html b/LayoutTests/fast/css/variables/constants/ios/safe-area-inset-set.html
deleted file mode 100644 (file)
index 2334b1d..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
-<script>
-if (window.internals) {
-    internals.settings.setConstantPropertiesEnabled(true);
-    internals.settings.setViewportFitEnabled(true);
-}
-</script>
-<head>
-    <meta name="viewport" content="initial-scale=1, viewport-fit=cover">
-    <style>
-        #a {
-            position: absolute;
-            left: constant(safe-area-inset-right);
-            top: constant(safe-area-inset-top);
-            width: 100px;
-            height: 100px;
-            background-color: green;
-        }
-
-        #b {
-            position: absolute;
-            left: constant(safe-area-inset-bottom);
-            top: constant(safe-area-inset-left);
-            width: 100px;
-            height: 100px;
-            background-color: blue;
-        }
-    </style>
-    <script>
-        function getUIScript()
-        {
-            return `
-            (function() {
-                uiController.setSafeAreaInsets(50, 25, 75, 100);
-                uiController.doAfterVisibleContentRectUpdate(function () {
-                    uiController.uiScriptComplete();
-                });
-            })();`
-        }
-
-        if (window.testRunner) {
-            testRunner.waitUntilDone();
-            window.onload = function () {
-                testRunner.runUIScript(getUIScript(), function(result) {
-                    testRunner.notifyDone();
-                });
-            }
-        }
-    </script>
-</head>
-<body>
-    <div id="a"></div>
-    <div id="b"></div>
-    <p>The boxes should be at 25, 50 and 75, 100.</p>
-</body>
-
diff --git a/LayoutTests/fast/css/variables/constants/safe-area-inset-cannot-override-expected.html b/LayoutTests/fast/css/variables/constants/safe-area-inset-cannot-override-expected.html
deleted file mode 100644 (file)
index fb05184..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<style>
-#a {
-    position: absolute;
-    left: 0px;
-    top: 0px;
-    width: 100px;
-    height: 100px;
-    background-color: green;
-}
-
-#b {
-    position: absolute;
-    left: 0px;
-    top: 0px;
-    width: 100px;
-    height: 100px;
-    background-color: blue;
-}
-</style>
-<body>
-<div id="a"></div>
-<div id="b"></div>
-<p>The boxes should both be at 0, 0.</p>
-
diff --git a/LayoutTests/fast/css/variables/constants/safe-area-inset-cannot-override.html b/LayoutTests/fast/css/variables/constants/safe-area-inset-cannot-override.html
deleted file mode 100644 (file)
index d0aea9a..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-<script>
-if (window.internals)
-    internals.settings.setConstantPropertiesEnabled(true);
-</script>
-<style>
-html {
-    --safe-area-inset-bottom: 50px;
-    safe-area-inset-left: 50px;
-}
-
-#a {
-    position: absolute;
-    --safe-area-inset-right: 100px;
-    safe-area-inset-top: 100px;
-    left: constant(safe-area-inset-right);
-    top: constant(safe-area-inset-top);
-    width: 100px;
-    height: 100px;
-    background-color: green;
-}
-
-#b {
-    position: absolute;
-    --safe-area-inset-bottom: 200px;
-    safe-area-inset-left: 200px;
-    left: constant(safe-area-inset-bottom);
-    top: constant(safe-area-inset-left);
-    width: 100px;
-    height: 100px;
-    background-color: blue;
-}
-</style>
-<body>
-<div id="a"></div>
-<div id="b"></div>
-<p>The boxes should both be at 0, 0.</p>
-
diff --git a/LayoutTests/fast/css/variables/constants/safe-area-inset-zero-expected.html b/LayoutTests/fast/css/variables/constants/safe-area-inset-zero-expected.html
deleted file mode 100644 (file)
index 058d492..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<style>
-div {
-    position: absolute;
-    left: 0px;
-    top: 0px;
-    width: 100px;
-    height: 100px;
-    background-color: green;
-}
-</style>
-<body>
-<div></div>
-<p>The box should be at 0, 0.</p>
-
diff --git a/LayoutTests/fast/css/variables/constants/safe-area-inset-zero.html b/LayoutTests/fast/css/variables/constants/safe-area-inset-zero.html
deleted file mode 100644 (file)
index c822c47..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<script>
-if (window.internals)
-    internals.settings.setConstantPropertiesEnabled(true);
-</script>
-<style>
-div {
-    position: absolute;
-    left: 100px;
-    top: 100px;
-    width: 100px;
-    height: 100px;
-    background-color: green;
-
-    top: constant(safe-area-inset-top);
-    left: constant(safe-area-inset-left);
-}
-</style>
-<body>
-<div></div>
-<p>The box should be at 0, 0.</p>
-
index 7f6c982..00b3f4f 100644 (file)
@@ -503,7 +503,6 @@ crypto/workers/subtle/rsa-pss-import-key-verify.html [ Pass ]
 fast/viewport/ios/viewport-fit-contain.html [ Pass ]
 fast/viewport/ios/viewport-fit-cover.html [ Pass ]
 fast/viewport/ios/viewport-fit-auto.html [ Pass ]
-fast/css/variables/constants/ios [ Pass ]
 fast/css/variables/env/ios [ Pass ]
 
 # This test relies on APIs not available on iOS
index e0f2ca7..e527640 100644 (file)
@@ -1,3 +1,20 @@
+2017-09-28  Tim Horton  <timothy_horton@apple.com>
+
+        Remove constant() in favor of env()
+        https://bugs.webkit.org/show_bug.cgi?id=177581
+        <rdar://problem/34701321>
+
+        Reviewed by Dean Jackson.
+
+        No new tests, removing a feature.
+
+        * css/CSSValueKeywords.in:
+        * css/CSSVariableData.cpp:
+        (WebCore::CSSVariableData::checkVariablesForCyclesWithRange const):
+        (WebCore::CSSVariableData::resolveTokenRange const):
+        * css/parser/CSSVariableParser.cpp:
+        (WebCore::classifyBlock):
+
 2017-09-28  Brent Fulgham  <bfulgham@apple.com>
 
         Add ports 6679 and 6697 (IRC SSL) to port blacklist
index 92b97fa..d9bca6b 100644 (file)
@@ -849,7 +849,6 @@ var
 //
 // Environment Variables
 //
-constant
 env
 
 //
index 8add6fb..98c9d09 100644 (file)
@@ -100,7 +100,7 @@ bool CSSVariableData::checkVariablesForCycles(const AtomicString& name, CustomPr
 bool CSSVariableData::checkVariablesForCyclesWithRange(CSSParserTokenRange range, CustomPropertyValueMap& customProperties, HashSet<AtomicString>& seenProperties, HashSet<AtomicString>& invalidProperties) const
 {
     while (!range.atEnd()) {
-        if (range.peek().functionId() == CSSValueVar || range.peek().functionId() == CSSValueConstant || range.peek().functionId() == CSSValueEnv) {
+        if (range.peek().functionId() == CSSValueVar || range.peek().functionId() == CSSValueEnv) {
             CSSParserTokenRange block = range.consumeBlock();
             
             block.consumeWhitespace();
@@ -170,7 +170,7 @@ bool CSSVariableData::resolveTokenRange(const CustomPropertyValueMap& customProp
 {
     bool success = true;
     while (!range.atEnd()) {
-        if (range.peek().functionId() == CSSValueVar || range.peek().functionId() == CSSValueConstant || range.peek().functionId() == CSSValueEnv)
+        if (range.peek().functionId() == CSSValueVar || range.peek().functionId() == CSSValueEnv)
             success &= resolveVariableReference(customProperties, range.consumeBlock(), result);
         else
             result.append(range.consume());
index 0799d7b..1715ff1 100644 (file)
@@ -70,7 +70,7 @@ static bool classifyBlock(CSSParserTokenRange range, bool& hasReferences, bool&
                 hasReferences = true;
                 continue;
             }
-            if ((token.functionId() == CSSValueConstant || token.functionId() == CSSValueEnv) && parserContext.constantPropertiesEnabled) {
+            if (token.functionId() == CSSValueEnv && parserContext.constantPropertiesEnabled) {
                 if (!isValidConstantReference(block, hasAtApplyRule, parserContext))
                     return false; // Bail if any references are invalid
                 hasReferences = true;
index 0cd64ea..9a180dc 100644 (file)
@@ -1,3 +1,16 @@
+2017-09-28  Tim Horton  <timothy_horton@apple.com>
+
+        Remove constant() in favor of env()
+        https://bugs.webkit.org/show_bug.cgi?id=177581
+        <rdar://problem/34701321>
+
+        Reviewed by Dean Jackson.
+
+        * UserInterface/Models/CSSCompletions.js:
+        * UserInterface/Models/CSSKeywordCompletions.js:
+        (WI.CSSKeywordCompletions.forProperty):
+        (WI.CSSKeywordCompletions.forFunction):
+
 2017-09-27  Joseph Pecoraro  <pecoraro@apple.com>
 
         Uncaught Exception: Attempted to assign to readonly property (at ContentView.js:​206:​34)​
index 434f841..46433e7 100644 (file)
@@ -97,7 +97,7 @@ WI.CSSCompletions = class CSSCompletions
                 return;
 
             var propertyNamesForCodeMirror = {};
-            var valueKeywordsForCodeMirror = {"inherit": true, "initial": true, "unset": true, "revert": true, "var": true, "constant": true, "env": true};
+            var valueKeywordsForCodeMirror = {"inherit": true, "initial": true, "unset": true, "revert": true, "var": true, "env": true};
             var colorKeywordsForCodeMirror = {};
 
             function nameForCodeMirror(name)
index 74794d0..dbb97c0 100644 (file)
@@ -33,7 +33,7 @@ WI.CSSKeywordCompletions = {};
 
 WI.CSSKeywordCompletions.forProperty = function(propertyName)
 {
-    let acceptedKeywords = ["initial", "unset", "revert", "var()", "constant()", "env()"];
+    let acceptedKeywords = ["initial", "unset", "revert", "var()", "env()"];
     let isNotPrefixed = propertyName.charAt(0) !== "-";
 
     if (propertyName in WI.CSSKeywordCompletions._propertyKeywordMap)
@@ -68,7 +68,7 @@ WI.CSSKeywordCompletions.forFunction = function(functionName)
 
     if (functionName === "var")
         suggestions = [];
-    else if (functionName === "constant" || functionName == "env")
+    else if (functionName == "env")
         suggestions = suggestions.concat(["safe-area-inset-top", "safe-area-inset-right", "safe-area-inset-bottom", "safe-area-inset-left"]);
     else if (functionName === "image-set")
         suggestions.push("url()");