Title: [260340] trunk
Revision
260340
Author
[email protected]
Date
2020-04-19 11:01:18 -0700 (Sun, 19 Apr 2020)

Log Message

Don't use the inherited custom properties to store environment variables.
https://bugs.webkit.org/show_bug.cgi?id=210707

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Annotate the progressions.

* web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
* web-platform-tests/css/cssom/getComputedStyle-logical-enumeration-expected.txt:

Source/WebCore:

It leaks this implementation detail when enumerating the computed style.

Tests: imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml.xhtml
       imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration.html

* css/CSSVariableReferenceValue.cpp:
(WebCore::resolveVariableReference):
(WebCore::resolveTokenRange):
* style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):

LayoutTests:

* platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (260339 => 260340)


--- trunk/LayoutTests/ChangeLog	2020-04-19 17:56:18 UTC (rev 260339)
+++ trunk/LayoutTests/ChangeLog	2020-04-19 18:01:18 UTC (rev 260340)
@@ -1,3 +1,12 @@
+2020-04-19  Emilio Cobos Álvarez  <[email protected]>
+
+        Don't use the inherited custom properties to store environment variables.
+        https://bugs.webkit.org/show_bug.cgi?id=210707
+
+        Reviewed by Antti Koivisto.
+
+        * platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
+
 2020-04-19  Antti Koivisto  <[email protected]>
 
         [CSS selectors] :is() / :where() should not allow pseudo-elements at parse-time

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (260339 => 260340)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-04-19 17:56:18 UTC (rev 260339)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-04-19 18:01:18 UTC (rev 260340)
@@ -1,5 +1,18 @@
 2020-04-19  Emilio Cobos Álvarez  <[email protected]>
 
+        Don't use the inherited custom properties to store environment variables.
+        https://bugs.webkit.org/show_bug.cgi?id=210707
+
+        Reviewed by Antti Koivisto.
+
+        Annotate the progressions.
+
+        * web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
+        * web-platform-tests/css/cssom/getComputedStyle-logical-enumeration-expected.txt:
+
+
+2020-04-19  Emilio Cobos Álvarez  <[email protected]>
+
         Fix the logic to decide whether a property is enumerated in a computed style declaration.
         https://bugs.webkit.org/show_bug.cgi?id=210695
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt (260339 => 260340)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2020-04-19 17:56:18 UTC (rev 260339)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2020-04-19 18:01:18 UTC (rev 260340)
@@ -376,13 +376,4 @@
 PASS -webkit-user-drag 
 PASS -webkit-user-modify 
 PASS -webkit-user-select 
-PASS fullscreen-inset-bottom 
-PASS safe-area-inset-bottom 
-PASS safe-area-inset-left 
-PASS fullscreen-inset-left 
-PASS fullscreen-auto-hide-duration 
-PASS fullscreen-inset-right 
-PASS safe-area-inset-right 
-PASS fullscreen-inset-top 
-PASS safe-area-inset-top 
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration-expected.txt (260339 => 260340)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration-expected.txt	2020-04-19 17:56:18 UTC (rev 260339)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration-expected.txt	2020-04-19 18:01:18 UTC (rev 260340)
@@ -1,3 +1,3 @@
 
-FAIL Logical properties in enumeration of computed style assert_false: environment variables should not be enumerated in computed style expected false got true
+PASS Logical properties in enumeration of computed style 
 

Modified: trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt (260339 => 260340)


--- trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2020-04-19 17:56:18 UTC (rev 260339)
+++ trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt	2020-04-19 18:01:18 UTC (rev 260340)
@@ -378,13 +378,4 @@
 PASS -webkit-user-drag 
 PASS -webkit-user-modify 
 PASS -webkit-user-select 
-PASS fullscreen-inset-bottom 
-PASS safe-area-inset-bottom 
-PASS safe-area-inset-left 
-PASS fullscreen-inset-left 
-PASS fullscreen-auto-hide-duration 
-PASS fullscreen-inset-right 
-PASS safe-area-inset-right 
-PASS fullscreen-inset-top 
-PASS safe-area-inset-top 
 

Modified: trunk/Source/WebCore/ChangeLog (260339 => 260340)


