diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/html/StepRange.cpp | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/html/StepRange.cpp')
-rw-r--r-- | Source/WebCore/html/StepRange.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Source/WebCore/html/StepRange.cpp b/Source/WebCore/html/StepRange.cpp index e7e548445..76d21dcae 100644 --- a/Source/WebCore/html/StepRange.cpp +++ b/Source/WebCore/html/StepRange.cpp @@ -24,6 +24,7 @@ #include "HTMLNames.h" #include "HTMLParserIdioms.h" #include <wtf/MathExtras.h> +#include <wtf/NeverDestroyed.h> namespace WebCore { @@ -34,7 +35,6 @@ StepRange::StepRange() , m_minimum(0) , m_step(1) , m_stepBase(0) - , m_hasStep(false) { } @@ -44,16 +44,18 @@ StepRange::StepRange(const StepRange& stepRange) , m_step(stepRange.m_step) , m_stepBase(stepRange.m_stepBase) , m_stepDescription(stepRange.m_stepDescription) + , m_hasRangeLimitations(stepRange.m_hasRangeLimitations) , m_hasStep(stepRange.m_hasStep) { } -StepRange::StepRange(const Decimal& stepBase, const Decimal& minimum, const Decimal& maximum, const Decimal& step, const StepDescription& stepDescription) +StepRange::StepRange(const Decimal& stepBase, RangeLimitations rangeLimitations, const Decimal& minimum, const Decimal& maximum, const Decimal& step, const StepDescription& stepDescription) : m_maximum(maximum) , m_minimum(minimum) , m_step(step.isFinite() ? step : 1) , m_stepBase(stepBase.isFinite() ? stepBase : 1) , m_stepDescription(stepDescription) + , m_hasRangeLimitations(rangeLimitations == RangeLimitations::Valid) , m_hasStep(step.isFinite()) { ASSERT(m_maximum.isFinite()); @@ -65,13 +67,13 @@ StepRange::StepRange(const Decimal& stepBase, const Decimal& minimum, const Deci Decimal StepRange::acceptableError() const { // FIXME: We should use DBL_MANT_DIG instead of FLT_MANT_DIG regarding to HTML5 specification. - DEFINE_STATIC_LOCAL(const Decimal, twoPowerOfFloatMantissaBits, (Decimal::Positive, 0, UINT64_C(1) << FLT_MANT_DIG)); + static NeverDestroyed<const Decimal> twoPowerOfFloatMantissaBits(Decimal::Positive, 0, UINT64_C(1) << FLT_MANT_DIG); return m_stepDescription.stepValueShouldBe == StepValueShouldBeReal ? m_step / twoPowerOfFloatMantissaBits : Decimal(0); } Decimal StepRange::alignValueForStep(const Decimal& currentValue, const Decimal& newValue) const { - DEFINE_STATIC_LOCAL(const Decimal, tenPowerOf21, (Decimal::Positive, 21, 1)); + static NeverDestroyed<const Decimal> tenPowerOf21(Decimal::Positive, 21, 1); if (newValue >= tenPowerOf21) return newValue; @@ -96,7 +98,7 @@ Decimal StepRange::parseStep(AnyStepHandling anyStepHandling, const StepDescript if (stepString.isEmpty()) return stepDescription.defaultValue(); - if (equalIgnoringCase(stepString, "any")) { + if (equalLettersIgnoringASCIICase(stepString, "any")) { switch (anyStepHandling) { case RejectAny: return Decimal::nan(); @@ -150,7 +152,7 @@ bool StepRange::stepMismatch(const Decimal& valueForCheck) const // Decimal's fractional part size is DBL_MAN_DIG-bit. If the current value // is greater than step*2^DBL_MANT_DIG, the following computation for // remainder makes no sense. - DEFINE_STATIC_LOCAL(const Decimal, twoPowerOfDoubleMantissaBits, (Decimal::Positive, 0, UINT64_C(1) << DBL_MANT_DIG)); + static NeverDestroyed<const Decimal> twoPowerOfDoubleMantissaBits(Decimal::Positive, 0, UINT64_C(1) << DBL_MANT_DIG); if (value / twoPowerOfDoubleMantissaBits > m_step) return false; // The computation follows HTML5 4.10.7.2.10 `The step attribute' : |