<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>247734</bug_id>
          
          <creation_ts>2022-11-10 07:54:19 -0800</creation_ts>
          <short_desc>cssText serializes shorthand with var() even if some longhand is different</short_desc>
          <delta_ts>2022-11-11 10:29:35 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>CSS</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>247741</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Oriol Brufau">obrufau</reporter>
          <assigned_to name="Oriol Brufau">obrufau</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1911534</commentid>
    <comment_count>0</comment_count>
    <who name="Oriol Brufau">obrufau</who>
    <bug_when>2022-11-10 07:54:19 -0800</bug_when>
    <thetext>Run this:

    document.body.style.cssText = &quot;margin: var(--m); margin-top: 1px&quot;;
    document.body.style.cssText;

Expected: &quot;margin-right: ; margin-bottom: ; margin-left: ; margin-top: 1px;&quot;

Actual: &quot;margin: var(--m);&quot;

The problem is that StyleProperties::asTextInternal() sees that margin-right is set to a pending-substitution value for margin:var(--m), and then https://searchfox.org/wubkat/rev/7a292520f6b12e8d4d9001d1480474b5c83cb0f8/Source/WebCore/css/StyleProperties.cpp#1795 sets value to &quot;var(--m)&quot;.

    value = substitutionValue.shorthandValue().cssText();

The value should instead be obtained in https://searchfox.org/wubkat/rev/7a292520f6b12e8d4d9001d1480474b5c83cb0f8/Source/WebCore/css/StyleProperties.cpp#1823

    value = getPropertyValue(shorthandPropertyID);

which will properly detect that &quot;var(--m)&quot; is not a proper serialization.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1911609</commentid>
    <comment_count>1</comment_count>
    <who name="Oriol Brufau">obrufau</who>
    <bug_when>2022-11-10 11:49:08 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/6356</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1911751</commentid>
    <comment_count>2</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-11-10 23:45:29 -0800</bug_when>
    <thetext>Committed 256564@main (b7eeaa128fab): &lt;https://commits.webkit.org/256564@main&gt;

Reviewed commits have been landed. Closing PR #6356 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1911752</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-11-10 23:46:19 -0800</bug_when>
    <thetext>&lt;rdar://problem/102229765&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>