[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
simon.fraser at apple.com
simon.fraser at apple.com
Wed Dec 22 14:42:15 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 4093cfbb8f34c7b3fe3b987c4cbd53f612175b9a
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sun Oct 17 20:05:56 2010 +0000
2010-10-17 Simon Fraser <simon.fraser at apple.com>
Reviewed by Nikolas Zimmermann.
Very large and small numbers fail to round-trip through CSS
https://bugs.webkit.org/show_bug.cgi?id=20674
Use the new DecimalNumber functionality to convert CSS numberic values to strings
using decimal notation, rather than %g (which can output scientific notation).
Test: fast/css/round-trip-values.html
* css/CSSPrimitiveValue.cpp:
(WebCore::formatNumber):
(WebCore::CSSPrimitiveValue::cssText):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69928 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index a623f87..9a18f2b 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,15 @@
+2010-10-17 Simon Fraser <simon.fraser at apple.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ Very large and small numbers fail to round-trip through CSS
+ https://bugs.webkit.org/show_bug.cgi?id=20674
+
+ New exports required to use DecimalNumber in WebCore.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+
2010-10-16 Kyusun Kim <maniagoon at company100.net>
Reviewed by Alexey Proskuryakov.
diff --git a/JavaScriptCore/JavaScriptCore.exp b/JavaScriptCore/JavaScriptCore.exp
index 2dd66c1..8f3ed5d 100644
--- a/JavaScriptCore/JavaScriptCore.exp
+++ b/JavaScriptCore/JavaScriptCore.exp
@@ -545,6 +545,9 @@ __ZNK3JSC8JSObject9toBooleanEPNS_9ExecStateE
__ZNK3JSC8JSString11resolveRopeEPNS_9ExecStateE
__ZNK3JSC9HashTable11createTableEPNS_12JSGlobalDataE
__ZNK3JSC9HashTable11deleteTableEv
+__ZN3WTF11dtoaRoundSFEPcdiRbRiRj
+__ZN3WTF11dtoaRoundDPEPcdiRbRiRj
+__ZN3WTF4dtoaEPcdRbRiRj
__ZNK3WTF12AtomicString5lowerEv
__ZNK3WTF6String11toIntStrictEPbi
__ZNK3WTF6String12toUIntStrictEPbi
diff --git a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
index 0f29c0e..0ddf1be 100644
--- a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+++ b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -204,7 +204,7 @@
8626BECF11928E3900782FAB /* StringStatics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8626BECE11928E3900782FAB /* StringStatics.cpp */; };
8627E5EB11F1281900A313B5 /* PageAllocation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8627E5E911F1281900A313B5 /* PageAllocation.cpp */; };
8627E5EC11F1281900A313B5 /* PageAllocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 8627E5EA11F1281900A313B5 /* PageAllocation.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 862AF4B612239C7B0024E5B8 /* DecimalNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 862AF4B512239C7B0024E5B8 /* DecimalNumber.h */; };
+ 862AF4B612239C7B0024E5B8 /* DecimalNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 862AF4B512239C7B0024E5B8 /* DecimalNumber.h */; settings = {ATTRIBUTES = (Private, ); }; };
863B23E00FC6118900703AA4 /* MacroAssemblerCodeRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 863B23DF0FC60E6200703AA4 /* MacroAssemblerCodeRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
86438FC41265503E00E0DFCA /* StringBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86438FC31265503E00E0DFCA /* StringBuilder.cpp */; };
86565742115BE3DA00291F40 /* CString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86565740115BE3DA00291F40 /* CString.cpp */; };
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index f500c76..c19dfbb 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,25 @@
+2010-10-17 Simon Fraser <simon.fraser at apple.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ Very large and small numbers fail to round-trip through CSS
+ https://bugs.webkit.org/show_bug.cgi?id=20674
+
+ Fix tests affected by outputting CSS numbers in decimal notation.
+
+ * fast/css/large-number-round-trip-expected.txt:
+ * fast/css/round-trip-values-expected.txt: Added.
+ * fast/css/round-trip-values.html: Added.
+ * platform/mac/fast/css/opacity-float-expected.txt: Removed.
+ * svg/dynamic-updates/SVGFEFloodElement-dom-flood-opacity-attr-expected.txt:
+ * svg/dynamic-updates/SVGFEFloodElement-svgdom-flood-opacity-prop-expected.txt:
+ * svg/dynamic-updates/script-tests/SVGFEFloodElement-dom-flood-opacity-attr.js:
+ (executeTest):
+ * svg/dynamic-updates/script-tests/SVGFEFloodElement-svgdom-flood-opacity-prop.js:
+ (executeTest):
+ * transforms/2d/resources/transform-test-utils.js:
+ (floatingPointEqual):
+
2010-10-17 Cosmin Truta <ctruta at chromium.org>
Reviewed by Nikolas Zimmermann.
diff --git a/LayoutTests/fast/css/large-number-round-trip-expected.txt b/LayoutTests/fast/css/large-number-round-trip-expected.txt
index c9c6dc1..4879544 100644
--- a/LayoutTests/fast/css/large-number-round-trip-expected.txt
+++ b/LayoutTests/fast/css/large-number-round-trip-expected.txt
@@ -1 +1 @@
-FAIL: read 90010000px back as 9.001e+07px, read again as 0px
+PASS: read 90010000px back as 90010000px, read again as 90010000px
diff --git a/LayoutTests/fast/css/round-trip-values-expected.txt b/LayoutTests/fast/css/round-trip-values-expected.txt
new file mode 100644
index 0000000..52111ea
--- /dev/null
+++ b/LayoutTests/fast/css/round-trip-values-expected.txt
@@ -0,0 +1,44 @@
+For each input on the left, this table lists what happens when you pass it into a CSS property and retrieve its value back. The third column indicates whether the value was round-tripped faithfully.
+
+Basic floats
+'0.0001' 0.0001 pass
+0.0001 0.0001 pass
+'123456.123456' 123456.123456 pass
+'1234567.1234567' 1234567.1234567 pass
+'12345678.12345678' 12345678.12345678 pass
+Trailing zeros
+'0.00100000' 0.001 pass
+'0.001000001' 0.001000001 pass
+'0.12345000001' 0.12345000001 pass
+'0.12304567' 0.12304567 pass
+'0.12340567' 0.12340567 pass
+'0.12345067' 0.12345067 pass
+'0.12345607' 0.12345607 pass
+'0.12345670' 0.1234567 pass
+Repeating decimals
+1/3 0.3333333333333333 pass
+123 + 1/3 123.33333333333333 pass
+13/99 0.13131313131313133 pass
+123 + 13/99 123.13131313131314 pass
+100/999 0.1001001001001001 pass
+123 + 100/999 123.10010010010011 pass
+Large numbers
+12345678 12345678 pass
+123456789 123456789 pass
+1234567890 1234567890 pass
+12345678901 12345678901 pass
+123456789012 123456789012 pass
+1234567890123 1234567890123 pass
+12345678901234 12345678901234 pass
+123456789012345 123456789012345 pass
+1234567890123456 1234567890123456 pass
+12345678901234567 12345678901234568 pass
+Weird numbers
+Number.NaN 12345678901234568 pass
+1/0 12345678901234568 pass
+Math.sqrt(-1) 12345678901234568 pass
+1/0.9999 1.000100010001 pass
+1/0.99999 1.000010000100001 pass
+1/0.999999 1.000001000001 pass
+1/0.9999999 1.00000010000001 pass
+1/0.99999999 1.0000000100000002 pass
diff --git a/LayoutTests/fast/css/round-trip-values.html b/LayoutTests/fast/css/round-trip-values.html
new file mode 100644
index 0000000..808fa45
--- /dev/null
+++ b/LayoutTests/fast/css/round-trip-values.html
@@ -0,0 +1,130 @@
+<!DOCTYPE HTML>
+
+<html>
+<head>
+<style>
+ body {
+ font-family: sans-serif;
+ font-size: 0.8em;
+ }
+
+ code {
+ font-family: workaround, monospace;
+ }
+
+ .heading {
+ background: #eee;
+ font-weight: bold;
+ }
+</style>
+</head>
+<body>
+ <p>For each input on the left, this table lists what happens when you
+pass it into a CSS property and retrieve its value back. The third column
+indicates whether the value was round-tripped faithfully.</p>
+
+<div id='test'></div>
+<table id='table'>
+</table>
+
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+var table = document.getElementById('table');
+var div = document.getElementById('test');
+
+function heading(text) {
+ var tr = document.createElement('tr');
+ tr.className = 'heading';
+ var td = document.createElement('td');
+ td.colSpan = 3;
+ td.align = 'center'
+ td.appendChild(document.createTextNode(text));
+ tr.appendChild(td);
+
+ table.appendChild(tr);
+}
+
+function evaluate(code) {
+ var result = eval(code);
+ var tr = document.createElement('tr');
+
+ var td = document.createElement('td');
+ var text = document.createElement('code');
+ text.appendChild(document.createTextNode(code));
+ td.appendChild(text);
+ tr.appendChild(td);
+
+ div.style.opacity = eval(code);
+
+ var td = document.createElement('td');
+ var text = document.createElement('code');
+ text.appendChild(document.createTextNode(div.style.opacity));
+ td.appendChild(text);
+ tr.appendChild(td);
+
+ var outValue = div.style.opacity;
+ // Test round-tripping
+ div.style.opacity = 0;
+ div.style.opacity = outValue;
+
+ var td = document.createElement('td');
+ var text = document.createElement('span');
+ text.appendChild(document.createTextNode(outValue == div.style.opacity ? "pass" : "fail"));
+ td.appendChild(text);
+ tr.appendChild(td);
+
+ table.appendChild(tr);
+}
+
+heading("Basic floats");
+evaluate("'0.0001'");
+evaluate("0.0001");
+evaluate("'123456.123456'");
+evaluate("'1234567.1234567'");
+evaluate("'12345678.12345678'");
+
+heading("Trailing zeros");
+evaluate("'0.00100000'");
+evaluate("'0.001000001'");
+evaluate("'0.12345000001'");
+evaluate("'0.12304567'");
+evaluate("'0.12340567'");
+evaluate("'0.12345067'");
+evaluate("'0.12345607'");
+evaluate("'0.12345670'");
+
+heading("Repeating decimals");
+evaluate("1/3");
+evaluate("123 + 1/3");
+evaluate("13/99");
+evaluate("123 + 13/99");
+evaluate("100/999");
+evaluate("123 + 100/999");
+
+heading("Large numbers");
+evaluate("12345678");
+evaluate("123456789");
+evaluate("1234567890");
+evaluate("12345678901");
+evaluate("123456789012");
+evaluate("1234567890123");
+evaluate("12345678901234");
+evaluate("123456789012345");
+evaluate("1234567890123456");
+evaluate("12345678901234567");
+
+heading("Weird numbers");
+evaluate("Number.NaN");
+evaluate("1/0");
+evaluate("Math.sqrt(-1)");
+evaluate("1/0.9999");
+evaluate("1/0.99999");
+evaluate("1/0.999999");
+evaluate("1/0.9999999");
+evaluate("1/0.99999999");
+
+</script>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/fast/css/opacity-float-expected.txt b/LayoutTests/platform/mac/fast/css/opacity-float-expected.txt
deleted file mode 100644
index b81983d..0000000
--- a/LayoutTests/platform/mac/fast/css/opacity-float-expected.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This test verifies that reading a floating-point opacity from CSS attributes gets back a properly-formatted float. Improperly handling locales that cause decimals to be written as commas might break it.
-
-FAIL: 0,9
diff --git a/LayoutTests/svg/dynamic-updates/SVGFEFloodElement-dom-flood-opacity-attr-expected.txt b/LayoutTests/svg/dynamic-updates/SVGFEFloodElement-dom-flood-opacity-attr-expected.txt
index 03a908b..4dba563 100644
--- a/LayoutTests/svg/dynamic-updates/SVGFEFloodElement-dom-flood-opacity-attr-expected.txt
+++ b/LayoutTests/svg/dynamic-updates/SVGFEFloodElement-dom-flood-opacity-attr-expected.txt
@@ -5,8 +5,8 @@ Tests dynamic updates of the 'flood-opacity' attribute of the SVGFEFloodElement
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS floodElement.getAttribute('flood-opacity') is ".1"
-PASS floodElement.getAttribute('flood-opacity') is ".8"
+PASS parseFloat(floodElement.getAttribute('flood-opacity')).toFixed(1) is "0.1"
+PASS parseFloat(floodElement.getAttribute('flood-opacity')).toFixed(1) is "0.8"
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/svg/dynamic-updates/SVGFEFloodElement-svgdom-flood-opacity-prop-expected.txt b/LayoutTests/svg/dynamic-updates/SVGFEFloodElement-svgdom-flood-opacity-prop-expected.txt
index 7d8c59a..e8a1c1c 100644
--- a/LayoutTests/svg/dynamic-updates/SVGFEFloodElement-svgdom-flood-opacity-prop-expected.txt
+++ b/LayoutTests/svg/dynamic-updates/SVGFEFloodElement-svgdom-flood-opacity-prop-expected.txt
@@ -5,8 +5,8 @@ Tests dynamic updates of the 'flood-opacity' property of the SVGFEFloodElement o
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS document.defaultView.getComputedStyle(floodElement).getPropertyValue('flood-opacity') is "0.1"
-PASS document.defaultView.getComputedStyle(floodElement).getPropertyValue('flood-opacity') is "0.8"
+PASS parseFloat(document.defaultView.getComputedStyle(floodElement).getPropertyValue('flood-opacity')).toFixed(1) is "0.1"
+PASS parseFloat(document.defaultView.getComputedStyle(floodElement).getPropertyValue('flood-opacity')).toFixed(1) is "0.8"
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/svg/dynamic-updates/script-tests/SVGFEFloodElement-dom-flood-opacity-attr.js b/LayoutTests/svg/dynamic-updates/script-tests/SVGFEFloodElement-dom-flood-opacity-attr.js
index a5610e9..04e3f81 100644
--- a/LayoutTests/svg/dynamic-updates/script-tests/SVGFEFloodElement-dom-flood-opacity-attr.js
+++ b/LayoutTests/svg/dynamic-updates/script-tests/SVGFEFloodElement-dom-flood-opacity-attr.js
@@ -34,11 +34,11 @@ rectElement.setAttribute("stroke-width", "8");
rectElement.setAttribute("filter", "url(#myFilter)");
rootSVGElement.appendChild(rectElement);
-shouldBeEqualToString("floodElement.getAttribute('flood-opacity')", ".1");
+shouldBeEqualToString("parseFloat(floodElement.getAttribute('flood-opacity')).toFixed(1)", "0.1");
function executeTest() {
floodElement.setAttribute("flood-opacity", ".8");
- shouldBeEqualToString("floodElement.getAttribute('flood-opacity')", ".8");
+ shouldBeEqualToString("parseFloat(floodElement.getAttribute('flood-opacity')).toFixed(1)", "0.8");
completeTest();
}
diff --git a/LayoutTests/svg/dynamic-updates/script-tests/SVGFEFloodElement-svgdom-flood-opacity-prop.js b/LayoutTests/svg/dynamic-updates/script-tests/SVGFEFloodElement-svgdom-flood-opacity-prop.js
index 3c39f64..2bbec7a 100644
--- a/LayoutTests/svg/dynamic-updates/script-tests/SVGFEFloodElement-svgdom-flood-opacity-prop.js
+++ b/LayoutTests/svg/dynamic-updates/script-tests/SVGFEFloodElement-svgdom-flood-opacity-prop.js
@@ -34,11 +34,11 @@ rectElement.setAttribute("stroke-width", "8");
rectElement.setAttribute("filter", "url(#myFilter)");
rootSVGElement.appendChild(rectElement);
-shouldBeEqualToString("document.defaultView.getComputedStyle(floodElement).getPropertyValue('flood-opacity')", "0.1");
+shouldBeEqualToString("parseFloat(document.defaultView.getComputedStyle(floodElement).getPropertyValue('flood-opacity')).toFixed(1)", "0.1");
function executeTest() {
floodElement.style.setProperty("flood-opacity", ".8", "");
- shouldBeEqualToString("document.defaultView.getComputedStyle(floodElement).getPropertyValue('flood-opacity')", "0.8");
+ shouldBeEqualToString("parseFloat(document.defaultView.getComputedStyle(floodElement).getPropertyValue('flood-opacity')).toFixed(1)", "0.8");
completeTest();
}
diff --git a/LayoutTests/transforms/2d/resources/transform-test-utils.js b/LayoutTests/transforms/2d/resources/transform-test-utils.js
index ae07b0e..6a1f1b7 100644
--- a/LayoutTests/transforms/2d/resources/transform-test-utils.js
+++ b/LayoutTests/transforms/2d/resources/transform-test-utils.js
@@ -3,7 +3,7 @@
function floatingPointEqual(a, b)
{
- const kEpsilon = 1e-6;
+ const kEpsilon = 1e-4;
return (Math.abs(a - b) < kEpsilon);
}
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4ab0f03..71c9976 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-10-17 Simon Fraser <simon.fraser at apple.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ Very large and small numbers fail to round-trip through CSS
+ https://bugs.webkit.org/show_bug.cgi?id=20674
+
+ Use the new DecimalNumber functionality to convert CSS numberic values to strings
+ using decimal notation, rather than %g (which can output scientific notation).
+
+ Test: fast/css/round-trip-values.html
+
+ * css/CSSPrimitiveValue.cpp:
+ (WebCore::formatNumber):
+ (WebCore::CSSPrimitiveValue::cssText):
+
2010-10-17 Cosmin Truta <ctruta at chromium.org>
Reviewed by Nikolas Zimmermann.
diff --git a/WebCore/css/CSSPrimitiveValue.cpp b/WebCore/css/CSSPrimitiveValue.cpp
index 5c83e7c..24f2451 100644
--- a/WebCore/css/CSSPrimitiveValue.cpp
+++ b/WebCore/css/CSSPrimitiveValue.cpp
@@ -35,6 +35,7 @@
#include "Rect.h"
#include "RenderStyle.h"
#include <wtf/ASCIICType.h>
+#include <wtf/DecimalNumber.h>
#include <wtf/StdLibExtras.h>
#if ENABLE(DASHBOARD_SUPPORT)
@@ -613,6 +614,13 @@ int CSSPrimitiveValue::getIdent()
return m_value.ident;
}
+static String formatNumber(double number)
+{
+ NumberToStringBuffer buffer;
+ unsigned length = DecimalNumber(number).toStringDecimal(buffer);
+ return String(buffer, length);
+}
+
String CSSPrimitiveValue::cssText() const
{
// FIXME: return the original value instead of a generated one (e.g. color
@@ -630,61 +638,61 @@ String CSSPrimitiveValue::cssText() const
break;
case CSS_NUMBER:
case CSS_PARSER_INTEGER:
- text = String::number(m_value.num);
+ text = formatNumber(m_value.num);
break;
case CSS_PERCENTAGE:
- text = String::format("%.6lg%%", m_value.num);
+ text = formatNumber(m_value.num) + "%";
break;
case CSS_EMS:
- text = String::format("%.6lgem", m_value.num);
+ text = formatNumber(m_value.num) + "em";
break;
case CSS_EXS:
- text = String::format("%.6lgex", m_value.num);
+ text = formatNumber(m_value.num) + "ex";
break;
case CSS_REMS:
- text = String::format("%.6lgrem", m_value.num);
+ text = formatNumber(m_value.num) + "rem";
break;
case CSS_PX:
- text = String::format("%.6lgpx", m_value.num);
+ text = formatNumber(m_value.num) + "px";
break;
case CSS_CM:
- text = String::format("%.6lgcm", m_value.num);
+ text = formatNumber(m_value.num) + "cm";
break;
case CSS_MM:
- text = String::format("%.6lgmm", m_value.num);
+ text = formatNumber(m_value.num) + "mm";
break;
case CSS_IN:
- text = String::format("%.6lgin", m_value.num);
+ text = formatNumber(m_value.num) + "in";
break;
case CSS_PT:
- text = String::format("%.6lgpt", m_value.num);
+ text = formatNumber(m_value.num) + "pt";
break;
case CSS_PC:
- text = String::format("%.6lgpc", m_value.num);
+ text = formatNumber(m_value.num) + "pc";
break;
case CSS_DEG:
- text = String::format("%.6lgdeg", m_value.num);
+ text = formatNumber(m_value.num) + "deg";
break;
case CSS_RAD:
- text = String::format("%.6lgrad", m_value.num);
+ text = formatNumber(m_value.num) + "rad";
break;
case CSS_GRAD:
- text = String::format("%.6lggrad", m_value.num);
+ text = formatNumber(m_value.num) + "grad";
break;
case CSS_MS:
- text = String::format("%.6lgms", m_value.num);
+ text = formatNumber(m_value.num) + "ms";
break;
case CSS_S:
- text = String::format("%.6lgs", m_value.num);
+ text = formatNumber(m_value.num) + "s";
break;
case CSS_HZ:
- text = String::format("%.6lghz", m_value.num);
+ text = formatNumber(m_value.num) + "hz";
break;
case CSS_KHZ:
- text = String::format("%.6lgkhz", m_value.num);
+ text = formatNumber(m_value.num) + "khz";
break;
case CSS_TURN:
- text = String::format("%.6lgturn", m_value.num);
+ text = formatNumber(m_value.num) + "turn";
break;
case CSS_DIMENSION:
// FIXME
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list