Title: [269774] trunk
Revision
269774
Author
[email protected]
Date
2020-11-13 06:32:15 -0800 (Fri, 13 Nov 2020)

Log 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):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (269773 => 269774)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-11-13 14:12:39 UTC (rev 269773)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-11-13 14:32:15 UTC (rev 269774)
@@ -1,3 +1,15 @@
+2020-11-13  Antoine Quint  <[email protected]>
+
+        Support more properties on ::marker
+        https://bugs.webkit.org/show_bug.cgi?id=218894
+        <rdar://problem/71368343>
+
+        Reviewed by Antti Koivisto.
+
+        Mark some WPT progressions.
+
+        * web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt:
+
 2020-11-12  Zalan Bujtas  <[email protected]>
 
         [LFC][Integration] Enable inline replaced support

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt (269773 => 269774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt	2020-11-13 14:12:39 UTC (rev 269773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/parsing/marker-supported-properties-expected.txt	2020-11-13 14:32:15 UTC (rev 269774)
@@ -22,19 +22,19 @@
 FAIL Property direction value 'rtl' in ::marker assert_equals: expected "rtl" but got "ltr"
 FAIL Property content value '"foo"' in ::marker assert_equals: expected "\"foo\"" but got ""
 FAIL 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 ""
-FAIL Property animation-delay value '1s' in ::marker assert_equals: expected "1s" but got "0s"
-FAIL Property animation-direction value 'alternate' in ::marker assert_equals: expected "alternate" but got "normal"
-FAIL Property animation-duration value '2s' in ::marker assert_equals: expected "2s" but got "0s"
-FAIL Property animation-fill-mode value 'forwards' in ::marker assert_equals: expected "forwards" but got "none"
-FAIL Property animation-iteration-count value 'infinite' in ::marker assert_equals: expected "infinite" but got "1"
-FAIL Property animation-name value 'anim' in ::marker assert_equals: expected "anim" but got "none"
-FAIL Property animation-play-state value 'paused' in ::marker assert_equals: expected "paused" but got "running"
-FAIL Property animation-timing-function value 'linear' in ::marker assert_equals: expected "linear" but got "ease"
-FAIL Property transition value 'display 1s linear 2s' in ::marker assert_equals: expected "display 1s linear 2s" but got "all 0s ease 0s"
-FAIL Property transition-delay value '1s' in ::marker assert_equals: expected "1s" but got "0s"
-FAIL Property transition-duration value '2s' in ::marker assert_equals: expected "2s" but got "0s"
-FAIL Property transition-property value 'display' in ::marker assert_equals: expected "display" but got "all"
-FAIL Property transition-timing-function value 'linear' in ::marker assert_equals: expected "linear" but got "ease"
+PASS Property animation-delay value '1s' in ::marker
+PASS Property animation-direction value 'alternate' in ::marker
+PASS Property animation-duration value '2s' in ::marker
+PASS Property animation-fill-mode value 'forwards' in ::marker
+PASS Property animation-iteration-count value 'infinite' in ::marker
+PASS Property animation-name value 'anim' in ::marker
+PASS Property animation-play-state value 'paused' in ::marker
+PASS Property animation-timing-function value 'linear' in ::marker
+PASS Property transition value 'display 1s linear 2s' in ::marker
+PASS Property transition-delay value '1s' in ::marker
+PASS Property transition-duration value '2s' in ::marker
+PASS Property transition-property value 'display' in ::marker
+PASS Property transition-timing-function value 'linear' in ::marker
 PASS Property display value 'none' in ::marker
 PASS Property position value 'absolute' in ::marker
 PASS Property float value 'right' in ::marker

Modified: trunk/Source/WebCore/ChangeLog (269773 => 269774)


--- trunk/Source/WebCore/ChangeLog	2020-11-13 14:12:39 UTC (rev 269773)
+++ trunk/Source/WebCore/ChangeLog	2020-11-13 14:32:15 UTC (rev 269774)
@@ -1,3 +1,21 @@
+2020-11-13  Antoine Quint  <[email protected]>
+
+        Support more properties on ::marker
+        https://bugs.webkit.org/show_bug.cgi?id=218894
+        <rdar://problem/71368343>
+
+        Reviewed by Antti Koivisto.
+
+        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):
+
 2020-11-13  Zalan Bujtas  <[email protected]>
 
         [LFC][Integration] Add initial bidi support

Modified: trunk/Source/WebCore/css/html.css (269773 => 269774)


--- trunk/Source/WebCore/css/html.css	2020-11-13 14:12:39 UTC (rev 269773)
+++ trunk/Source/WebCore/css/html.css	2020-11-13 14:32:15 UTC (rev 269774)
@@ -302,7 +302,13 @@
     text-align: -webkit-match-parent;
 }
 
