<?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>256814</bug_id>
          
          <creation_ts>2023-05-15 16:25:20 -0700</creation_ts>
          <short_desc>REGRESSION (Safari 16.4, 258767@main): Carcassonne game on boardgamearena.com unplayable (serialization bug affecting background-position)</short_desc>
          <delta_ts>2023-06-12 08:36:29 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>Safari 16</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://github.com/web-platform-tests/wpt/pull/40482</see_also>
          <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>248913</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Andrew Collier">webkitbugzilla</reporter>
          <assigned_to name="Darin Adler">darin</assigned_to>
          <cc>ap</cc>
    
    <cc>darin</cc>
    
    <cc>koivisto</cc>
    
    <cc>ntim</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1955525</commentid>
    <comment_count>0</comment_count>
    <who name="Andrew Collier">webkitbugzilla</who>
    <bug_when>2023-05-15 16:25:20 -0700</bug_when>
    <thetext>This behaviour changed with the introduction of Safari 16.4. It is still present in Safari technology Preview Release 169 (Safari 16.4, WebKit 18616.1.12.2)

Given the following HTML:

    &lt;div id=&quot;outer&quot; style=&quot;background-position: 10% 0%&quot;&gt;&lt;/div&gt;

Note the missing semicolon at the end of the style definition.

In Safari 16.4, this node&apos;s style.cssText becomes &quot;background-position: 10%;&quot;
In older Safari or any other browser, this node&apos;s style.cssText is &quot;background-position: 10% 0%;&quot;

Visible reproducer at https://jsfiddle.net/shadowphiar/skh5q6yz/


The reason this matters is that if any other style gets applied (such as a rotation transform) and background-position is recalculated, then suddenly the background-position-y is treated as 50% (because now only one argument is present in background-position). The writer expects background-position-y to remain 0%. I understand that the markup is incorrect but treating it so differently will be very unexpected.

This currently affects a production site boardgamearea.com and in particular their implementation of the game Carcassonne.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1955549</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2023-05-15 17:50:41 -0700</bug_when>
    <thetext>Thank you for the report! Could you please add more details on how the website is affected? 

I tried going there, but &quot;boardgamearea.com&quot; just redirected to some malicious content at first, and then at a placeholder after a minute or so.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1955550</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-05-15 17:50:55 -0700</bug_when>
    <thetext>&lt;rdar://problem/109380755&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1955554</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2023-05-15 17:53:58 -0700</bug_when>
    <thetext>I don&apos;t have an older Safari readily available to confirm, but I suspect that serialization changed in bug 247879, while parsing may have always been wrong, defaulting to &quot;0&quot; by accident?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1955617</commentid>
    <comment_count>4</comment_count>
    <who name="Andrew Collier">webkitbugzilla</who>
    <bug_when>2023-05-16 01:47:26 -0700</bug_when>
    <thetext>(In reply to Alexey Proskuryakov from comment #1)
&gt; Thank you for the report! Could you please add more details on how the
&gt; website is affected? 
&gt; 
&gt; I tried going there, but &quot;boardgamearea.com&quot; just redirected to some
&gt; malicious content at first, and then at a placeholder after a minute or so.

Oh no! Sorry, that is a typo. I meant boardgamearena.com (with the n)

boardgamearena.com is quite a dynamic site, so page urls might not last long. Nonetheless here are a couple of examples currently visible live:

https://boardgamearena.com/3/carcassonne?table=377083053
https://boardgamearena.com/6/carcassonne?table=377145832

and there are screenshots of the issue in some forum threads:

https://boardgamearena.com/forum/viewtopic.php?t=29913
https://en.boardgamearena.com/bug?id=87361
https://imgur.com/ag3Sl21

I believe these should all be visible without needing to log in.

If you&apos;re unfamiliar with the game it may be difficult to see what the problem is, but notice that some of the tiles have a line exactly half way through, with building on one side and grass on the other, or roads the stop in the middle of the tile. This never happens on correctly-displayed tiles.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1955673</commentid>
    <comment_count>5</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2023-05-16 08:56:32 -0700</bug_when>
    <thetext>Thank you, this clearly makes the game unplayable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1960465</commentid>
    <comment_count>6</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2023-06-07 17:08:27 -0700</bug_when>
    <thetext>We use the initial value to choose whether to omit the longhand: https://searchfox.org/wubkat/rev/a33f8a24c752c23225ebeb863f4523b5f2ee4201/Source/WebCore/css/parser/CSSPropertyParser.cpp#1092-1096

While the initial value is indeed 0%, the serialization rule for `background-position` is different, if only one value is set, then 50% is used as Y coordinate. So serializing `10% 0%` as `10%` is clearly incorrect.

I think this is a regression of 259185@main.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1960466</commentid>
    <comment_count>7</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2023-06-07 17:12:06 -0700</bug_when>
    <thetext>Actually, I think it&apos;s 258767@main</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1960769</commentid>
    <comment_count>8</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2023-06-09 10:13:00 -0700</bug_when>
    <thetext>So it’s not about the semicolon, it’s just a bug I introduced. Should be very easy to fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1960779</commentid>
    <comment_count>9</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2023-06-09 10:41:04 -0700</bug_when>
    <thetext>Annoying that WPT did not catch this. I’ll have to add some WPT test cases too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1960899</commentid>
    <comment_count>10</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2023-06-09 18:32:51 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/14842</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1960927</commentid>
    <comment_count>11</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-06-10 02:15:17 -0700</bug_when>
    <thetext>Committed 265056@main (82228ed93559): &lt;https://commits.webkit.org/265056@main&gt;

Reviewed commits have been landed. Closing PR #14842 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>