<?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>25972</bug_id>
          
          <creation_ts>2009-05-22 18:06:43 -0700</creation_ts>
          <short_desc>Help Disambiguate min/max calls in TimeRanges</short_desc>
          <delta_ts>2009-05-29 10:37:34 -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>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Brent Fulgham">bfulgham</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>122751</commentid>
    <comment_count>0</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2009-05-22 18:06:43 -0700</bug_when>
    <thetext>I am finding that the following change is needed to get a clean build:

$ diff TimeRanges.h TimeRanges.h.brent
93,94c93,94
&lt;     ret.m_start = min(m_start, range.m_start);
&lt;     ret.m_end = max(m_end, range.m_end);
---
&gt;     ret.m_start = std::min(m_start, range.m_start);
&gt;     ret.m_end = std::max(m_end, range.m_end);

It seems that some difference in the include order (or included files) allows the CG builds to handle this without needing to be told to use the std:: template call.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122752</commentid>
    <comment_count>1</comment_count>
      <attachid>30599</attachid>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2009-05-22 18:13:22 -0700</bug_when>
    <thetext>Created attachment 30599
Help compiler figure out arguments to min/max.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122754</commentid>
    <comment_count>2</comment_count>
      <attachid>30600</attachid>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2009-05-22 18:16:27 -0700</bug_when>
    <thetext>Created attachment 30600
Disambiguate min/max call.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122769</commentid>
    <comment_count>3</comment_count>
      <attachid>30600</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-05-22 19:52:44 -0700</bug_when>
    <thetext>Comment on attachment 30600
Disambiguate min/max call.

This needs more explanation in the ChangeLog as to why this is necessary or correct.  Without that I can&apos;t tell.  Feel free to explain it to maciej or I (or any other reviewer) in teh bug or over IRC.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123293</commentid>
    <comment_count>4</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2009-05-27 09:05:22 -0700</bug_when>
    <thetext>Building the Windows Cairo target, the min/max calls in TimeRanges.h are misinterpreted, leading to a compile-time error:
c:\Cygwin\home\bfulgham\WebKit\WebCore\html\TimeRanges.h(93) : error C2440: &apos;=&apos; : cannot convert from &apos;WebCore::SMILTime&apos; to &apos;float&apos;
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
c:\Cygwin\home\bfulgham\WebKit\WebCore\html\TimeRanges.h(94) : error C2440: &apos;=&apos; : cannot convert from &apos;WebCore::SMILTime&apos; to &apos;float&apos;
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

Somehow, it seems to be confused about the correct signature for min/max, resolving to the animation/SMILTime data type:
     inline SMILTime max(const SMILTime&amp; a, const SMILTime&amp; b) { return std::max(a.value(), b.value()); }
     inline SMILTime min(const SMILTime&amp; a, const SMILTime&amp; b) { return std::min(a.value(), b.value()); }

Modifying the TimeRanges implementation to explicitly use the std::min/std::max calls resolves the compile error.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123480</commentid>
    <comment_count>5</comment_count>
      <attachid>30755</attachid>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2009-05-28 15:16:59 -0700</bug_when>
    <thetext>Created attachment 30755
Correct build error.

Revise changelog to explain problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123486</commentid>
    <comment_count>6</comment_count>
      <attachid>30755</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-05-28 15:28:14 -0700</bug_when>
    <thetext>Comment on attachment 30755
Correct build error.

&gt; +        Compiler mistakenly selects SMILTime min/max instead of STL version,

Why? What even includes SMILTime?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123521</commentid>
    <comment_count>7</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2009-05-28 22:29:21 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; (From update of attachment 30755 [review])
&gt; &gt; +        Compiler mistakenly selects SMILTime min/max instead of STL version,
&gt; 
&gt; Why? What even includes SMILTime?
&gt; 

This is a byproduct of compiling the DerivedSources.cpp file, which includes and builds a ton of stuff.  Something in the 300-odd files included by DerivedSources.cpp causes SMILTime.h to be included, which sets us up for the problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123548</commentid>
    <comment_count>8</comment_count>
      <attachid>30755</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-05-29 07:53:15 -0700</bug_when>
    <thetext>Comment on attachment 30755
Correct build error.

This is close to correct, but not quite.

Since this is a header, it&apos;s not appropriate to say &quot;using namespace std&quot; here. We need to remove that. Adding the include of &lt;algorithm&gt; is also good, but it needs to be sorted in with the rest of the includes, not a separate paragraph. And we do indeed need to add the &quot;std::&quot; prefixes.

Further, SMILTime.h should not define min and max functions, since the std versions will work fine on SMILTime objects.

review- because I&apos;d prefer to see a patch that removes the incorrect &quot;using namespace std&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123555</commentid>
    <comment_count>9</comment_count>
      <attachid>30776</attachid>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2009-05-29 09:36:37 -0700</bug_when>
    <thetext>Created attachment 30776
Revised per Darin&apos;s suggestions.

Remove &apos;using namespace std&apos;, place &quot;#include &lt;algorithm&gt;&quot; in similar location as other files.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123557</commentid>
    <comment_count>10</comment_count>
      <attachid>30776</attachid>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2009-05-29 09:50:21 -0700</bug_when>
    <thetext>Comment on attachment 30776
Revised per Darin&apos;s suggestions.

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123563</commentid>
    <comment_count>11</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2009-05-29 10:37:34 -0700</bug_when>
    <thetext>Landed in r44265.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>30599</attachid>
            <date>2009-05-22 18:13:22 -0700</date>
            <delta_ts>2009-05-22 18:16:27 -0700</delta_ts>
            <desc>Help compiler figure out arguments to min/max.</desc>
            <filename>timeranges.patch</filename>
            <type>text/plain</type>
            <size>0</size>
            <attacher name="Brent Fulgham">bfulgham</attacher>
            
              <data encoding="base64"></data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>30600</attachid>
            <date>2009-05-22 18:16:27 -0700</date>
            <delta_ts>2009-05-28 15:16:59 -0700</delta_ts>
            <desc>Disambiguate min/max call.</desc>
            <filename>timeranges.patch</filename>
            <type>text/plain</type>
            <size>1279</size>
            <attacher name="Brent Fulgham">bfulgham</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09P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GlvbkNvZGUuaCIKICNpbmNsdWRlIDx3dGYv
UGFzc1JlZlB0ci5oPgogI2luY2x1ZGUgPHd0Zi9SZWZDb3VudGVkLmg+CkBAIC05MCw4ICs5Miw4
IEBAIHByaXZhdGU6CiAgICAgICAgIHsKICAgICAgICAgICAgIFJhbmdlIHJldDsKIAotICAgICAg
ICAgICAgcmV0Lm1fc3RhcnQgPSBtaW4obV9zdGFydCwgcmFuZ2UubV9zdGFydCk7Ci0gICAgICAg
ICAgICByZXQubV9lbmQgPSBtYXgobV9lbmQsIHJhbmdlLm1fZW5kKTsKKyAgICAgICAgICAgIHJl
dC5tX3N0YXJ0ID0gc3RkOjptaW4obV9zdGFydCwgcmFuZ2UubV9zdGFydCk7CisgICAgICAgICAg
ICByZXQubV9lbmQgPSBzdGQ6Om1heChtX2VuZCwgcmFuZ2UubV9lbmQpOwogCiAgICAgICAgICAg
ICByZXR1cm4gcmV0OwogICAgICAgICB9Cg==
</data>
<flag name="review"
          id="15477"
          type_id="1"
          status="-"
          setter="eric"
    />
          </attachment>
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>30755</attachid>
            <date>2009-05-28 15:16:59 -0700</date>
            <delta_ts>2009-05-29 09:36:37 -0700</delta_ts>
            <desc>Correct build error.</desc>
            <filename>smilfix.patch</filename>
            <type>text/plain</type>
            <size>1468</size>
            <attacher name="Brent Fulgham">bfulgham</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA0NDI1MikKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTcgQEAKKzIwMDktMDUtMjggIEJyZW50IEZ1bGdoYW0gIDxiZnVsZ2hhbUB3Z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gPGFsZ29yaXRobT4KKwogI2luY2x1ZGUgIkV4Y2VwdGlvbkNvZGUu
