From a580caaa0095f4b75666dd7fd00d67dbbb15052a Mon Sep 17 00:00:00 2001 From: "shinyak@chromium.org" Date: Thu, 15 Nov 2012 07:41:33 +0000 Subject: [PATCH] Changing pseudoClass (:disabled) should cause distribution. https://bugs.webkit.org/show_bug.cgi?id=101901 Reviewed by Hajime Morita. Source/WebCore: We have to invalidate distribution when pseudo-class (:disabled) is changed. According to the HTML5 spec, :disabled will match button, input, select, textarea, optgroup, option, command, li, and fieldset. However, command is not implemented yet, we skip li and command. li might have 'disabled' state, but we need a command element to make it 'disabled' state. Tests: fast/dom/shadow/pseudoclass-update-disabled-button.html fast/dom/shadow/pseudoclass-update-disabled-fieldset.html fast/dom/shadow/pseudoclass-update-disabled-input.html fast/dom/shadow/pseudoclass-update-disabled-optgroup.html fast/dom/shadow/pseudoclass-update-disabled-option.html fast/dom/shadow/pseudoclass-update-disabled-select.html fast/dom/shadow/pseudoclass-update-disabled-textarea.html * html/HTMLFormControlElement.cpp: (WebCore::HTMLFormControlElement::disabledAttributeChanged): * html/HTMLOptGroupElement.cpp: (WebCore::HTMLOptGroupElement::parseAttribute): * html/HTMLOptionElement.cpp: (WebCore::HTMLOptionElement::parseAttribute): LayoutTests: * fast/dom/shadow/pseudoclass-update-disabled-button-expected.html: Added. * fast/dom/shadow/pseudoclass-update-disabled-button.html: Added. * fast/dom/shadow/pseudoclass-update-disabled-fieldset-expected.html: Added. * fast/dom/shadow/pseudoclass-update-disabled-fieldset.html: Added. * fast/dom/shadow/pseudoclass-update-disabled-input-expected.html: Added. * fast/dom/shadow/pseudoclass-update-disabled-input.html: Added. * fast/dom/shadow/pseudoclass-update-disabled-optgroup-expected.txt: Added. * fast/dom/shadow/pseudoclass-update-disabled-optgroup.html: Added. * fast/dom/shadow/pseudoclass-update-disabled-option-expected.txt: Added. * fast/dom/shadow/pseudoclass-update-disabled-option.html: Added. * fast/dom/shadow/pseudoclass-update-disabled-select-expected.html: Added. * fast/dom/shadow/pseudoclass-update-disabled-select.html: Added. * fast/dom/shadow/pseudoclass-update-disabled-textarea-expected.html: Added. * fast/dom/shadow/pseudoclass-update-disabled-textarea.html: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@134748 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 22 ++++++++ ...seudoclass-update-disabled-button-expected.html | 16 ++++++ .../shadow/pseudoclass-update-disabled-button.html | 37 ++++++++++++++ ...udoclass-update-disabled-fieldset-expected.html | 16 ++++++ .../pseudoclass-update-disabled-fieldset.html | 37 ++++++++++++++ ...pseudoclass-update-disabled-input-expected.html | 16 ++++++ .../shadow/pseudoclass-update-disabled-input.html | 37 ++++++++++++++ ...eudoclass-update-disabled-optgroup-expected.txt | 12 +++++ .../pseudoclass-update-disabled-optgroup.html | 58 ++++++++++++++++++++++ ...pseudoclass-update-disabled-option-expected.txt | 12 +++++ .../shadow/pseudoclass-update-disabled-option.html | 58 ++++++++++++++++++++++ ...seudoclass-update-disabled-select-expected.html | 16 ++++++ .../shadow/pseudoclass-update-disabled-select.html | 37 ++++++++++++++ ...udoclass-update-disabled-textarea-expected.html | 16 ++++++ .../pseudoclass-update-disabled-textarea.html | 37 ++++++++++++++ Source/WebCore/ChangeLog | 28 +++++++++++ Source/WebCore/html/HTMLFormControlElement.cpp | 1 + Source/WebCore/html/HTMLOptGroupElement.cpp | 3 ++ Source/WebCore/html/HTMLOptionElement.cpp | 1 + 19 files changed, 460 insertions(+) create mode 100644 LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-button-expected.html create mode 100644 LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-button.html create mode 100644 LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-fieldset-expected.html create mode 100644 LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-fieldset.html create mode 100644 LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-input-expected.html create mode 100644 LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-input.html create mode 100644 LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-optgroup-expected.txt create mode 100644 LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-optgroup.html create mode 100644 LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-option-expected.txt create mode 100644 LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-option.html create mode 100644 LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-select-expected.html create mode 100644 LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-select.html create mode 100644 LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-textarea-expected.html create mode 100644 LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-textarea.html diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index fe36c26..3ec46f2 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,25 @@ +2012-11-14 Shinya Kawanaka + + Changing pseudoClass (:disabled) should cause distribution. + https://bugs.webkit.org/show_bug.cgi?id=101901 + + Reviewed by Hajime Morita. + + * fast/dom/shadow/pseudoclass-update-disabled-button-expected.html: Added. + * fast/dom/shadow/pseudoclass-update-disabled-button.html: Added. + * fast/dom/shadow/pseudoclass-update-disabled-fieldset-expected.html: Added. + * fast/dom/shadow/pseudoclass-update-disabled-fieldset.html: Added. + * fast/dom/shadow/pseudoclass-update-disabled-input-expected.html: Added. + * fast/dom/shadow/pseudoclass-update-disabled-input.html: Added. + * fast/dom/shadow/pseudoclass-update-disabled-optgroup-expected.txt: Added. + * fast/dom/shadow/pseudoclass-update-disabled-optgroup.html: Added. + * fast/dom/shadow/pseudoclass-update-disabled-option-expected.txt: Added. + * fast/dom/shadow/pseudoclass-update-disabled-option.html: Added. + * fast/dom/shadow/pseudoclass-update-disabled-select-expected.html: Added. + * fast/dom/shadow/pseudoclass-update-disabled-select.html: Added. + * fast/dom/shadow/pseudoclass-update-disabled-textarea-expected.html: Added. + * fast/dom/shadow/pseudoclass-update-disabled-textarea.html: Added. + 2012-11-14 Sheriff Bot Unreviewed, rolling out r134691, r134703, r134715, r134716, diff --git a/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-button-expected.html b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-button-expected.html new file mode 100644 index 0000000..2038a26 --- /dev/null +++ b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-button-expected.html @@ -0,0 +1,16 @@ + + + + + + + +

