Changeset 260340 in webkit


Ignore:
Timestamp:
Apr 19, 2020 11:01:18 AM (4 years ago)
Author:
emilio
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:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r260338 r260340  
     12020-04-19  Emilio Cobos Álvarez  <emilio@crisal.io>
     2
     3        Don't use the inherited custom properties to store environment variables.
     4        https://bugs.webkit.org/show_bug.cgi?id=210707
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
     9
    1102020-04-19  Antti Koivisto  <antti@apple.com>
    211
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r260335 r260340  
     12020-04-19  Emilio Cobos Álvarez  <emilio@crisal.io>
     2
     3        Don't use the inherited custom properties to store environment variables.
     4        https://bugs.webkit.org/show_bug.cgi?id=210707
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Annotate the progressions.
     9
     10        * web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
     11        * web-platform-tests/css/cssom/getComputedStyle-logical-enumeration-expected.txt:
     12
     13
    1142020-04-19  Emilio Cobos Álvarez  <emilio@crisal.io>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt

    r260335 r260340  
    377377PASS -webkit-user-modify
    378378PASS -webkit-user-select
    379 PASS fullscreen-inset-bottom
    380 PASS safe-area-inset-bottom
    381 PASS safe-area-inset-left
    382 PASS fullscreen-inset-left
    383 PASS fullscreen-auto-hide-duration
    384 PASS fullscreen-inset-right
    385 PASS safe-area-inset-right
    386 PASS fullscreen-inset-top
    387 PASS safe-area-inset-top
    388379
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration-expected.txt

    r260335 r260340  
    11
    2 FAIL Logical properties in enumeration of computed style assert_false: environment variables should not be enumerated in computed style expected false got true
     2PASS Logical properties in enumeration of computed style
    33
  • trunk/LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt

    r260335 r260340  
    379379PASS -webkit-user-modify
    380380PASS -webkit-user-select
    381 PASS fullscreen-inset-bottom
    382 PASS safe-area-inset-bottom
    383 PASS safe-area-inset-left
    384 PASS fullscreen-inset-left
    385 PASS fullscreen-auto-hide-duration
    386 PASS fullscreen-inset-right
    387 PASS safe-area-inset-right
    388 PASS fullscreen-inset-top
    389 PASS safe-area-inset-top
    390381
  • trunk/Source/WebCore/ChangeLog

    r260338 r260340  
     12020-04-19  Emilio Cobos Álvarez  <emilio@crisal.io>
     2
     3        Don't use the inherited custom properties to store environment variables.
     4        https://bugs.webkit.org/show_bug.cgi?id=210707
     5
     6        Reviewed by Antti Koivisto.
     7
     8        It leaks this implementation detail when enumerating the computed style.
     9
     10        Tests: imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml.xhtml
     11               imported/w3c/web-platform-tests/css/cssom/getComputedStyle-logical-enumeration.html
     12
     13        * css/CSSVariableReferenceValue.cpp:
     14        (WebCore::resolveVariableReference):
     15        (WebCore::resolveTokenRange):
     16        * style/StyleResolveForDocument.cpp:
     17        (WebCore::Style::resolveForDocument):
     18
    1192020-04-19  Antti Koivisto  <antti@apple.com>
    220
  • trunk/Source/WebCore/css/CSSVariableReferenceValue.cpp

    r259988 r260340  
    3232
    3333#include "CSSVariableData.h"
     34#include "ConstantPropertyMap.h"
    3435#include "RenderStyle.h"
    3536#include "StyleBuilder.h"
     
    7273}
    7374
    74 static bool resolveVariableReference(CSSParserTokenRange range, Vector<CSSParserToken>& result, Style::BuilderState& builderState)
     75static bool resolveVariableReference(CSSParserTokenRange range, CSSValueID functionId, Vector<CSSParserToken>& result, Style::BuilderState& builderState)
    7576{
     77    ASSERT(functionId == CSSValueVar || functionId == CSSValueEnv);
     78
    7679    auto& registeredProperties = builderState.document().getCSSRegisteredCustomPropertySet();
    7780    auto& style = builderState.style();
     
    8992    bool fallbackReturn = resolveVariableFallback(CSSParserTokenRange(range), fallbackResult, builderState);
    9093
    91     auto* property = style.getCustomProperty(variableName);
    9294
     95    auto* property = functionId == CSSValueVar
     96        ? style.getCustomProperty(variableName)
     97        : builderState.document().constantProperties().values().get(variableName);
    9398    if (!property || property->isUnset()) {
    9499        auto* registered = registeredProperties.get(variableName);
     
    113118    bool success = true;
    114119    while (!range.atEnd()) {
    115         if (range.peek().functionId() == CSSValueVar || range.peek().functionId() == CSSValueEnv)
    116             success &= resolveVariableReference(range.consumeBlock(), result, builderState);
     120        auto functionId = range.peek().functionId();
     121        if (functionId == CSSValueVar || functionId == CSSValueEnv)
     122            success &= resolveVariableReference(range.consumeBlock(), functionId, result, builderState);
    117123        else
    118124            result.append(range.consume());
  • trunk/Source/WebCore/style/StyleResolveForDocument.cpp

    r251413 r260340  
    3131
    3232#include "CSSFontSelector.h"
    33 #include "ConstantPropertyMap.h"
    3433#include "Document.h"
    3534#include "FontCascade.h"
     
    126125    documentStyle.fontCascade().update(&const_cast<Document&>(document).fontSelector());
    127126
    128     for (auto& it : document.constantProperties().values())
    129         documentStyle.setInheritedCustomPropertyValue(it.key, makeRef(it.value.get()));
    130 
    131127    return documentStyle;
    132128}
Note: See TracChangeset for help on using the changeset viewer.