OLD | NEW |
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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 // integral multiple of the allowed value step, then abort these steps. | 710 // integral multiple of the allowed value step, then abort these steps. |
711 Decimal aligned_maximum = step_range.StepSnappedMaximum(); | 711 Decimal aligned_maximum = step_range.StepSnappedMaximum(); |
712 if (!aligned_maximum.IsFinite()) | 712 if (!aligned_maximum.IsFinite()) |
713 return; | 713 return; |
714 | 714 |
715 Decimal base = step_range.StepBase(); | 715 Decimal base = step_range.StepBase(); |
716 Decimal step = step_range.Step(); | 716 Decimal step = step_range.Step(); |
717 EventQueueScope scope; | 717 EventQueueScope scope; |
718 Decimal new_value = current; | 718 Decimal new_value = current; |
719 const AtomicString& step_string = GetElement().FastGetAttribute(stepAttr); | 719 const AtomicString& step_string = GetElement().FastGetAttribute(stepAttr); |
720 if (!EqualIgnoringCase(step_string, "any") && | 720 if (!DeprecatedEqualIgnoringCase(step_string, "any") && |
721 step_range.StepMismatch(current)) { | 721 step_range.StepMismatch(current)) { |
722 // Snap-to-step / clamping steps | 722 // Snap-to-step / clamping steps |
723 // If the current value is not matched to step value: | 723 // If the current value is not matched to step value: |
724 // - The value should be the larger matched value nearest to 0 if count > 0 | 724 // - The value should be the larger matched value nearest to 0 if count > 0 |
725 // e.g. <input type=number value=3 min=-100 step=3> -> 5 | 725 // e.g. <input type=number value=3 min=-100 step=3> -> 5 |
726 // - The value should be the smaller matched value nearest to 0 if count < 0 | 726 // - The value should be the smaller matched value nearest to 0 if count < 0 |
727 // e.g. <input type=number value=3 min=-100 step=3> -> 2 | 727 // e.g. <input type=number value=3 min=-100 step=3> -> 2 |
728 // | 728 // |
729 | 729 |
730 DCHECK(!step.IsZero()); | 730 DCHECK(!step.IsZero()); |
731 if (count < 0) { | 731 if (count < 0) { |
732 new_value = base + ((new_value - base) / step).Floor() * step; | 732 new_value = base + ((new_value - base) / step).Floor() * step; |
733 ++count; | 733 ++count; |
734 } else if (count > 0) { | 734 } else if (count > 0) { |
735 new_value = base + ((new_value - base) / step).Ceil() * step; | 735 new_value = base + ((new_value - base) / step).Ceil() * step; |
736 --count; | 736 --count; |
737 } | 737 } |
738 } | 738 } |
739 new_value = new_value + step_range.Step() * Decimal::FromDouble(count); | 739 new_value = new_value + step_range.Step() * Decimal::FromDouble(count); |
740 | 740 |
741 if (!EqualIgnoringCase(step_string, "any")) | 741 if (!DeprecatedEqualIgnoringCase(step_string, "any")) |
742 new_value = step_range.AlignValueForStep(current, new_value); | 742 new_value = step_range.AlignValueForStep(current, new_value); |
743 | 743 |
744 // 7. If the element has a minimum, and value is less than that minimum, | 744 // 7. If the element has a minimum, and value is less than that minimum, |
745 // then set value to the smallest value that, when subtracted from the step | 745 // then set value to the smallest value that, when subtracted from the step |
746 // base, is an integral multiple of the allowed value step, and that is more | 746 // base, is an integral multiple of the allowed value step, and that is more |
747 // than or equal to minimum. | 747 // than or equal to minimum. |
748 if (new_value < step_range.Minimum()) { | 748 if (new_value < step_range.Minimum()) { |
749 const Decimal aligned_minimum = | 749 const Decimal aligned_minimum = |
750 base + ((step_range.Minimum() - base) / step).Ceil() * step; | 750 base + ((step_range.Minimum() - base) / step).Ceil() * step; |
751 DCHECK_GE(aligned_minimum, step_range.Minimum()); | 751 DCHECK_GE(aligned_minimum, step_range.Minimum()); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 | 915 |
916 void InputType::AddWarningToConsole(const char* message_format, | 916 void InputType::AddWarningToConsole(const char* message_format, |
917 const String& value) const { | 917 const String& value) const { |
918 GetElement().GetDocument().AddConsoleMessage(ConsoleMessage::Create( | 918 GetElement().GetDocument().AddConsoleMessage(ConsoleMessage::Create( |
919 kRenderingMessageSource, kWarningMessageLevel, | 919 kRenderingMessageSource, kWarningMessageLevel, |
920 String::Format(message_format, | 920 String::Format(message_format, |
921 JSONValue::QuoteString(value).Utf8().Data()))); | 921 JSONValue::QuoteString(value).Utf8().Data()))); |
922 } | 922 } |
923 | 923 |
924 } // namespace blink | 924 } // namespace blink |
OLD | NEW |