--- trunk/Source/WebCore/ChangeLog	2020-04-19 17:56:18 UTC (rev 260339)
+++ trunk/Source/WebCore/ChangeLog	2020-04-19 18:01:18 UTC (rev 260340)
@@ -1,3 +1,21 @@
+2020-04-19  Emilio Cobos Álvarez  <[email protected]>
+
+        Don't use the inherited custom properties to store environment variables.
+        https://bugs.webkit.org/show_bug.cgi?id=210707
+
+        Reviewed by Antti Koivisto.
+
+        It leaks this implementation detail when enumerating the computed style.
+
+        Tests: imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml.xhtml
+               imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration.html
+
+        * css/CSSVariableReferenceValue.cpp:
+        (WebCore::resolveVariableReference):
+        (WebCore::resolveTokenRange):
+        * style/StyleResolveForDocument.cpp:
+        (WebCore::Style::resolveForDocument):
+
 2020-04-19  Antti Koivisto  <[email protected]>
 
         [CSS selectors] :is() / :where() should not allow pseudo-elements at parse-time

Modified: trunk/Source/WebCore/css/CSSVariableReferenceValue.cpp (260339 => 260340)


--- trunk/Source/WebCore/css/CSSVariableReferenceValue.cpp	2020-04-19 17:56:18 UTC (rev 260339)
+++ trunk/Source/WebCore/css/CSSVariableReferenceValue.cpp	2020-04-19 18:01:18 UTC (rev 260340)
@@ -31,6 +31,7 @@
 #include "CSSVariableReferenceValue.h"
 
 #include "CSSVariableData.h"
+#include "ConstantPropertyMap.h"
 #include "RenderStyle.h"
 #include "StyleBuilder.h"
 #include "StyleResolver.h"
@@ -71,8 +72,10 @@
     return resolveTokenRange(range, result, builderState);
 }
 
-static bool resolveVariableReference(CSSParserTokenRange range, Vector<CSSParserToken>& result, Style::BuilderState& builderState)
+static bool resolveVariableReference(CSSParserTokenRange range, CSSValueID functionId, Vector<CSSParserToken>& result, Style::BuilderState& builderState)
 {
+    ASSERT(functionId == CSSValueVar || functionId == CSSValueEnv);
+
     auto& registeredProperties = builderState.document().getCSSRegisteredCustomPropertySet();
     auto& style = builderState.style();
 
@@ -88,8 +91,10 @@
     Vector<CSSParserToken> fallbackResult;
     bool fallbackReturn = resolveVariableFallback(CSSParserTokenRange(range), fallbackResult, builderState);
 
-    auto* property = style.getCustomProperty(variableName);
 
+    auto* property = functionId == CSSValueVar
+        ? style.getCustomProperty(variableName)
+        : builderState.document().constantProperties().values().get(variableName);
     if (!property || property->isUnset()) {
         auto* registered = registeredProperties.get(variableName);
         if (registered && registered->initialValue())
@@ -112,8 +117,9 @@
 {
     bool success = true;
     while (!range.atEnd()) {
-        if (range.peek().functionId() == CSSValueVar || range.peek().functionId() == CSSValueEnv)
-            success &= resolveVariableReference(range.consumeBlock(), result, builderState);
+        auto functionId = range.peek().functionId();
+        if (functionId == CSSValueVar || functionId == CSSValueEnv)
+            success &= resolveVariableReference(range.consumeBlock(), functionId, result, builderState);
         else
             result.append(range.consume());
     }

Modified: trunk/Source/WebCore/style/StyleResolveForDocument.cpp (260339 => 260340)


--- trunk/Source/WebCore/style/StyleResolveForDocument.cpp	2020-04-19 17:56:18 UTC (rev 260339)
+++ trunk/Source/WebCore/style/StyleResolveForDocument.cpp	2020-04-19 18:01:18 UTC (rev 260340)
@@ -30,7 +30,6 @@
 #include "StyleResolveForDocument.h"
 
 #include "CSSFontSelector.h"
-#include "ConstantPropertyMap.h"
 #include "Document.h"
 #include "FontCascade.h"
 #include "Frame.h"
@@ -125,9 +124,6 @@
 
     documentStyle.fontCascade().update(&const_cast<Document&>(document).fontSelector());
 
-    for (auto& it : document.constantProperties().values())
-        documentStyle.setInheritedCustomPropertyValue(it.key, makeRef(it.value.get()));
-
     return documentStyle;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to