+2007-11-08 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ - test for <rdar://problem/5491922> REGRESSION (Safari 2-3): Flash-based "Cash Optimizer" on etrade.com does not draw completely
+
+ * fast/dom/length-attribute-mapping-expected.txt: Added.
+ * fast/dom/length-attribute-mapping.html: Added.
+
2007-11-08 Darin Adler <darin@apple.com>
Reviewed by Adam.
--- /dev/null
+This tests the mapping of length-type attributes to CSS length values.
+
+<img>:
+PASS: 90zz is mapped to 90px
+PASS: 80% is mapped to 80%
+PASS: 70%5 is mapped to 70%
+PASS: 60%% is mapped to 60%
+PASS: 50* is not mapped
+PASS: 40*5 is not mapped
+PASS: 30.5 is mapped to 30px
+
+<col>:
+PASS: 90zz is mapped to 90px
+PASS: 80% is mapped to 80%
+PASS: 70%5 is mapped to 70%
+PASS: 60%% is mapped to 60%
+PASS: 50* is not mapped
+PASS: 40*5 is not mapped
+PASS: 30.5 is mapped to 30px
+
--- /dev/null
+<p>
+ This tests the mapping of length-type attributes to CSS length values.
+</p>
+<pre id="console"></pre>
+<img id="img" style="display: none;">
+<table><col id="col" style="display: none;"></table>
+<script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ var console = document.getElementById("console");
+ function log(message)
+ {
+ console.appendChild(document.createTextNode(message + "\n"));
+ }
+
+ function test(target, value, expected)
+ {
+ target.setAttribute("height", value);
+ var actual = getComputedStyle(target, null).height;
+ var mapping = actual == "auto" ? "not mapped" : "mapped to " + actual;
+ if (actual == (expected ? expected : "auto"))
+ log("PASS: " + value + " is " + mapping);
+ else
+ log("FAIL: " + value + " is " + mapping + " instead of " + (expected ? expected : "not being mapped"));
+ }
+
+ var img = document.getElementById("img");
+ log ("<img>:");
+ test(img, "90zz", "90px");
+ test(img, "80%", "80%");
+ test(img, "70%5", "70%");
+ test(img, "60%%", "60%");
+ test(img, "50*");
+ test(img, "40*5");
+ test(img, "30.5", "30px");
+ log("");
+
+ var col = document.getElementById("col");
+ log ("<col>:");
+ test(col, "90zz", "90px");
+ test(col, "80%", "80%");
+ test(col, "70%5", "70%");
+ test(col, "60%%", "60%");
+ test(col, "50*");
+ test(col, "40*5");
+ test(col, "30.5", "30px");
+</script>
+2007-11-08 Dan Bernstein <mitz@apple.com>
+
+ Reviewed by Beth Dakin.
+
+ - fix <rdar://problem/5491922> REGRESSION (Safari 2-3): Flash-based "Cash Optimizer" on etrade.com does not draw completely
+
+ Test: fast/dom/length-attribute-mapping.html
+
+ * dom/StyledElement.cpp:
+ (WebCore::StyledElement::addCSSLength): Changed the garbage-stripping
+ logic to stop after the first "%" or "*" in the string. This allows for
+ "100%25" to be mapped to "100%" like it is in Firefox and WinIE.
+
2007-11-08 Kevin McCullough <kmccullough@apple.com>
- Build fix.
{
// FIXME: This function should not spin up the CSS parser, but should instead just figure out the correct
// length unit and make the appropriate parsed value.
- if (!attr->decl()) createMappedDecl(attr);
+ if (!attr->decl())
+ createMappedDecl(attr);
// strip attribute garbage..
StringImpl* v = value.impl();
for (; l < v->length(); l++) {
UChar cc = (*v)[l];
- if (cc > '9' || (cc < '0' && cc != '*' && cc != '%' && cc != '.'))
+ if (cc > '9')
break;
+ if (cc < '0') {
+ if (cc == '%' || cc == '*')
+ l++;
+ if (cc != '.')
+ break;
+ }
}
if (l != v->length()) {