Title: [288054] trunk
Revision
288054
Author
[email protected]
Date
2022-01-15 05:32:05 -0800 (Sat, 15 Jan 2022)

Log Message

Setting `content: normal` on a ::marker should make computed style return resolved values
https://bugs.webkit.org/show_bug.cgi?id=235222

Reviewed by Aditya Keerthi.

LayoutTests/imported/w3c:

Mark WPT progressions.

* web-platform-tests/css/css-pseudo/marker-computed-size-expected.txt:

Source/WebCore:

Until now, StyleBuilder would treat "none" and "normal" values the same way for the "content"
CSS property. However, "normal", the initial value, is not the same as "none" which explicitly
states that we do not have any content. The WPT test css/css-pseudo/marker-computed-size.html
checks on this by setting `content: normal` on a ::marker and expecting the computed style
for "width" and "height" to be pixel values and not "auto".

We already have a bit in RenderStyle that would be turned on when we would parse either "none"
or "normal". We're now only setting that bit, with a better name  when the value is explicitly "none".

So we now remove hasExplicitlyClearedContent() and instead expose hasEffectiveContentNone()
on RenderStyle.

We also remove a stale comment in applyInheritContent() since the spec has not changed to make
"content" inherited.

Finally, Styleable::renderer() now returns the markerRenderer() unless
RenderStyle::hasEffectiveContentNone() is true.

For reference, the relevant spec is https://drafts.csswg.org/css-content-3/#content-property.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::contentToCSSValue):
* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::isControlStyled const):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::RenderStyle):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::hasEffectiveContentNone const):
(WebCore::RenderStyle::setHasContentNone):
(WebCore::RenderStyle::NonInheritedFlags::operator== const):
(WebCore::RenderStyle::setHasExplicitlyClearedContent): Deleted.
(WebCore::RenderStyle::hasExplicitlyClearedContent const): Deleted.
* style/StyleBuilderCustom.h:
(WebCore::Style::BuilderCustom::applyInitialContent):
(WebCore::Style::BuilderCustom::applyInheritContent):
(WebCore::Style::BuilderCustom::applyValueContent):
* style/Styleable.cpp:
(WebCore::Styleable::renderer const):

LayoutTests:

* platform/gtk/imported/w3c/web-platform-tests/css/css-pseudo/marker-computed-size-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (288053 => 288054)


--- trunk/LayoutTests/ChangeLog	2022-01-15 07:30:01 UTC (rev 288053)
+++ trunk/LayoutTests/ChangeLog	2022-01-15 13:32:05 UTC (rev 288054)
@@ -1,3 +1,12 @@
+2022-01-14  Antoine Quint  <[email protected]>
+
+        Setting `content: normal` on a ::marker should make computed style return resolved values
+        https://bugs.webkit.org/show_bug.cgi?id=235222
+
+        Reviewed by Aditya Keerthi.
+
+        * platform/gtk/imported/w3c/web-platform-tests/css/css-pseudo/marker-computed-size-expected.txt:
+
 2022-01-14  Frederic Wang  <[email protected]>
 
         null ptr deref in WebCore::ReplaceSelectionCommand::moveNodeOutOfAncestor()

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (288053 => 288054)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-01-15 07:30:01 UTC (rev 288053)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-01-15 13:32:05 UTC (rev 288054)
@@ -1,3 +1,14 @@
+2022-01-14  Antoine Quint  <[email protected]>
+
+        Setting `content: normal` on a ::marker should make computed style return resolved values
+        https://bugs.webkit.org/show_bug.cgi?id=235222
+
+        Reviewed by Aditya Keerthi.
+
+        Mark WPT progressions.
+
+        * web-platform-tests/css/css-pseudo/marker-computed-size-expected.txt:
+
 2022-01-14  Yusuke Suzuki  <[email protected]>
 
         [JSC] Fix WebAssembly.Global's typename for "anyfunc"

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-computed-size-expected.txt (288053 => 288054)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-computed-size-expected.txt	2022-01-15 07:30:01 UTC (rev 288053)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-computed-size-expected.txt	2022-01-15 13:32:05 UTC (rev 288054)
@@ -1,7 +1,7 @@
 
-FAIL Decimal ::marker assert_equals: width expected "30px" but got "auto"
-FAIL Decimal ::marker with custom value assert_equals: width expected "40px" but got "auto"
-FAIL String ::marker assert_equals: width expected "20px" but got "auto"
+PASS Decimal ::marker
+PASS Decimal ::marker with custom value
+PASS String ::marker
 PASS ::marker with no box due to 'list-style'
 FAIL ::marker with custom string contents assert_equals: width expected "60px" but got "auto"
 FAIL ::marker with custom image contents assert_equals: width expected "100px" but got "auto"

Copied: trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/css-pseudo/marker-computed-size-expected.txt (from rev 288053, trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo/marker-computed-size-expected.txt) (0 => 288054)


--- trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/css-pseudo/marker-computed-size-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/css-pseudo/marker-computed-size-expected.txt	2022-01-15 13:32:05 UTC (rev 288054)
@@ -0,0 +1,10 @@
+
+FAIL Decimal ::marker assert_equals: width expected "30px" but got "11px"
+FAIL Decimal ::marker with custom value assert_equals: width expected "40px" but got "16px"
+FAIL String ::marker assert_equals: width expected "20px" but got "7px"
+PASS ::marker with no box due to 'list-style'
+FAIL ::marker with custom string contents assert_equals: width expected "60px" but got "auto"
+FAIL ::marker with custom image contents assert_equals: width expected "100px" but got "auto"
+FAIL ::marker with custom string and image contents assert_equals: width expected "130px" but got "auto"
+PASS ::marker with no box due to 'content'
+

Modified: trunk/Source/WebCore/ChangeLog (288053 => 288054)


--- trunk/Source/WebCore/ChangeLog	2022-01-15 07:30:01 UTC (rev 288053)
+++ trunk/Source/WebCore/ChangeLog	2022-01-15 13:32:05 UTC (rev 288054)
@@ -1,3 +1,49 @@
+2022-01-14  Antoine Quint  <[email protected]>
+
+        Setting `content: normal` on a ::marker should make computed style return resolved values
+        https://bugs.webkit.org/show_bug.cgi?id=235222
+
+        Reviewed by Aditya Keerthi.
+
+        Until now, StyleBuilder would treat "none" and "normal" values the same way for the "content"
+        CSS property. However, "normal", the initial value, is not the same as "none" which explicitly
+        states that we do not have any content. The WPT test css/css-pseudo/marker-computed-size.html
+        checks on this by setting `content: normal` on a ::marker and expecting the computed style
+        for "width" and "height" to be pixel values and not "auto".
+
+        We already have a bit in RenderStyle that would be turned on when we would parse either "none"
+        or "normal". We're now only setting that bit, with a better name  when the value is explicitly "none".
+
+        So we now remove hasExplicitlyClearedContent() and instead expose hasEffectiveContentNone()
+        on RenderStyle.
+
+        We also remove a stale comment in applyInheritContent() since the spec has not changed to make
+        "content" inherited.
+
+        Finally, Styleable::renderer() now returns the markerRenderer() unless
+        RenderStyle::hasEffectiveContentNone() is true.
+
+        For reference, the relevant spec is https://drafts.csswg.org/css-content-3/#content-property.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::contentToCSSValue):
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::RenderThemeIOS::isControlStyled const):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::RenderStyle):
+        * rendering/style/RenderStyle.h:
+        (WebCore::RenderStyle::hasEffectiveContentNone const):
+        (WebCore::RenderStyle::setHasContentNone):
+        (WebCore::RenderStyle::NonInheritedFlags::operator== const):
+        (WebCore::RenderStyle::setHasExplicitlyClearedContent): Deleted.
+        (WebCore::RenderStyle::hasExplicitlyClearedContent const): Deleted.
+        * style/StyleBuilderCustom.h:
+        (WebCore::Style::BuilderCustom::applyInitialContent):
+        (WebCore::Style::BuilderCustom::applyInheritContent):
+        (WebCore::Style::BuilderCustom::applyValueContent):
+        * style/Styleable.cpp:
+        (WebCore::Styleable::renderer const):
+
 2022-01-14  Peng Liu  <[email protected]>
 
         Unable to playback portrait videos on HTML canvas elements

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (288053 => 288054)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-01-15 07:30:01 UTC (rev 288053)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-01-15 13:32:05 UTC (rev 288054)
@@ -1924,10 +1924,8 @@
         else if (is<TextContentData>(*contentData))
             list->append(cssValuePool.createValue(downcast<TextContentData>(*contentData).text(), CSSUnitType::CSS_STRING));
     }
-    if (!list->length()) {
-        auto isBeforeOrAfter = style.styleType() == PseudoId::Before || style.styleType() == PseudoId::After;
-        list->append(cssValuePool.createIdentifierValue(isBeforeOrAfter ? CSSValueNone : CSSValueNormal));
-    }
+    if (!list->length())
+        list->append(cssValuePool.createIdentifierValue(style.hasEffectiveContentNone() ? CSSValueNone : CSSValueNormal));
     return list;
 }
 

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (288053 => 288054)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2022-01-15 07:30:01 UTC (rev 288053)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2022-01-15 13:32:05 UTC (rev 288054)
@@ -496,7 +496,7 @@
 
 #if ENABLE(DATALIST_ELEMENT)
     if (style.effectiveAppearance() == ListButtonPart)
-        return style.hasContent() || style.hasExplicitlyClearedContent();
+        return style.hasContent() || style.hasEffectiveContentNone();
 #endif
 
     return RenderTheme::isControlStyled(style, userAgentStyle);

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (288053 => 288054)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2022-01-15 07:30:01 UTC (rev 288053)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2022-01-15 13:32:05 UTC (rev 288054)
@@ -194,7 +194,7 @@
     m_nonInheritedFlags.firstChildState = false;
     m_nonInheritedFlags.lastChildState = false;
     m_nonInheritedFlags.isLink = false;
