Web Inspector: generate CSSKeywordCompletions from backend values
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Sep 2018 22:43:11 +0000 (22:43 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Sep 2018 22:43:11 +0000 (22:43 +0000)
commit70efcc39314b68d02f69666f5b96fb4c50370baf
tree728fff76e08b713c823ce0aa00532cb51c24ff34
parent5302db5b086355ad6c1fda401a8e569fa8754e29
Web Inspector: generate CSSKeywordCompletions from backend values
https://bugs.webkit.org/show_bug.cgi?id=189041

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/protocol/CSS.json:
Include an optional `aliases` array and `inherited` boolean for `CSSPropertyInfo`.

Source/WebCore:

Modified existing test inspector/css/getSupportedCSSProperties.html.

* inspector/agents/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::getSupportedCSSProperties):
Send alias and longhand information for all properties, and any known keyword values for
those applicable. This makes use of `CSSParserFastPaths::isValidKeywordPropertyAndValue` to
determine if a given keyword is a valid value for each property. This only generates a list
for properties who have no non-keyword values.

* css/makeprop.pl:
* css/makevalues.pl:
Create additional helper functions/constants for retrieving strings of each CSS keyword.

* css/CSSProperty.h:
(WebCore::CSSProperty::aliasesForProperty):

* css/CSSPrimitiveValue.cpp:
(WebCore::valueName):

* css/CSSValuePool.cpp:
(WebCore::CSSValuePool::CSSValuePool):
(WebCore::CSSValuePool::createIdentifierValue):

Source/WebInspectorUI:

Moves the longhands map to `WI.CSSKeywordCompletions` for more global access. Creates an
aliases map to support completions on aliases with the same values as the non-alias name.
Removes all keyword-only properties from `WI.CSSKeywordCompletions._propertyKeywordMap` as
they are now generated by the backend (kept for compatibility).

* UserInterface/Models/CSSCompletions.js:
(WI.CSSCompletions):
(WI.CSSCompletions.requestCSSCompletions.propertyNamesCallback):
(WI.CSSCompletions.prototype.isShorthandPropertyName):

* UserInterface/Models/CSSKeywordCompletions.js:
(WI.CSSKeywordCompletions.forProperty.addKeywordsForName): Added.
(WI.CSSKeywordCompletions.forProperty):
(WI.CSSKeywordCompletions.addCustomCompletions):

* UserInterface/Models/CSSProperty.js:
(WI.CSSProperty.isInheritedPropertyName):

LayoutTests:

* inspector/css/getSupportedCSSProperties-expected.txt:
* inspector/css/getSupportedCSSProperties.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236091 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/css/getSupportedCSSProperties-expected.txt
LayoutTests/inspector/css/getSupportedCSSProperties.html
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/CSS.json
Source/WebCore/ChangeLog
Source/WebCore/css/CSSPrimitiveValue.cpp
Source/WebCore/css/CSSProperty.h
Source/WebCore/css/CSSValuePool.cpp
Source/WebCore/css/makeprop.pl
Source/WebCore/css/makevalues.pl
Source/WebCore/inspector/agents/InspectorCSSAgent.cpp
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js
Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js
Source/WebInspectorUI/UserInterface/Models/CSSProperty.js