+/* FIXME: this should also match ::before::marker and ::after::marker but we don't support
+   this yet. When we do, we can remove the code specific to ::before and ::after in
+   RenderListItem::computeMarkerStyle(), see bugs.webkit.org/b/218897. */
 ::marker {
+    unicode-bidi: isolate;
+    font-variant-numeric: tabular-nums;
+    white-space: pre;
     text-transform: none;
 }
 

Modified: trunk/Source/WebCore/rendering/RenderListItem.cpp (269773 => 269774)


--- trunk/Source/WebCore/rendering/RenderListItem.cpp	2020-11-13 14:12:39 UTC (rev 269773)
+++ trunk/Source/WebCore/rendering/RenderListItem.cpp	2020-11-13 14:32:15 UTC (rev 269774)
@@ -31,9 +31,11 @@
 #include "HTMLUListElement.h"
 #include "InlineElementBox.h"
 #include "PseudoElement.h"
+#include "RenderStyleConstants.h"
 #include "RenderTreeBuilder.h"
 #include "RenderView.h"
 #include "StyleInheritedData.h"
+#include "UnicodeBidi.h"
 #include <wtf/IsoMallocInlines.h>
 #include <wtf/StackStats.h>
 #include <wtf/StdLibExtras.h>
@@ -58,23 +60,27 @@
 
 RenderStyle RenderListItem::computeMarkerStyle() const
 {
+    if (!is<PseudoElement>(element())) {
+        auto markerStyle = getCachedPseudoStyle(PseudoId::Marker, &style());
+        ASSERT(markerStyle);
+        return RenderStyle::clone(*markerStyle);
+    }
+
     // The marker always inherits from the list item, regardless of where it might end
     // up (e.g., in some deeply nested line box). See CSS3 spec.
-    // FIXME: The marker should only inherit all font properties and the color property
-    // according to the CSS Pseudo-Elements Module Level 4 spec.
-    //
-    // Although the CSS Pseudo-Elements Module Level 4 spec. saids to add ::marker to the UA sheet
-    // we apply it here as an optimization because it only applies to markers. That is, it does not
-    // apply to all elements.
-    RenderStyle parentStyle = RenderStyle::clone(style());
+    auto markerStyle = RenderStyle::create();
+    markerStyle.inheritFrom(style());
+
+    // In the case of a ::before or ::after pseudo-element, we manually apply the properties
+    // otherwise set in the user-agent stylesheet since we don't support ::before::marker or
+    // ::after::marker. See bugs.webkit.org/b/218897.
     auto fontDescription = style().fontDescription();
     fontDescription.setVariantNumericSpacing(FontVariantNumericSpacing::TabularNumbers);
-    parentStyle.setFontDescription(WTFMove(fontDescription));
-    parentStyle.fontCascade().update(&document().fontSelector());
-    if (auto markerStyle = getCachedPseudoStyle(PseudoId::Marker, &parentStyle))
-        return RenderStyle::clone(*markerStyle);
-    auto markerStyle = RenderStyle::create();
-    markerStyle.inheritFrom(parentStyle);
+    markerStyle.setFontDescription(WTFMove(fontDescription));
+    markerStyle.fontCascade().update(&document().fontSelector());
+    markerStyle.setUnicodeBidi(EUnicodeBidi::Isolate);
+    markerStyle.setWhiteSpace(WhiteSpace::Pre);
+    markerStyle.setTextTransform(TextTransform::None);
     return markerStyle;
 }
 

Modified: trunk/Source/WebCore/style/PropertyCascade.cpp (269773 => 269774)


--- trunk/Source/WebCore/style/PropertyCascade.cpp	2020-11-13 14:12:39 UTC (rev 269773)
+++ trunk/Source/WebCore/style/PropertyCascade.cpp	2020-11-13 14:32:15 UTC (rev 269774)
@@ -70,6 +70,7 @@
 }
 
 // https://www.w3.org/TR/css-pseudo-4/#marker-pseudo (Editor's Draft, 25 July 2017)
+// FIXME: this is outdated, see https://bugs.webkit.org/show_bug.cgi?id=218791.
 static inline bool isValidMarkerStyleProperty(CSSPropertyID id)
 {
     switch (id) {
@@ -91,6 +92,18 @@
     case CSSPropertyFontOpticalSizing:
     case CSSPropertyFontVariationSettings:
 #endif
+    case CSSPropertyAnimationDuration:
+    case CSSPropertyAnimationTimingFunction:
+    case CSSPropertyAnimationDelay:
+    case CSSPropertyAnimationIterationCount:
+    case CSSPropertyAnimationDirection:
+    case CSSPropertyAnimationFillMode:
+    case CSSPropertyAnimationPlayState:
+    case CSSPropertyAnimationName:
+    case CSSPropertyTransitionDuration:
+    case CSSPropertyTransitionTimingFunction:
+    case CSSPropertyTransitionDelay:
+    case CSSPropertyTransitionProperty:
         return true;
     default:
         break;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to