Skip to content

Commit a0cd8b9

Browse files
[Touch Bar Web API] Add support for menuitem tag
https://bugs.webkit.org/show_bug.cgi?id=179020 Patch by Aishwarya Nirmal <[email protected]> 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: http://svn.webkit.org/repository/webkit/trunk@224457 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 94ca07e commit a0cd8b9

31 files changed

+307
-1
lines changed

LayoutTests/ChangeLog

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2017-11-04 Aishwarya Nirmal <[email protected]>
2+
3+
[Touch Bar Web API] Add support for menuitem tag
4+
https://bugs.webkit.org/show_bug.cgi?id=179020
5+
6+
Reviewed by Ryosuke Niwa.
7+
8+
This test ensures that the menuitem element is recognized when
9+
its runtime feature is turned on.
10+
11+
* fast/html/menuitem-element-expected.txt: Added.
12+
* fast/html/menuitem-element.html: Added.
13+
114
2017-11-03 Youenn Fablet <[email protected]>
215

316
Implement ServiceWorkerContainer.getRegistration
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Various tests for the menuitem element.
2+
3+
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4+
5+
6+
MenuItem is recognized:
7+
PASS document.createElement("menuitem") instanceof HTMLMenuItemElement is true
8+
PASS successfullyParsed is true
9+
10+
TEST COMPLETE
11+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html><!-- webkit-test-runner [ enableMenuItemElement=true ] -->
2+
<html>
3+
<head>
4+
<script src="../../resources/js-test-pre.js"></script>
5+
</head>
6+
<body>
7+
<script>
8+
description('Various tests for the menuitem element.');
9+
10+
debug('MenuItem is recognized:')
11+
shouldBeTrue('document.createElement("menuitem") instanceof HTMLMenuItemElement');
12+
13+
</script>
14+
<script src="../../resources/js-test-post.js"></script>
15+
</body>
16+
</html>

