Reviewed by Maciej and Alice.
- fix <rdar://problem/
4404302> Borders where there should be none (canadasmountains.com)
Test: fast/images/border.html
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::parseMappedAttribute): Change the code that handles cases
where the border value is not a number to use the value "0" for the border width instead
of not setting the border width and style at all. This matches other browsers, and makes
more sense.
LayoutTests:
Reviewed by Maciej and Alice.
- test for <rdar://problem/
4404302> Borders where there should be none (canadasmountains.com)
* fast/images/border.html: Added.
* fast/images/resources/TEMPLATE.html: Copied from fast/js/resources/TEMPLATE.html.
* fast/images/resources/border.js: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29185
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2008-01-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej and Alice.
+
+ - test for <rdar://problem/4404302> Borders where there should be none (canadasmountains.com)
+
+ * fast/images/border.html: Added.
+ * fast/images/resources/TEMPLATE.html: Copied from fast/js/resources/TEMPLATE.html.
+ * fast/images/resources/border.js: Added.
+
2008-01-04 Alice Liu <alice.liu@apple.com>
Reviewed by Alexey and Darin.
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="resources/border.js"></script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="YOUR_JS_FILE_HERE"></script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
--- /dev/null
+description(
+"This tests the HTMLImageElement border property."
+);
+
+function imageBorderWidth(borderValue, style)
+{
+ var image = document.createElement("img");
+ if (borderValue !== undefined)
+ image.setAttribute("border", borderValue);
+ image.setAttribute("style", style);
+ image.setAttribute("width", "0");
+ document.body.appendChild(image);
+ var borderBoxWidth = image.offsetWidth;
+ document.body.removeChild(image);
+ return borderBoxWidth / 2;
+}
+
+shouldBe("imageBorderWidth()", "0");
+shouldBe("imageBorderWidth(null)", "0");
+shouldBe("imageBorderWidth('')", "0");
+shouldBe("imageBorderWidth(0)", "0");
+shouldBe("imageBorderWidth('x')", "0");
+shouldBe("imageBorderWidth(undefined, 'border-width: 20px')", "0");
+
+shouldBe("imageBorderWidth(null, 'border-width: 20px')", "20");
+shouldBe("imageBorderWidth('', 'border-width: 20px')", "20");
+shouldBe("imageBorderWidth('x', 'border-width: 20px')", "20");
+shouldBe("imageBorderWidth(0, 'border-width: 20px')", "20");
+
+shouldBe("imageBorderWidth(10)", "10");
+shouldBe("imageBorderWidth(' 10')", "10");
+shouldBe("imageBorderWidth('10 ')", "10");
+shouldBe("imageBorderWidth(' 10 ')", "10");
+shouldBe("imageBorderWidth('10q')", "10");
+shouldBe("imageBorderWidth(' 10q')", "10");
+shouldBe("imageBorderWidth('10q ')", "10");
+shouldBe("imageBorderWidth(' 10q ')", "10");
+
+var successfullyParsed = true;
+2008-01-04 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej and Alice.
+
+ - fix <rdar://problem/4404302> Borders where there should be none (canadasmountains.com)
+
+ Test: fast/images/border.html
+
+ * html/HTMLImageElement.cpp:
+ (WebCore::HTMLImageElement::parseMappedAttribute): Change the code that handles cases
+ where the border value is not a number to use the value "0" for the border width instead
+ of not setting the border width and style at all. This matches other browsers, and makes
+ more sense.
+
2008-01-04 Antti Koivisto <antti@apple.com>
Try to fix 64-bit build
-/**
- * This file is part of the DOM implementation for KDE.
- *
+/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
- * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
addCSSLength(attr, CSS_PROP_HEIGHT, attr->value());
else if (attrName == borderAttr) {
// border="noborder" -> border="0"
- if(attr->value().toInt()) {
- addCSSLength(attr, CSS_PROP_BORDER_WIDTH, attr->value());
- addCSSProperty(attr, CSS_PROP_BORDER_TOP_STYLE, CSS_VAL_SOLID);
- addCSSProperty(attr, CSS_PROP_BORDER_RIGHT_STYLE, CSS_VAL_SOLID);
- addCSSProperty(attr, CSS_PROP_BORDER_BOTTOM_STYLE, CSS_VAL_SOLID);
- addCSSProperty(attr, CSS_PROP_BORDER_LEFT_STYLE, CSS_VAL_SOLID);
- }
+ addCSSLength(attr, CSS_PROP_BORDER_WIDTH, attr->value().toInt() ? attr->value() : "0");
+ addCSSProperty(attr, CSS_PROP_BORDER_TOP_STYLE, CSS_VAL_SOLID);
+ addCSSProperty(attr, CSS_PROP_BORDER_RIGHT_STYLE, CSS_VAL_SOLID);
+ addCSSProperty(attr, CSS_PROP_BORDER_BOTTOM_STYLE, CSS_VAL_SOLID);
+ addCSSProperty(attr, CSS_PROP_BORDER_LEFT_STYLE, CSS_VAL_SOLID);
} else if (attrName == vspaceAttr) {
addCSSLength(attr, CSS_PROP_MARGIN_TOP, attr->value());
addCSSLength(attr, CSS_PROP_MARGIN_BOTTOM, attr->value());