Add the unprefixed version of the pseudo element ::placeholder
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Jun 2016 22:09:33 +0000 (22:09 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Jun 2016 22:09:33 +0000 (22:09 +0000)
commit90f41a0d2be93f67c4d19e6e53a24c3413c23bdd
tree2527eeee11bb36523f91121493b9d3d4018dedf4
parentedf29612220c1731ec163097218b3561b50488d7
Add the unprefixed version of the pseudo element ::placeholder
https://bugs.webkit.org/show_bug.cgi?id=158653

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-06-14
Reviewed by Dean Jackson.

Source/WebCore:

Test: fast/forms/placeholder-pseudo-element-with-webkit-prefix.html

The pseudo element ::-webkit-input-placeholder is stupidly popular
which forces other engines to support this exact name.

The pseudo-element spec provides a new standard name we can adopt
to drop the prefix: https://drafts.csswg.org/css-pseudo-4/#placeholder-pseudo

This patch does just that, make ::placeholder the standard name to select
the placeholder element in the shadow dom of input elements.

Unlike pseudo classes, we did not have any support for prefixes and aliasing.
I want to keep the absurdly efficient matching we currently use for styling
because style updates are more common than stylesheet updates.
With that constraint in mind, the value of CSSSelector has to be the unprefixed
version for both forms of input.

This leaves us with the problem of displaying the CSSSelector for CSSOM.
To differentiate the legacy form from the standard form, I added
a new type of PseudoElement: PseudoElementWebKitCustomLegacyPrefixed.
When parsing, PseudoElementWebKitCustomLegacyPrefixed let us replace
the original value "-webkit-input-placeholder" by the standard value.
When creating the selectorText for CSSOM, PseudoElementWebKitCustomLegacyPrefixed
let us replace the standard for by the legacy form.

* css/CSSParserValues.cpp:
(WebCore::CSSParserSelector::parsePseudoElementSelector):
* css/CSSSelector.cpp:
(WebCore::CSSSelector::pseudoId):
(WebCore::CSSSelector::selectorText):
* css/CSSSelector.h:
(WebCore::CSSSelector::isCustomPseudoElement):
(WebCore::CSSSelector::isWebKitCustomPseudoElement):
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::matchRecursively):
* css/SelectorPseudoElementTypeMap.in:
* css/html.css:
(::placeholder):
(input::placeholder, isindex::placeholder):
(textarea::placeholder):
(::-webkit-input-placeholder): Deleted.
(input::-webkit-input-placeholder, isindex::-webkit-input-placeholder): Deleted.
(textarea::-webkit-input-placeholder): Deleted.
* features.json:
* html/shadow/TextControlInnerElements.cpp:
(WebCore::TextControlPlaceholderElement::TextControlPlaceholderElement):

Source/WebInspectorUI:

* UserInterface/Views/FilterBar.css:
(.filter-bar > input[type="search"]::placeholder):
(.filter-bar > input[type="search"]::-webkit-input-placeholder): Deleted.
* UserInterface/Views/FindBanner.css:
(.find-banner.console-find-banner > input[type="search"]::placeholder):
(.find-banner.console-find-banner > input[type="search"]::-webkit-input-placeholder): Deleted.
* UserInterface/Views/GoToLineDialog.css:
(.go-to-line-dialog > div > input::placeholder):
(.go-to-line-dialog > div > input::-webkit-input-placeholder): Deleted.
* UserInterface/Views/OpenResourceDialog.css:
(.open-resource-dialog > .field > input::placeholder):
(.open-resource-dialog > .field > input::-webkit-input-placeholder): Deleted.
* UserInterface/Views/SearchBar.css:
(.search-bar > input[type="search"]::placeholder):
(.search-bar > input[type="search"]::-webkit-input-placeholder): Deleted.
* UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.css:

LayoutTests:

* fast/css/css-selector-text-expected.txt:
* fast/css/css-selector-text.html:
* fast/css/css-set-selector-text-expected.txt:
* fast/css/css-set-selector-text.html:
This covers CSSOM for the prefixed version.

* fast/forms/placeholder-pseudo-element-with-webkit-prefix-expected.html: Added.
* fast/forms/placeholder-pseudo-element-with-webkit-prefix.html: Added.
This verifies both version of the pseudo elements are equivalent.

* fast/css/pseudo-cache-stale-expected.html:
* fast/css/pseudo-cache-stale.html:
* fast/forms/input-placeholder-paint-order-2-expected.html:
* fast/forms/input-placeholder-paint-order-2.html:
* fast/forms/input-placeholder-paint-order.html:
* fast/forms/input-placeholder-text-indent.html:
* fast/forms/input-user-modify.html:
* fast/forms/isindex-placeholder.html:
* fast/forms/placeholder-position.html:
* fast/forms/placeholder-pseudo-style.html:
* fast/forms/textarea-placeholder-pseudo-style.html:
* fast/forms/textarea/textarea-placeholder-paint-order-2-expected.html:
* fast/forms/textarea/textarea-placeholder-paint-order-2.html:
* fast/forms/textarea/textarea-placeholder-paint-order.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202066 268f45cc-cd09-0410-ab3c-d52691b4dbfc
37 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css/css-selector-text-expected.txt
LayoutTests/fast/css/css-selector-text.html
LayoutTests/fast/css/css-set-selector-text-expected.txt
LayoutTests/fast/css/css-set-selector-text.html
LayoutTests/fast/css/pseudo-cache-stale-expected.html
LayoutTests/fast/css/pseudo-cache-stale.html
LayoutTests/fast/forms/input-placeholder-paint-order-2-expected.html
LayoutTests/fast/forms/input-placeholder-paint-order-2.html
LayoutTests/fast/forms/input-placeholder-paint-order.html
LayoutTests/fast/forms/input-placeholder-text-indent.html
LayoutTests/fast/forms/input-user-modify.html
LayoutTests/fast/forms/isindex-placeholder.html
LayoutTests/fast/forms/placeholder-position.html
LayoutTests/fast/forms/placeholder-pseudo-element-with-webkit-prefix-expected.html [new file with mode: 0644]
LayoutTests/fast/forms/placeholder-pseudo-element-with-webkit-prefix.html [new file with mode: 0644]
LayoutTests/fast/forms/placeholder-pseudo-style.html
LayoutTests/fast/forms/textarea-placeholder-pseudo-style.html
LayoutTests/fast/forms/textarea/textarea-placeholder-paint-order-2-expected.html
LayoutTests/fast/forms/textarea/textarea-placeholder-paint-order-2.html
LayoutTests/fast/forms/textarea/textarea-placeholder-paint-order.html
Source/WebCore/ChangeLog
Source/WebCore/css/CSSParserValues.cpp
Source/WebCore/css/CSSSelector.cpp
Source/WebCore/css/CSSSelector.h
Source/WebCore/css/SelectorChecker.cpp
Source/WebCore/css/SelectorPseudoElementTypeMap.in
Source/WebCore/css/html.css
Source/WebCore/features.json
Source/WebCore/html/shadow/TextControlInnerElements.cpp
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/FilterBar.css
Source/WebInspectorUI/UserInterface/Views/FindBanner.css
Source/WebInspectorUI/UserInterface/Views/GoToLineDialog.css
Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.css
Source/WebInspectorUI/UserInterface/Views/SearchBar.css
Source/WebInspectorUI/UserInterface/Views/VisualStyleCommaSeparatedKeywordEditor.css