Changeset 269774 in webkit


Ignore:
Timestamp:
Nov 13, 2020 6:32:15 AM (3 years ago)
Author:
graouts@webkit.org
Message:

Support more properties on ::marker
https://bugs.webkit.org/show_bug.cgi?id=218894
<rdar://problem/71368343>

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Mark some WPT progressions.

  • web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt:

Source/WebCore:

In preparation for the support of animations on ::marker and other pseudo-elements, we add support for animation and transition
properties and add more rules to the user-agent stylesheet as defined by https://drafts.csswg.org/css-lists-3/#marker-properties.

  • css/html.css:

(::marker):

  • rendering/RenderListItem.cpp:

(WebCore::RenderListItem::computeMarkerStyle const):

  • style/PropertyCascade.cpp:

(WebCore::Style::isValidMarkerStyleProperty):

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r269745 r269774  
     12020-11-13  Antoine Quint  <graouts@webkit.org>
     2
     3        Support more properties on ::marker
     4        https://bugs.webkit.org/show_bug.cgi?id=218894
     5        <rdar://problem/71368343>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Mark some WPT progressions.
     10
     11        * web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt:
     12
    1132020-11-12  Zalan Bujtas  <zalan@apple.com>
    214
  • trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt

    r267650 r269774  
    2323FAIL Property content value '"foo"' in ::marker assert_equals: expected "\"foo\"" but got ""
    2424FAIL Property animation value '1s linear 2s infinite alternate forwards paused anim' in ::marker assert_equals: expected "1s linear 2s infinite alternate forwards paused anim" but got ""
    25 FAIL Property animation-delay value '1s' in ::marker assert_equals: expected "1s" but got "0s"
    26 FAIL Property animation-direction value 'alternate' in ::marker assert_equals: expected "alternate" but got "normal"
    27 FAIL Property animation-duration value '2s' in ::marker assert_equals: expected "2s" but got "0s"
    28 FAIL Property animation-fill-mode value 'forwards' in ::marker assert_equals: expected "forwards" but got "none"
    29 FAIL Property animation-iteration-count value 'infinite' in ::marker assert_equals: expected "infinite" but got "1"
    30 FAIL Property animation-name value 'anim' in ::marker assert_equals: expected "anim" but got "none"
    31 FAIL Property animation-play-state value 'paused' in ::marker assert_equals: expected "paused" but got "running"
    32 FAIL Property animation-timing-function value 'linear' in ::marker assert_equals: expected "linear" but got "ease"
    33 FAIL Property transition value 'display 1s linear 2s' in ::marker assert_equals: expected "display 1s linear 2s" but got "all 0s ease 0s"
    34 FAIL Property transition-delay value '1s' in ::marker assert_equals: expected "1s" but got "0s"
    35 FAIL Property transition-duration value '2s' in ::marker assert_equals: expected "2s" but got "0s"
    36 FAIL Property transition-property value 'display' in ::marker assert_equals: expected "display" but got "all"
    37 FAIL Property transition-timing-function value 'linear' in ::marker assert_equals: expected "linear" but got "ease"
     25PASS Property animation-delay value '1s' in ::marker
     26PASS Property animation-direction value 'alternate' in ::marker
     27PASS Property animation-duration value '2s' in ::marker
     28PASS Property animation-fill-mode value 'forwards' in ::marker
     29PASS Property animation-iteration-count value 'infinite' in ::marker
     30PASS Property animation-name value 'anim' in ::marker
     31PASS Property animation-play-state value 'paused' in ::marker
     32PASS Property animation-timing-function value 'linear' in ::marker
     33PASS Property transition value 'display 1s linear 2s' in ::marker
     34PASS Property transition-delay value '1s' in ::marker
     35PASS Property transition-duration value '2s' in ::marker
     36PASS Property transition-property value 'display' in ::marker
     37PASS Property transition-timing-function value 'linear' in ::marker
    3838PASS Property display value 'none' in ::marker
    3939PASS Property position value 'absolute' in ::marker
  • trunk/Source/WebCore/ChangeLog

    r269773 r269774  
     12020-11-13  Antoine Quint  <graouts@webkit.org>
     2
     3        Support more properties on ::marker
     4        https://bugs.webkit.org/show_bug.cgi?id=218894
     5        <rdar://problem/71368343>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        In preparation for the support of animations on ::marker and other pseudo-elements, we add support for animation and transition
     10        properties and add more rules to the user-agent stylesheet as defined by https://drafts.csswg.org/css-lists-3/#marker-properties.
     11
     12        * css/html.css:
     13        (::marker):
     14        * rendering/RenderListItem.cpp:
     15        (WebCore::RenderListItem::computeMarkerStyle const):
     16        * style/PropertyCascade.cpp:
     17        (WebCore::Style::isValidMarkerStyleProperty):
     18
    1192020-11-13  Zalan Bujtas  <zalan@apple.com>
    220
  • trunk/Source/WebCore/css/html.css

    r267701 r269774  
    303303}
    304304
     305/* FIXME: this should also match ::before::marker and ::after::marker but we don't support
     306   this yet. When we do, we can remove the code specific to ::before and ::after in
     307   RenderListItem::computeMarkerStyle(), see bugs.webkit.org/b/218897. */
    305308::marker {
     309    unicode-bidi: isolate;
     310    font-variant-numeric: tabular-nums;
     311    white-space: pre;
    306312    text-transform: none;
    307313}
  • trunk/Source/WebCore/rendering/RenderListItem.cpp

    r258680 r269774  
    3232#include "InlineElementBox.h"
    3333#include "PseudoElement.h"
     34#include "RenderStyleConstants.h"
    3435#include "RenderTreeBuilder.h"
    3536#include "RenderView.h"
    3637#include "StyleInheritedData.h"
     38#include "UnicodeBidi.h"
    3739#include <wtf/IsoMallocInlines.h>
    3840#include <wtf/StackStats.h>
     
    5961RenderStyle RenderListItem::computeMarkerStyle() const
    6062{
     63    if (!is<PseudoElement>(element())) {
     64        auto markerStyle = getCachedPseudoStyle(PseudoId::Marker, &style());
     65        ASSERT(markerStyle);
     66        return RenderStyle::clone(*markerStyle);
     67    }
     68
    6169    // The marker always inherits from the list item, regardless of where it might end
    6270    // up (e.g., in some deeply nested line box). See CSS3 spec.
    63     // FIXME: The marker should only inherit all font properties and the color property
    64     // according to the CSS Pseudo-Elements Module Level 4 spec.
    65     //
    66     // Although the CSS Pseudo-Elements Module Level 4 spec. saids to add ::marker to the UA sheet
    67     // we apply it here as an optimization because it only applies to markers. That is, it does not
    68     // apply to all elements.
    69     RenderStyle parentStyle = RenderStyle::clone(style());
     71    auto markerStyle = RenderStyle::create();
     72    markerStyle.inheritFrom(style());
     73
     74    // In the case of a ::before or ::after pseudo-element, we manually apply the properties
     75    // otherwise set in the user-agent stylesheet since we don't support ::before::marker or
     76    // ::after::marker. See bugs.webkit.org/b/218897.
    7077    auto fontDescription = style().fontDescription();
    7178    fontDescription.setVariantNumericSpacing(FontVariantNumericSpacing::TabularNumbers);
    72     parentStyle.setFontDescription(WTFMove(fontDescription));
    73     parentStyle.fontCascade().update(&document().fontSelector());
    74     if (auto markerStyle = getCachedPseudoStyle(PseudoId::Marker, &parentStyle))
    75         return RenderStyle::clone(*markerStyle);
    76     auto markerStyle = RenderStyle::create();
    77     markerStyle.inheritFrom(parentStyle);
     79    markerStyle.setFontDescription(WTFMove(fontDescription));
     80    markerStyle.fontCascade().update(&document().fontSelector());
     81    markerStyle.setUnicodeBidi(EUnicodeBidi::Isolate);
     82    markerStyle.setWhiteSpace(WhiteSpace::Pre);
     83    markerStyle.setTextTransform(TextTransform::None);
    7884    return markerStyle;
    7985}
  • trunk/Source/WebCore/style/PropertyCascade.cpp

    r266689 r269774  
    7171
    7272// https://www.w3.org/TR/css-pseudo-4/#marker-pseudo (Editor's Draft, 25 July 2017)
     73// FIXME: this is outdated, see https://bugs.webkit.org/show_bug.cgi?id=218791.
    7374static inline bool isValidMarkerStyleProperty(CSSPropertyID id)
    7475{
     
    9293    case CSSPropertyFontVariationSettings:
    9394#endif
     95    case CSSPropertyAnimationDuration:
     96    case CSSPropertyAnimationTimingFunction:
     97    case CSSPropertyAnimationDelay:
     98    case CSSPropertyAnimationIterationCount:
     99    case CSSPropertyAnimationDirection:
     100    case CSSPropertyAnimationFillMode:
     101    case CSSPropertyAnimationPlayState:
     102    case CSSPropertyAnimationName:
     103    case CSSPropertyTransitionDuration:
     104    case CSSPropertyTransitionTimingFunction:
     105    case CSSPropertyTransitionDelay:
     106    case CSSPropertyTransitionProperty:
    94107        return true;
    95108    default:
Note: See TracChangeset for help on using the changeset viewer.