Diff
Modified: trunk/LayoutTests/ChangeLog (92117 => 92118)
--- trunk/LayoutTests/ChangeLog 2011-08-01 11:16:15 UTC (rev 92117)
+++ trunk/LayoutTests/ChangeLog 2011-08-01 11:18:15 UTC (rev 92118)
@@ -1,3 +1,18 @@
+2011-08-01 Mihnea Ovidenie <[email protected]>
+
+ BORDER attribute with the object tag, using percentage values not working.
+ https://bugs.webkit.org/show_bug.cgi?id=65176
+
+ Reviewed by Hajime Morita.
+
+ Added the tests with border width with percentages in a new file. Moved them
+ from images border test file.
+
+ * fast/borders/border-width-percent-expected.txt: Added.
+ * fast/borders/border-width-percent.html: Added.
+ * fast/images/border-expected.txt:
+ * fast/images/script-tests/border.js:
+
2011-08-01 Tony Gentilcore <[email protected]>
[chromium] Update expectations for fast/text/international/bidi-mirror-he-ar.html
Added: trunk/LayoutTests/fast/borders/border-width-percent-expected.txt (0 => 92118)
--- trunk/LayoutTests/fast/borders/border-width-percent-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/borders/border-width-percent-expected.txt 2011-08-01 11:18:15 UTC (rev 92118)
@@ -0,0 +1,16 @@
+This tests the border width property with percent values for HTML elements.
+
+PASS elementBorderWidth('img', '10%') is 10
+PASS elementBorderWidth('img', '-10%') is 0
+PASS elementBorderWidth('img', ' +10%') is 10
+PASS elementBorderWidth('img', 0, 'border-width: 10%') is 0
+PASS elementBorderWidth('img', 0, 'border-width: -10%') is 0
+PASS elementBorderWidth('object', '10%') is 10
+PASS elementBorderWidth('object', '-10%') is 0
+PASS elementBorderWidth('object', ' +10%') is 10
+PASS elementBorderWidth('object', 0, 'border-width: 10%') is 0
+PASS elementBorderWidth('object', 0, 'border-width: -10%') is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/borders/border-width-percent.html (0 => 92118)
--- trunk/LayoutTests/fast/borders/border-width-percent.html (rev 0)
+++ trunk/LayoutTests/fast/borders/border-width-percent.html 2011-08-01 11:18:15 UTC (rev 92118)
@@ -0,0 +1,42 @@
+<!doctype html>
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p>This tests the border width property with percent values for HTML elements.</p>
+<div id="console"></div>
+<script>
+function elementBorderWidth(element, borderValue, style)
+{
+ var element = document.createElement(element);
+ if (borderValue !== undefined)
+ element.setAttribute("border", borderValue);
+ element.setAttribute("style", style);
+ element.setAttribute("width", "0");
+ document.body.appendChild(element);
+ var borderBoxWidth = element.offsetWidth;
+ document.body.removeChild(element);
+ return borderBoxWidth / 2;
+}
+
+shouldBe("elementBorderWidth('img', '10%')", "10");
+shouldBe("elementBorderWidth('img', '-10%')", "0");
+shouldBe("elementBorderWidth('img', ' +10%')", "10");
+
+shouldBe("elementBorderWidth('img', 0, 'border-width: 10%')", "0");
+shouldBe("elementBorderWidth('img', 0, 'border-width: -10%')", "0");
+
+shouldBe("elementBorderWidth('object', '10%')", "10");
+shouldBe("elementBorderWidth('object', '-10%')", "0");
+shouldBe("elementBorderWidth('object', ' +10%')", "10");
+
+shouldBe("elementBorderWidth('object', 0, 'border-width: 10%')", "0");
+shouldBe("elementBorderWidth('object', 0, 'border-width: -10%')", "0");
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/fast/images/border-expected.txt (92117 => 92118)
--- trunk/LayoutTests/fast/images/border-expected.txt 2011-08-01 11:16:15 UTC (rev 92117)
+++ trunk/LayoutTests/fast/images/border-expected.txt 2011-08-01 11:18:15 UTC (rev 92118)
@@ -21,11 +21,6 @@
PASS imageBorderWidth(' 10q') is 10
PASS imageBorderWidth('10q ') is 10
PASS imageBorderWidth(' 10q ') is 10
-PASS imageBorderWidth('10%') is 10
-PASS imageBorderWidth('-10%') is 0
-PASS imageBorderWidth(' +10%') is 10
-PASS imageBorderWidth(0, 'border-width: 10%') is 0
-PASS imageBorderWidth(0, 'border-width: -10%') is 0
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/images/script-tests/border.js (92117 => 92118)
--- trunk/LayoutTests/fast/images/script-tests/border.js 2011-08-01 11:16:15 UTC (rev 92117)
+++ trunk/LayoutTests/fast/images/script-tests/border.js 2011-08-01 11:18:15 UTC (rev 92118)
@@ -36,11 +36,4 @@
shouldBe("imageBorderWidth('10q ')", "10");
shouldBe("imageBorderWidth(' 10q ')", "10");
-shouldBe("imageBorderWidth('10%')", "10");
-shouldBe("imageBorderWidth('-10%')", "0");
-shouldBe("imageBorderWidth(' +10%')", "10");
-
-shouldBe("imageBorderWidth(0, 'border-width: 10%')", "0");
-shouldBe("imageBorderWidth(0, 'border-width: -10%')", "0");
-
var successfullyParsed = true;
Modified: trunk/Source/WebCore/ChangeLog (92117 => 92118)
--- trunk/Source/WebCore/ChangeLog 2011-08-01 11:16:15 UTC (rev 92117)
+++ trunk/Source/WebCore/ChangeLog 2011-08-01 11:18:15 UTC (rev 92118)
@@ -1,3 +1,21 @@
+2011-08-01 Mihnea Ovidenie <[email protected]>
+
+ BORDER attribute with the object tag, using percentage values not working.
+ https://bugs.webkit.org/show_bug.cgi?id=65176
+
+ Reviewed by Hajime Morita.
+
+ When border presentational attribute for object element has % in it, it should be parsed using HTML parser rules.
+
+ Test: fast/borders/border-width-percent.html
+
+ * html/HTMLElement.cpp:
+ (WebCore::HTMLElement::parseBorderWidthAttribute):
+ * html/HTMLElement.h:
+ * html/HTMLImageElement.cpp:
+ * html/HTMLObjectElement.cpp:
+ (WebCore::HTMLObjectElement::parseMappedAttribute):
+
2011-08-01 Yuta Kitamura <[email protected]>
WebSocket: Receive URL and subprotocol in WebSocketChannel::connect()
Modified: trunk/Source/WebCore/html/HTMLElement.cpp (92117 => 92118)
--- trunk/Source/WebCore/html/HTMLElement.cpp 2011-08-01 11:16:15 UTC (rev 92117)
+++ trunk/Source/WebCore/html/HTMLElement.cpp 2011-08-01 11:18:15 UTC (rev 92118)
@@ -135,6 +135,17 @@
return CSSValueEmbed;
}
+unsigned HTMLElement::parseBorderWidthAttribute(Attribute* attr)
+{
+ ASSERT(attr && attr->name() == borderAttr);
+
+ unsigned borderWidth = 0;
+ if (!attr->value().isEmpty())
+ parseHTMLNonNegativeInteger(attr->value(), borderWidth);
+
+ return borderWidth;
+}
+
void HTMLElement::parseMappedAttribute(Attribute* attr)
{
if (isIdAttributeName(attr->name()) || attr->name() == classAttr || attr->name() == styleAttr)
Modified: trunk/Source/WebCore/html/HTMLElement.h (92117 => 92118)
--- trunk/Source/WebCore/html/HTMLElement.h 2011-08-01 11:16:15 UTC (rev 92117)
+++ trunk/Source/WebCore/html/HTMLElement.h 2011-08-01 11:18:15 UTC (rev 92118)
@@ -90,6 +90,7 @@
virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(Attribute*);
+ unsigned parseBorderWidthAttribute(Attribute*);
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (92117 => 92118)
--- trunk/Source/WebCore/html/HTMLImageElement.cpp 2011-08-01 11:16:15 UTC (rev 92117)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp 2011-08-01 11:18:15 UTC (rev 92118)
@@ -98,17 +98,6 @@
return HTMLElement::mapToEntry(attrName, result);
}
-static unsigned int parseBorderWidthAttribute(Attribute* attr)
-{
- ASSERT(attr && attr->name() == borderAttr);
-
- unsigned int borderWidth = 0;
- if (!attr->value().isEmpty() && !attr->value().isNull())
- parseHTMLNonNegativeInteger(attr->value(), borderWidth);
-
- return borderWidth;
-}
-
void HTMLImageElement::parseMappedAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
Modified: trunk/Source/WebCore/html/HTMLObjectElement.cpp (92117 => 92118)
--- trunk/Source/WebCore/html/HTMLObjectElement.cpp 2011-08-01 11:16:15 UTC (rev 92117)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp 2011-08-01 11:18:15 UTC (rev 92118)
@@ -121,7 +121,7 @@
}
m_name = newName;
} else if (attr->name() == borderAttr) {
- addCSSLength(attr, CSSPropertyBorderWidth, attr->value().toInt() ? attr->value() : "0");
+ addCSSLength(attr, CSSPropertyBorderWidth, String::number(parseBorderWidthAttribute(attr)));
addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid);
addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid);
addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid);