Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Unified Diff: Source/core/html/forms/MonthInputType.cpp

Issue 27746003: Have InputType factories take an HTMLInputElement reference in parameter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/forms/MonthInputType.h ('k') | Source/core/html/forms/NumberInputType.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/forms/MonthInputType.cpp
diff --git a/Source/core/html/forms/MonthInputType.cpp b/Source/core/html/forms/MonthInputType.cpp
index 1294ebdf56069508deabaaf31359ea43e3eb45ea..5c568d3ae9d24bfcbcf5685cc2e80b6f5cd15f53 100644
--- a/Source/core/html/forms/MonthInputType.cpp
+++ b/Source/core/html/forms/MonthInputType.cpp
@@ -51,7 +51,7 @@ static const int monthDefaultStep = 1;
static const int monthDefaultStepBase = 0;
static const int monthStepScaleFactor = 1;
-PassRefPtr<InputType> MonthInputType::create(HTMLInputElement* element)
+PassRefPtr<InputType> MonthInputType::create(HTMLInputElement& element)
{
return adoptRef(new MonthInputType(element));
}
@@ -74,7 +74,7 @@ DateComponents::Type MonthInputType::dateType() const
double MonthInputType::valueAsDate() const
{
DateComponents date;
- if (!parseToDateComponents(element()->value(), &date))
+ if (!parseToDateComponents(element().value(), &date))
return DateComponents::invalidMilliseconds();
double msec = date.millisecondsSinceEpoch();
ASSERT(std::isfinite(msec));
@@ -108,10 +108,10 @@ StepRange MonthInputType::createStepRange(AnyStepHandling anyStepHandling) const
{
DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (monthDefaultStep, monthDefaultStepBase, monthStepScaleFactor, StepRange::ParsedStepValueShouldBeInteger));
- const Decimal stepBase = parseToNumber(element()->fastGetAttribute(minAttr), Decimal::fromDouble(monthDefaultStepBase));
- const Decimal minimum = parseToNumber(element()->fastGetAttribute(minAttr), Decimal::fromDouble(DateComponents::minimumMonth()));
- const Decimal maximum = parseToNumber(element()->fastGetAttribute(maxAttr), Decimal::fromDouble(DateComponents::maximumMonth()));
- const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element()->fastGetAttribute(stepAttr));
+ const Decimal stepBase = parseToNumber(element().fastGetAttribute(minAttr), Decimal::fromDouble(monthDefaultStepBase));
+ const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), Decimal::fromDouble(DateComponents::minimumMonth()));
+ const Decimal maximum = parseToNumber(element().fastGetAttribute(maxAttr), Decimal::fromDouble(DateComponents::maximumMonth()));
+ const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription, element().fastGetAttribute(stepAttr));
return StepRange(stepBase, minimum, maximum, step, stepDescription);
}
@@ -155,9 +155,9 @@ void MonthInputType::setupLayoutParameters(DateTimeEditElement::LayoutParameters
{
layoutParameters.dateTimeFormat = layoutParameters.locale.monthFormat();
layoutParameters.fallbackDateTimeFormat = "yyyy-MM";
- if (!parseToDateComponents(element()->fastGetAttribute(minAttr), &layoutParameters.minimum))
+ if (!parseToDateComponents(element().fastGetAttribute(minAttr), &layoutParameters.minimum))
layoutParameters.minimum = DateComponents();
- if (!parseToDateComponents(element()->fastGetAttribute(maxAttr), &layoutParameters.maximum))
+ if (!parseToDateComponents(element().fastGetAttribute(maxAttr), &layoutParameters.maximum))
layoutParameters.maximum = DateComponents();
layoutParameters.placeholderForMonth = "--";
layoutParameters.placeholderForYear = "----";
« no previous file with comments | « Source/core/html/forms/MonthInputType.h ('k') | Source/core/html/forms/NumberInputType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698