AutoFill button should not be shown in read-only or disabled field
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Jun 2015 20:44:56 +0000 (20:44 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Jun 2015 20:44:56 +0000 (20:44 +0000)
commitb77a43d1033db93668ad172c5c93c59799ab2236
tree66b68d0191868627e0e925bac93a5d305479dba5
parenta53ea6a4c82e810a61180f47b4f6a01c37579363
AutoFill button should not be shown in read-only or disabled field
https://bugs.webkit.org/show_bug.cgi?id=145579
<rdar://problem/21212494>

Reviewed by Darin Adler.

Source/WebCore:

Fixes an issue where the AutoFill button is shown in a read-only or disabled
field. We should not show the AutoFill button in such cases.

Tests: fast/forms/auto-fill-button/hide-auto-fill-button-when-input-becomes-disabled.html
       fast/forms/auto-fill-button/hide-auto-fill-button-when-input-becomes-readonly.html
       fast/forms/auto-fill-button/input-auto-fill-button.html
       fast/forms/auto-fill-button/input-disabled-auto-fill-button.html
       fast/forms/auto-fill-button/input-readonly-auto-fill-button.html
       fast/forms/auto-fill-button/input-readonly-non-empty-auto-fill-button.html

* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::disabledAttributeChanged): Update AutoFill button state.
(WebCore::TextFieldInputType::readonlyAttributeChanged): Ditto.
(WebCore::TextFieldInputType::shouldDrawAutoFillButton): Do not draw AutoFill button
when the field is disabled or read-only.

LayoutTests:

Add tests to ensure that we do no show the AutoFill button in a read-only or disabled field.

Additionally, create directory LayoutTests/fast/forms/auto-fill-button and move existing test
LayoutTests/fast/forms/input-auto-fill-button.html and associated test results into this directory
or the platform-specific variant of this directory.

* fast/forms/auto-fill-button/hide-auto-fill-button-when-input-becomes-disabled-expected.html: Added.
* fast/forms/auto-fill-button/hide-auto-fill-button-when-input-becomes-disabled.html: Added.
* fast/forms/auto-fill-button/hide-auto-fill-button-when-input-becomes-readonly-expected.html: Added.
* fast/forms/auto-fill-button/hide-auto-fill-button-when-input-becomes-readonly.html: Added.
* fast/forms/auto-fill-button/input-auto-fill-button-expected.txt: Renamed from LayoutTests/fast/forms/input-auto-fill-button-expected.txt.
* fast/forms/auto-fill-button/input-auto-fill-button.html: Renamed from LayoutTests/fast/forms/input-auto-fill-button.html.
* fast/forms/auto-fill-button/input-disabled-auto-fill-button-expected.html: Added.
* fast/forms/auto-fill-button/input-disabled-auto-fill-button.html: Added.
* fast/forms/auto-fill-button/input-readonly-auto-fill-button-expected.html: Added.
* fast/forms/auto-fill-button/input-readonly-auto-fill-button.html: Added.
* fast/forms/auto-fill-button/input-readonly-non-empty-auto-fill-button-expected.html: Added.
* fast/forms/auto-fill-button/input-readonly-non-empty-auto-fill-button.html: Added.
* platform/ios-simulator/fast/forms/auto-fill-button/input-auto-fill-button-expected.png: Renamed from LayoutTests/platform/ios-simulator/fast/forms/input-auto-fill-button-expected.png.
* platform/ios-simulator/fast/forms/auto-fill-button/input-auto-fill-button-expected.txt: Renamed from LayoutTests/platform/ios-simulator/fast/forms/input-auto-fill-button-expected.txt.
* platform/mac-mavericks/fast/forms/auto-fill-button/input-auto-fill-button-expected.txt: Renamed from LayoutTests/platform/mac-mavericks/fast/forms/input-auto-fill-button-expected.txt.
* platform/win/fast/forms/auto-fill-button/input-auto-fill-button-expected.txt: Renamed from LayoutTests/platform/win/fast/forms/input-auto-fill-button-expected.txt.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@185166 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/auto-fill-button/hide-auto-fill-button-when-input-becomes-disabled-expected.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/hide-auto-fill-button-when-input-becomes-disabled.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/hide-auto-fill-button-when-input-becomes-readonly-expected.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/hide-auto-fill-button-when-input-becomes-readonly.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/input-auto-fill-button-expected.txt [moved from LayoutTests/fast/forms/input-auto-fill-button-expected.txt with 100% similarity]
LayoutTests/fast/forms/auto-fill-button/input-auto-fill-button.html [moved from LayoutTests/fast/forms/input-auto-fill-button.html with 100% similarity]
LayoutTests/fast/forms/auto-fill-button/input-disabled-auto-fill-button-expected.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/input-disabled-auto-fill-button.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/input-readonly-auto-fill-button-expected.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/input-readonly-auto-fill-button.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/input-readonly-non-empty-auto-fill-button-expected.html [new file with mode: 0644]
LayoutTests/fast/forms/auto-fill-button/input-readonly-non-empty-auto-fill-button.html [new file with mode: 0644]
LayoutTests/platform/ios-simulator/fast/forms/auto-fill-button/input-auto-fill-button-expected.png [moved from LayoutTests/platform/ios-simulator/fast/forms/input-auto-fill-button-expected.png with 100% similarity]
LayoutTests/platform/ios-simulator/fast/forms/auto-fill-button/input-auto-fill-button-expected.txt [moved from LayoutTests/platform/ios-simulator/fast/forms/input-auto-fill-button-expected.txt with 100% similarity]
LayoutTests/platform/mac-mavericks/fast/forms/auto-fill-button/input-auto-fill-button-expected.txt [moved from LayoutTests/platform/mac-mavericks/fast/forms/input-auto-fill-button-expected.txt with 100% similarity]
LayoutTests/platform/win/fast/forms/auto-fill-button/input-auto-fill-button-expected.txt [moved from LayoutTests/platform/win/fast/forms/input-auto-fill-button-expected.txt with 66% similarity]
Source/WebCore/ChangeLog
Source/WebCore/html/TextFieldInputType.cpp