:read-write pseudo-class should not be applied on <input type="text" disabled>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Sep 2013 12:21:41 +0000 (12:21 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Sep 2013 12:21:41 +0000 (12:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=118236

Patch by Gurpreet Kaur <k.gurpreet@samsung.com> on 2013-09-25
Reviewed by Darin Adler.

Source/WebCore:

The :read-write pseudo-class must match any element falling into one
of the following categories i.e
input elements to which the readonly attribute applies, and that are mutable
(i.e. that do not have the readonly attribute specified and that are not disabled)
textarea elements that do not have a readonly attribute, and that are not disabled
elements that are editing hosts or editable and are neither input elements nor
textarea elements.

Test: fast/css/readwrite-pseudoclass-input.html

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::matchesReadWritePseudoClass):
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::matchesReadWritePseudoClass):
Checking for both readonly and disabled attribute on input ane textarea element.

LayoutTests:

* fast/css/readwrite-pseudoclass-input-expected.txt: Added.
* fast/css/readwrite-pseudoclass-input.html: Added.
Added test case to verify that :read-write pseudo-class properties are
are not applied to disabled input and textarea elements.

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

LayoutTests/ChangeLog
LayoutTests/fast/css/readwrite-pseudoclass-input-expected.txt [new file with mode: 0755]
LayoutTests/fast/css/readwrite-pseudoclass-input.html [new file with mode: 0755]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLTextAreaElement.cpp

index 3ee172591f81acfd205f6b881605a49fd8804199..43fcf24375f243cbdaf6714c2dd71030fd36e38c 100644 (file)
@@ -1,3 +1,15 @@
+2013-09-25  Gurpreet Kaur  <k.gurpreet@samsung.com>
+
+        :read-write pseudo-class should not be applied on <input type="text" disabled>
+        https://bugs.webkit.org/show_bug.cgi?id=118236
+
+        Reviewed by Darin Adler.
+
+        * fast/css/readwrite-pseudoclass-input-expected.txt: Added.
+        * fast/css/readwrite-pseudoclass-input.html: Added.
+        Added test case to verify that :read-write pseudo-class properties are
+        are not applied to disabled input and textarea elements.
+
 2013-09-25  Krzysztof Czech  <k.czech@samsung.com>
 
         [EFL] accessibility/loading-iframe-sends-notification.html is failing
diff --git a/LayoutTests/fast/css/readwrite-pseudoclass-input-expected.txt b/LayoutTests/fast/css/readwrite-pseudoclass-input-expected.txt
new file mode 100755 (executable)
index 0000000..52f7f98
--- /dev/null
@@ -0,0 +1,11 @@
+Tests read-write pseudo-class properties are not applied to disabled input and textarea elements
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.getComputedStyle(document.getElementById('inputdisabled'),null).getPropertyValue('background-color') is not "rgb(255, 0, 0)"
+PASS window.getComputedStyle(document.getElementById('textareadisabled'),null).getPropertyValue('background-color') is not "rgb(255, 0, 0)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+         
diff --git a/LayoutTests/fast/css/readwrite-pseudoclass-input.html b/LayoutTests/fast/css/readwrite-pseudoclass-input.html
new file mode 100755 (executable)
index 0000000..901367e
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="../../resources/js-test-pre.js"></script>
+        <script>
+            function runTest() {
+                description('Tests read-write pseudo-class properties are not applied to disabled input and textarea elements');
+
+                shouldNotBeEqualToString("window.getComputedStyle(document.getElementById('inputdisabled'),null).getPropertyValue('background-color')","rgb(255, 0, 0)");
+                shouldNotBeEqualToString("window.getComputedStyle(document.getElementById('textareadisabled'),null).getPropertyValue('background-color')","rgb(255, 0, 0)");
+                isSuccessfullyParsed();
+            }
+        </script>
+        <style>
+            :read-write {
+                background-color: red;
+            }
+        </style>
+    </head>
+    <body onload="runTest()">
+        <input type="text"/>
+        <input type="text" readonly />
+        <input type="text" disabled id="inputdisabled"/>
+
+        <textarea></textarea>
+        <textarea readonly></textarea>
+        <textarea disabled id="textareadisabled"></textarea>
+    </body>
+</html>
\ No newline at end of file
index 763312c7eeb05e26060eaeed78c58b6424fa72a0..2249166b46a75f75d8e0aa2bf5af8499f7ea96c2 100644 (file)
@@ -1,3 +1,26 @@
+2013-09-25  Gurpreet Kaur  <k.gurpreet@samsung.com>
+
+        :read-write pseudo-class should not be applied on <input type="text" disabled>
+        https://bugs.webkit.org/show_bug.cgi?id=118236
+
+        Reviewed by Darin Adler.
+
+        The :read-write pseudo-class must match any element falling into one
+        of the following categories i.e
+        input elements to which the readonly attribute applies, and that are mutable
+        (i.e. that do not have the readonly attribute specified and that are not disabled)
+        textarea elements that do not have a readonly attribute, and that are not disabled
+        elements that are editing hosts or editable and are neither input elements nor
+        textarea elements.
+
+        Test: fast/css/readwrite-pseudoclass-input.html
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::matchesReadWritePseudoClass):
+        * html/HTMLTextAreaElement.cpp:
+        (WebCore::HTMLTextAreaElement::matchesReadWritePseudoClass):
+        Checking for both readonly and disabled attribute on input ane textarea element.
+
 2013-09-25  Krzysztof Czech  <k.czech@samsung.com>
 
         [EFL] accessibility/loading-iframe-sends-notification.html is failing
index 669cc2018e5c5481d7d8cb842ea86641f3103a8c..f67674364081465faec002898bcb8cdfadcf8e35 100644 (file)
@@ -1463,7 +1463,7 @@ bool HTMLInputElement::matchesReadOnlyPseudoClass() const
 
 bool HTMLInputElement::matchesReadWritePseudoClass() const
 {
-    return m_inputType->supportsReadOnly() && !isReadOnly();
+    return m_inputType->supportsReadOnly() && !isDisabledOrReadOnly();
 }
 
 void HTMLInputElement::addSearchResult()
index 51e0275b10a5a8e0e5f127ac857ce8341cc94e11..0fd0739a9aa166955232f945698459086f7d6e67 100644 (file)
@@ -523,7 +523,7 @@ bool HTMLTextAreaElement::matchesReadOnlyPseudoClass() const
 
 bool HTMLTextAreaElement::matchesReadWritePseudoClass() const
 {
-    return !isReadOnly();
+    return !isDisabledOrReadOnly();
 }
 
 void HTMLTextAreaElement::updatePlaceholderText()