summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrob.buis@samsung.com <rob.buis@samsung.com>2014-12-10 21:51:49 +0000
committerrob.buis@samsung.com <rob.buis@samsung.com>2014-12-10 21:51:49 +0000
commita1f44a9d3fd07def0f4ddedc51a066e34e84ee50 (patch)
tree9198570c10bf540246c462053fc8a48cf10b36c2
parent1e11bdefe33a7ebe143baceb5826dc819a4d9db8 (diff)
downloadchromium_src-a1f44a9d3fd07def0f4ddedc51a066e34e84ee50.zip
chromium_src-a1f44a9d3fd07def0f4ddedc51a066e34e84ee50.tar.gz
chromium_src-a1f44a9d3fd07def0f4ddedc51a066e34e84ee50.tar.bz2
Removing border attribute should remove the visual border
When removing the border attribute the table should look the same as if the border attribute was never given. So when we notice the border attribute is removed, make sure m_borderAttr is set to false so the border will be removed visually. Behavior matches Firefox. BUG=436915 Review URL: https://codereview.chromium.org/789513004 git-svn-id: svn://svn.chromium.org/blink/trunk@186883 bbb929c8-8fbe-4397-9dbb-9b2b20218538
-rw-r--r--third_party/WebKit/LayoutTests/fast/table/border-changes-expected.txt12
-rw-r--r--third_party/WebKit/LayoutTests/fast/table/border-remove-border-attribute-expected.html7
-rw-r--r--third_party/WebKit/LayoutTests/fast/table/border-remove-border-attribute.html10
-rw-r--r--third_party/WebKit/LayoutTests/fast/table/script-tests/border-changes.js16
-rw-r--r--third_party/WebKit/Source/core/html/HTMLElement.cpp6
5 files changed, 49 insertions, 2 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/table/border-changes-expected.txt b/third_party/WebKit/LayoutTests/fast/table/border-changes-expected.txt
index 6f40c23..fb3307c 100644
--- a/third_party/WebKit/LayoutTests/fast/table/border-changes-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/table/border-changes-expected.txt
@@ -123,6 +123,18 @@ PASS getComputedStyle(cell, '').borderLeftColor is red
PASS getComputedStyle(cell, '').borderRightColor is red
PASS getComputedStyle(cell, '').borderTopColor is red
PASS getComputedStyle(cell, '').borderBottomColor is red
+PASS getComputedStyle(table, '').borderLeftWidth is '3px'
+PASS getComputedStyle(table, '').borderRightWidth is '3px'
+PASS getComputedStyle(table, '').borderTopWidth is '3px'
+PASS getComputedStyle(table, '').borderBottomWidth is '3px'
+PASS getComputedStyle(table, '').borderLeftStyle is 'solid'
+PASS getComputedStyle(table, '').borderRightStyle is 'solid'
+PASS getComputedStyle(table, '').borderTopStyle is 'solid'
+PASS getComputedStyle(table, '').borderBottomStyle is 'solid'
+PASS getComputedStyle(table, '').borderLeftColor is yellow
+PASS getComputedStyle(table, '').borderRightColor is yellow
+PASS getComputedStyle(table, '').borderTopColor is yellow
+PASS getComputedStyle(table, '').borderBottomColor is yellow
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/third_party/WebKit/LayoutTests/fast/table/border-remove-border-attribute-expected.html b/third_party/WebKit/LayoutTests/fast/table/border-remove-border-attribute-expected.html
new file mode 100644
index 0000000..cc6e6f3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/table/border-remove-border-attribute-expected.html
@@ -0,0 +1,7 @@
+<table>
+ <tbody>
+ <tr>
+ <td>PASS</td>
+ </tr>
+ </tbody>
+</table>
diff --git a/third_party/WebKit/LayoutTests/fast/table/border-remove-border-attribute.html b/third_party/WebKit/LayoutTests/fast/table/border-remove-border-attribute.html
new file mode 100644
index 0000000..bb0da31
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/table/border-remove-border-attribute.html
@@ -0,0 +1,10 @@
+<table border="1">
+ <tbody>
+ <tr>
+ <td>PASS</td>
+ </tr>
+ </tbody>
+</table>
+<script>
+ document.getElementsByTagName('table')[0].removeAttribute('border');
+</script>
diff --git a/third_party/WebKit/LayoutTests/fast/table/script-tests/border-changes.js b/third_party/WebKit/LayoutTests/fast/table/script-tests/border-changes.js
index e532931..87ccb15 100644
--- a/third_party/WebKit/LayoutTests/fast/table/script-tests/border-changes.js
+++ b/third_party/WebKit/LayoutTests/fast/table/script-tests/border-changes.js
@@ -153,4 +153,20 @@ shouldBe("getComputedStyle(cell, '').borderRightColor", "red");
shouldBe("getComputedStyle(cell, '').borderTopColor", "red");
shouldBe("getComputedStyle(cell, '').borderBottomColor", "red");
+// resets to default border width of 3px
+table.removeAttribute("border");
+
+shouldBe("getComputedStyle(table, '').borderLeftWidth", "'3px'");
+shouldBe("getComputedStyle(table, '').borderRightWidth", "'3px'");
+shouldBe("getComputedStyle(table, '').borderTopWidth", "'3px'");
+shouldBe("getComputedStyle(table, '').borderBottomWidth", "'3px'");
+shouldBe("getComputedStyle(table, '').borderLeftStyle", "'solid'");
+shouldBe("getComputedStyle(table, '').borderRightStyle", "'solid'");
+shouldBe("getComputedStyle(table, '').borderTopStyle", "'solid'");
+shouldBe("getComputedStyle(table, '').borderBottomStyle", "'solid'");
+shouldBe("getComputedStyle(table, '').borderLeftColor", "yellow");
+shouldBe("getComputedStyle(table, '').borderRightColor", "yellow");
+shouldBe("getComputedStyle(table, '').borderTopColor", "yellow");
+shouldBe("getComputedStyle(table, '').borderBottomColor", "yellow");
+
document.body.removeChild(table);
diff --git a/third_party/WebKit/Source/core/html/HTMLElement.cpp b/third_party/WebKit/Source/core/html/HTMLElement.cpp
index 5ab64fc..ca8bde5 100644
--- a/third_party/WebKit/Source/core/html/HTMLElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLElement.cpp
@@ -127,8 +127,10 @@ static inline CSSValueID unicodeBidiAttributeForDirAuto(HTMLElement* element)
unsigned HTMLElement::parseBorderWidthAttribute(const AtomicString& value) const
{
unsigned borderWidth = 0;
- if (value.isEmpty() || !parseHTMLNonNegativeInteger(value, borderWidth))
- return hasTagName(tableTag) ? 1 : borderWidth;
+ if (value.isEmpty() || !parseHTMLNonNegativeInteger(value, borderWidth)) {
+ if (hasTagName(tableTag) && !value.isNull())
+ return 1;
+ }
return borderWidth;
}