-    m_nonInheritedFlags.hasExplicitlyClearedContent = false;
+    m_nonInheritedFlags.hasContentNone = false;
     m_nonInheritedFlags.styleType = static_cast<unsigned>(PseudoId::None);
     m_nonInheritedFlags.pseudoBits = static_cast<unsigned>(PseudoId::None);
 

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (288053 => 288054)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2022-01-15 07:30:01 UTC (rev 288053)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2022-01-15 13:32:05 UTC (rev 288054)
@@ -1471,13 +1471,13 @@
     PathOperation* clipPath() const { return m_rareNonInheritedData->clipPath.get(); }
     static PathOperation* initialClipPath() { return nullptr; }
 
+    bool hasEffectiveContentNone() const { return !contentData() && (m_nonInheritedFlags.hasContentNone || styleType() == PseudoId::Before || styleType() == PseudoId::After); }
     bool hasContent() const { return contentData(); }
     const ContentData* contentData() const { return m_rareNonInheritedData->content.get(); }
     void setContent(std::unique_ptr<ContentData>, bool add);
     bool contentDataEquivalent(const RenderStyle* otherStyle) const { return const_cast<RenderStyle*>(this)->m_rareNonInheritedData->contentDataEquivalent(*const_cast<RenderStyle*>(otherStyle)->m_rareNonInheritedData); }
     void clearContent();
-    void setHasExplicitlyClearedContent(bool v) { m_nonInheritedFlags.hasExplicitlyClearedContent = v; }
-    bool hasExplicitlyClearedContent() const { return m_nonInheritedFlags.hasExplicitlyClearedContent; };
+    void setHasContentNone(bool v) { m_nonInheritedFlags.hasContentNone = v; }
     void setContent(const String&, bool add = false);
     void setContent(RefPtr<StyleImage>&&, bool add = false);
     void setContent(std::unique_ptr<CounterContent>, bool add = false);
@@ -1941,7 +1941,7 @@
         unsigned firstChildState : 1;
         unsigned lastChildState : 1;
         unsigned isLink : 1;
-        unsigned hasExplicitlyClearedContent : 1;
+        unsigned hasContentNone : 1;
 
         unsigned styleType : 4; // PseudoId
         unsigned pseudoBits : (static_cast<unsigned>(PseudoId::FirstInternalPseudoId) - static_cast<unsigned>(PseudoId::FirstPublicPseudoId));
@@ -2078,7 +2078,7 @@
         && firstChildState == other.firstChildState
         && lastChildState == other.lastChildState
         && isLink == other.isLink
-        && hasExplicitlyClearedContent == other.hasExplicitlyClearedContent
+        && hasContentNone == other.hasContentNone
         && styleType == other.styleType
         && pseudoBits == other.pseudoBits;
 }

Modified: trunk/Source/WebCore/style/StyleBuilderCustom.h (288053 => 288054)


--- trunk/Source/WebCore/style/StyleBuilderCustom.h	2022-01-15 07:30:01 UTC (rev 288053)
+++ trunk/Source/WebCore/style/StyleBuilderCustom.h	2022-01-15 13:32:05 UTC (rev 288054)
@@ -1520,13 +1520,11 @@
 inline void BuilderCustom::applyInitialContent(BuilderState& builderState)
 {
     builderState.style().clearContent();
-    builderState.style().setHasExplicitlyClearedContent(true);
+    builderState.style().setHasContentNone(false);
 }
 
 inline void BuilderCustom::applyInheritContent(BuilderState&)
 {
-    // FIXME: In CSS3, it will be possible to inherit content. In CSS2 it is not. This
-    // note is a reminder that eventually "inherit" needs to be supported.
 }
 
 inline void BuilderCustom::applyValueContent(BuilderState& builderState, CSSValue& value)
@@ -1535,7 +1533,7 @@
         const auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
         ASSERT_UNUSED(primitiveValue, primitiveValue.valueID() == CSSValueNormal || primitiveValue.valueID() == CSSValueNone);
         builderState.style().clearContent();
-        builderState.style().setHasExplicitlyClearedContent(true);
+        builderState.style().setHasContentNone(primitiveValue.valueID() == CSSValueNone);
         return;
     }
 

Modified: trunk/Source/WebCore/style/Styleable.cpp (288053 => 288054)


--- trunk/Source/WebCore/style/Styleable.cpp	2022-01-15 07:30:01 UTC (rev 288053)
+++ trunk/Source/WebCore/style/Styleable.cpp	2022-01-15 13:32:05 UTC (rev 288054)
@@ -100,7 +100,7 @@
     case PseudoId::Marker:
         if (is<RenderListItem>(element.renderer())) {
             auto* markerRenderer = downcast<RenderListItem>(*element.renderer()).markerRenderer();
-            if (markerRenderer && markerRenderer->style().hasContent())
+            if (markerRenderer && !markerRenderer->style().hasEffectiveContentNone())
                 return markerRenderer;
         }
         break;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to