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

Side by Side Diff: third_party/WebKit/Source/core/html/forms/InputType.cpp

Issue 2774723004: Update :in-range/:out-of-range when steppable min/max/value changes. (Closed)
Patch Set: Moved code to InputType class. Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/forms/InputType.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
9 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved. 9 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved.
10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 const Decimal numericValue = parseToNumberOrNaN(value); 290 const Decimal numericValue = parseToNumberOrNaN(value);
291 if (!numericValue.isFinite()) 291 if (!numericValue.isFinite())
292 return false; 292 return false;
293 293
294 StepRange stepRange(createStepRange(RejectAny)); 294 StepRange stepRange(createStepRange(RejectAny));
295 return stepRange.hasRangeLimitations() && 295 return stepRange.hasRangeLimitations() &&
296 (numericValue < stepRange.minimum() || 296 (numericValue < stepRange.minimum() ||
297 numericValue > stepRange.maximum()); 297 numericValue > stepRange.maximum());
298 } 298 }
299 299
300 void InputType::inRangeChanged() const {
301 if (isSteppable()) {
302 element().pseudoStateChanged(CSSSelector::PseudoInRange);
303 element().pseudoStateChanged(CSSSelector::PseudoOutOfRange);
304 }
305 }
306
300 bool InputType::stepMismatch(const String& value) const { 307 bool InputType::stepMismatch(const String& value) const {
301 if (!isSteppable()) 308 if (!isSteppable())
302 return false; 309 return false;
303 310
304 const Decimal numericValue = parseToNumberOrNaN(value); 311 const Decimal numericValue = parseToNumberOrNaN(value);
305 if (!numericValue.isFinite()) 312 if (!numericValue.isFinite())
306 return false; 313 return false;
307 314
308 return createStepRange(RejectAny).stepMismatch(numericValue); 315 return createStepRange(RejectAny).stepMismatch(numericValue);
309 } 316 }
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 914
908 void InputType::addWarningToConsole(const char* messageFormat, 915 void InputType::addWarningToConsole(const char* messageFormat,
909 const String& value) const { 916 const String& value) const {
910 element().document().addConsoleMessage(ConsoleMessage::create( 917 element().document().addConsoleMessage(ConsoleMessage::create(
911 RenderingMessageSource, WarningMessageLevel, 918 RenderingMessageSource, WarningMessageLevel,
912 String::format(messageFormat, 919 String::format(messageFormat,
913 JSONValue::quoteString(value).utf8().data()))); 920 JSONValue::quoteString(value).utf8().data())));
914 } 921 }
915 922
916 } // namespace blink 923 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/forms/InputType.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698