[iOS] Focus ring for checkboxes, radio buttons, buttons and search fields should...
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Feb 2019 00:10:35 +0000 (00:10 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Feb 2019 00:10:35 +0000 (00:10 +0000)
commit343b9b026a6588007b10d8346d6bb7fe80a6034a
tree8c08b70b488625f921331eacdb7299640af7635c
parent17707ad4ee590c28a4b469dfc7db929d0ad8a1a3
[iOS] Focus ring for checkboxes, radio buttons, buttons and search fields should hug tighter to the contour
https://bugs.webkit.org/show_bug.cgi?id=193599
<rdar://problem/47399602>

Reviewed by Simon Fraser.

Source/WebCore:

For now, iOS uses a 3px outline width for its focus rings. Do not inset the focus ring on iOS
for text fields, textareas, keygens, and selects so as to match the visual appearance of all
the other controls.

Tests: fast/forms/ios/focus-button.html
       fast/forms/ios/focus-checkbox.html
       fast/forms/ios/focus-checked-checkbox.html
       fast/forms/ios/focus-checked-radio.html
       fast/forms/ios/focus-radio.html
       fast/forms/ios/focus-reset-button.html
       fast/forms/ios/focus-search-field.html
       fast/forms/ios/focus-submit-button.html
       fast/forms/ios/focus-text-field.html
       fast/forms/ios/focus-textarea.html

* css/html.css:
(:focus): Use 3px outline width.
(input:focus, textarea:focus, keygen:focus, select:focus): Guard this code to exclude it when building for iOS.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::paintBoxDecorations): Add FIXME comment.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::paintOutline): Call RenderTheme::adjustPaintRect() to adjust the paint rect.
Otherwise, the focus rings for radios and checkboxes are drawn at the wrong y-coordinate and are not snug.

LayoutTests:

Ideally we should find a way to write non-pixel tests for focus rings. For now, add some mismatch ref
tests.

We cannot write a "good" mismatch ref test for <select> at the moment since there is no way to defocus
a <select> without closing its popup. We also cannot change outline-color when outline-style: auto is
used and outline-style: auto is needed to get shrink-wrapped focus rings :(

* fast/forms/ios/focus-button-expected-mismatch.html: Added.
* fast/forms/ios/focus-button.html: Added.
* fast/forms/ios/focus-checkbox-expected-mismatch.html: Added.
* fast/forms/ios/focus-checkbox.html: Added.
* fast/forms/ios/focus-checked-checkbox-expected-mismatch.html: Added.
* fast/forms/ios/focus-checked-checkbox.html: Added.
* fast/forms/ios/focus-checked-radio-expected-mismatch.html: Added.
* fast/forms/ios/focus-checked-radio.html: Added.
* fast/forms/ios/focus-radio-expected-mismatch.html: Added.
* fast/forms/ios/focus-radio.html: Added.
* fast/forms/ios/focus-reset-button-expected-mismatch.html: Added.
* fast/forms/ios/focus-reset-button.html: Added.
* fast/forms/ios/focus-search-field-expected-mismatch.html: Added.
* fast/forms/ios/focus-search-field.html: Added.
* fast/forms/ios/focus-submit-button-expected-mismatch.html: Added.
* fast/forms/ios/focus-submit-button.html: Added.
* fast/forms/ios/focus-text-field-expected-mismatch.html: Added.
* fast/forms/ios/focus-text-field.html: Added.
* fast/forms/ios/focus-textarea-expected-mismatch.html: Added.
* fast/forms/ios/focus-textarea.html: Added.
* platform/ios/TestExpectations: Skip the tests for now on iOS we do not build with ENABLE(FULL_KEYBOARD_ACCESS) enabled.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241747 268f45cc-cd09-0410-ab3c-d52691b4dbfc
26 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/ios/focus-button-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-button.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-checkbox-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-checkbox.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-checked-checkbox-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-checked-checkbox.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-checked-radio-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-checked-radio.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-radio-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-radio.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-reset-button-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-reset-button.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-search-field-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-search-field.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-submit-button-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-submit-button.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-text-field-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-text-field.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-textarea-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/forms/ios/focus-textarea.html [new file with mode: 0644]
LayoutTests/platform/ios/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/css/html.css
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderElement.cpp