Source/WebCore/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,7 @@ set(WebCore_NON_SVG_IDL_FILES
650650
html/HTMLMarqueeElement.idl
651651
html/HTMLMediaElement.idl
652652
html/HTMLMenuElement.idl
653+
html/HTMLMenuItemElement.idl
653654
html/HTMLMetaElement.idl
654655
html/HTMLMeterElement.idl
655656
html/HTMLModElement.idl

Source/WebCore/ChangeLog

+36
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
2017-11-04 Aishwarya Nirmal <[email protected]>
2+
3+
[Touch Bar Web API] Add support for menuitem tag
4+
https://bugs.webkit.org/show_bug.cgi?id=179020
5+
6+
Reviewed by Ryosuke Niwa.
7+
8+
The Touch Bar Web API will make use of the menu and menuitem tags
9+
to represent the NSTouchBar and NSTouchBarItem respectively.
10+
Since WebKit currently does not offer support for the menuitem tag,
11+
this change adds it in. There is a runtime flag for this tag, which
12+
is set to false by default.
13+
14+
A specification for the menuitem element can be found at
15+
https://www.w3.org/TR/2013/WD-html51-20130528/interactive-elements.html#the-menuitem-element.
16+
More attributes of this element will be implemented in future patches.
17+
18+
Test: fast/html/menuitem-element.html
19+
20+
* CMakeLists.txt:
21+
* DerivedSources.cpp:
22+
* DerivedSources.make:
23+
* Sources.txt:
24+
* WebCore.xcodeproj/project.pbxproj:
25+
* bindings/js/WebCoreBuiltinNames.h:
26+
* html/HTMLElementsAllInOne.cpp:
27+
* html/HTMLMenuItemElement.cpp: Added.
28+
(WebCore::HTMLMenuItemElement::HTMLMenuItemElement):
29+
(WebCore::HTMLMenuItemElement::create):
30+
* html/HTMLMenuItemElement.h: Added.
31+
* html/HTMLMenuItemElement.idl: Added.
32+
* html/HTMLTagNames.in:
33+
* page/RuntimeEnabledFeatures.h:
34+
(WebCore::RuntimeEnabledFeatures::setMenuItemElementEnabled):
35+
(WebCore::RuntimeEnabledFeatures::menuItemElementEnabled const):
36+
137
2017-11-03 Zalan Bujtas <[email protected]>
238

339
LayoutState should take RenderBox reference.

Source/WebCore/DerivedSources.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@
254254
#include "JSHTMLMediaElement.cpp"
255255
#include "JSHTMLMediaElementMediaSession.cpp"
256256
#include "JSHTMLMenuElement.cpp"
257+
#include "JSHTMLMenuItemElement.cpp"
257258
#include "JSHTMLMetaElement.cpp"
258259
#include "JSHTMLMeterElement.cpp"
259260
#include "JSHTMLModElement.cpp"

Source/WebCore/DerivedSources.make

+1
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ JS_BINDING_IDLS = \
563563
$(WebCore)/html/HTMLMarqueeElement.idl \
564564
$(WebCore)/html/HTMLMediaElement.idl \
565565
$(WebCore)/html/HTMLMenuElement.idl \
566+
$(WebCore)/html/HTMLMenuItemElement.idl \
566567
$(WebCore)/html/HTMLMetaElement.idl \
567568
$(WebCore)/html/HTMLMeterElement.idl \
568569
$(WebCore)/html/HTMLModElement.idl \

Source/WebCore/Sources.txt

+2
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,7 @@ html/HTMLMapElement.cpp
953953
html/HTMLMarqueeElement.cpp
954954
html/HTMLMediaElement.cpp
955955
html/HTMLMenuElement.cpp
956+
html/HTMLMenuItemElement.cpp
956957
html/HTMLMetaElement.cpp
957958
html/HTMLMeterElement.cpp
958959
html/HTMLModElement.cpp
@@ -2502,6 +2503,7 @@ JSHTMLMarqueeElement.cpp
25022503
JSHTMLMediaElement.cpp
25032504
JSHTMLMediaElementMediaSession.cpp
25042505
JSHTMLMenuElement.cpp
2506+
JSHTMLMenuItemElement.cpp
25052507
JSHTMLMetaElement.cpp
25062508
JSHTMLMeterElement.cpp
25072509
JSHTMLModElement.cpp

Source/WebCore/WebCore.xcodeproj/project.pbxproj

+8
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,7 @@
803803
2EDF369D122C94B4002F7D4E /* FileReaderSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDF369B122C94B4002F7D4E /* FileReaderSync.h */; };
804804
2EF1BFEB121C9F4200C27627 /* FileStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EF1BFE9121C9F4200C27627 /* FileStream.h */; settings = {ATTRIBUTES = (Private, ); }; };
805805
2EF1BFF9121CB0CE00C27627 /* FileStreamClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EF1BFF8121CB0CE00C27627 /* FileStreamClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
806+
2F31E0751FA3B62B00E059BA /* HTMLMenuItemElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 2F31E0711FA3B33B00E059BA /* HTMLMenuItemElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
806807
3103B7DF1DB01567008BB890 /* ColorHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 3103B7DE1DB01556008BB890 /* ColorHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
807808
31078CC71880AAB5008099DC /* OESTextureHalfFloatLinear.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31078CC21880A6A6008099DC /* OESTextureHalfFloatLinear.cpp */; };
808809
31078CC81880AABB008099DC /* OESTextureHalfFloatLinear.h in Headers */ = {isa = PBXBuildFile; fileRef = 31078CC31880A6A6008099DC /* OESTextureHalfFloatLinear.h */; };
@@ -6453,6 +6454,9 @@
64536454
2EF1BFE8121C9F4200C27627 /* FileStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileStream.cpp; sourceTree = "<group>"; };
64546455
2EF1BFE9121C9F4200C27627 /* FileStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileStream.h; sourceTree = "<group>"; };
64556456
2EF1BFF8121CB0CE00C27627 /* FileStreamClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileStreamClient.h; sourceTree = "<group>"; };
6457+
2F31E0711FA3B33B00E059BA /* HTMLMenuItemElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLMenuItemElement.h; sourceTree = "<group>"; };
6458+
2F31E0731FA3B33C00E059BA /* HTMLMenuItemElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLMenuItemElement.cpp; sourceTree = "<group>"; };
6459+
2F31E0761FA3C10B00E059BA /* HTMLMenuItemElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLMenuItemElement.idl; sourceTree = "<group>"; };
64566460
3103B7DE1DB01556008BB890 /* ColorHash.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ColorHash.h; sourceTree = "<group>"; };
64576461
31055BB81E4FE18900EB604E /* WebKitFontFamilyNames.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitFontFamilyNames.in; sourceTree = "<group>"; };
64586462
31078CC21880A6A6008099DC /* OESTextureHalfFloatLinear.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OESTextureHalfFloatLinear.cpp; sourceTree = "<group>"; };
@@ -19614,6 +19618,9 @@
1961419618
A8EA79EC0A1916DF00A8EF5F /* HTMLMenuElement.cpp */,
1961519619
A8EA79E80A1916DF00A8EF5F /* HTMLMenuElement.h */,
1961619620
1AE2AE430A1D269E00B42B25 /* HTMLMenuElement.idl */,
19621+
2F31E0731FA3B33C00E059BA /* HTMLMenuItemElement.cpp */,
19622+
2F31E0711FA3B33B00E059BA /* HTMLMenuItemElement.h */,
19623+
2F31E0761FA3C10B00E059BA /* HTMLMenuItemElement.idl */,
1961719624
A871DC1B0A15205700B12A68 /* HTMLMetaElement.cpp */,
1961819625
A871DC180A15205700B12A68 /* HTMLMetaElement.h */,
1961919626
A80E79FC0A19C307007FB8C5 /* HTMLMetaElement.idl */,
@@ -26982,6 +26989,7 @@
2698226989
CD5209E61B0BD9E10077184E /* HTMLMediaElementEnums.h in Headers */,
2698326990
C937FE8D1B1F6821008ECC5D /* HTMLMediaElementMediaSession.h in Headers */,
2698426991
A8EA79F40A1916DF00A8EF5F /* HTMLMenuElement.h in Headers */,
26992+
2F31E0751FA3B62B00E059BA /* HTMLMenuItemElement.h in Headers */,
2698526993
2BE8E2C712A589EC00FAD550 /* HTMLMetaCharsetParser.h in Headers */,
2698626994
A871DC240A15205700B12A68 /* HTMLMetaElement.h in Headers */,
2698726995
A454424B119B3661009BE912 /* HTMLMeterElement.h in Headers */,

