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 r
ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
8 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2012 Samsung Electronics. All rights reserved. | 9 * Copyright (C) 2012 Samsung Electronics. All rights reserved. |
10 * | 10 * |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 if (!current.isFinite()) { | 936 if (!current.isFinite()) { |
937 current = defaultValueForStepUp(); | 937 current = defaultValueForStepUp(); |
938 const Decimal nextDiff = step * n; | 938 const Decimal nextDiff = step * n; |
939 if (current < stepRange.minimum() - nextDiff) | 939 if (current < stepRange.minimum() - nextDiff) |
940 current = stepRange.minimum() - nextDiff; | 940 current = stepRange.minimum() - nextDiff; |
941 if (current > stepRange.maximum() - nextDiff) | 941 if (current > stepRange.maximum() - nextDiff) |
942 current = stepRange.maximum() - nextDiff; | 942 current = stepRange.maximum() - nextDiff; |
943 setValueAsDecimal(current, DispatchNoEvent, IGNORE_EXCEPTION); | 943 setValueAsDecimal(current, DispatchNoEvent, IGNORE_EXCEPTION); |
944 } | 944 } |
945 if ((sign > 0 && current < stepRange.minimum()) || (sign < 0 && current > st
epRange.maximum())) { | 945 if ((sign > 0 && current < stepRange.minimum()) || (sign < 0 && current > st
epRange.maximum())) { |
946 setValueAsDecimal(sign > 0 ? stepRange.minimum() : stepRange.maximum(),
DispatchChangeEvent, IGNORE_EXCEPTION); | 946 setValueAsDecimal(sign > 0 ? stepRange.minimum() : stepRange.maximum(),
DispatchInputAndChangeEvent, IGNORE_EXCEPTION); |
947 return; | 947 return; |
948 } | 948 } |
949 applyStep(current, n, AnyIsDefaultStep, DispatchChangeEvent, IGNORE_EXCEPTIO
N); | 949 applyStep(current, n, AnyIsDefaultStep, DispatchInputAndChangeEvent, IGNORE_
EXCEPTION); |
950 } | 950 } |
951 | 951 |
952 void InputType::countUsageIfVisible(UseCounter::Feature feature) const | 952 void InputType::countUsageIfVisible(UseCounter::Feature feature) const |
953 { | 953 { |
954 if (RenderStyle* style = element().renderStyle()) { | 954 if (RenderStyle* style = element().renderStyle()) { |
955 if (style->visibility() != HIDDEN) | 955 if (style->visibility() != HIDDEN) |
956 UseCounter::count(element().document(), feature); | 956 UseCounter::count(element().document(), feature); |
957 } | 957 } |
958 } | 958 } |
959 | 959 |
960 Decimal InputType::findStepBase(const Decimal& defaultValue) const | 960 Decimal InputType::findStepBase(const Decimal& defaultValue) const |
961 { | 961 { |
962 Decimal stepBase = parseToNumber(element().fastGetAttribute(minAttr), Decima
l::nan()); | 962 Decimal stepBase = parseToNumber(element().fastGetAttribute(minAttr), Decima
l::nan()); |
963 if (!stepBase.isFinite()) | 963 if (!stepBase.isFinite()) |
964 stepBase = parseToNumber(element().fastGetAttribute(valueAttr), defaultV
alue); | 964 stepBase = parseToNumber(element().fastGetAttribute(valueAttr), defaultV
alue); |
965 return stepBase; | 965 return stepBase; |
966 } | 966 } |
967 | 967 |
968 StepRange InputType::createStepRange(AnyStepHandling anyStepHandling, const Deci
mal& stepBaseDefault, const Decimal& minimumDefault, const Decimal& maximumDefau
lt, const StepRange::StepDescription& stepDescription) const | 968 StepRange InputType::createStepRange(AnyStepHandling anyStepHandling, const Deci
mal& stepBaseDefault, const Decimal& minimumDefault, const Decimal& maximumDefau
lt, const StepRange::StepDescription& stepDescription) const |
969 { | 969 { |
970 const Decimal stepBase = findStepBase(stepBaseDefault); | 970 const Decimal stepBase = findStepBase(stepBaseDefault); |
971 const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), m
inimumDefault); | 971 const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), m
inimumDefault); |
972 const Decimal maximum = parseToNumber(element().fastGetAttribute(maxAttr), m
aximumDefault); | 972 const Decimal maximum = parseToNumber(element().fastGetAttribute(maxAttr), m
aximumDefault); |
973 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription,
element().fastGetAttribute(stepAttr)); | 973 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription,
element().fastGetAttribute(stepAttr)); |
974 return StepRange(stepBase, minimum, maximum, step, stepDescription); | 974 return StepRange(stepBase, minimum, maximum, step, stepDescription); |
975 } | 975 } |
976 | 976 |
977 } // namespace WebCore | 977 } // namespace WebCore |
OLD | NEW |