[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 14:59:51 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit e89da8b567c92bb92d38b124ac54b6c819c1677b
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Oct 27 05:42:29 2010 +0000
2010-10-26 Dai Mikurube <dmikurube at google.com>
Reviewed by Kent Tamura.
constraint validation: stepMismatch (rounding error)
https://bugs.webkit.org/show_bug.cgi?id=48220
* fast/forms/ValidityState-stepMismatch-expected.txt:
* fast/forms/script-tests/ValidityState-stepMismatch.js:
2010-10-26 Dai Mikurube <dmikurube at google.com>
Reviewed by Kent Tamura.
constraint validation: stepMismatch (rounding error)
https://bugs.webkit.org/show_bug.cgi?id=48220
1. Changed the computation to achieve difference from a integral
multiple of the allowed value step.
The previous fmod(doubleValue, step) sometimes returned unacceptable
remainder. For example,
double doubleValue = 1.005; // Actually, near to 1.005
double step = 0.005; // Actually, near to 0.005
fmod(doubleValue, step) ==> (near to) 0.005
It's a case that doubleValue is a little smaller than 1.005 and step is
a little larger than 0.005.
2. Changed the error threshold.
Number values in HTML5 are expressed in IEEE 754 single-precision.
Too precise comparison sometimes leads unintended errors.
For example, I found a case :
remainder = 0.00000000000000022204460
acceptableError = 0.00000000000000007105427
* html/NumberInputType.cpp:
(WebCore::NumberInputType::stepMismatch):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70615 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 67c79b8..61194c7 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-10-26 Dai Mikurube <dmikurube at google.com>
+
+ Reviewed by Kent Tamura.
+
+ constraint validation: stepMismatch (rounding error)
+ https://bugs.webkit.org/show_bug.cgi?id=48220
+
+ * fast/forms/ValidityState-stepMismatch-expected.txt:
+ * fast/forms/script-tests/ValidityState-stepMismatch.js:
+
2010-10-26 Antonio Gomes <agomes at rim.com>
Reviewed by Martin Robinson.
diff --git a/LayoutTests/fast/forms/ValidityState-stepMismatch-expected.txt b/LayoutTests/fast/forms/ValidityState-stepMismatch-expected.txt
index f072640..aa129a6 100644
--- a/LayoutTests/fast/forms/ValidityState-stepMismatch-expected.txt
+++ b/LayoutTests/fast/forms/ValidityState-stepMismatch-expected.txt
@@ -142,6 +142,8 @@ PASS stepMismatchFor("0.9", "0.1", "") is false
PASS stepMismatchFor("0.9", "0.1000001", "") is true
PASS stepMismatchFor("0.9", "0.1000000000000001", "") is false
PASS stepMismatchFor("1.0", "0.3333333333333333", "") is false
+Rounding
+PASS stepMismatchFor("5.005", "0.005", "4") is false
Range type
Empty values
diff --git a/LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js b/LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js
index 6322e96..7fc5ef5 100644
--- a/LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js
+++ b/LayoutTests/fast/forms/script-tests/ValidityState-stepMismatch.js
@@ -159,6 +159,8 @@ shouldBe('stepMismatchFor("0.9", "0.1", "")', 'false');
shouldBe('stepMismatchFor("0.9", "0.1000001", "")', 'true');
shouldBe('stepMismatchFor("0.9", "0.1000000000000001", "")', 'false');
shouldBe('stepMismatchFor("1.0", "0.3333333333333333", "")', 'false');
+debug('Rounding');
+shouldBe('stepMismatchFor("5.005", "0.005", "4")', 'false');
debug('');
debug('Range type');
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2f1767a..ce1081d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,33 @@
+2010-10-26 Dai Mikurube <dmikurube at google.com>
+
+ Reviewed by Kent Tamura.
+
+ constraint validation: stepMismatch (rounding error)
+ https://bugs.webkit.org/show_bug.cgi?id=48220
+
+ 1. Changed the computation to achieve difference from a integral
+ multiple of the allowed value step.
+
+ The previous fmod(doubleValue, step) sometimes returned unacceptable
+ remainder. For example,
+ double doubleValue = 1.005; // Actually, near to 1.005
+ double step = 0.005; // Actually, near to 0.005
+ fmod(doubleValue, step) ==> (near to) 0.005
+ It's a case that doubleValue is a little smaller than 1.005 and step is
+ a little larger than 0.005.
+
+ 2. Changed the error threshold.
+
+ Number values in HTML5 are expressed in IEEE 754 single-precision.
+ Too precise comparison sometimes leads unintended errors.
+
+ For example, I found a case :
+ remainder = 0.00000000000000022204460
+ acceptableError = 0.00000000000000007105427
+
+ * html/NumberInputType.cpp:
+ (WebCore::NumberInputType::stepMismatch):
+
2010-10-26 Chris Rogers <crogers at google.com>
Reviewed by Kenneth Russell.
diff --git a/WebCore/html/NumberInputType.cpp b/WebCore/html/NumberInputType.cpp
index b60e2ee..28f510c 100644
--- a/WebCore/html/NumberInputType.cpp
+++ b/WebCore/html/NumberInputType.cpp
@@ -121,12 +121,17 @@ bool NumberInputType::stepMismatch(const String& value, double step) const
if (isinf(doubleValue))
return false;
// double's fractional part size is DBL_MAN_DIG-bit. If the current value
- // is greater than step*2^DBL_MANT_DIG, the following fmod() makes no sense.
+ // is greater than step*2^DBL_MANT_DIG, the following computation for
+ // remainder makes no sense.
if (doubleValue / pow(2.0, DBL_MANT_DIG) > step)
return false;
- double remainder = fmod(doubleValue, step);
- // Accepts errors in lower 7-bit.
- double acceptableError = step / pow(2.0, DBL_MANT_DIG - 7);
+ // The computation follows HTML5 4.10.7.2.10 `The step attribute' :
+ // ... that number subtracted from the step base is not an integral multiple
+ // of the allowed value step, the element is suffering from a step mismatch.
+ double remainder = fabs(doubleValue - step * round(doubleValue / step));
+ // Accepts erros in lower fractional part which IEEE 754 single-precision
+ // can't represent.
+ double acceptableError = step / pow(2.0, FLT_MANT_DIG);
return acceptableError < remainder && remainder < (step - acceptableError);
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list