<?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>276414</bug_id>
          
          <creation_ts>2024-07-10 02:26:48 -0700</creation_ts>
          <short_desc>Handling of negative margins in MathML</short_desc>
          <delta_ts>2025-07-07 05:53:44 -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>MathML</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</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>
          <dependson>276428</dependson>
          <blocked>276169</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Frédéric Wang Nélar">fred.wang</reporter>
          <assigned_to name="Frédéric Wang Nélar">fred.wang</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2045499</commentid>
    <comment_count>0</comment_count>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2024-07-10 02:26:48 -0700</bug_when>
    <thetext>It seems margin has been supported for mrow-like elements for a while and I&apos;ve been doing that for other MathML elements in bug 276169&apos;s dependencies.

MathML elements calculate their sizes from the coordinates/sizes of their children&apos;s margin boxes, which can lead to weird cases with negative margins. We should make sure these edge cases don&apos;t cause any wrong behavior laying MathML elements, probably clamping negative offsets to 0 when necessary.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2045540</commentid>
    <comment_count>1</comment_count>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2024-07-10 08:05:51 -0700</bug_when>
    <thetext>There are WPT crash tests for what I&apos;m mentioning:

http://wpt.live/mathml/crashtests/children-with-negative-inline-sizes.html
http://wpt.live/mathml/crashtests/children-with-negative-block-sizes.html

and they don&apos;t seem to cause any crash/asserts, so maybe some explicit clamping is not necessary.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2046685</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-07-17 02:27:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/131909042&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2128122</commentid>
    <comment_count>3</comment_count>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2025-07-07 05:53:44 -0700</bug_when>
    <thetext>I&apos;ll close this issue. I believe MathML Core does not support negative margin for now and WPT tests mentioned above don&apos;t crash/assert. If things change we can always revisit.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>