Option, checkbox and radio should support ':default' selector
Spec: https://html.spec.whatwg.org/multipage/scripting.html#selector-default
This patch adds support for the following to match :default
pseudo class
a)input elements to which the checked attribute applies and
that have a checked attribute
b)option elements that have a selected attribute
This patch does not support handling dynamic state changes
to input types to add/remove :default class.
BUG=591226
Committed: https://crrev.com/6e3a05d6080ba6ae25af2835573ff9e2406b90c0
Cr-Commit-Position: refs/heads/master@{#379279}
On 2016/03/03 06:46:02, tkent wrote: > You need to add code to support dynamic changes ...
4 years, 9 months ago
(2016-03-03 10:29:00 UTC)
#5
On 2016/03/03 06:46:02, tkent wrote:
> You need to add code to support dynamic changes of conditions. e.g. Changing
> input type correctly add/remove :default style. You can copy some code from
> https://codereview.chromium.org/1763553002/ .
>
> You need to add more tests.
> web-platform-tests/html/semantics/selectors/pseudo-classes/default.html
doesn't
> have enough coverage.
>
>
https://codereview.chromium.org/1756483005/diff/20001/third_party/WebKit/Sour...
> File third_party/WebKit/Source/core/css/SelectorChecker.cpp (right):
>
>
https://codereview.chromium.org/1756483005/diff/20001/third_party/WebKit/Sour...
> third_party/WebKit/Source/core/css/SelectorChecker.cpp:836: if
> (isHTMLInputElement(element)) {
> You shouldn't add code here. You should override
> HTMLOptionElement::isDefaultButtonForForm and
> HTMLInputElement::isDefaultButtonForForm.
>
>
https://codereview.chromium.org/1756483005/diff/20001/third_party/WebKit/Sour...
> third_party/WebKit/Source/core/css/SelectorChecker.cpp:838: if
> (inputElement.shouldAppearChecked() &&
> !inputElement.shouldAppearIndeterminate())
> The specification doesn't ask to check them. It says "have a checked
attribute"
>
>
https://codereview.chromium.org/1756483005/diff/20001/third_party/WebKit/Sour...
> third_party/WebKit/Source/core/css/SelectorChecker.cpp:840: } else if
> (isHTMLOptionElement(element) && toHTMLOptionElement(element).selected()) {
> The specification doesn't ask to check |selected| IDL attribute. It says
"have
> a selected attribute".
Thank you for the review comments :).
Updated with new patch-set.
You need to add code to support dynamic changes of conditions. e.g. Changing
input type correctly add/remove :default style. You can copy some code from
https://codereview.chromium.org/1763553002/ .
>> Since this patch is under review, once this is landed, will make similar
changes in subsequent patch after this,
for checkbox/radio/option element when they are dynamically updated.
You need to add more tests.
web-platform-tests/html/semantics/selectors/pseudo-classes/default.html doesn't
have enough coverage.
>> Have added test to check basic support of :default pseudo class for
checkbox/radio/option element.
Once I add patch for dynamic handling, will add more test cases for the same.
Please let me know if I have to check any other corner cases.
PTAL!
Thanks
ramya.v
https://codereview.chromium.org/1756483005/diff/20001/third_party/WebKit/Source/core/css/SelectorChecker.cpp File third_party/WebKit/Source/core/css/SelectorChecker.cpp (right): https://codereview.chromium.org/1756483005/diff/20001/third_party/WebKit/Source/core/css/SelectorChecker.cpp#newcode836 third_party/WebKit/Source/core/css/SelectorChecker.cpp:836: if (isHTMLInputElement(element)) { On 2016/03/03 06:46:02, tkent wrote: > ...
4 years, 9 months ago
(2016-03-03 10:29:19 UTC)
#6
On 2016/03/03 at 10:29:00, ramya.v wrote: > >> Since this patch is under review, once ...
4 years, 9 months ago
(2016-03-03 13:28:57 UTC)
#7
On 2016/03/03 at 10:29:00, ramya.v wrote:
> >> Since this patch is under review, once this is landed, will make similar
changes in subsequent patch after this,
> for checkbox/radio/option element when they are dynamically updated.
ok. Please mention it in the CL description.
tkent
https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html File third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html (right): https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html#newcode1 third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html:1: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> Please do not add ...
4 years, 9 months ago
(2016-03-03 13:29:08 UTC)
#8
https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/Layo...
File third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html (right):
https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/Layo...
third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html:1: <!DOCTYPE
HTML PUBLIC "-//IETF//DTD HTML//EN">
Please do not add |-005| to the file name. It's hard to understand what's
tested.
Separate it to pseudo-default-checkbox-radio.html and
pseudo-default-option.html.
https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/Layo...
third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html:4: <script
src="../../resources/js-test.js"></script>
I recommend to use testharness.js for new conformance tests.
https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/Layo...
third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html:18: <input
name="y" type ="radio" checked />
Add more cases:
- other input types with 'checked' attribute (This Patch Set fails for them)
- checkbox/radio without 'checked' attribute, but checked by 'checked'
property
https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/Layo...
third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html:21: <option
name="y" selected>2</option>
Add another case:
- OPTION without selected attribute, but selected by 'selected' property.
https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/Layo...
third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html:30:
shouldBe("document.defaultView.getComputedStyle(u[i],
null).getPropertyValue('background-color')", "'rgb(255, 0, 0)'");
You can simply check |shouldBeFalse("u[i].matches(':default')")|.
https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/Sour...
File third_party/WebKit/Source/core/html/HTMLInputElement.cpp (right):
https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/html/HTMLInputElement.cpp:1660: if
(fastHasAttribute(checkedAttr))
The specification says "input elements to which the checked attribute applies"
but this code doesn't check it.
Please add InputType::matchesDefaultPseudoClass(), then
- HTMLInputElement::isDefaultButtonForForm() just calls
m_inputType->matchesDefaultPseudoClass().
- BaseCheckableInputType::matchesDefaultPseudoClass() checkes
fastHasAttribute(checkedAttr)
- BaseButtonInputType::isDefaultButtonForForm() checks
|isSuccessfulSubmitButton() && element().form() &&
element().form()->defaultButton() == &element()| (copy the logic of
HTMLFormControlElement::isDefaultButtonForForm)
- Copy HTMLFormControlElement::isDefaultButtonForForm to
HTMLButtonElement::isDefaultButtonForForm
- Remove HTMLFormControlElement::isDefaultButtonForForm
ramya.v
Description was changed from ========== Option, checkbox and radio should support ':default' selector Spec: https://html.spec.whatwg.org/multipage/scripting.html#selector-default ...
4 years, 9 months ago
(2016-03-04 06:30:43 UTC)
#9
Description was changed from
==========
Option, checkbox and radio should support ':default' selector
Spec: https://html.spec.whatwg.org/multipage/scripting.html#selector-default
BUG=591226
==========
to
==========
Option, checkbox and radio should support ':default' selector
Spec: https://html.spec.whatwg.org/multipage/scripting.html#selector-default
This patch adds support for the following to match :default
pseudo class
a)input elements to which the checked attribute applies and
that have a checked attribute
b)option elements that have a selected attribute
This patch does not support handling dynamic state changes
to input types to add/remove :default class.
BUG=591226
==========
ramya.v
Updated as per review comments. PTAL! Thanks https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html File third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html (right): https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html#newcode1 third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html:1: <!DOCTYPE HTML ...
4 years, 9 months ago
(2016-03-04 06:31:45 UTC)
#10
Updated as per review comments.
PTAL!
Thanks
https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/Layo...
File third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html (right):
https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/Layo...
third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html:1: <!DOCTYPE
HTML PUBLIC "-//IETF//DTD HTML//EN">
On 2016/03/03 13:29:07, tkent wrote:
> Please do not add |-005| to the file name. It's hard to understand what's
> tested.
> Separate it to pseudo-default-checkbox-radio.html and
> pseudo-default-option.html.
Done.
https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/Layo...
third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html:4: <script
src="../../resources/js-test.js"></script>
On 2016/03/03 13:29:07, tkent wrote:
> I recommend to use testharness.js for new conformance tests.
Done.
https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/Layo...
third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html:18: <input
name="y" type ="radio" checked />
On 2016/03/03 13:29:07, tkent wrote:
> Add more cases:
> - other input types with 'checked' attribute (This Patch Set fails for
them)
> - checkbox/radio without 'checked' attribute, but checked by 'checked'
> property
Done.
https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/Layo...
third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html:21: <option
name="y" selected>2</option>
On 2016/03/03 13:29:08, tkent wrote:
> Add another case:
> - OPTION without selected attribute, but selected by 'selected' property.
Done.
https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/Layo...
third_party/WebKit/LayoutTests/fast/css/pseudo-default-005.html:30:
shouldBe("document.defaultView.getComputedStyle(u[i],
null).getPropertyValue('background-color')", "'rgb(255, 0, 0)'");
On 2016/03/03 13:29:08, tkent wrote:
> You can simply check |shouldBeFalse("u[i].matches(':default')")|.
Done.
https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/Sour...
File third_party/WebKit/Source/core/html/HTMLInputElement.cpp (right):
https://codereview.chromium.org/1756483005/diff/40001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/html/HTMLInputElement.cpp:1660: if
(fastHasAttribute(checkedAttr))
On 2016/03/03 13:29:08, tkent wrote:
> The specification says "input elements to which the checked attribute applies"
> but this code doesn't check it.
>
> Please add InputType::matchesDefaultPseudoClass(), then
> - HTMLInputElement::isDefaultButtonForForm() just calls
> m_inputType->matchesDefaultPseudoClass().
> - BaseCheckableInputType::matchesDefaultPseudoClass() checkes
> fastHasAttribute(checkedAttr)
> - BaseButtonInputType::isDefaultButtonForForm() checks
> |isSuccessfulSubmitButton() && element().form() &&
> element().form()->defaultButton() == &element()| (copy the logic of
> HTMLFormControlElement::isDefaultButtonForForm)
> - Copy HTMLFormControlElement::isDefaultButtonForForm to
> HTMLButtonElement::isDefaultButtonForForm
> - Remove HTMLFormControlElement::isDefaultButtonForForm
Done.
Almost ok. Please hold uploading new patch set until https://codereview.chromium.org/1764063002/ is landed. https://codereview.chromium.org/1756483005/diff/80001/third_party/WebKit/LayoutTests/fast/css/pseudo-default-checkbox-radio.html File third_party/WebKit/LayoutTests/fast/css/pseudo-default-checkbox-radio.html ...
4 years, 9 months ago
(2016-03-04 06:39:15 UTC)
#12
4 years, 9 months ago
(2016-03-04 12:32:36 UTC)
#15
lgtm
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1756483005/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1756483005/100001
4 years, 9 months ago
(2016-03-04 12:32:51 UTC)
#16
Description was changed from ========== Option, checkbox and radio should support ':default' selector Spec: https://html.spec.whatwg.org/multipage/scripting.html#selector-default ...
4 years, 9 months ago
(2016-03-04 13:42:36 UTC)
#17
Message was sent while issue was closed.
Description was changed from
==========
Option, checkbox and radio should support ':default' selector
Spec: https://html.spec.whatwg.org/multipage/scripting.html#selector-default
This patch adds support for the following to match :default
pseudo class
a)input elements to which the checked attribute applies and
that have a checked attribute
b)option elements that have a selected attribute
This patch does not support handling dynamic state changes
to input types to add/remove :default class.
BUG=591226
==========
to
==========
Option, checkbox and radio should support ':default' selector
Spec: https://html.spec.whatwg.org/multipage/scripting.html#selector-default
This patch adds support for the following to match :default
pseudo class
a)input elements to which the checked attribute applies and
that have a checked attribute
b)option elements that have a selected attribute
This patch does not support handling dynamic state changes
to input types to add/remove :default class.
BUG=591226
==========
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 9 months ago
(2016-03-04 13:42:38 UTC)
#18
Message was sent while issue was closed.
Committed patchset #6 (id:100001)
commit-bot: I haz the power
Description was changed from ========== Option, checkbox and radio should support ':default' selector Spec: https://html.spec.whatwg.org/multipage/scripting.html#selector-default ...
4 years, 9 months ago
(2016-03-04 13:44:37 UTC)
#19
Message was sent while issue was closed.
Description was changed from
==========
Option, checkbox and radio should support ':default' selector
Spec: https://html.spec.whatwg.org/multipage/scripting.html#selector-default
This patch adds support for the following to match :default
pseudo class
a)input elements to which the checked attribute applies and
that have a checked attribute
b)option elements that have a selected attribute
This patch does not support handling dynamic state changes
to input types to add/remove :default class.
BUG=591226
==========
to
==========
Option, checkbox and radio should support ':default' selector
Spec: https://html.spec.whatwg.org/multipage/scripting.html#selector-default
This patch adds support for the following to match :default
pseudo class
a)input elements to which the checked attribute applies and
that have a checked attribute
b)option elements that have a selected attribute
This patch does not support handling dynamic state changes
to input types to add/remove :default class.
BUG=591226
Committed: https://crrev.com/6e3a05d6080ba6ae25af2835573ff9e2406b90c0
Cr-Commit-Position: refs/heads/master@{#379279}
==========
commit-bot: I haz the power
Patchset 6 (id:??) landed as https://crrev.com/6e3a05d6080ba6ae25af2835573ff9e2406b90c0 Cr-Commit-Position: refs/heads/master@{#379279}
4 years, 9 months ago
(2016-03-04 13:44:38 UTC)
#20
Issue 1756483005: Option, checkbox and radio should support ':default' selector
(Closed)
Created 4 years, 9 months ago by ramya.v
Modified 4 years, 9 months ago
Reviewers: tkent
Base URL: https://chromium.googlesource.com/chromium/src.git@master
Comments: 32