When the 'disabled' state of a button tag is changed, we have to invalidate distribution.

+ +
+ +
+ + + + diff --git a/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-button.html b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-button.html new file mode 100644 index 0000000..6864caa --- /dev/null +++ b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-button.html @@ -0,0 +1,37 @@ + + + + + + + + +

When the 'disabled' state of a button tag is changed, we have to invalidate distribution.

+ +
+ + +
+ +
+ + +
+ + + + + diff --git a/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-fieldset-expected.html b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-fieldset-expected.html new file mode 100644 index 0000000..89539e4 --- /dev/null +++ b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-fieldset-expected.html @@ -0,0 +1,16 @@ + + + + + + + +

When the 'disabled' state of a fieldset tag is changed, we have to invalidate distribution.

+ +
Fieldset 2
+ +
Fieldset 3
+ + + + diff --git a/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-fieldset.html b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-fieldset.html new file mode 100644 index 0000000..5857151 --- /dev/null +++ b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-fieldset.html @@ -0,0 +1,37 @@ + + + + + + + + +

When the 'disabled' state of a fieldset tag is changed, we have to invalidate distribution.

+ +
+
Fieldset 1
+
Fieldset 2
+
+ +
+
Fieldset 3
+
Fieldset 4
+
+ + + + + diff --git a/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-input-expected.html b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-input-expected.html new file mode 100644 index 0000000..93e1d4f --- /dev/null +++ b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-input-expected.html @@ -0,0 +1,16 @@ + + + + + + + +

