Diff
Modified: trunk/LayoutTests/ChangeLog (94424 => 94425)
--- trunk/LayoutTests/ChangeLog 2011-09-02 16:59:56 UTC (rev 94424)
+++ trunk/LayoutTests/ChangeLog 2011-09-02 17:01:42 UTC (rev 94425)
@@ -1,3 +1,21 @@
+2011-09-02 Mihnea Ovidenie <mih...@adobe.com>
+
+ BORDER attribute percent with the input image tag not working.
+ https://bugs.webkit.org/show_bug.cgi?id=66467
+
+ Reviewed by Simon Fraser.
+
+ Test border-width-percent was modified with tests for input image element.
+ Expected results for input-image-alt-test were regenerated since an image input element
+ takes border attribute into account.
+ Also, mark the test as failure for chromium.
+
+ * fast/borders/border-width-percent-expected.txt:
+ * fast/borders/border-width-percent.html:
+ * platform/chromium/test_expectations.txt:
+ * platform/mac/fast/dom/HTMLInputElement/input-image-alt-text-expected.png:
+ * platform/mac/fast/dom/HTMLInputElement/input-image-alt-text-expected.txt:
+
2011-09-02 Kentaro Hara <hara...@google.com>
Implement the Event constructor for V8.
Modified: trunk/LayoutTests/fast/borders/border-width-percent-expected.txt (94424 => 94425)
--- trunk/LayoutTests/fast/borders/border-width-percent-expected.txt 2011-09-02 16:59:56 UTC (rev 94424)
+++ trunk/LayoutTests/fast/borders/border-width-percent-expected.txt 2011-09-02 17:01:42 UTC (rev 94425)
@@ -10,6 +10,11 @@
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 inputElementBorderWidth('image', '10%') is 10
+PASS inputElementBorderWidth('image', '-10%') is 0
+PASS inputElementBorderWidth('image', ' +10%') is 10
+PASS inputElementBorderWidth('image', 0, 'border-width: 10%') is 0
+PASS inputElementBorderWidth('image', 0, 'border-width: -10%') is 0
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/borders/border-width-percent.html (94424 => 94425)
--- trunk/LayoutTests/fast/borders/border-width-percent.html 2011-09-02 16:59:56 UTC (rev 94424)
+++ trunk/LayoutTests/fast/borders/border-width-percent.html 2011-09-02 17:01:42 UTC (rev 94425)
@@ -21,6 +21,20 @@
return borderBoxWidth / 2;
}
+function inputElementBorderWidth(elementType, borderValue, style)
+{
+ var inputElement = document.createElement("input");
+ inputElement.setAttribute("type", elementType);
+ if (borderValue != undefined)
+ inputElement.setAttribute("border", borderValue);
+ inputElement.setAttribute("style", style);
+ inputElement.setAttribute("width", "0");
+ document.body.appendChild(inputElement);
+ var borderBoxWidth = inputElement.offsetWidth;
+ document.body.removeChild(inputElement);
+ return borderBoxWidth / 2;
+}
+
shouldBe("elementBorderWidth('img', '10%')", "10");
shouldBe("elementBorderWidth('img', '-10%')", "0");
shouldBe("elementBorderWidth('img', ' +10%')", "10");
@@ -35,6 +49,13 @@
shouldBe("elementBorderWidth('object', 0, 'border-width: 10%')", "0");
shouldBe("elementBorderWidth('object', 0, 'border-width: -10%')", "0");
+shouldBe("inputElementBorderWidth('image', '10%')", "10");
+shouldBe("inputElementBorderWidth('image', '-10%')", "0");
+shouldBe("inputElementBorderWidth('image', ' +10%')", "10");
+
+shouldBe("inputElementBorderWidth('image', 0, 'border-width: 10%')", "0");
+shouldBe("inputElementBorderWidth('image', 0, 'border-width: -10%')", "0");
+
var successfullyParsed = true;
</script>
<script src=""
Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (94424 => 94425)
--- trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-09-02 16:59:56 UTC (rev 94424)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-09-02 17:01:42 UTC (rev 94425)
@@ -978,6 +978,8 @@
// GURL doesn't handle switching from standard URL to path URL correctly
BUGWK27914 WIN : fast/dom/HTMLAnchorElement/set-href-attribute-protocol.html = TEXT
+BUGWK66467 : fast/dom/HTMLInputElement/input-image-alt-text.html = FAIL
+
// ----------------------------------------------------------------------------
// NEW FOR THE MERGE
//
Modified: trunk/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-image-alt-text-expected.png
(Binary files differ)
Modified: trunk/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-image-alt-text-expected.txt (94424 => 94425)
--- trunk/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-image-alt-text-expected.txt 2011-09-02 16:59:56 UTC (rev 94424)
+++ trunk/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-image-alt-text-expected.txt 2011-09-02 17:01:42 UTC (rev 94425)
@@ -9,10 +9,10 @@
text run at (481,0) width 267: "no src attribute. You should see \"Success\""
text run at (0,18) width 225: "twice, followed by a blue rectangle."
RenderBlock {P} at (0,52) size 784x0
- RenderBlock {FORM} at (0,52) size 784x88
+ RenderBlock {FORM} at (0,52) size 784x90
RenderImage {INPUT} at (0,0) size 41x13
RenderBR {BR} at (41,13) size 0x0
- RenderImage {INPUT} at (0,13) size 100x50
- RenderBR {BR} at (100,63) size 0x0
- RenderImage {INPUT} at (0,63) size 75x25
- RenderBR {BR} at (75,88) size 0x0
+ RenderImage {INPUT} at (0,13) size 102x52 [border: (1px solid #000000)]
+ RenderBR {BR} at (102,65) size 0x0
+ RenderImage {INPUT} at (0,65) size 75x25
+ RenderBR {BR} at (75,90) size 0x0
Modified: trunk/Source/WebCore/ChangeLog (94424 => 94425)
--- trunk/Source/WebCore/ChangeLog 2011-09-02 16:59:56 UTC (rev 94424)
+++ trunk/Source/WebCore/ChangeLog 2011-09-02 17:01:42 UTC (rev 94425)
@@ -1,3 +1,28 @@
+2011-09-02 Mihnea Ovidenie <mih...@adobe.com>
+
+ BORDER attribute percent with the input image tag not working.
+ https://bugs.webkit.org/show_bug.cgi?id=66467
+
+ Reviewed by Simon Fraser.
+
+ This patch fixes 2 issues regarding the border attribute of an input image element.
+ 1. The border attribute, if specified, is now taken into account and the border of the input image element is displayed.
+ 2. If the border attribute contains percent, the border is displayed.
+ The value of the border attribute for input image element is now parsed according to the rules for parsing non-negative integers.
+ This implies that when percent is specified in the border attribute, parsing takes place and the percent is ignored.
+ If after parsing, the value of the border is greater than zero, the border of the input image element is displayed.
+
+ * html/HTMLElement.cpp:
+ (WebCore::parseBorderWidthAttribute):
+ (WebCore::HTMLElement::applyBorderAttribute):
+ * html/HTMLElement.h:
+ * html/HTMLImageElement.cpp:
+ (WebCore::HTMLImageElement::parseMappedAttribute):
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::parseMappedAttribute):
+ * html/HTMLObjectElement.cpp:
+ (WebCore::HTMLObjectElement::parseMappedAttribute):
+
2011-09-02 Kentaro Hara <hara...@google.com>
Implement the Event constructor for V8.
Modified: trunk/Source/WebCore/html/HTMLElement.cpp (94424 => 94425)
--- trunk/Source/WebCore/html/HTMLElement.cpp 2011-09-02 16:59:56 UTC (rev 94424)
+++ trunk/Source/WebCore/html/HTMLElement.cpp 2011-09-02 17:01:42 UTC (rev 94425)
@@ -137,7 +137,7 @@
return CSSValueEmbed;
}
-unsigned HTMLElement::parseBorderWidthAttribute(Attribute* attr)
+static unsigned parseBorderWidthAttribute(Attribute* attr)
{
ASSERT(attr && attr->name() == borderAttr);
@@ -148,6 +148,15 @@
return borderWidth;
}
+void HTMLElement::applyBorderAttribute(Attribute* attr)
+{
+ addCSSLength(attr, CSSPropertyBorderWidth, String::number(parseBorderWidthAttribute(attr)));
+ addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid);
+ addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid);
+ addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid);
+ addCSSProperty(attr, CSSPropertyBorderLeftStyle, CSSValueSolid);
+}
+
void HTMLElement::parseMappedAttribute(Attribute* attr)
{
if (isIdAttributeName(attr->name()) || attr->name() == classAttr || attr->name() == styleAttr)
Modified: trunk/Source/WebCore/html/HTMLElement.h (94424 => 94425)
--- trunk/Source/WebCore/html/HTMLElement.h 2011-09-02 16:59:56 UTC (rev 94424)
+++ trunk/Source/WebCore/html/HTMLElement.h 2011-09-02 17:01:42 UTC (rev 94425)
@@ -90,7 +90,7 @@
virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const;
virtual void parseMappedAttribute(Attribute*);
- unsigned parseBorderWidthAttribute(Attribute*);
+ void applyBorderAttribute(Attribute*);
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
void calculateAndAdjustDirectionality();
Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (94424 => 94425)
--- trunk/Source/WebCore/html/HTMLImageElement.cpp 2011-09-02 16:59:56 UTC (rev 94424)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp 2011-09-02 17:01:42 UTC (rev 94425)
@@ -111,11 +111,7 @@
addCSSLength(attr, CSSPropertyHeight, attr->value());
else if (attrName == borderAttr) {
// border="noborder" -> border="0"
- addCSSLength(attr, CSSPropertyBorderWidth, String::number(parseBorderWidthAttribute(attr)));
- addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid);
- addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid);
- addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid);
- addCSSProperty(attr, CSSPropertyBorderLeftStyle, CSSValueSolid);
+ applyBorderAttribute(attr);
} else if (attrName == vspaceAttr) {
addCSSLength(attr, CSSPropertyMarginTop, attr->value());
addCSSLength(attr, CSSPropertyMarginBottom, attr->value());
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (94424 => 94425)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2011-09-02 16:59:56 UTC (rev 94424)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2011-09-02 17:01:42 UTC (rev 94425)
@@ -31,6 +31,7 @@
#include "AXObjectCache.h"
#include "BeforeTextInsertedEvent.h"
#include "CSSPropertyNames.h"
+#include "CSSValueKeywords.h"
#include "Document.h"
#include "EventNames.h"
#include "ExceptionCode.h"
@@ -793,6 +794,8 @@
} else if (attr->name() == heightAttr) {
if (m_inputType->shouldRespectHeightAndWidthAttributes())
addCSSLength(attr, CSSPropertyHeight, attr->value());
+ } else if (attr->name() == borderAttr && isImageButton()) {
+ applyBorderAttribute(attr);
} else if (attr->name() == onsearchAttr) {
// Search field and slider attributes all just cause updateFromElement to be called through style recalcing.
setAttributeEventListener(eventNames().searchEvent, createAttributeEventListener(this, attr));
Modified: trunk/Source/WebCore/html/HTMLObjectElement.cpp (94424 => 94425)
--- trunk/Source/WebCore/html/HTMLObjectElement.cpp 2011-09-02 16:59:56 UTC (rev 94424)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp 2011-09-02 17:01:42 UTC (rev 94425)
@@ -122,13 +122,9 @@
document->addNamedItem(newName);
}
m_name = newName;
- } else if (attr->name() == borderAttr) {
- addCSSLength(attr, CSSPropertyBorderWidth, String::number(parseBorderWidthAttribute(attr)));
- addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid);
- addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid);
- addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid);
- addCSSProperty(attr, CSSPropertyBorderLeftStyle, CSSValueSolid);
- } else if (isIdAttributeName(attr->name())) {
+ } else if (attr->name() == borderAttr)
+ applyBorderAttribute(attr);
+ else if (isIdAttributeName(attr->name())) {
const AtomicString& newId = attr->value();
if (isDocNamedItem() && inDocument() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());