<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[146453] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/146453">146453</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2013-03-21 04:54:50 -0700 (Thu, 21 Mar 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Refactoring: Reorganize datetime field element parameters
https://bugs.webkit.org/show_bug.cgi?id=112877

Patch by Kunihiko Sakamoto &lt;ksakamoto@chromium.org&gt; on 2013-03-21
Reviewed by Kent Tamura.

Before this patch, the field element constructors took minimum/maximum
as a pair of integers, and step/stepbase as a DateTimeNumericFieldElement::Parameters.
This patch makes these constructors to take a Range (for minimum/maximum)
and a Step (for step/stepbase).

No new tests. Just refactoring.

* html/shadow/DateTimeEditElement.cpp:
(DateTimeEditBuilder): Replaced min/max data members by Ranges.
(WebCore::DateTimeEditBuilder::DateTimeEditBuilder):
(WebCore::DateTimeEditBuilder::visitField):
(WebCore::DateTimeEditBuilder::shouldAMPMFieldDisabled):
(WebCore::DateTimeEditBuilder::shouldDayOfMonthFieldDisabled):
(WebCore::DateTimeEditBuilder::shouldHourFieldDisabled):
(WebCore::DateTimeEditBuilder::shouldMillisecondFieldDisabled):
(WebCore::DateTimeEditBuilder::shouldMinuteFieldDisabled):
(WebCore::DateTimeEditBuilder::shouldSecondFieldDisabled):
(WebCore::DateTimeEditBuilder::createStep):
* html/shadow/DateTimeFieldElements.cpp:
(WebCore::DateTimeDayFieldElement::DateTimeDayFieldElement):
(WebCore::DateTimeDayFieldElement::create):
(WebCore::DateTimeHourFieldElementBase::DateTimeHourFieldElementBase):
(WebCore::DateTimeHour11FieldElement::DateTimeHour11FieldElement):
(WebCore::DateTimeHour11FieldElement::create):
(WebCore::DateTimeHour12FieldElement::DateTimeHour12FieldElement):
(WebCore::DateTimeHour12FieldElement::create):
(WebCore::DateTimeHour23FieldElement::DateTimeHour23FieldElement):
(WebCore::DateTimeHour23FieldElement::create):
(WebCore::DateTimeHour24FieldElement::DateTimeHour24FieldElement):
(WebCore::DateTimeHour24FieldElement::create):
(WebCore::DateTimeMillisecondFieldElement::DateTimeMillisecondFieldElement):
(WebCore::DateTimeMillisecondFieldElement::create):
(WebCore::DateTimeMinuteFieldElement::DateTimeMinuteFieldElement):
(WebCore::DateTimeMinuteFieldElement::create):
(WebCore::DateTimeMonthFieldElement::DateTimeMonthFieldElement):
(WebCore::DateTimeMonthFieldElement::create):
(WebCore::DateTimeSecondFieldElement::DateTimeSecondFieldElement):
(WebCore::DateTimeSecondFieldElement::create):
(WebCore::DateTimeWeekFieldElement::DateTimeWeekFieldElement):
(WebCore::DateTimeWeekFieldElement::create):
* html/shadow/DateTimeFieldElements.h:
(DateTimeDayFieldElement):
(DateTimeHourFieldElementBase):
(DateTimeHour11FieldElement):
(DateTimeHour12FieldElement):
(DateTimeHour23FieldElement):
(DateTimeHour24FieldElement):
(DateTimeMillisecondFieldElement):
(DateTimeMinuteFieldElement):
(DateTimeMonthFieldElement):
(DateTimeSecondFieldElement):
(DateTimeWeekFieldElement):
* html/shadow/DateTimeNumericFieldElement.cpp:
(WebCore):
(WebCore::DateTimeNumericFieldElement::DateTimeNumericFieldElement):
(WebCore::DateTimeNumericFieldElement::roundDown):
(WebCore::DateTimeNumericFieldElement::roundUp):
* html/shadow/DateTimeNumericFieldElement.h:
(WebCore::DateTimeNumericFieldElement::Step::Step): Renamed from Parameters.
(WebCore::DateTimeNumericFieldElement::Range::Range):
(WebCore::DateTimeNumericFieldElement::Range::isSingleton): Returns true if the range is a singleton range (i.e. contains exactly one value).
(Range): Now it's parameter type, hence public.
(DateTimeNumericFieldElement): Replaced two int members (m_step and m_stepBase) by a Range.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowDateTimeEditElementcpp">trunk/Source/WebCore/html/shadow/DateTimeEditElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowDateTimeFieldElementscpp">trunk/Source/WebCore/html/shadow/DateTimeFieldElements.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowDateTimeFieldElementsh">trunk/Source/WebCore/html/shadow/DateTimeFieldElements.h</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowDateTimeNumericFieldElementcpp">trunk/Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowDateTimeNumericFieldElementh">trunk/Source/WebCore/html/shadow/DateTimeNumericFieldElement.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (146452 => 146453)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-03-21 11:41:39 UTC (rev 146452)
+++ trunk/Source/WebCore/ChangeLog        2013-03-21 11:54:50 UTC (rev 146453)
</span><span class="lines">@@ -1,3 +1,74 @@
</span><ins>+2013-03-21  Kunihiko Sakamoto  &lt;ksakamoto@chromium.org&gt;
+
+        Refactoring: Reorganize datetime field element parameters
+        https://bugs.webkit.org/show_bug.cgi?id=112877
+
+        Reviewed by Kent Tamura.
+
+        Before this patch, the field element constructors took minimum/maximum
+        as a pair of integers, and step/stepbase as a DateTimeNumericFieldElement::Parameters.
+        This patch makes these constructors to take a Range (for minimum/maximum)
+        and a Step (for step/stepbase).
+
+        No new tests. Just refactoring.
+
+        * html/shadow/DateTimeEditElement.cpp:
+        (DateTimeEditBuilder): Replaced min/max data members by Ranges.
+        (WebCore::DateTimeEditBuilder::DateTimeEditBuilder):
+        (WebCore::DateTimeEditBuilder::visitField):
+        (WebCore::DateTimeEditBuilder::shouldAMPMFieldDisabled):
+        (WebCore::DateTimeEditBuilder::shouldDayOfMonthFieldDisabled):
+        (WebCore::DateTimeEditBuilder::shouldHourFieldDisabled):
+        (WebCore::DateTimeEditBuilder::shouldMillisecondFieldDisabled):
+        (WebCore::DateTimeEditBuilder::shouldMinuteFieldDisabled):
+        (WebCore::DateTimeEditBuilder::shouldSecondFieldDisabled):
+        (WebCore::DateTimeEditBuilder::createStep):
+        * html/shadow/DateTimeFieldElements.cpp:
+        (WebCore::DateTimeDayFieldElement::DateTimeDayFieldElement):
+        (WebCore::DateTimeDayFieldElement::create):
+        (WebCore::DateTimeHourFieldElementBase::DateTimeHourFieldElementBase):
+        (WebCore::DateTimeHour11FieldElement::DateTimeHour11FieldElement):
+        (WebCore::DateTimeHour11FieldElement::create):
+        (WebCore::DateTimeHour12FieldElement::DateTimeHour12FieldElement):
+        (WebCore::DateTimeHour12FieldElement::create):
+        (WebCore::DateTimeHour23FieldElement::DateTimeHour23FieldElement):
+        (WebCore::DateTimeHour23FieldElement::create):
+        (WebCore::DateTimeHour24FieldElement::DateTimeHour24FieldElement):
+        (WebCore::DateTimeHour24FieldElement::create):
+        (WebCore::DateTimeMillisecondFieldElement::DateTimeMillisecondFieldElement):
+        (WebCore::DateTimeMillisecondFieldElement::create):
+        (WebCore::DateTimeMinuteFieldElement::DateTimeMinuteFieldElement):
+        (WebCore::DateTimeMinuteFieldElement::create):
+        (WebCore::DateTimeMonthFieldElement::DateTimeMonthFieldElement):
+        (WebCore::DateTimeMonthFieldElement::create):
+        (WebCore::DateTimeSecondFieldElement::DateTimeSecondFieldElement):
+        (WebCore::DateTimeSecondFieldElement::create):
+        (WebCore::DateTimeWeekFieldElement::DateTimeWeekFieldElement):
+        (WebCore::DateTimeWeekFieldElement::create):
+        * html/shadow/DateTimeFieldElements.h:
+        (DateTimeDayFieldElement):
+        (DateTimeHourFieldElementBase):
+        (DateTimeHour11FieldElement):
+        (DateTimeHour12FieldElement):
+        (DateTimeHour23FieldElement):
+        (DateTimeHour24FieldElement):
+        (DateTimeMillisecondFieldElement):
+        (DateTimeMinuteFieldElement):
+        (DateTimeMonthFieldElement):
+        (DateTimeSecondFieldElement):
+        (DateTimeWeekFieldElement):
+        * html/shadow/DateTimeNumericFieldElement.cpp:
+        (WebCore):
+        (WebCore::DateTimeNumericFieldElement::DateTimeNumericFieldElement):
+        (WebCore::DateTimeNumericFieldElement::roundDown):
+        (WebCore::DateTimeNumericFieldElement::roundUp):
+        * html/shadow/DateTimeNumericFieldElement.h:
+        (WebCore::DateTimeNumericFieldElement::Step::Step): Renamed from Parameters.
+        (WebCore::DateTimeNumericFieldElement::Range::Range):
+        (WebCore::DateTimeNumericFieldElement::Range::isSingleton): Returns true if the range is a singleton range (i.e. contains exactly one value).
+        (Range): Now it's parameter type, hence public.
+        (DateTimeNumericFieldElement): Replaced two int members (m_step and m_stepBase) by a Range.
+
</ins><span class="cx"> 2013-03-21  Sergey Ryazanov  &lt;serya@chromium.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Track CSS error location information.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowDateTimeEditElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/DateTimeEditElement.cpp (146452 => 146453)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/DateTimeEditElement.cpp        2013-03-21 11:41:39 UTC (rev 146452)
+++ trunk/Source/WebCore/html/shadow/DateTimeEditElement.cpp        2013-03-21 11:54:50 UTC (rev 146453)
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx">     bool shouldSecondFieldDisabled() const;
</span><span class="cx">     bool shouldYearFieldDisabled() const;
</span><span class="cx">     inline const StepRange&amp; stepRange() const { return m_parameters.stepRange; }
</span><del>-    DateTimeNumericFieldElement::Parameters createNumericFieldParameters(const Decimal&amp; msPerFieldUnit, const Decimal&amp; msPerFieldSize) const;
</del><ins>+    DateTimeNumericFieldElement::Step createStep(double msPerFieldUnit, double msPerFieldSize) const;
</ins><span class="cx"> 
</span><span class="cx">     // DateTimeFormat::TokenHandler functions.
</span><span class="cx">     virtual void visitField(DateTimeFormat::FieldType, int) OVERRIDE FINAL;
</span><span class="lines">@@ -77,32 +77,22 @@
</span><span class="cx">     DateTimeEditElement&amp; m_editElement;
</span><span class="cx">     const DateComponents m_dateValue;
</span><span class="cx">     const DateTimeEditElement::LayoutParameters&amp; m_parameters;
</span><del>-    int m_minDay;
-    int m_maxDay;
-    int m_minHour23;
-    int m_maxHour23;
-    int m_minMinute;
-    int m_maxMinute;
-    int m_minSecond;
-    int m_maxSecond;
-    int m_minMillisecond;
-    int m_maxMillisecond;
</del><ins>+    DateTimeNumericFieldElement::Range m_dayRange;
+    DateTimeNumericFieldElement::Range m_hour23Range;
+    DateTimeNumericFieldElement::Range m_minuteRange;
+    DateTimeNumericFieldElement::Range m_secondRange;
+    DateTimeNumericFieldElement::Range m_millisecondRange;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> DateTimeEditBuilder::DateTimeEditBuilder(DateTimeEditElement&amp; elemnt, const DateTimeEditElement::LayoutParameters&amp; layoutParameters, const DateComponents&amp; dateValue)
</span><span class="cx">     : m_editElement(elemnt)
</span><span class="cx">     , m_dateValue(dateValue)
</span><span class="cx">     , m_parameters(layoutParameters)
</span><del>-    , m_minDay(1)
-    , m_maxDay(31)
-    , m_minHour23(0)
-    , m_maxHour23(23)
-    , m_minMinute(0)
-    , m_maxMinute(59)
-    , m_minSecond(0)
-    , m_maxSecond(59)
-    , m_minMillisecond(0)
-    , m_maxMillisecond(999)
</del><ins>+    , m_dayRange(1, 31)
+    , m_hour23Range(0, 23)
+    , m_minuteRange(0, 59)
+    , m_secondRange(0, 59)
+    , m_millisecondRange(0, 999)
</ins><span class="cx"> {
</span><span class="cx">     if (m_dateValue.type() == DateComponents::Date
</span><span class="cx">         || m_dateValue.type() == DateComponents::DateTimeLocal
</span><span class="lines">@@ -112,31 +102,31 @@
</span><span class="cx">             &amp;&amp; m_parameters.minimum.fullYear() == m_parameters.maximum.fullYear()
</span><span class="cx">             &amp;&amp; m_parameters.minimum.month() == m_parameters.maximum.month()
</span><span class="cx">             &amp;&amp; m_parameters.minimum.monthDay() &lt;= m_parameters.maximum.monthDay()) {
</span><del>-            m_minDay = m_parameters.minimum.monthDay();
-            m_maxDay = m_parameters.maximum.monthDay();
</del><ins>+            m_dayRange.minimum = m_parameters.minimum.monthDay();
+            m_dayRange.maximum = m_parameters.maximum.monthDay();
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (m_dateValue.type() == DateComponents::Time || m_minDay == m_maxDay) {
</del><ins>+    if (m_dateValue.type() == DateComponents::Time || m_dayRange.isSingleton()) {
</ins><span class="cx">         if (m_parameters.minimum.type() != DateComponents::Invalid
</span><span class="cx">             &amp;&amp; m_parameters.maximum.type() != DateComponents::Invalid
</span><span class="cx">             &amp;&amp; m_parameters.minimum.hour() &lt;= m_parameters.maximum.hour()) {
</span><del>-            m_minHour23 = m_parameters.minimum.hour();
-            m_maxHour23 = m_parameters.maximum.hour();
</del><ins>+            m_hour23Range.minimum = m_parameters.minimum.hour();
+            m_hour23Range.maximum = m_parameters.maximum.hour();
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (m_minHour23 == m_maxHour23 &amp;&amp; m_parameters.minimum.minute() &lt;= m_parameters.maximum.minute()) {
-        m_minMinute = m_parameters.minimum.minute();
-        m_maxMinute = m_parameters.maximum.minute();
</del><ins>+    if (m_hour23Range.isSingleton() &amp;&amp; m_parameters.minimum.minute() &lt;= m_parameters.maximum.minute()) {
+        m_minuteRange.minimum = m_parameters.minimum.minute();
+        m_minuteRange.maximum = m_parameters.maximum.minute();
</ins><span class="cx">     }
</span><del>-    if (m_minMinute == m_maxMinute &amp;&amp; m_parameters.minimum.second() &lt;= m_parameters.maximum.second()) {
-        m_minSecond = m_parameters.minimum.second();
-        m_maxSecond = m_parameters.maximum.second();
</del><ins>+    if (m_minuteRange.isSingleton() &amp;&amp; m_parameters.minimum.second() &lt;= m_parameters.maximum.second()) {
+        m_secondRange.minimum = m_parameters.minimum.second();
+        m_secondRange.maximum = m_parameters.maximum.second();
</ins><span class="cx">     }
</span><del>-    if (m_minSecond == m_maxSecond &amp;&amp; m_parameters.minimum.millisecond() &lt;= m_parameters.maximum.millisecond()) {
-        m_minMillisecond = m_parameters.minimum.millisecond();
-        m_maxMillisecond = m_parameters.maximum.millisecond();
</del><ins>+    if (m_secondRange.isSingleton() &amp;&amp; m_parameters.minimum.millisecond() &lt;= m_parameters.maximum.millisecond()) {
+        m_millisecondRange.minimum = m_parameters.minimum.millisecond();
+        m_millisecondRange.maximum = m_parameters.maximum.millisecond();
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -162,7 +152,7 @@
</span><span class="cx"> 
</span><span class="cx">     switch (fieldType) {
</span><span class="cx">     case DateTimeFormat::FieldTypeDayOfMonth: {
</span><del>-        RefPtr&lt;DateTimeFieldElement&gt; field = DateTimeDayFieldElement::create(document, m_editElement, m_parameters.placeholderForDay, m_minDay, m_maxDay);
</del><ins>+        RefPtr&lt;DateTimeFieldElement&gt; field = DateTimeDayFieldElement::create(document, m_editElement, m_parameters.placeholderForDay, m_dayRange);
</ins><span class="cx">         m_editElement.addField(field);
</span><span class="cx">         if (shouldDayOfMonthFieldDisabled()) {
</span><span class="cx">             field-&gt;setValueAsDate(m_dateValue);
</span><span class="lines">@@ -172,8 +162,8 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     case DateTimeFormat::FieldTypeHour11: {
</span><del>-        DateTimeNumericFieldElement::Parameters parameters = createNumericFieldParameters(static_cast&lt;int&gt;(msPerHour), static_cast&lt;int&gt;(msPerHour * 12));
-        RefPtr&lt;DateTimeFieldElement&gt; field = DateTimeHour11FieldElement::create(document, m_editElement, m_minHour23, m_maxHour23, parameters);
</del><ins>+        DateTimeNumericFieldElement::Step step = createStep(msPerHour, msPerHour * 12);
+        RefPtr&lt;DateTimeFieldElement&gt; field = DateTimeHour11FieldElement::create(document, m_editElement, m_hour23Range, step);
</ins><span class="cx">         m_editElement.addField(field);
</span><span class="cx">         if (shouldHourFieldDisabled()) {
</span><span class="cx">             field-&gt;setValueAsDate(m_dateValue);
</span><span class="lines">@@ -183,8 +173,8 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     case DateTimeFormat::FieldTypeHour12: {
</span><del>-        DateTimeNumericFieldElement::Parameters parameters = createNumericFieldParameters(static_cast&lt;int&gt;(msPerHour), static_cast&lt;int&gt;(msPerHour * 12));
-        RefPtr&lt;DateTimeFieldElement&gt; field = DateTimeHour12FieldElement::create(document, m_editElement, m_minHour23, m_maxHour23, parameters);
</del><ins>+        DateTimeNumericFieldElement::Step step = createStep(msPerHour, msPerHour * 12);
+        RefPtr&lt;DateTimeFieldElement&gt; field = DateTimeHour12FieldElement::create(document, m_editElement, m_hour23Range, step);
</ins><span class="cx">         m_editElement.addField(field);
</span><span class="cx">         if (shouldHourFieldDisabled()) {
</span><span class="cx">             field-&gt;setValueAsDate(m_dateValue);
</span><span class="lines">@@ -194,8 +184,8 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     case DateTimeFormat::FieldTypeHour23: {
</span><del>-        DateTimeNumericFieldElement::Parameters parameters = createNumericFieldParameters(static_cast&lt;int&gt;(msPerHour), static_cast&lt;int&gt;(msPerDay));
-        RefPtr&lt;DateTimeFieldElement&gt; field = DateTimeHour23FieldElement::create(document, m_editElement, m_minHour23, m_maxHour23, parameters);
</del><ins>+        DateTimeNumericFieldElement::Step step = createStep(msPerHour, msPerDay);
+        RefPtr&lt;DateTimeFieldElement&gt; field = DateTimeHour23FieldElement::create(document, m_editElement, m_hour23Range, step);
</ins><span class="cx">         m_editElement.addField(field);
</span><span class="cx">         if (shouldHourFieldDisabled()) {
</span><span class="cx">             field-&gt;setValueAsDate(m_dateValue);
</span><span class="lines">@@ -205,8 +195,8 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     case DateTimeFormat::FieldTypeHour24: {
</span><del>-        DateTimeNumericFieldElement::Parameters parameters = createNumericFieldParameters(static_cast&lt;int&gt;(msPerHour), static_cast&lt;int&gt;(msPerDay));
-        RefPtr&lt;DateTimeFieldElement&gt; field = DateTimeHour24FieldElement::create(document, m_editElement, m_minHour23, m_maxHour23, parameters);
</del><ins>+        DateTimeNumericFieldElement::Step step = createStep(msPerHour, msPerDay);
+        RefPtr&lt;DateTimeFieldElement&gt; field = DateTimeHour24FieldElement::create(document, m_editElement, m_hour23Range, step);
</ins><span class="cx">         m_editElement.addField(field);
</span><span class="cx">         if (shouldHourFieldDisabled()) {
</span><span class="cx">             field-&gt;setValueAsDate(m_dateValue);
</span><span class="lines">@@ -216,8 +206,8 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     case DateTimeFormat::FieldTypeMinute: {
</span><del>-        DateTimeNumericFieldElement::Parameters parameters = createNumericFieldParameters(static_cast&lt;int&gt;(msPerMinute), static_cast&lt;int&gt;(msPerHour));
-        RefPtr&lt;DateTimeNumericFieldElement&gt; field = DateTimeMinuteFieldElement::create(document, m_editElement, m_minMinute, m_maxMinute, parameters);
</del><ins>+        DateTimeNumericFieldElement::Step step = createStep(msPerMinute, msPerHour);
+        RefPtr&lt;DateTimeNumericFieldElement&gt; field = DateTimeMinuteFieldElement::create(document, m_editElement, m_minuteRange, step);
</ins><span class="cx">         m_editElement.addField(field);
</span><span class="cx">         if (shouldMinuteFieldDisabled()) {
</span><span class="cx">             field-&gt;setValueAsDate(m_dateValue);
</span><span class="lines">@@ -246,7 +236,7 @@
</span><span class="cx">             field = DateTimeSymbolicMonthFieldElement::create(document, m_editElement, fieldType == DateTimeFormat::FieldTypeMonth ? m_parameters.locale.monthLabels() : m_parameters.locale.standAloneMonthLabels(), minMonth, maxMonth);
</span><span class="cx">             break;
</span><span class="cx">         default:
</span><del>-            field = DateTimeMonthFieldElement::create(document, m_editElement, m_parameters.placeholderForMonth, minMonth + 1, maxMonth + 1);
</del><ins>+            field = DateTimeMonthFieldElement::create(document, m_editElement, m_parameters.placeholderForMonth, DateTimeNumericFieldElement::Range(minMonth + 1, maxMonth + 1));
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         m_editElement.addField(field);
</span><span class="lines">@@ -268,8 +258,8 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     case DateTimeFormat::FieldTypeSecond: {
</span><del>-        DateTimeNumericFieldElement::Parameters parameters = createNumericFieldParameters(static_cast&lt;int&gt;(msPerSecond), static_cast&lt;int&gt;(msPerMinute));
-        RefPtr&lt;DateTimeNumericFieldElement&gt; field = DateTimeSecondFieldElement::create(document, m_editElement, m_minSecond, m_maxSecond, parameters);
</del><ins>+        DateTimeNumericFieldElement::Step step = createStep(msPerSecond, msPerMinute);
+        RefPtr&lt;DateTimeNumericFieldElement&gt; field = DateTimeSecondFieldElement::create(document, m_editElement, m_secondRange, step);
</ins><span class="cx">         m_editElement.addField(field);
</span><span class="cx">         if (shouldSecondFieldDisabled()) {
</span><span class="cx">             field-&gt;setValueAsDate(m_dateValue);
</span><span class="lines">@@ -284,8 +274,8 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     case DateTimeFormat::FieldTypeFractionalSecond: {
</span><del>-        DateTimeNumericFieldElement::Parameters parameters = createNumericFieldParameters(1, static_cast&lt;int&gt;(msPerSecond));
-        RefPtr&lt;DateTimeNumericFieldElement&gt; field = DateTimeMillisecondFieldElement::create(document, m_editElement, m_minMillisecond, m_maxMillisecond, parameters);
</del><ins>+        DateTimeNumericFieldElement::Step step = createStep(1, msPerSecond);
+        RefPtr&lt;DateTimeNumericFieldElement&gt; field = DateTimeMillisecondFieldElement::create(document, m_editElement, m_millisecondRange, step);
</ins><span class="cx">         m_editElement.addField(field);
</span><span class="cx">         if (shouldMillisecondFieldDisabled()) {
</span><span class="cx">             field-&gt;setValueAsDate(m_dateValue);
</span><span class="lines">@@ -295,16 +285,15 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     case DateTimeFormat::FieldTypeWeekOfYear: {
</span><del>-        int minWeek = DateComponents::minimumWeekNumber;
-        int maxWeek = DateComponents::maximumWeekNumber;
</del><ins>+        DateTimeNumericFieldElement::Range range(DateComponents::minimumWeekNumber, DateComponents::maximumWeekNumber);
</ins><span class="cx">         if (m_parameters.minimum.type() != DateComponents::Invalid
</span><span class="cx">             &amp;&amp; m_parameters.maximum.type() != DateComponents::Invalid
</span><span class="cx">             &amp;&amp; m_parameters.minimum.fullYear() == m_parameters.maximum.fullYear()
</span><span class="cx">             &amp;&amp; m_parameters.minimum.week() &lt;= m_parameters.maximum.week()) {
</span><del>-            minWeek = m_parameters.minimum.week();
-            maxWeek = m_parameters.maximum.week();
</del><ins>+            range.minimum = m_parameters.minimum.week();
+            range.maximum = m_parameters.maximum.week();
</ins><span class="cx">         }
</span><del>-        m_editElement.addField(DateTimeWeekFieldElement::create(document, m_editElement, minWeek, maxWeek));
</del><ins>+        m_editElement.addField(DateTimeWeekFieldElement::create(document, m_editElement, range));
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -346,18 +335,18 @@
</span><span class="cx"> bool DateTimeEditBuilder::shouldAMPMFieldDisabled() const
</span><span class="cx"> {
</span><span class="cx">     return shouldHourFieldDisabled()
</span><del>-        || (m_minHour23 &lt; 12 &amp;&amp; m_maxHour23 &lt; 12 &amp;&amp; m_dateValue.hour() &lt; 12)
-        || (m_minHour23 &gt;= 12 &amp;&amp; m_maxHour23 &gt;= 12 &amp;&amp; m_dateValue.hour() &gt;= 12);
</del><ins>+        || (m_hour23Range.minimum &lt; 12 &amp;&amp; m_hour23Range.maximum &lt; 12 &amp;&amp; m_dateValue.hour() &lt; 12)
+        || (m_hour23Range.minimum &gt;= 12 &amp;&amp; m_hour23Range.maximum &gt;= 12 &amp;&amp; m_dateValue.hour() &gt;= 12);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool DateTimeEditBuilder::shouldDayOfMonthFieldDisabled() const
</span><span class="cx"> {
</span><del>-    return m_minDay == m_maxDay &amp;&amp; m_minDay == m_dateValue.monthDay() &amp;&amp; m_dateValue.type() != DateComponents::Date;
</del><ins>+    return m_dayRange.isSingleton() &amp;&amp; m_dayRange.minimum == m_dateValue.monthDay() &amp;&amp; m_dateValue.type() != DateComponents::Date;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool DateTimeEditBuilder::shouldHourFieldDisabled() const
</span><span class="cx"> {
</span><del>-    if (m_minHour23 == m_maxHour23 &amp;&amp; m_minHour23 == m_dateValue.hour()
</del><ins>+    if (m_hour23Range.isSingleton() &amp;&amp; m_hour23Range.minimum == m_dateValue.hour()
</ins><span class="cx">         &amp;&amp; !(shouldMinuteFieldDisabled() &amp;&amp; shouldSecondFieldDisabled() &amp;&amp; shouldMillisecondFieldDisabled()))
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="lines">@@ -378,7 +367,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool DateTimeEditBuilder::shouldMillisecondFieldDisabled() const
</span><span class="cx"> {
</span><del>-    if (m_minMillisecond == m_maxMillisecond &amp;&amp; m_minMillisecond == m_dateValue.millisecond())
</del><ins>+    if (m_millisecondRange.isSingleton() &amp;&amp; m_millisecondRange.minimum == m_dateValue.millisecond())
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     const Decimal decimalMsPerSecond(static_cast&lt;int&gt;(msPerSecond));
</span><span class="lines">@@ -387,7 +376,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool DateTimeEditBuilder::shouldMinuteFieldDisabled() const
</span><span class="cx"> {
</span><del>-    if (m_minMinute == m_maxMinute &amp;&amp; m_minMinute == m_dateValue.minute())
</del><ins>+    if (m_minuteRange.isSingleton() &amp;&amp; m_minuteRange.minimum == m_dateValue.minute())
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     const Decimal decimalMsPerHour(static_cast&lt;int&gt;(msPerHour));
</span><span class="lines">@@ -397,7 +386,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool DateTimeEditBuilder::shouldSecondFieldDisabled() const
</span><span class="cx"> {
</span><del>-    if (m_minSecond == m_maxSecond &amp;&amp; m_minSecond == m_dateValue.second())
</del><ins>+    if (m_secondRange.isSingleton() &amp;&amp; m_secondRange.minimum == m_dateValue.second())
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     const Decimal decimalMsPerMinute(static_cast&lt;int&gt;(msPerMinute));
</span><span class="lines">@@ -428,23 +417,25 @@
</span><span class="cx">     m_editElement.fieldsWrapperElement()-&gt;appendChild(element);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-DateTimeNumericFieldElement::Parameters DateTimeEditBuilder::createNumericFieldParameters(const Decimal&amp; msPerFieldUnit, const Decimal&amp; msPerFieldSize) const
</del><ins>+DateTimeNumericFieldElement::Step DateTimeEditBuilder::createStep(double msPerFieldUnit, double msPerFieldSize) const
</ins><span class="cx"> {
</span><del>-    ASSERT(!msPerFieldUnit.isZero());
-    ASSERT(!msPerFieldSize.isZero());
</del><ins>+    const Decimal msPerFieldUnitDecimal(static_cast&lt;int&gt;(msPerFieldUnit));
+    const Decimal msPerFieldSizeDecimal(static_cast&lt;int&gt;(msPerFieldSize));
</ins><span class="cx">     Decimal stepMilliseconds = stepRange().step();
</span><ins>+    ASSERT(!msPerFieldUnitDecimal.isZero());
+    ASSERT(!msPerFieldSizeDecimal.isZero());
</ins><span class="cx">     ASSERT(!stepMilliseconds.isZero());
</span><span class="cx"> 
</span><del>-    DateTimeNumericFieldElement::Parameters parameters(1, 0);
</del><ins>+    DateTimeNumericFieldElement::Step step(1, 0);
</ins><span class="cx"> 
</span><del>-    if (stepMilliseconds.remainder(msPerFieldSize).isZero())
-        stepMilliseconds = msPerFieldSize;
</del><ins>+    if (stepMilliseconds.remainder(msPerFieldSizeDecimal).isZero())
+        stepMilliseconds = msPerFieldSizeDecimal;
</ins><span class="cx"> 
</span><del>-    if (msPerFieldSize.remainder(stepMilliseconds).isZero() &amp;&amp; stepMilliseconds.remainder(msPerFieldUnit).isZero()) {
-        parameters.step = static_cast&lt;int&gt;((stepMilliseconds / msPerFieldUnit).toDouble());
-        parameters.stepBase = static_cast&lt;int&gt;((stepRange().stepBase() / msPerFieldUnit).floor().remainder(msPerFieldSize / msPerFieldUnit).toDouble());
</del><ins>+    if (msPerFieldSizeDecimal.remainder(stepMilliseconds).isZero() &amp;&amp; stepMilliseconds.remainder(msPerFieldUnitDecimal).isZero()) {
+        step.step = static_cast&lt;int&gt;((stepMilliseconds / msPerFieldUnitDecimal).toDouble());
+        step.stepBase = static_cast&lt;int&gt;((stepRange().stepBase() / msPerFieldUnitDecimal).floor().remainder(msPerFieldSizeDecimal / msPerFieldUnitDecimal).toDouble());
</ins><span class="cx">     }
</span><del>-    return parameters;
</del><ins>+    return step;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // ----------------------------
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowDateTimeFieldElementscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/DateTimeFieldElements.cpp (146452 => 146453)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/DateTimeFieldElements.cpp        2013-03-21 11:41:39 UTC (rev 146452)
+++ trunk/Source/WebCore/html/shadow/DateTimeFieldElements.cpp        2013-03-21 11:54:50 UTC (rev 146453)
</span><span class="lines">@@ -71,15 +71,15 @@
</span><span class="cx"> 
</span><span class="cx"> // ----------------------------
</span><span class="cx"> 
</span><del>-DateTimeDayFieldElement::DateTimeDayFieldElement(Document* document, FieldOwner&amp; fieldOwner, const String&amp; placeholder, int minimum, int maximum)
-    : DateTimeNumericFieldElement(document, fieldOwner, Range(minimum, maximum), Range(1, 31), placeholder)
</del><ins>+DateTimeDayFieldElement::DateTimeDayFieldElement(Document* document, FieldOwner&amp; fieldOwner, const String&amp; placeholder, const Range&amp; range)
+    : DateTimeNumericFieldElement(document, fieldOwner, range, Range(1, 31), placeholder)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;DateTimeDayFieldElement&gt; DateTimeDayFieldElement::create(Document* document, FieldOwner&amp; fieldOwner, const String&amp; placeholder, int minimum, int maximum)
</del><ins>+PassRefPtr&lt;DateTimeDayFieldElement&gt; DateTimeDayFieldElement::create(Document* document, FieldOwner&amp; fieldOwner, const String&amp; placeholder, const Range&amp; range)
</ins><span class="cx"> {
</span><span class="cx">     DEFINE_STATIC_LOCAL(AtomicString, dayPsuedoId, (&quot;-webkit-datetime-edit-day-field&quot;, AtomicString::ConstructFromLiteral));
</span><del>-    RefPtr&lt;DateTimeDayFieldElement&gt; field = adoptRef(new DateTimeDayFieldElement(document, fieldOwner, placeholder.isEmpty() ? ASCIILiteral(&quot;--&quot;) : placeholder, minimum, maximum));
</del><ins>+    RefPtr&lt;DateTimeDayFieldElement&gt; field = adoptRef(new DateTimeDayFieldElement(document, fieldOwner, placeholder.isEmpty() ? ASCIILiteral(&quot;--&quot;) : placeholder, range));
</ins><span class="cx">     field-&gt;initialize(dayPsuedoId, AXDayOfMonthFieldText());
</span><span class="cx">     return field.release();
</span><span class="cx"> }
</span><span class="lines">@@ -112,8 +112,8 @@
</span><span class="cx"> 
</span><span class="cx"> // ----------------------------
</span><span class="cx"> 
</span><del>-DateTimeHourFieldElementBase::DateTimeHourFieldElementBase(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; range, const Range&amp; hardLimits, const DateTimeNumericFieldElement::Parameters&amp; parameters)
-    : DateTimeNumericFieldElement(document, fieldOwner, range, hardLimits, &quot;--&quot;, parameters)
</del><ins>+DateTimeHourFieldElementBase::DateTimeHourFieldElementBase(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; range, const Range&amp; hardLimits, const Step&amp; step)
+    : DateTimeNumericFieldElement(document, fieldOwner, range, hardLimits, &quot;--&quot;, step)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -148,26 +148,25 @@
</span><span class="cx"> }
</span><span class="cx"> // ----------------------------
</span><span class="cx"> 
</span><del>-DateTimeHour11FieldElement::DateTimeHour11FieldElement(Document* document, FieldOwner&amp; fieldOwner, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp; parameters)
-    : DateTimeHourFieldElementBase(document, fieldOwner, Range(minimum, maximum), Range(0, 11), parameters)
</del><ins>+DateTimeHour11FieldElement::DateTimeHour11FieldElement(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; range, const Step&amp; step)
+    : DateTimeHourFieldElementBase(document, fieldOwner, range, Range(0, 11), step)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;DateTimeHour11FieldElement&gt; DateTimeHour11FieldElement::create(Document* document, FieldOwner&amp; fieldOwner, int minimumHour23, int maximumHour23, const DateTimeNumericFieldElement::Parameters&amp; parameters)
</del><ins>+PassRefPtr&lt;DateTimeHour11FieldElement&gt; DateTimeHour11FieldElement::create(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; hour23Range, const Step&amp; step)
</ins><span class="cx"> {
</span><del>-    ASSERT(minimumHour23 &gt;= 0);
-    ASSERT(maximumHour23 &lt;= 23);
-    ASSERT(minimumHour23 &lt;= maximumHour23);
-    int minimum = 0, maximum = 11;
-    if (maximumHour23 &lt; 12) {
-        minimum = minimumHour23;
-        maximum = maximumHour23;
-    } else if (minimumHour23 &gt;= 12) {
-        minimum = minimumHour23 - 12;
-        maximum = maximumHour23 - 12;
</del><ins>+    ASSERT(hour23Range.minimum &gt;= 0);
+    ASSERT(hour23Range.maximum &lt;= 23);
+    ASSERT(hour23Range.minimum &lt;= hour23Range.maximum);
+    Range range(0, 11);
+    if (hour23Range.maximum &lt; 12)
+        range = hour23Range;
+    else if (hour23Range.minimum &gt;= 12) {
+        range.minimum = hour23Range.minimum - 12;
+        range.maximum = hour23Range.maximum - 12;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RefPtr&lt;DateTimeHour11FieldElement&gt; field = adoptRef(new DateTimeHour11FieldElement(document, fieldOwner, minimum, maximum, parameters));
</del><ins>+    RefPtr&lt;DateTimeHour11FieldElement&gt; field = adoptRef(new DateTimeHour11FieldElement(document, fieldOwner, range, step));
</ins><span class="cx">     field-&gt;initialize();
</span><span class="cx">     return field.release();
</span><span class="cx"> }
</span><span class="lines">@@ -190,33 +189,32 @@
</span><span class="cx"> 
</span><span class="cx"> // ----------------------------
</span><span class="cx"> 
</span><del>-DateTimeHour12FieldElement::DateTimeHour12FieldElement(Document* document, FieldOwner&amp; fieldOwner, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp; parameters)
-    : DateTimeHourFieldElementBase(document, fieldOwner, Range(minimum, maximum), Range(1, 12), parameters)
</del><ins>+DateTimeHour12FieldElement::DateTimeHour12FieldElement(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; range, const Step&amp; step)
+    : DateTimeHourFieldElementBase(document, fieldOwner, range, Range(1, 12), step)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;DateTimeHour12FieldElement&gt; DateTimeHour12FieldElement::create(Document* document, FieldOwner&amp; fieldOwner, int minimumHour23, int maximumHour23, const DateTimeNumericFieldElement::Parameters&amp; parameters)
</del><ins>+PassRefPtr&lt;DateTimeHour12FieldElement&gt; DateTimeHour12FieldElement::create(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; hour23Range, const Step&amp; step)
</ins><span class="cx"> {
</span><del>-    ASSERT(minimumHour23 &gt;= 0);
-    ASSERT(maximumHour23 &lt;= 23);
-    ASSERT(minimumHour23 &lt;= maximumHour23);
-    int minimum = 1, maximum = 12;
-    if (maximumHour23 &lt; 12) {
-        minimum = minimumHour23;
-        maximum = maximumHour23;
-    } else if (minimumHour23 &gt;= 12) {
-        minimum = minimumHour23 - 12;
-        maximum = maximumHour23 - 12;
</del><ins>+    ASSERT(hour23Range.minimum &gt;= 0);
+    ASSERT(hour23Range.maximum &lt;= 23);
+    ASSERT(hour23Range.minimum &lt;= hour23Range.maximum);
+    Range range(1, 12);
+    if (hour23Range.maximum &lt; 12)
+        range = hour23Range;
+    else if (hour23Range.minimum &gt;= 12) {
+        range.minimum = hour23Range.minimum - 12;
+        range.maximum = hour23Range.maximum - 12;
</ins><span class="cx">     }
</span><del>-    if (!minimum)
-        minimum = 12;
-    if (!maximum)
-        maximum = 12;
-    if (minimum &gt; maximum) {
-        minimum = 1;
-        maximum = 12;
</del><ins>+    if (!range.minimum)
+        range.minimum = 12;
+    if (!range.maximum)
+        range.maximum = 12;
+    if (range.minimum &gt; range.maximum) {
+        range.minimum = 1;
+        range.maximum = 12;
</ins><span class="cx">     }
</span><del>-    RefPtr&lt;DateTimeHour12FieldElement&gt; field = adoptRef(new DateTimeHour12FieldElement(document, fieldOwner, minimum, maximum, parameters));
</del><ins>+    RefPtr&lt;DateTimeHour12FieldElement&gt; field = adoptRef(new DateTimeHour12FieldElement(document, fieldOwner, range, step));
</ins><span class="cx">     field-&gt;initialize();
</span><span class="cx">     return field.release();
</span><span class="cx"> }
</span><span class="lines">@@ -234,17 +232,17 @@
</span><span class="cx"> 
</span><span class="cx"> // ----------------------------
</span><span class="cx"> 
</span><del>-DateTimeHour23FieldElement::DateTimeHour23FieldElement(Document* document, FieldOwner&amp; fieldOwner, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp; parameters)
-    : DateTimeHourFieldElementBase(document, fieldOwner, Range(minimum, maximum), Range(0, 23), parameters)
</del><ins>+DateTimeHour23FieldElement::DateTimeHour23FieldElement(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; range, const Step&amp; step)
+    : DateTimeHourFieldElementBase(document, fieldOwner, range, Range(0, 23), step)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;DateTimeHour23FieldElement&gt; DateTimeHour23FieldElement::create(Document* document, FieldOwner&amp; fieldOwner, int minimumHour23, int maximumHour23, const DateTimeNumericFieldElement::Parameters&amp; parameters)
</del><ins>+PassRefPtr&lt;DateTimeHour23FieldElement&gt; DateTimeHour23FieldElement::create(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; hour23Range, const Step&amp; step)
</ins><span class="cx"> {
</span><del>-    ASSERT(minimumHour23 &gt;= 0);
-    ASSERT(maximumHour23 &lt;= 23);
-    ASSERT(minimumHour23 &lt;= maximumHour23);
-    RefPtr&lt;DateTimeHour23FieldElement&gt; field = adoptRef(new DateTimeHour23FieldElement(document, fieldOwner, minimumHour23, maximumHour23, parameters));
</del><ins>+    ASSERT(hour23Range.minimum &gt;= 0);
+    ASSERT(hour23Range.maximum &lt;= 23);
+    ASSERT(hour23Range.minimum &lt;= hour23Range.maximum);
+    RefPtr&lt;DateTimeHour23FieldElement&gt; field = adoptRef(new DateTimeHour23FieldElement(document, fieldOwner, hour23Range, step));
</ins><span class="cx">     field-&gt;initialize();
</span><span class="cx">     return field.release();
</span><span class="cx"> }
</span><span class="lines">@@ -270,24 +268,23 @@
</span><span class="cx"> 
</span><span class="cx"> // ----------------------------
</span><span class="cx"> 
</span><del>-DateTimeHour24FieldElement::DateTimeHour24FieldElement(Document* document, FieldOwner&amp; fieldOwner, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp; parameters)
-    : DateTimeHourFieldElementBase(document, fieldOwner, Range(minimum, maximum), Range(1, 24), parameters)
</del><ins>+DateTimeHour24FieldElement::DateTimeHour24FieldElement(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; range, const Step&amp; step)
+    : DateTimeHourFieldElementBase(document, fieldOwner, range, Range(1, 24), step)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;DateTimeHour24FieldElement&gt; DateTimeHour24FieldElement::create(Document* document, FieldOwner&amp; fieldOwner, int minimumHour23, int maximumHour23, const DateTimeNumericFieldElement::Parameters&amp; parameters)
</del><ins>+PassRefPtr&lt;DateTimeHour24FieldElement&gt; DateTimeHour24FieldElement::create(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; hour23Range, const Step&amp; step)
</ins><span class="cx"> {
</span><del>-    ASSERT(minimumHour23 &gt;= 0);
-    ASSERT(maximumHour23 &lt;= 23);
-    ASSERT(minimumHour23 &lt;= maximumHour23);
-    int minimum = minimumHour23 ? minimumHour23 : 24;
-    int maximum = maximumHour23 ? maximumHour23 : 24;
-    if (minimum &gt; maximum) {
-        minimum = 1;
-        maximum = 24;
</del><ins>+    ASSERT(hour23Range.minimum &gt;= 0);
+    ASSERT(hour23Range.maximum &lt;= 23);
+    ASSERT(hour23Range.minimum &lt;= hour23Range.maximum);
+    Range range(hour23Range.minimum ? hour23Range.minimum : 24, hour23Range.maximum ? hour23Range.maximum : 24);
+    if (range.minimum &gt; range.maximum) {
+        range.minimum = 1;
+        range.maximum = 24;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RefPtr&lt;DateTimeHour24FieldElement&gt; field = adoptRef(new DateTimeHour24FieldElement(document, fieldOwner, minimum, maximum, parameters));
</del><ins>+    RefPtr&lt;DateTimeHour24FieldElement&gt; field = adoptRef(new DateTimeHour24FieldElement(document, fieldOwner, range, step));
</ins><span class="cx">     field-&gt;initialize();
</span><span class="cx">     return field.release();
</span><span class="cx"> }
</span><span class="lines">@@ -318,15 +315,15 @@
</span><span class="cx"> 
</span><span class="cx"> // ----------------------------
</span><span class="cx"> 
</span><del>-DateTimeMillisecondFieldElement::DateTimeMillisecondFieldElement(Document* document, FieldOwner&amp; fieldOwner, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp; parameters)
-    : DateTimeNumericFieldElement(document, fieldOwner, Range(minimum, maximum), Range(0, 999), &quot;---&quot;, parameters)
</del><ins>+DateTimeMillisecondFieldElement::DateTimeMillisecondFieldElement(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; range, const Step&amp; step)
+    : DateTimeNumericFieldElement(document, fieldOwner, range, Range(0, 999), &quot;---&quot;, step)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;DateTimeMillisecondFieldElement&gt; DateTimeMillisecondFieldElement::create(Document* document, FieldOwner&amp; fieldOwner, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp; parameters)
</del><ins>+PassRefPtr&lt;DateTimeMillisecondFieldElement&gt; DateTimeMillisecondFieldElement::create(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; range, const Step&amp; step)
</ins><span class="cx"> {
</span><span class="cx">     DEFINE_STATIC_LOCAL(AtomicString, millisecondPsuedoId, (&quot;-webkit-datetime-edit-millisecond-field&quot;, AtomicString::ConstructFromLiteral));
</span><del>-    RefPtr&lt;DateTimeMillisecondFieldElement&gt; field = adoptRef(new DateTimeMillisecondFieldElement(document, fieldOwner, minimum, maximum, parameters));
</del><ins>+    RefPtr&lt;DateTimeMillisecondFieldElement&gt; field = adoptRef(new DateTimeMillisecondFieldElement(document, fieldOwner, range, step));
</ins><span class="cx">     field-&gt;initialize(millisecondPsuedoId, AXMillisecondFieldText());
</span><span class="cx">     return field.release();
</span><span class="cx"> }
</span><span class="lines">@@ -359,15 +356,15 @@
</span><span class="cx"> 
</span><span class="cx"> // ----------------------------
</span><span class="cx"> 
</span><del>-DateTimeMinuteFieldElement::DateTimeMinuteFieldElement(Document* document, FieldOwner&amp; fieldOwner, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp; parameters)
-    : DateTimeNumericFieldElement(document, fieldOwner, Range(minimum, maximum), Range(0, 59), &quot;--&quot;, parameters)
</del><ins>+DateTimeMinuteFieldElement::DateTimeMinuteFieldElement(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; range, const Step&amp; step)
+    : DateTimeNumericFieldElement(document, fieldOwner, range, Range(0, 59), &quot;--&quot;, step)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;DateTimeMinuteFieldElement&gt; DateTimeMinuteFieldElement::create(Document* document, FieldOwner&amp; fieldOwner, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp; parameters)
</del><ins>+PassRefPtr&lt;DateTimeMinuteFieldElement&gt; DateTimeMinuteFieldElement::create(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; range, const Step&amp; step)
</ins><span class="cx"> {
</span><span class="cx">     DEFINE_STATIC_LOCAL(AtomicString, minutePsuedoId, (&quot;-webkit-datetime-edit-minute-field&quot;, AtomicString::ConstructFromLiteral));
</span><del>-    RefPtr&lt;DateTimeMinuteFieldElement&gt; field = adoptRef(new DateTimeMinuteFieldElement(document, fieldOwner, minimum, maximum, parameters));
</del><ins>+    RefPtr&lt;DateTimeMinuteFieldElement&gt; field = adoptRef(new DateTimeMinuteFieldElement(document, fieldOwner, range, step));
</ins><span class="cx">     field-&gt;initialize(minutePsuedoId, AXMinuteFieldText());
</span><span class="cx">     return field.release();
</span><span class="cx"> }
</span><span class="lines">@@ -400,15 +397,15 @@
</span><span class="cx"> 
</span><span class="cx"> // ----------------------------
</span><span class="cx"> 
</span><del>-DateTimeMonthFieldElement::DateTimeMonthFieldElement(Document* document, FieldOwner&amp; fieldOwner, const String&amp; placeholder, int minimum, int maximum)
-    : DateTimeNumericFieldElement(document, fieldOwner, Range(minimum, maximum), Range(1, 12), placeholder)
</del><ins>+DateTimeMonthFieldElement::DateTimeMonthFieldElement(Document* document, FieldOwner&amp; fieldOwner, const String&amp; placeholder, const Range&amp; range)
+    : DateTimeNumericFieldElement(document, fieldOwner, range, Range(1, 12), placeholder)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;DateTimeMonthFieldElement&gt; DateTimeMonthFieldElement::create(Document* document, FieldOwner&amp; fieldOwner, const String&amp; placeholder, int minimum, int maximum)
</del><ins>+PassRefPtr&lt;DateTimeMonthFieldElement&gt; DateTimeMonthFieldElement::create(Document* document, FieldOwner&amp; fieldOwner, const String&amp; placeholder, const Range&amp; range)
</ins><span class="cx"> {
</span><span class="cx">     DEFINE_STATIC_LOCAL(AtomicString, monthPsuedoId, (&quot;-webkit-datetime-edit-month-field&quot;, AtomicString::ConstructFromLiteral));
</span><del>-    RefPtr&lt;DateTimeMonthFieldElement&gt; field = adoptRef(new DateTimeMonthFieldElement(document, fieldOwner, placeholder.isEmpty() ? ASCIILiteral(&quot;--&quot;) : placeholder, minimum, maximum));
</del><ins>+    RefPtr&lt;DateTimeMonthFieldElement&gt; field = adoptRef(new DateTimeMonthFieldElement(document, fieldOwner, placeholder.isEmpty() ? ASCIILiteral(&quot;--&quot;) : placeholder, range));
</ins><span class="cx">     field-&gt;initialize(monthPsuedoId, AXMonthFieldText());
</span><span class="cx">     return field.release();
</span><span class="cx"> }
</span><span class="lines">@@ -441,15 +438,15 @@
</span><span class="cx"> 
</span><span class="cx"> // ----------------------------
</span><span class="cx"> 
</span><del>-DateTimeSecondFieldElement::DateTimeSecondFieldElement(Document* document, FieldOwner&amp; fieldOwner, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp; parameters)
-    : DateTimeNumericFieldElement(document, fieldOwner, Range(minimum, maximum), Range(0, 59), &quot;--&quot;, parameters)
</del><ins>+DateTimeSecondFieldElement::DateTimeSecondFieldElement(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; range, const Step&amp; step)
+    : DateTimeNumericFieldElement(document, fieldOwner, range, Range(0, 59), &quot;--&quot;, step)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;DateTimeSecondFieldElement&gt; DateTimeSecondFieldElement::create(Document* document, FieldOwner&amp; fieldOwner, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp; parameters)
</del><ins>+PassRefPtr&lt;DateTimeSecondFieldElement&gt; DateTimeSecondFieldElement::create(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; range, const Step&amp; step)
</ins><span class="cx"> {
</span><span class="cx">     DEFINE_STATIC_LOCAL(AtomicString, secondPsuedoId, (&quot;-webkit-datetime-edit-second-field&quot;, AtomicString::ConstructFromLiteral));
</span><del>-    RefPtr&lt;DateTimeSecondFieldElement&gt; field = adoptRef(new DateTimeSecondFieldElement(document, fieldOwner, minimum, maximum, parameters));
</del><ins>+    RefPtr&lt;DateTimeSecondFieldElement&gt; field = adoptRef(new DateTimeSecondFieldElement(document, fieldOwner, range, step));
</ins><span class="cx">     field-&gt;initialize(secondPsuedoId, AXSecondFieldText());
</span><span class="cx">     return field.release();
</span><span class="cx"> }
</span><span class="lines">@@ -526,15 +523,15 @@
</span><span class="cx"> 
</span><span class="cx"> // ----------------------------
</span><span class="cx"> 
</span><del>-DateTimeWeekFieldElement::DateTimeWeekFieldElement(Document* document, FieldOwner&amp; fieldOwner, int minimum, int maximum)
-    : DateTimeNumericFieldElement(document, fieldOwner, Range(minimum, maximum), Range(DateComponents::minimumWeekNumber, DateComponents::maximumWeekNumber), &quot;--&quot;)
</del><ins>+DateTimeWeekFieldElement::DateTimeWeekFieldElement(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; range)
+    : DateTimeNumericFieldElement(document, fieldOwner, range, Range(DateComponents::minimumWeekNumber, DateComponents::maximumWeekNumber), &quot;--&quot;)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;DateTimeWeekFieldElement&gt; DateTimeWeekFieldElement::create(Document* document, FieldOwner&amp; fieldOwner, int minimum, int maximum)
</del><ins>+PassRefPtr&lt;DateTimeWeekFieldElement&gt; DateTimeWeekFieldElement::create(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; range)
</ins><span class="cx"> {
</span><span class="cx">     DEFINE_STATIC_LOCAL(AtomicString, weekPsuedoId, (&quot;-webkit-datetime-edit-week-field&quot;, AtomicString::ConstructFromLiteral));
</span><del>-    RefPtr&lt;DateTimeWeekFieldElement&gt; field = adoptRef(new DateTimeWeekFieldElement(document, fieldOwner, minimum, maximum));
</del><ins>+    RefPtr&lt;DateTimeWeekFieldElement&gt; field = adoptRef(new DateTimeWeekFieldElement(document, fieldOwner, range));
</ins><span class="cx">     field-&gt;initialize(weekPsuedoId, AXWeekOfYearFieldText());
</span><span class="cx">     return field.release();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowDateTimeFieldElementsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/DateTimeFieldElements.h (146452 => 146453)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/DateTimeFieldElements.h        2013-03-21 11:41:39 UTC (rev 146452)
+++ trunk/Source/WebCore/html/shadow/DateTimeFieldElements.h        2013-03-21 11:54:50 UTC (rev 146453)
</span><span class="lines">@@ -51,10 +51,10 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(DateTimeDayFieldElement);
</span><span class="cx"> 
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;DateTimeDayFieldElement&gt; create(Document*, FieldOwner&amp;, const String&amp; placeholder, int minimum, int maximum);
</del><ins>+    static PassRefPtr&lt;DateTimeDayFieldElement&gt; create(Document*, FieldOwner&amp;, const String&amp; placeholder, const Range&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    DateTimeDayFieldElement(Document*, FieldOwner&amp;, const String&amp; placeholder, int minimum, int maximum);
</del><ins>+    DateTimeDayFieldElement(Document*, FieldOwner&amp;, const String&amp; placeholder, const Range&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // DateTimeFieldElement functions.
</span><span class="cx">     virtual void populateDateTimeFieldsState(DateTimeFieldsState&amp;) OVERRIDE FINAL;
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(DateTimeHourFieldElementBase);
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    DateTimeHourFieldElementBase(Document*, FieldOwner&amp;, const Range&amp;, const Range&amp; hardLimits, const DateTimeNumericFieldElement::Parameters&amp;);
</del><ins>+    DateTimeHourFieldElementBase(Document*, FieldOwner&amp;, const Range&amp;, const Range&amp; hardLimits, const Step&amp;);
</ins><span class="cx">     void initialize();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -79,10 +79,10 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(DateTimeHour11FieldElement);
</span><span class="cx"> 
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;DateTimeHour11FieldElement&gt; create(Document*, FieldOwner&amp;, int minimumHour23, int maximumHour23, const DateTimeNumericFieldElement::Parameters&amp;);
</del><ins>+    static PassRefPtr&lt;DateTimeHour11FieldElement&gt; create(Document*, FieldOwner&amp;, const Range&amp;, const Step&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    DateTimeHour11FieldElement(Document*, FieldOwner&amp;, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp;);
</del><ins>+    DateTimeHour11FieldElement(Document*, FieldOwner&amp;, const Range&amp; hour23Range, const Step&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // DateTimeFieldElement functions.
</span><span class="cx">     virtual void populateDateTimeFieldsState(DateTimeFieldsState&amp;) OVERRIDE FINAL;
</span><span class="lines">@@ -93,10 +93,10 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(DateTimeHour12FieldElement);
</span><span class="cx"> 
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;DateTimeHour12FieldElement&gt; create(Document*, FieldOwner&amp;, int minimumHour23, int maximumHour23, const DateTimeNumericFieldElement::Parameters&amp;);
</del><ins>+    static PassRefPtr&lt;DateTimeHour12FieldElement&gt; create(Document*, FieldOwner&amp;, const Range&amp;, const Step&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    DateTimeHour12FieldElement(Document*, FieldOwner&amp;, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp;);
</del><ins>+    DateTimeHour12FieldElement(Document*, FieldOwner&amp;, const Range&amp; hour23Range, const Step&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // DateTimeFieldElement functions.
</span><span class="cx">     virtual void populateDateTimeFieldsState(DateTimeFieldsState&amp;) OVERRIDE FINAL;
</span><span class="lines">@@ -107,10 +107,10 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(DateTimeHour23FieldElement);
</span><span class="cx"> 
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;DateTimeHour23FieldElement&gt; create(Document*, FieldOwner&amp;, int minimumHour23, int maximumHour23, const DateTimeNumericFieldElement::Parameters&amp;);
</del><ins>+    static PassRefPtr&lt;DateTimeHour23FieldElement&gt; create(Document*, FieldOwner&amp;, const Range&amp;, const Step&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    DateTimeHour23FieldElement(Document*, FieldOwner&amp;, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp;);
</del><ins>+    DateTimeHour23FieldElement(Document*, FieldOwner&amp;, const Range&amp; hour23Range, const Step&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // DateTimeFieldElement functions.
</span><span class="cx">     virtual void populateDateTimeFieldsState(DateTimeFieldsState&amp;) OVERRIDE FINAL;
</span><span class="lines">@@ -121,10 +121,10 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(DateTimeHour24FieldElement);
</span><span class="cx"> 
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;DateTimeHour24FieldElement&gt; create(Document*, FieldOwner&amp;, int minimumHour23, int maximumHour23, const DateTimeNumericFieldElement::Parameters&amp;);
</del><ins>+    static PassRefPtr&lt;DateTimeHour24FieldElement&gt; create(Document*, FieldOwner&amp;, const Range&amp;, const Step&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    DateTimeHour24FieldElement(Document*, FieldOwner&amp;, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp;);
</del><ins>+    DateTimeHour24FieldElement(Document*, FieldOwner&amp;, const Range&amp; hour23Range, const Step&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // DateTimeFieldElement functions.
</span><span class="cx">     virtual void populateDateTimeFieldsState(DateTimeFieldsState&amp;) OVERRIDE FINAL;
</span><span class="lines">@@ -135,10 +135,10 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(DateTimeMillisecondFieldElement);
</span><span class="cx"> 
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;DateTimeMillisecondFieldElement&gt; create(Document*, FieldOwner&amp;, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp;);
</del><ins>+    static PassRefPtr&lt;DateTimeMillisecondFieldElement&gt; create(Document*, FieldOwner&amp;, const Range&amp;, const Step&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    DateTimeMillisecondFieldElement(Document*, FieldOwner&amp;, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp;);
</del><ins>+    DateTimeMillisecondFieldElement(Document*, FieldOwner&amp;, const Range&amp;, const Step&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // DateTimeFieldElement functions.
</span><span class="cx">     virtual void populateDateTimeFieldsState(DateTimeFieldsState&amp;) OVERRIDE FINAL;
</span><span class="lines">@@ -150,10 +150,10 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(DateTimeMinuteFieldElement);
</span><span class="cx"> 
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;DateTimeMinuteFieldElement&gt; create(Document*, FieldOwner&amp;, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp;);
</del><ins>+    static PassRefPtr&lt;DateTimeMinuteFieldElement&gt; create(Document*, FieldOwner&amp;, const Range&amp;, const Step&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    DateTimeMinuteFieldElement(Document*, FieldOwner&amp;, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp;);
</del><ins>+    DateTimeMinuteFieldElement(Document*, FieldOwner&amp;, const Range&amp;, const Step&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // DateTimeFieldElement functions.
</span><span class="cx">     virtual void populateDateTimeFieldsState(DateTimeFieldsState&amp;) OVERRIDE FINAL;
</span><span class="lines">@@ -165,10 +165,10 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(DateTimeMonthFieldElement);
</span><span class="cx"> 
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;DateTimeMonthFieldElement&gt; create(Document*, FieldOwner&amp;, const String&amp; placeholder, int minimum, int maximum);
</del><ins>+    static PassRefPtr&lt;DateTimeMonthFieldElement&gt; create(Document*, FieldOwner&amp;, const String&amp; placeholder, const Range&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    DateTimeMonthFieldElement(Document*, FieldOwner&amp;, const String&amp; placeholder, int minimum, int maximum);
</del><ins>+    DateTimeMonthFieldElement(Document*, FieldOwner&amp;, const String&amp; placeholder, const Range&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // DateTimeFieldElement functions.
</span><span class="cx">     virtual void populateDateTimeFieldsState(DateTimeFieldsState&amp;) OVERRIDE FINAL;
</span><span class="lines">@@ -180,10 +180,10 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(DateTimeSecondFieldElement);
</span><span class="cx"> 
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;DateTimeSecondFieldElement&gt; create(Document*, FieldOwner&amp;, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp;);
</del><ins>+    static PassRefPtr&lt;DateTimeSecondFieldElement&gt; create(Document*, FieldOwner&amp;, const Range&amp;, const Step&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    DateTimeSecondFieldElement(Document*, FieldOwner&amp;, int minimum, int maximum, const DateTimeNumericFieldElement::Parameters&amp;);
</del><ins>+    DateTimeSecondFieldElement(Document*, FieldOwner&amp;, const Range&amp;, const Step&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // DateTimeFieldElement functions.
</span><span class="cx">     virtual void populateDateTimeFieldsState(DateTimeFieldsState&amp;) OVERRIDE FINAL;
</span><span class="lines">@@ -210,10 +210,10 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(DateTimeWeekFieldElement);
</span><span class="cx"> 
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;DateTimeWeekFieldElement&gt; create(Document*, FieldOwner&amp;, int minimum, int maximum);
</del><ins>+    static PassRefPtr&lt;DateTimeWeekFieldElement&gt; create(Document*, FieldOwner&amp;, const Range&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    DateTimeWeekFieldElement(Document*, FieldOwner&amp;, int minimum, int maximum);
</del><ins>+    DateTimeWeekFieldElement(Document*, FieldOwner&amp;, const Range&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // DateTimeFieldElement functions.
</span><span class="cx">     virtual void populateDateTimeFieldsState(DateTimeFieldsState&amp;) OVERRIDE FINAL;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowDateTimeNumericFieldElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp (146452 => 146453)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp        2013-03-21 11:41:39 UTC (rev 146452)
+++ trunk/Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp        2013-03-21 11:54:50 UTC (rev 146453)
</span><span class="lines">@@ -40,13 +40,6 @@
</span><span class="cx"> 
</span><span class="cx"> static const DOMTimeStamp typeAheadTimeout = 1000;
</span><span class="cx"> 
</span><del>-DateTimeNumericFieldElement::Range::Range(int minimum, int maximum)
-    : maximum(maximum)
-    , minimum(minimum)
-{
-    ASSERT(minimum &lt;= maximum);
-}
-
</del><span class="cx"> int DateTimeNumericFieldElement::Range::clampValue(int value) const
</span><span class="cx"> {
</span><span class="cx">     return std::min(std::max(value, minimum), maximum);
</span><span class="lines">@@ -59,18 +52,19 @@
</span><span class="cx"> 
</span><span class="cx"> // ----------------------------
</span><span class="cx"> 
</span><del>-DateTimeNumericFieldElement::DateTimeNumericFieldElement(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; range, const Range&amp; hardLimits, const String&amp; placeholder, const DateTimeNumericFieldElement::Parameters&amp; parameters)
</del><ins>+DateTimeNumericFieldElement::DateTimeNumericFieldElement(Document* document, FieldOwner&amp; fieldOwner, const Range&amp; range, const Range&amp; hardLimits, const String&amp; placeholder, const DateTimeNumericFieldElement::Step&amp; step)
</ins><span class="cx">     : DateTimeFieldElement(document, fieldOwner)
</span><span class="cx">     , m_lastDigitCharTime(0)
</span><span class="cx">     , m_placeholder(placeholder)
</span><span class="cx">     , m_range(range)
</span><span class="cx">     , m_hardLimits(hardLimits)
</span><ins>+    , m_step(step)
</ins><span class="cx">     , m_value(0)
</span><span class="cx">     , m_hasValue(false)
</span><del>-    , m_step(parameters.step)
-    , m_stepBase(parameters.stepBase)
</del><span class="cx"> {
</span><del>-    ASSERT(m_step);
</del><ins>+    ASSERT(m_step.step);
+    ASSERT(m_range.minimum &lt;= m_range.maximum);
+    ASSERT(m_hardLimits.minimum &lt;= m_hardLimits.maximum);
</ins><span class="cx"> 
</span><span class="cx">     // We show a direction-neutral string such as &quot;--&quot; as a placeholder. It
</span><span class="cx">     // should follow the direction of numeric values.
</span><span class="lines">@@ -228,22 +222,22 @@
</span><span class="cx"> 
</span><span class="cx"> int DateTimeNumericFieldElement::roundDown(int n) const
</span><span class="cx"> {
</span><del>-    n -= m_stepBase;
</del><ins>+    n -= m_step.stepBase;
</ins><span class="cx">     if (n &gt;= 0)
</span><del>-        n = n / m_step * m_step;
</del><ins>+        n = n / m_step.step * m_step.step;
</ins><span class="cx">     else
</span><del>-        n = -((-n + m_step - 1) / m_step * m_step);
-    return n + m_stepBase;
</del><ins>+        n = -((-n + m_step.step - 1) / m_step.step * m_step.step);
+    return n + m_step.stepBase;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int DateTimeNumericFieldElement::roundUp(int n) const
</span><span class="cx"> {
</span><del>-    n -= m_stepBase;
</del><ins>+    n -= m_step.stepBase;
</ins><span class="cx">     if (n &gt;= 0)
</span><del>-        n = (n + m_step - 1) / m_step * m_step;
</del><ins>+        n = (n + m_step.step - 1) / m_step.step * m_step.step;
</ins><span class="cx">     else
</span><del>-        n = -(-n / m_step * m_step);
-    return n + m_stepBase;
</del><ins>+        n = -(-n / m_step.step * m_step.step);
+    return n + m_step.stepBase;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowDateTimeNumericFieldElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/DateTimeNumericFieldElement.h (146452 => 146453)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/DateTimeNumericFieldElement.h        2013-03-21 11:41:39 UTC (rev 146452)
+++ trunk/Source/WebCore/html/shadow/DateTimeNumericFieldElement.h        2013-03-21 11:54:50 UTC (rev 146453)
</span><span class="lines">@@ -42,23 +42,24 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(DateTimeNumericFieldElement);
</span><span class="cx"> 
</span><span class="cx"> public:
</span><del>-    struct Parameters {
-        Parameters(int step = 1, int stepBase = 0) : step(step), stepBase(stepBase) { }
</del><ins>+    struct Step {
+        Step(int step = 1, int stepBase = 0) : step(step), stepBase(stepBase) { }
</ins><span class="cx">         int step;
</span><span class="cx">         int stepBase;
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-protected:
</del><span class="cx">     struct Range {
</span><del>-        Range(int minimum, int maximum);
</del><ins>+        Range(int minimum, int maximum) : minimum(minimum), maximum(maximum) { }
</ins><span class="cx">         int clampValue(int) const;
</span><span class="cx">         bool isInRange(int) const;
</span><ins>+        bool isSingleton() const { return minimum == maximum; }
</ins><span class="cx"> 
</span><ins>+        int minimum;
</ins><span class="cx">         int maximum;
</span><del>-        int minimum;
</del><span class="cx">     };
</span><span class="cx"> 
</span><del>-    DateTimeNumericFieldElement(Document*, FieldOwner&amp;, const Range&amp;, const Range&amp; hardLimits, const String&amp; placeholder, const Parameters&amp; = Parameters());
</del><ins>+protected:
+    DateTimeNumericFieldElement(Document*, FieldOwner&amp;, const Range&amp;, const Range&amp; hardLimits, const String&amp; placeholder, const Step&amp; = Step());
</ins><span class="cx"> 
</span><span class="cx">     int clampValue(int value) const { return m_range.clampValue(value); }
</span><span class="cx">     virtual int defaultValueForStepDown() const;
</span><span class="lines">@@ -92,10 +93,9 @@
</span><span class="cx">     const String m_placeholder;
</span><span class="cx">     const Range m_range;
</span><span class="cx">     const Range m_hardLimits;
</span><ins>+    const Step m_step;
</ins><span class="cx">     int m_value;
</span><span class="cx">     bool m_hasValue;
</span><del>-    int m_step;
-    int m_stepBase;
</del><span class="cx">     mutable StringBuilder m_typeAheadBuffer;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>