When the 'disabled' state of an input tag is changed, we have to invalidate distribution.

+ +
+ +
+ + + + diff --git a/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-input.html b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-input.html new file mode 100644 index 0000000..32f21ce --- /dev/null +++ b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-input.html @@ -0,0 +1,37 @@ + + + + + + + + +

When the 'disabled' state of an input tag is changed, we have to invalidate distribution.

+ +
+ + +
+ +
+ + +
+ + + + + diff --git a/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-optgroup-expected.txt b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-optgroup-expected.txt new file mode 100644 index 0000000..c4b4e32 --- /dev/null +++ b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-optgroup-expected.txt @@ -0,0 +1,12 @@ +When an optgroup element became 'disabled' or not-'disabled', distribution should happen. + +Since an optgroup element does not create a renderer, we cannot check this using reftest. + +PASS nodes1.length is 1 +PASS nodes1.item(0).innerHTML is "optgroup 2" +PASS nodes2.length is 1 +PASS nodes2.item(0).innerHTML is "optgroup 3" +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-optgroup.html b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-optgroup.html new file mode 100644 index 0000000..d886033 --- /dev/null +++ b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-optgroup.html @@ -0,0 +1,58 @@ + + + + + + + + + +

When an optgroup element became 'disabled' or not-'disabled', distribution should happen.

+

Since an optgroup element does not create a renderer, we cannot check this using reftest.

+ +
+
+ optgroup 1 + optgroup 2 +
+ +
+ optgroup 3 + optgroup 4 +
+
+ +

+
+
+
+
+
diff --git a/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-option-expected.txt b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-option-expected.txt
new file mode 100644
index 0000000..af8817e
--- /dev/null
+++ b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-option-expected.txt
@@ -0,0 +1,12 @@
+When an option element became 'disabled' or not-'disabled', distribution should happen.
+
+Since an option element does not create a renderer, we cannot check this using reftest.
+
+PASS nodes1.length is 1
+PASS nodes1.item(0).innerHTML is "option 2"
+PASS nodes2.length is 1
+PASS nodes2.item(0).innerHTML is "option 3"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-option.html b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-option.html
new file mode 100644
index 0000000..450227f
--- /dev/null
+++ b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-option.html
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+

When an option element became 'disabled' or not-'disabled', distribution should happen.

+

Since an option element does not create a renderer, we cannot check this using reftest.

+ +
+
+ + +
+ +
+ + +
+
+ +

+
+
+
+
+
diff --git a/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-select-expected.html b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-select-expected.html
new file mode 100644
index 0000000..f3a8914
--- /dev/null
+++ b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-select-expected.html
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+

When the 'disabled' state of a select tag is changed, we have to invalidate distribution.

+ +
+ +
+ + + + diff --git a/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-select.html b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-select.html new file mode 100644 index 0000000..da03c14 --- /dev/null +++ b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-select.html @@ -0,0 +1,37 @@ + + + + + + + + +

When the 'disabled' state of a select tag is changed, we have to invalidate distribution.

+ +
+ + +
+ +
+ + +
+ + + + + diff --git a/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-textarea-expected.html b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-textarea-expected.html new file mode 100644 index 0000000..3c3739a --- /dev/null +++ b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-textarea-expected.html @@ -0,0 +1,16 @@ + + + + + + + +

When the 'disabled' state of a textarea tag is changed, we have to invalidate distribution.

+ +
+ +
+ + + + diff --git a/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-textarea.html b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-textarea.html new file mode 100644 index 0000000..d75f4cc --- /dev/null +++ b/LayoutTests/fast/dom/shadow/pseudoclass-update-disabled-textarea.html @@ -0,0 +1,37 @@ + + + + + + + + +

