<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - SVGColor css custom text format is different from the CSS color custom text format"
   href="https://bugs.webkit.org/show_bug.cgi?id=148879">148879</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SVGColor css custom text format is different from the CSS color custom text format
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>WebKit Nightly Build
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>CSS
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sabouhallawa&#64;apple.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=260669" name="attach_260669" title="test case">attachment 260669</a> <a href="attachment.cgi?id=260669&amp;action=edit" title="test case">[details]</a></span>
test case

Open the attached test case.

Result: The css custom text format of the &lt;div&gt; tag is different from the css custom text format of the SVG &lt;rect&gt; tag.
Expected: Colors should always have the same format.

Notes: The problem is Color::serialized() function uses the hex format if the color is opaque. This function is used by SVGColor::customCSSText(). The CSS color itself does not use this function, but instead CSSPrimitiveValue::formatNumberForCustomCSSText() uses different format and code for the cases CSS_RGBCOLOR and CSS_PARSER_HEXCOLOR. This code seems to be the correct format for colors and it used by non SVG colors.

Also in the header file Color.h, this comment is there 

    // Returns the color serialized according to HTML5
    // - <a href="http://www.whatwg.org/specs/web-apps/current-work/#serialization-of-a-color">http://www.whatwg.org/specs/web-apps/current-work/#serialization-of-a-color</a>
    WEBCORE_EXPORT String serialized() const;

The above link is broken and I could not find CSS specs for serialization of a color.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>