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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 if (!current.isFinite()) { | 937 if (!current.isFinite()) { |
938 current = defaultValueForStepUp(); | 938 current = defaultValueForStepUp(); |
939 const Decimal nextDiff = step * n; | 939 const Decimal nextDiff = step * n; |
940 if (current < stepRange.minimum() - nextDiff) | 940 if (current < stepRange.minimum() - nextDiff) |
941 current = stepRange.minimum() - nextDiff; | 941 current = stepRange.minimum() - nextDiff; |
942 if (current > stepRange.maximum() - nextDiff) | 942 if (current > stepRange.maximum() - nextDiff) |
943 current = stepRange.maximum() - nextDiff; | 943 current = stepRange.maximum() - nextDiff; |
944 setValueAsDecimal(current, DispatchNoEvent, IGNORE_EXCEPTION); | 944 setValueAsDecimal(current, DispatchNoEvent, IGNORE_EXCEPTION); |
945 } | 945 } |
946 if ((sign > 0 && current < stepRange.minimum()) || (sign < 0 && current > st
epRange.maximum())) { | 946 if ((sign > 0 && current < stepRange.minimum()) || (sign < 0 && current > st
epRange.maximum())) { |
947 setValueAsDecimal(sign > 0 ? stepRange.minimum() : stepRange.maximum(),
DispatchInputAndChangeEvent, IGNORE_EXCEPTION); | 947 setValueAsDecimal(sign > 0 ? stepRange.minimum() : stepRange.maximum(),
DispatchChangeEvent, IGNORE_EXCEPTION); |
948 return; | 948 return; |
949 } | 949 } |
950 applyStep(current, n, AnyIsDefaultStep, DispatchInputAndChangeEvent, IGNORE_
EXCEPTION); | 950 applyStep(current, n, AnyIsDefaultStep, DispatchChangeEvent, IGNORE_EXCEPTIO
N); |
951 } | 951 } |
952 | 952 |
953 void InputType::countUsageIfVisible(UseCounter::Feature feature) const | 953 void InputType::countUsageIfVisible(UseCounter::Feature feature) const |
954 { | 954 { |
955 if (RenderStyle* style = element().renderStyle()) { | 955 if (RenderStyle* style = element().renderStyle()) { |
956 if (style->visibility() != HIDDEN) | 956 if (style->visibility() != HIDDEN) |
957 UseCounter::count(element().document(), feature); | 957 UseCounter::count(element().document(), feature); |
958 } | 958 } |
959 } | 959 } |
960 | 960 |
961 Decimal InputType::findStepBase(const Decimal& defaultValue) const | 961 Decimal InputType::findStepBase(const Decimal& defaultValue) const |
962 { | 962 { |
963 Decimal stepBase = parseToNumber(element().fastGetAttribute(minAttr), Decima
l::nan()); | 963 Decimal stepBase = parseToNumber(element().fastGetAttribute(minAttr), Decima
l::nan()); |
964 if (!stepBase.isFinite()) | 964 if (!stepBase.isFinite()) |
965 stepBase = parseToNumber(element().fastGetAttribute(valueAttr), defaultV
alue); | 965 stepBase = parseToNumber(element().fastGetAttribute(valueAttr), defaultV
alue); |
966 return stepBase; | 966 return stepBase; |
967 } | 967 } |
968 | 968 |
969 StepRange InputType::createStepRange(AnyStepHandling anyStepHandling, const Deci
mal& stepBaseDefault, const Decimal& minimumDefault, const Decimal& maximumDefau
lt, const StepRange::StepDescription& stepDescription) const | 969 StepRange InputType::createStepRange(AnyStepHandling anyStepHandling, const Deci
mal& stepBaseDefault, const Decimal& minimumDefault, const Decimal& maximumDefau
lt, const StepRange::StepDescription& stepDescription) const |
970 { | 970 { |
971 const Decimal stepBase = findStepBase(stepBaseDefault); | 971 const Decimal stepBase = findStepBase(stepBaseDefault); |
972 const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), m
inimumDefault); | 972 const Decimal minimum = parseToNumber(element().fastGetAttribute(minAttr), m
inimumDefault); |
973 const Decimal maximum = parseToNumber(element().fastGetAttribute(maxAttr), m
aximumDefault); | 973 const Decimal maximum = parseToNumber(element().fastGetAttribute(maxAttr), m
aximumDefault); |
974 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription,
element().fastGetAttribute(stepAttr)); | 974 const Decimal step = StepRange::parseStep(anyStepHandling, stepDescription,
element().fastGetAttribute(stepAttr)); |
975 return StepRange(stepBase, minimum, maximum, step, stepDescription); | 975 return StepRange(stepBase, minimum, maximum, step, stepDescription); |
976 } | 976 } |
977 | 977 |
978 } // namespace WebCore | 978 } // namespace WebCore |
OLD | NEW |