2010-06-22 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jun 2010 05:43:32 +0000 (05:43 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jun 2010 05:43:32 +0000 (05:43 +0000)
        Reviewed by Simon Fraser.

        Implement IDL attribute for HTML5 hidden
        https://bugs.webkit.org/show_bug.cgi?id=41039

        Test: fast/html/hidden-attr-dom.html

        * html/HTMLElement.idl: Just add to the IDL file. [Reflect] takes
        care of the rest.
2010-06-22  Maciej Stachowiak  <mjs@apple.com>

        Reviewed by Simon Fraser.

        Implement IDL attribute for HTML5 hidden
        https://bugs.webkit.org/show_bug.cgi?id=41039

        Test cases.

        * fast/html/hidden-attr-dom.html: Added.
        * fast/html/hidden-attr-dom-expected.txt: Added.
        * fast/html/script-tests/hidden-attr-dom.js: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@61734 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/html/hidden-attr-dom-expected.txt [new file with mode: 0644]
LayoutTests/fast/html/hidden-attr-dom.html [new file with mode: 0644]
LayoutTests/fast/html/script-tests/hidden-attr-dom.js [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLElement.idl

index f3175adc752fec04a274e491d32989cc724ab7ad..c5b6e1f7583e950c718a7fe3e68a147b2667a279 100644 (file)
@@ -1,3 +1,16 @@
+2010-06-22  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Simon Fraser.
+
+        Implement IDL attribute for HTML5 hidden
+        https://bugs.webkit.org/show_bug.cgi?id=41039
+
+        Test cases.
+        
+        * fast/html/hidden-attr-dom.html: Added.
+        * fast/html/hidden-attr-dom-expected.txt: Added.
+        * fast/html/script-tests/hidden-attr-dom.js: Added.
+
 2010-06-23  Tony Chang  <tony@chromium.org>
 
         Not reviewed, fixing gtk/qt tests
diff --git a/LayoutTests/fast/html/hidden-attr-dom-expected.txt b/LayoutTests/fast/html/hidden-attr-dom-expected.txt
new file mode 100644 (file)
index 0000000..d34c7f7
--- /dev/null
@@ -0,0 +1,22 @@
+Various tests for the the hidden IDL attribute.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+The IDL attribute reflects what is present in markup:
+PASS h1.hidden is true
+PASS h2.hidden is true
+PASS h3.hidden is true
+PASS s1.hidden is false
+Changes via DOM Core are reflected through the IDL attribute:
+PASS (h1.removeAttribute("hidden"), h1.hidden) is false
+PASS (h1.setAttribute("hidden", ""), h1.hidden) is true
+PASS (h2.setAttribute("hidden", ""), h2.hidden) is true
+PASS (s1.setAttribute("hidden", ""), s1.hidden) is true
+Changes via IDL attribute are reflected in the core DOM:
+PASS (h3.hidden = false, h3.getAttribute("hidden")) is null
+PASS (h3.hidden = true, h3.getAttribute("hidden")) is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/html/hidden-attr-dom.html b/LayoutTests/fast/html/hidden-attr-dom.html
new file mode 100644 (file)
index 0000000..fee1880
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/hidden-attr-dom.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/html/script-tests/hidden-attr-dom.js b/LayoutTests/fast/html/script-tests/hidden-attr-dom.js
new file mode 100644 (file)
index 0000000..465b96a
--- /dev/null
@@ -0,0 +1,30 @@
+description('Various tests for the the hidden IDL attribute.');
+
+var testParent = document.createElement('div');
+document.body.appendChild(testParent);
+
+debug('The IDL attribute reflects what is present in markup:');
+testParent.innerHTML = '<div id=h1 hidden></div><div id=h2 hidden=false></div><div id=h3 hidden=off></div><div id=s1></div>';
+var h1 = document.getElementById("h1");
+var h2 = document.getElementById("h2");
+var h3 = document.getElementById("h3");
+var s1 = document.getElementById("s1");
+
+shouldBeTrue('h1.hidden');
+shouldBeTrue('h2.hidden');
+shouldBeTrue('h3.hidden');
+shouldBeFalse('s1.hidden');
+
+debug('Changes via DOM Core are reflected through the IDL attribute:');
+
+shouldBeFalse('(h1.removeAttribute("hidden"), h1.hidden)');
+shouldBeTrue('(h1.setAttribute("hidden", ""), h1.hidden)');
+shouldBeTrue('(h2.setAttribute("hidden", ""), h2.hidden)');
+shouldBeTrue('(s1.setAttribute("hidden", ""), s1.hidden)');
+
+debug('Changes via IDL attribute are reflected in the core DOM:');
+
+shouldBe('(h3.hidden = false, h3.getAttribute("hidden"))', 'null');
+shouldBe('(h3.hidden = true, h3.getAttribute("hidden"))', '""');
+
+var successfullyParsed = true;
index 281e0bbd2e19437d2b2e36f56dfa32e48138543c..6e0ff9a5b092d1f5be75f11394da238aa3b0c513 100644 (file)
@@ -1,3 +1,15 @@
+2010-06-22  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Simon Fraser.
+
+        Implement IDL attribute for HTML5 hidden
+        https://bugs.webkit.org/show_bug.cgi?id=41039
+
+        Test: fast/html/hidden-attr-dom.html
+
+        * html/HTMLElement.idl: Just add to the IDL file. [Reflect] takes
+        care of the rest.
+
 2010-06-23  Joanmarie Diggs  <joanmarie.diggs@gmail.com>
 
         Reviewed by Chris Fleizach.
index 5feb1f8b536218081c574bae9c9d7b3a1c07f89b..863f28c86547eb97cc48cc621d9a1b66ac9267bb 100644 (file)
@@ -32,8 +32,9 @@ module html {
                  attribute [Reflect] DOMString dir;
                  attribute [Reflect=class] DOMString className;
 
-                 attribute long            tabIndex;
-                 attribute boolean         draggable;
+                 attribute long              tabIndex;
+                 attribute boolean           draggable;
+                 attribute [Reflect] boolean hidden;
 
         // Extensions
                  attribute [ConvertNullToNullString] DOMString innerHTML