aCIKICNpbmNsdWRlIDx3dGYvUGFzc1JlZlB0ci5oPgogI2luY2x1ZGUgPHd0Zi9SZWZDb3VudGVk
Lmg+CkBAIC05MCw4ICs5Miw4IEBAIHByaXZhdGU6CiAgICAgICAgIHsKICAgICAgICAgICAgIFJh
bmdlIHJldDsKIAotICAgICAgICAgICAgcmV0Lm1fc3RhcnQgPSBtaW4obV9zdGFydCwgcmFuZ2Uu
bV9zdGFydCk7Ci0gICAgICAgICAgICByZXQubV9lbmQgPSBtYXgobV9lbmQsIHJhbmdlLm1fZW5k
KTsKKyAgICAgICAgICAgIHJldC5tX3N0YXJ0ID0gc3RkOjptaW4obV9zdGFydCwgcmFuZ2UubV9z
dGFydCk7CisgICAgICAgICAgICByZXQubV9lbmQgPSBzdGQ6Om1heChtX2VuZCwgcmFuZ2UubV9l
bmQpOwogCiAgICAgICAgICAgICByZXR1cm4gcmV0OwogICAgICAgICB9Cg==
</data>
<flag name="review"
          id="15601"
          type_id="1"
          status="-"
          setter="darin"
    />
          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>30776</attachid>
            <date>2009-05-29 09:36:37 -0700</date>
            <delta_ts>2009-05-29 09:50:21 -0700</delta_ts>
            <desc>Revised per Darin&apos;s suggestions.</desc>
            <filename>smilfix.patch</filename>
            <type>text/plain</type>
            <size>1574</size>
            <attacher name="Brent Fulgham">bfulgham</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA0NDI1MikKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTcgQEAKKzI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dlc19oCiAKICNpbmNsdWRlICJF
eGNlcHRpb25Db2RlLmgiCisKKyNpbmNsdWRlIDxhbGdvcml0aG0+CiAjaW5jbHVkZSA8d3RmL1Bh
c3NSZWZQdHIuaD4KICNpbmNsdWRlIDx3dGYvUmVmQ291bnRlZC5oPgogI2luY2x1ZGUgPHd0Zi9W
ZWN0b3IuaD4KIAotdXNpbmcgbmFtZXNwYWNlIHN0ZDsKLQogbmFtZXNwYWNlIFdlYkNvcmUgewog
CiBjbGFzcyBUaW1lUmFuZ2VzIDogcHVibGljIFJlZkNvdW50ZWQ8VGltZVJhbmdlcz4gewpAQCAt
OTAsOCArOTAsOCBAQCBwcml2YXRlOgogICAgICAgICB7CiAgICAgICAgICAgICBSYW5nZSByZXQ7
CiAKLSAgICAgICAgICAgIHJldC5tX3N0YXJ0ID0gbWluKG1fc3RhcnQsIHJhbmdlLm1fc3RhcnQp
OwotICAgICAgICAgICAgcmV0Lm1fZW5kID0gbWF4KG1fZW5kLCByYW5nZS5tX2VuZCk7CisgICAg
ICAgICAgICByZXQubV9zdGFydCA9IHN0ZDo6bWluKG1fc3RhcnQsIHJhbmdlLm1fc3RhcnQpOwor
ICAgICAgICAgICAgcmV0Lm1fZW5kID0gc3RkOjptYXgobV9lbmQsIHJhbmdlLm1fZW5kKTsKIAog
ICAgICAgICAgICAgcmV0dXJuIHJldDsKICAgICAgICAgfQo=
</data>
<flag name="review"
          id="15615"
          type_id="1"
          status="+"
          setter="aroben"
    />
          </attachment>
      

    </bug>

</bugzilla>