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

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

Issue 2390563002: Reflow comments in core/html/forms/. (Closed)
Patch Set: Created 4 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 unified diff | Download patch
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 r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
8 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved. 9 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
10 * 11 *
11 * This library is free software; you can redistribute it and/or 12 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public 13 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either 14 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version. 15 * version 2 of the License, or (at your option) any later version.
15 * 16 *
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 return; 773 return;
773 } 774 }
774 const Decimal current = parseToNumber(element().value(), 0); 775 const Decimal current = parseToNumber(element().value(), 0);
775 applyStep(current, n, RejectAny, DispatchNoEvent, exceptionState); 776 applyStep(current, n, RejectAny, DispatchNoEvent, exceptionState);
776 } 777 }
777 778
778 void InputType::stepUpFromLayoutObject(int n) { 779 void InputType::stepUpFromLayoutObject(int n) {
779 // The only difference from stepUp()/stepDown() is the extra treatment 780 // The only difference from stepUp()/stepDown() is the extra treatment
780 // of the current value before applying the step: 781 // of the current value before applying the step:
781 // 782 //
782 // If the current value is not a number, including empty, the current value is assumed as 0. 783 // If the current value is not a number, including empty, the current value is
784 // assumed as 0.
783 // * If 0 is in-range, and matches to step value 785 // * If 0 is in-range, and matches to step value
784 // - The value should be the +step if n > 0 786 // - The value should be the +step if n > 0
785 // - The value should be the -step if n < 0 787 // - The value should be the -step if n < 0
786 // If -step or +step is out of range, new value should be 0. 788 // If -step or +step is out of range, new value should be 0.
787 // * If 0 is smaller than the minimum value 789 // * If 0 is smaller than the minimum value
788 // - The value should be the minimum value for any n 790 // - The value should be the minimum value for any n
789 // * If 0 is larger than the maximum value 791 // * If 0 is larger than the maximum value
790 // - The value should be the maximum value for any n 792 // - The value should be the maximum value for any n
791 // * If 0 is in-range, but not matched to step value 793 // * If 0 is in-range, but not matched to step value
792 // - The value should be the larger matched value nearest to 0 if n > 0 794 // - The value should be the larger matched value nearest to 0 if n > 0
793 // e.g. <input type=number min=-100 step=3> -> 2 795 // e.g. <input type=number min=-100 step=3> -> 2
794 // - The value should be the smaler matched value nearest to 0 if n < 0 796 // - The value should be the smaler matched value nearest to 0 if n < 0
795 // e.g. <input type=number min=-100 step=3> -> -1 797 // e.g. <input type=number min=-100 step=3> -> -1
796 // As for date/datetime-local/month/time/week types, the current value is as sumed as "the current local date/time". 798 // As for date/datetime-local/month/time/week types, the current value is
797 // As for datetime type, the current value is assumed as "the current date/t ime in UTC". 799 // assumed as "the current local date/time".
800 // As for datetime type, the current value is assumed as "the current
801 // date/time in UTC".
798 // If the current value is smaller than the minimum value: 802 // If the current value is smaller than the minimum value:
799 // - The value should be the minimum value if n > 0 803 // - The value should be the minimum value if n > 0
800 // - Nothing should happen if n < 0 804 // - Nothing should happen if n < 0
801 // If the current value is larger than the maximum value: 805 // If the current value is larger than the maximum value:
802 // - The value should be the maximum value if n < 0 806 // - The value should be the maximum value if n < 0
803 // - Nothing should happen if n > 0 807 // - Nothing should happen if n > 0
804 // 808 //
805 // n is assumed as -n if step < 0. 809 // n is assumed as -n if step < 0.
806 810
807 DCHECK(isSteppable()); 811 DCHECK(isSteppable());
808 if (!isSteppable()) 812 if (!isSteppable())
809 return; 813 return;
810 DCHECK(n); 814 DCHECK(n);
811 if (!n) 815 if (!n)
812 return; 816 return;
813 817
814 StepRange stepRange(createStepRange(AnyIsDefaultStep)); 818 StepRange stepRange(createStepRange(AnyIsDefaultStep));
815 819
816 // FIXME: Not any changes after stepping, even if it is an invalid value, may be better. 820 // FIXME: Not any changes after stepping, even if it is an invalid value, may
817 // (e.g. Stepping-up for <input type="number" value="foo" step="any" /> => "fo o") 821 // be better.
822 // (e.g. Stepping-up for <input type="number" value="foo" step="any" /> =>
823 // "foo")
818 if (!stepRange.hasStep()) 824 if (!stepRange.hasStep())
819 return; 825 return;
820 826
821 EventQueueScope scope; 827 EventQueueScope scope;
822 const Decimal step = stepRange.step(); 828 const Decimal step = stepRange.step();
823 829
824 int sign; 830 int sign;
825 if (step > 0) 831 if (step > 0)
826 sign = n; 832 sign = n;
827 else if (step < 0) 833 else if (step < 0)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 900
895 void InputType::addWarningToConsole(const char* messageFormat, 901 void InputType::addWarningToConsole(const char* messageFormat,
896 const String& value) const { 902 const String& value) const {
897 element().document().addConsoleMessage(ConsoleMessage::create( 903 element().document().addConsoleMessage(ConsoleMessage::create(
898 RenderingMessageSource, WarningMessageLevel, 904 RenderingMessageSource, WarningMessageLevel,
899 String::format(messageFormat, 905 String::format(messageFormat,
900 JSONValue::quoteString(value).utf8().data()))); 906 JSONValue::quoteString(value).utf8().data())));
901 } 907 }
902 908
903 } // namespace blink 909 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698