When the 'disabled' state of a textarea tag is changed, we have to invalidate distribution.

+ +
+ + +
+ +
+ + +
+ + + + + diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 073bc0e..2a67c08 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,31 @@ +2012-11-14 Shinya Kawanaka + + Changing pseudoClass (:disabled) should cause distribution. + https://bugs.webkit.org/show_bug.cgi?id=101901 + + Reviewed by Hajime Morita. + + We have to invalidate distribution when pseudo-class (:disabled) is changed. + + According to the HTML5 spec, :disabled will match button, input, select, textarea, optgroup, + option, command, li, and fieldset. However, command is not implemented yet, we skip li and command. li might + have 'disabled' state, but we need a command element to make it 'disabled' state. + + Tests: fast/dom/shadow/pseudoclass-update-disabled-button.html + fast/dom/shadow/pseudoclass-update-disabled-fieldset.html + fast/dom/shadow/pseudoclass-update-disabled-input.html + fast/dom/shadow/pseudoclass-update-disabled-optgroup.html + fast/dom/shadow/pseudoclass-update-disabled-option.html + fast/dom/shadow/pseudoclass-update-disabled-select.html + fast/dom/shadow/pseudoclass-update-disabled-textarea.html + + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::disabledAttributeChanged): + * html/HTMLOptGroupElement.cpp: + (WebCore::HTMLOptGroupElement::parseAttribute): + * html/HTMLOptionElement.cpp: + (WebCore::HTMLOptionElement::parseAttribute): + 2012-11-14 Sheriff Bot Unreviewed, rolling out r134691, r134703, r134715, r134716, diff --git a/Source/WebCore/html/HTMLFormControlElement.cpp b/Source/WebCore/html/HTMLFormControlElement.cpp index cf16f43..7b4ae3e 100644 --- a/Source/WebCore/html/HTMLFormControlElement.cpp +++ b/Source/WebCore/html/HTMLFormControlElement.cpp @@ -151,6 +151,7 @@ void HTMLFormControlElement::disabledAttributeChanged() { setNeedsWillValidateCheck(); setNeedsStyleRecalc(); + invalidateParentDistributionIfNecessary(this, SelectRuleFeatureSet::RuleFeatureDisabled); if (renderer() && renderer()->style()->hasAppearance()) renderer()->theme()->stateChanged(renderer(), EnabledState); } diff --git a/Source/WebCore/html/HTMLOptGroupElement.cpp b/Source/WebCore/html/HTMLOptGroupElement.cpp index c5e526f..03c9e14 100644 --- a/Source/WebCore/html/HTMLOptGroupElement.cpp +++ b/Source/WebCore/html/HTMLOptGroupElement.cpp @@ -82,6 +82,9 @@ void HTMLOptGroupElement::parseAttribute(const Attribute& attribute) { HTMLElement::parseAttribute(attribute); recalcSelectOptions(); + + if (attribute.name() == disabledAttr) + invalidateParentDistributionIfNecessary(this, SelectRuleFeatureSet::RuleFeatureDisabled); } void HTMLOptGroupElement::recalcSelectOptions() diff --git a/Source/WebCore/html/HTMLOptionElement.cpp b/Source/WebCore/html/HTMLOptionElement.cpp index d169173..38edc3e 100644 --- a/Source/WebCore/html/HTMLOptionElement.cpp +++ b/Source/WebCore/html/HTMLOptionElement.cpp @@ -203,6 +203,7 @@ void HTMLOptionElement::parseAttribute(const Attribute& attribute) m_disabled = !attribute.isNull(); if (oldDisabled != m_disabled) { setNeedsStyleRecalc(); + invalidateParentDistributionIfNecessary(this, SelectRuleFeatureSet::RuleFeatureDisabled); if (renderer() && renderer()->style()->hasAppearance()) renderer()->theme()->stateChanged(renderer(), EnabledState); } -- 1.8.3.1