[Touch Bar Web API] Add support for menuitem tag
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Nov 2017 08:20:03 +0000 (08:20 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 4 Nov 2017 08:20:03 +0000 (08:20 +0000)
commit02e18763332edcf3debaf21ced70a3d3bd3790cc
tree4c6a493244d51b044f8992e1ed4b657d1e8fa87e
parent45ce357e99fd727eab151b65dc96fdc09d65c0e7
[Touch Bar Web API] Add support for menuitem tag
https://bugs.webkit.org/show_bug.cgi?id=179020

Patch by Aishwarya Nirmal <anirmal@apple.com> on 2017-11-04
Reviewed by Ryosuke Niwa.

Source/WebCore:

The Touch Bar Web API will make use of the menu and menuitem tags
to represent the NSTouchBar and NSTouchBarItem respectively.
Since WebKit currently does not offer support for the menuitem tag,
this change adds it in. There is a runtime flag for this tag, which
is set to false by default.

A specification for the menuitem element can be found at
https://www.w3.org/TR/2013/WD-html51-20130528/interactive-elements.html#the-menuitem-element.
More attributes of this element will be implemented in future patches.

Test: fast/html/menuitem-element.html

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* html/HTMLElementsAllInOne.cpp:
* html/HTMLMenuItemElement.cpp: Added.
(WebCore::HTMLMenuItemElement::HTMLMenuItemElement):
(WebCore::HTMLMenuItemElement::create):
* html/HTMLMenuItemElement.h: Added.
* html/HTMLMenuItemElement.idl: Added.
* html/HTMLTagNames.in:
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setMenuItemElementEnabled):
(WebCore::RuntimeEnabledFeatures::menuItemElementEnabled const):

Source/WebKit:

Adds in the MenuItemElementEnabled flag so that the menu item element is a runtime-
enabled feature. It has a default value of false.

* Shared/WebPreferences.yaml:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetMenuItemElementEnabled):
(WKPreferencesGetMenuItemElementEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:

Source/WebKitLegacy/mac:

Adds in properties and methods that allow the menuitem runtime feature
to be enabled or disabled.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(-[WebPreferences menuItemElementEnabled]):
(-[WebPreferences setMenuItemElementEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Tools:

Defines flags for the menu item test so that the element is recognized
only while its test is being run.

* DumpRenderTree/TestOptions.h:
* DumpRenderTree/TestOptions.mm:
(TestOptions::TestOptions):
* DumpRenderTree/mac/DumpRenderTree.mm:
(setWebPreferencesForTestOptions):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):
(WTR::updateTestOptionsFromTestHeader):
* WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::hasSameInitializationOptions const):

LayoutTests:

This test ensures that the menuitem element is recognized when
its runtime feature is turned on.

* fast/html/menuitem-element-expected.txt: Added.
* fast/html/menuitem-element.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
31 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/html/menuitem-element-expected.txt [new file with mode: 0644]
LayoutTests/fast/html/menuitem-element.html [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.cpp
Source/WebCore/DerivedSources.make
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/WebCoreBuiltinNames.h
Source/WebCore/html/HTMLElementsAllInOne.cpp
Source/WebCore/html/HTMLMenuItemElement.cpp [new file with mode: 0644]
Source/WebCore/html/HTMLMenuItemElement.h [new file with mode: 0644]
Source/WebCore/html/HTMLMenuItemElement.idl [new file with mode: 0644]
Source/WebCore/html/HTMLTagNames.in
Source/WebCore/page/RuntimeEnabledFeatures.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKit/UIProcess/API/C/WKPreferences.cpp
Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKitLegacy/mac/WebView/WebPreferences.mm
Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
Source/WebKitLegacy/mac/WebView/WebView.mm
Tools/ChangeLog
Tools/DumpRenderTree/TestOptions.h
Tools/DumpRenderTree/TestOptions.mm
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestOptions.h