Source/WebCore/bindings/js/WebCoreBuiltinNames.h

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ namespace WebCore {
6262
macro(GamepadEvent) \
6363
macro(HTMLAttachmentElement) \
6464
macro(HTMLAudioElement) \
65+
macro(HTMLMenuItemElement) \
6566
macro(HTMLSlotElement) \
6667
macro(Headers) \
6768
macro(IDBCursor) \

Source/WebCore/html/HTMLElementsAllInOne.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
#include "HTMLMarqueeElement.cpp"
7777
#include "HTMLMediaElement.cpp"
7878
#include "HTMLMenuElement.cpp"
79+
#include "HTMLMenuItemElement.cpp"
7980
#include "HTMLMetaElement.cpp"
8081
#include "HTMLMeterElement.cpp"
8182
#include "HTMLModElement.cpp"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (C) 2017 Apple Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23+
* THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
26+
#include "config.h"
27+
#include "HTMLMenuItemElement.h"
28+
29+
#include "HTMLNames.h"
30+
31+
namespace WebCore {
32+
33+
using namespace HTMLNames;
34+
35+
inline HTMLMenuItemElement::HTMLMenuItemElement(const QualifiedName& tagName, Document& document)
36+
: HTMLElement(tagName, document)
37+
{
38+
ASSERT(hasTagName(menuitemTag));
39+
}
40+
41+
Ref<HTMLMenuItemElement> HTMLMenuItemElement::create(const QualifiedName& tagName, Document& document)
42+
{
43+
return adoptRef(*new HTMLMenuItemElement(tagName, document));
44+
}
45+
46+
}
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (C) 2017 Apple Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23+
* THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
26+
#pragma once
27+
28+
#include "HTMLElement.h"
29+
30+
namespace WebCore {
31+
32+
class HTMLMenuItemElement final : public HTMLElement {
33+
public:
34+
static Ref<HTMLMenuItemElement> create(const QualifiedName&, Document&);
35+
36+
private:
37+
HTMLMenuItemElement(const QualifiedName&, Document&);
38+
};
39+
40+
} // namespace WebCore
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright (C) 2017 Apple Inc. All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
* 1. Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* 2. Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
*
13+
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17+
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23+
* THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
[
26+
EnabledAtRuntime = MenuItemElement,
27+
] interface HTMLMenuItemElement : HTMLElement {
28+
};

Source/WebCore/html/HTMLTagNames.in

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ map
8383
mark interfaceName=HTMLElement
8484
marquee
8585
menu
86+
menuitem interfaceName=HTMLMenuItemElement, runtimeEnabled=menuItemElement
8687
meta
8788
meter interfaceName=HTMLMeterElement, conditional=METER_ELEMENT
8889
nav interfaceName=HTMLElement

Source/WebCore/page/RuntimeEnabledFeatures.h

+4
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ class RuntimeEnabledFeatures {
7373
void setCustomElementsEnabled(bool areEnabled) { m_areCustomElementsEnabled = areEnabled; }
7474
bool customElementsEnabled() const { return m_areCustomElementsEnabled; }
7575

76+
void setMenuItemElementEnabled(bool isEnabled) { m_isMenuItemElementEnabled = isEnabled; }
77+
bool menuItemElementEnabled() const { return m_isMenuItemElementEnabled; }
78+
7679
void setDirectoryUploadEnabled(bool isEnabled) { m_isDirectoryUploadEnabled = isEnabled; }
7780
bool directoryUploadEnabled() const { return m_isDirectoryUploadEnabled; }
7881

@@ -240,6 +243,7 @@ class RuntimeEnabledFeatures {
240243
bool m_isDisplayContentsEnabled { false };
241244
bool m_isShadowDOMEnabled { true };
242245
bool m_areCustomElementsEnabled { true };
246+
bool m_isMenuItemElementEnabled { false };
243247
bool m_isDirectoryUploadEnabled { false };
244248
bool m_areDataTransferItemsEnabled { false };
245249
bool m_inputEventsEnabled { true };

Source/WebKit/ChangeLog

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
2017-11-04 Aishwarya Nirmal <[email protected]>
2+
3+
[Touch Bar Web API] Add support for menuitem tag
4+
https://bugs.webkit.org/show_bug.cgi?id=179020
5+
6+
Reviewed by Ryosuke Niwa.
7+
8+
Adds in the MenuItemElementEnabled flag so that the menu item element is a runtime-
9+
enabled feature. It has a default value of false.
10+
11+
* Shared/WebPreferences.yaml:
12+
* UIProcess/API/C/WKPreferences.cpp:
13+
(WKPreferencesSetMenuItemElementEnabled):
14+
(WKPreferencesGetMenuItemElementEnabled):
15+
* UIProcess/API/C/WKPreferencesRefPrivate.h:
16+
117
2017-11-03 Chris Dumez <[email protected]>
218

319
Unreviewed, rolling out r224438.

Source/WebKit/Shared/WebPreferences.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,11 @@ CustomElementsEnabled:
639639
defaultValue: true
640640
webcoreBinding: RuntimeEnabledFeatures
641641

642+
MenuItemElementEnabled:
643+
type: bool
644+
defaultValue: false
645+
webcoreBinding: RuntimeEnabledFeatures
646+
642647
EncryptedMediaAPIEnabled:
643648
type: bool
644649
defaultValue: false

Source/WebKit/UIProcess/API/C/WKPreferences.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -1720,6 +1720,16 @@ bool WKPreferencesGetIntersectionObserverEnabled(WKPreferencesRef preferencesRef
17201720
return toImpl(preferencesRef)->intersectionObserverEnabled();
17211721
}
17221722

1723+
void WKPreferencesSetMenuItemElementEnabled(WKPreferencesRef preferencesRef, bool flag)
1724+
{
1725+
return toImpl(preferencesRef)->setMenuItemElementEnabled(flag);
1726+
}
1727+
1728+
bool WKPreferencesGetMenuItemElementEnabled(WKPreferencesRef preferencesRef)
1729+
{
1730+
return toImpl(preferencesRef)->menuItemElementEnabled();
1731+
}
1732+
17231733
void WKPreferencesSetUserTimingEnabled(WKPreferencesRef preferencesRef, bool flag)
17241734
{
17251735
toImpl(preferencesRef)->setUserTimingEnabled(flag);

Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h

+4
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,10 @@ WK_EXPORT bool WKPreferencesGetAttachmentElementEnabled(WKPreferencesRef prefere
469469
WK_EXPORT void WKPreferencesSetIntersectionObserverEnabled(WKPreferencesRef, bool flag);
470470
WK_EXPORT bool WKPreferencesGetIntersectionObserverEnabled(WKPreferencesRef);
471471

472+
// Defaults to false
473+
WK_EXPORT void WKPreferencesSetMenuItemElementEnabled(WKPreferencesRef, bool flag);
474+
WK_EXPORT bool WKPreferencesGetMenuItemElementEnabled(WKPreferencesRef);
475+
472476
// Defaults to false
473477
WK_EXPORT void WKPreferencesSetDisplayContentsEnabled(WKPreferencesRef, bool flag);
474478
WK_EXPORT bool WKPreferencesGetDisplayContentsEnabled(WKPreferencesRef);

0 commit comments

Comments
 (0)