[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)
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

index c599da5..91ef6b6 100644 (file)
@@ -1,3 +1,16 @@
+2017-11-04  Aishwarya Nirmal  <anirmal@apple.com>
+
+        [Touch Bar Web API] Add support for menuitem tag
+        https://bugs.webkit.org/show_bug.cgi?id=179020
+
+        Reviewed by Ryosuke Niwa.
+
+        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.
+
 2017-11-03  Youenn Fablet  <youenn@apple.com>
 
         Implement ServiceWorkerContainer.getRegistration
diff --git a/LayoutTests/fast/html/menuitem-element-expected.txt b/LayoutTests/fast/html/menuitem-element-expected.txt
new file mode 100644 (file)
index 0000000..1ea3bea
--- /dev/null
@@ -0,0 +1,11 @@
+Various tests for the menuitem element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+MenuItem is recognized:
+PASS document.createElement("menuitem") instanceof HTMLMenuItemElement is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/html/menuitem-element.html b/LayoutTests/fast/html/menuitem-element.html
new file mode 100644 (file)
index 0000000..06fb1c7
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableMenuItemElement=true ] -->
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+description('Various tests for the menuitem element.');
+
+debug('MenuItem is recognized:')
+shouldBeTrue('document.createElement("menuitem") instanceof HTMLMenuItemElement');
+
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
\ No newline at end of file
index 975e9df..5c4d1b3 100644 (file)
@@ -650,6 +650,7 @@ set(WebCore_NON_SVG_IDL_FILES
     html/HTMLMarqueeElement.idl
     html/HTMLMediaElement.idl
     html/HTMLMenuElement.idl
+    html/HTMLMenuItemElement.idl
     html/HTMLMetaElement.idl
     html/HTMLMeterElement.idl
     html/HTMLModElement.idl
index 4ef8378..91a2379 100644 (file)
@@ -1,3 +1,39 @@
+2017-11-04  Aishwarya Nirmal  <anirmal@apple.com>
+
+        [Touch Bar Web API] Add support for menuitem tag
+        https://bugs.webkit.org/show_bug.cgi?id=179020
+
+        Reviewed by Ryosuke Niwa.
+
+        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):
+
 2017-11-03  Zalan Bujtas  <zalan@apple.com>
 
         LayoutState should take RenderBox reference.
index e2ab09b..6c0cd63 100644 (file)
 #include "JSHTMLMediaElement.cpp"
 #include "JSHTMLMediaElementMediaSession.cpp"
 #include "JSHTMLMenuElement.cpp"
+#include "JSHTMLMenuItemElement.cpp"
 #include "JSHTMLMetaElement.cpp"
 #include "JSHTMLMeterElement.cpp"
 #include "JSHTMLModElement.cpp"
index 5c16c3c..4034abf 100644 (file)
@@ -563,6 +563,7 @@ JS_BINDING_IDLS = \
     $(WebCore)/html/HTMLMarqueeElement.idl \
     $(WebCore)/html/HTMLMediaElement.idl \
     $(WebCore)/html/HTMLMenuElement.idl \
+    $(WebCore)/html/HTMLMenuItemElement.idl \
     $(WebCore)/html/HTMLMetaElement.idl \
     $(WebCore)/html/HTMLMeterElement.idl \
     $(WebCore)/html/HTMLModElement.idl \
index d78699e..1f072b0 100644 (file)
@@ -953,6 +953,7 @@ html/HTMLMapElement.cpp
 html/HTMLMarqueeElement.cpp
 html/HTMLMediaElement.cpp
 html/HTMLMenuElement.cpp
+html/HTMLMenuItemElement.cpp
 html/HTMLMetaElement.cpp
 html/HTMLMeterElement.cpp
 html/HTMLModElement.cpp
@@ -2502,6 +2503,7 @@ JSHTMLMarqueeElement.cpp
 JSHTMLMediaElement.cpp
 JSHTMLMediaElementMediaSession.cpp
 JSHTMLMenuElement.cpp
+JSHTMLMenuItemElement.cpp
 JSHTMLMetaElement.cpp
 JSHTMLMeterElement.cpp
 JSHTMLModElement.cpp
index 1a0311c..301d810 100644 (file)
                2EDF369D122C94B4002F7D4E /* FileReaderSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EDF369B122C94B4002F7D4E /* FileReaderSync.h */; };
                2EF1BFEB121C9F4200C27627 /* FileStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EF1BFE9121C9F4200C27627 /* FileStream.h */; settings = {ATTRIBUTES = (Private, ); }; };
                2EF1BFF9121CB0CE00C27627 /* FileStreamClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EF1BFF8121CB0CE00C27627 /* FileStreamClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               2F31E0751FA3B62B00E059BA /* HTMLMenuItemElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 2F31E0711FA3B33B00E059BA /* HTMLMenuItemElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
                3103B7DF1DB01567008BB890 /* ColorHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 3103B7DE1DB01556008BB890 /* ColorHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
                31078CC71880AAB5008099DC /* OESTextureHalfFloatLinear.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31078CC21880A6A6008099DC /* OESTextureHalfFloatLinear.cpp */; };
                31078CC81880AABB008099DC /* OESTextureHalfFloatLinear.h in Headers */ = {isa = PBXBuildFile; fileRef = 31078CC31880A6A6008099DC /* OESTextureHalfFloatLinear.h */; };
                2EF1BFE8121C9F4200C27627 /* FileStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileStream.cpp; sourceTree = "<group>"; };
                2EF1BFE9121C9F4200C27627 /* FileStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileStream.h; sourceTree = "<group>"; };
                2EF1BFF8121CB0CE00C27627 /* FileStreamClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileStreamClient.h; sourceTree = "<group>"; };
+               2F31E0711FA3B33B00E059BA /* HTMLMenuItemElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLMenuItemElement.h; sourceTree = "<group>"; };
+               2F31E0731FA3B33C00E059BA /* HTMLMenuItemElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLMenuItemElement.cpp; sourceTree = "<group>"; };
+               2F31E0761FA3C10B00E059BA /* HTMLMenuItemElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLMenuItemElement.idl; sourceTree = "<group>"; };
                3103B7DE1DB01556008BB890 /* ColorHash.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ColorHash.h; sourceTree = "<group>"; };
                31055BB81E4FE18900EB604E /* WebKitFontFamilyNames.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitFontFamilyNames.in; sourceTree = "<group>"; };
                31078CC21880A6A6008099DC /* OESTextureHalfFloatLinear.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OESTextureHalfFloatLinear.cpp; sourceTree = "<group>"; };
                                A8EA79EC0A1916DF00A8EF5F /* HTMLMenuElement.cpp */,
                                A8EA79E80A1916DF00A8EF5F /* HTMLMenuElement.h */,
                                1AE2AE430A1D269E00B42B25 /* HTMLMenuElement.idl */,
+                               2F31E0731FA3B33C00E059BA /* HTMLMenuItemElement.cpp */,
+                               2F31E0711FA3B33B00E059BA /* HTMLMenuItemElement.h */,
+                               2F31E0761FA3C10B00E059BA /* HTMLMenuItemElement.idl */,
                                A871DC1B0A15205700B12A68 /* HTMLMetaElement.cpp */,
                                A871DC180A15205700B12A68 /* HTMLMetaElement.h */,
                                A80E79FC0A19C307007FB8C5 /* HTMLMetaElement.idl */,
                                CD5209E61B0BD9E10077184E /* HTMLMediaElementEnums.h in Headers */,
                                C937FE8D1B1F6821008ECC5D /* HTMLMediaElementMediaSession.h in Headers */,
                                A8EA79F40A1916DF00A8EF5F /* HTMLMenuElement.h in Headers */,
+                               2F31E0751FA3B62B00E059BA /* HTMLMenuItemElement.h in Headers */,
                                2BE8E2C712A589EC00FAD550 /* HTMLMetaCharsetParser.h in Headers */,
                                A871DC240A15205700B12A68 /* HTMLMetaElement.h in Headers */,
                                A454424B119B3661009BE912 /* HTMLMeterElement.h in Headers */,
index 369a102..f1007f7 100644 (file)
@@ -62,6 +62,7 @@ namespace WebCore {
     macro(GamepadEvent) \
     macro(HTMLAttachmentElement) \
     macro(HTMLAudioElement) \
+    macro(HTMLMenuItemElement) \
     macro(HTMLSlotElement) \
     macro(Headers) \
     macro(IDBCursor) \
index dd663d2..25707f6 100644 (file)
@@ -76,6 +76,7 @@
 #include "HTMLMarqueeElement.cpp"
 #include "HTMLMediaElement.cpp"
 #include "HTMLMenuElement.cpp"
+#include "HTMLMenuItemElement.cpp"
 #include "HTMLMetaElement.cpp"
 #include "HTMLMeterElement.cpp"
 #include "HTMLModElement.cpp"
diff --git a/Source/WebCore/html/HTMLMenuItemElement.cpp b/Source/WebCore/html/HTMLMenuItemElement.cpp
new file mode 100644 (file)
index 0000000..19b1d58
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "HTMLMenuItemElement.h"
+
+#include "HTMLNames.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+    
+inline HTMLMenuItemElement::HTMLMenuItemElement(const QualifiedName& tagName, Document& document)
+    : HTMLElement(tagName, document)
+{
+    ASSERT(hasTagName(menuitemTag));
+}
+    
+Ref<HTMLMenuItemElement> HTMLMenuItemElement::create(const QualifiedName& tagName, Document& document)
+{
+    return adoptRef(*new HTMLMenuItemElement(tagName, document));
+}
+    
+}
diff --git a/Source/WebCore/html/HTMLMenuItemElement.h b/Source/WebCore/html/HTMLMenuItemElement.h
new file mode 100644 (file)
index 0000000..e24cfd2
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "HTMLElement.h"
+
+namespace WebCore {
+
+class HTMLMenuItemElement final : public HTMLElement {
+public:
+    static Ref<HTMLMenuItemElement> create(const QualifiedName&, Document&);
+    
+private:
+    HTMLMenuItemElement(const QualifiedName&, Document&);
+};
+
+} // namespace WebCore
diff --git a/Source/WebCore/html/HTMLMenuItemElement.idl b/Source/WebCore/html/HTMLMenuItemElement.idl
new file mode 100644 (file)
index 0000000..52e4cea
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+[
+    EnabledAtRuntime = MenuItemElement,
+] interface HTMLMenuItemElement : HTMLElement {
+};
index 5c7c8d7..094cef2 100644 (file)
@@ -83,6 +83,7 @@ map
 mark interfaceName=HTMLElement
 marquee
 menu
+menuitem interfaceName=HTMLMenuItemElement, runtimeEnabled=menuItemElement
 meta
 meter interfaceName=HTMLMeterElement, conditional=METER_ELEMENT
 nav interfaceName=HTMLElement
index 8adc913..170df68 100644 (file)
@@ -73,6 +73,9 @@ public:
     void setCustomElementsEnabled(bool areEnabled) { m_areCustomElementsEnabled = areEnabled; }
     bool customElementsEnabled() const { return m_areCustomElementsEnabled; }
 
+    void setMenuItemElementEnabled(bool isEnabled) { m_isMenuItemElementEnabled = isEnabled; }
+    bool menuItemElementEnabled() const { return m_isMenuItemElementEnabled; }
+    
     void setDirectoryUploadEnabled(bool isEnabled) { m_isDirectoryUploadEnabled = isEnabled; }
     bool directoryUploadEnabled() const { return m_isDirectoryUploadEnabled; }
 
@@ -240,6 +243,7 @@ private:
     bool m_isDisplayContentsEnabled { false };
     bool m_isShadowDOMEnabled { true };
     bool m_areCustomElementsEnabled { true };
+    bool m_isMenuItemElementEnabled { false };
     bool m_isDirectoryUploadEnabled { false };
     bool m_areDataTransferItemsEnabled { false };
     bool m_inputEventsEnabled { true };
index eaddbe9..24d3dfa 100644 (file)
@@ -1,3 +1,19 @@
+2017-11-04  Aishwarya Nirmal  <anirmal@apple.com>
+
+        [Touch Bar Web API] Add support for menuitem tag
+        https://bugs.webkit.org/show_bug.cgi?id=179020
+
+        Reviewed by Ryosuke Niwa.
+
+        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:
+
 2017-11-03  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed, rolling out r224438.
index c434e5f..93eea38 100644 (file)
@@ -639,6 +639,11 @@ CustomElementsEnabled:
   defaultValue: true
   webcoreBinding: RuntimeEnabledFeatures
 
+MenuItemElementEnabled:
+  type: bool
+  defaultValue: false
+  webcoreBinding: RuntimeEnabledFeatures
+
 EncryptedMediaAPIEnabled:
   type: bool
   defaultValue: false
index 8d2626f..e254968 100644 (file)
@@ -1720,6 +1720,16 @@ bool WKPreferencesGetIntersectionObserverEnabled(WKPreferencesRef preferencesRef
     return toImpl(preferencesRef)->intersectionObserverEnabled();
 }
 
+void WKPreferencesSetMenuItemElementEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+    return toImpl(preferencesRef)->setMenuItemElementEnabled(flag);
+}
+
+bool WKPreferencesGetMenuItemElementEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->menuItemElementEnabled();
+}
+
 void WKPreferencesSetUserTimingEnabled(WKPreferencesRef preferencesRef, bool flag)
 {
     toImpl(preferencesRef)->setUserTimingEnabled(flag);
index 0984486..d2171f5 100644 (file)
@@ -470,6 +470,10 @@ WK_EXPORT void WKPreferencesSetIntersectionObserverEnabled(WKPreferencesRef, boo
 WK_EXPORT bool WKPreferencesGetIntersectionObserverEnabled(WKPreferencesRef);
 
 // Defaults to false
+WK_EXPORT void WKPreferencesSetMenuItemElementEnabled(WKPreferencesRef, bool flag);
+WK_EXPORT bool WKPreferencesGetMenuItemElementEnabled(WKPreferencesRef);
+    
+// Defaults to false
 WK_EXPORT void WKPreferencesSetDisplayContentsEnabled(WKPreferencesRef, bool flag);
 WK_EXPORT bool WKPreferencesGetDisplayContentsEnabled(WKPreferencesRef);
     
index 225c8b7..ad3eb68 100644 (file)
@@ -1,3 +1,21 @@
+2017-11-04  Aishwarya Nirmal  <anirmal@apple.com>
+
+        [Touch Bar Web API] Add support for menuitem tag
+        https://bugs.webkit.org/show_bug.cgi?id=179020
+
+        Reviewed by Ryosuke Niwa.
+
+        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:]):
+
 2017-11-02  Alex Christensen  <achristensen@webkit.org>
 
         Use CompletionHandlers for redirects
index bd94f64..4afc1c1 100644 (file)
 #define WebKitMediaCaptureRequiresSecureConnectionPreferenceKey @"WebKitMediaCaptureRequiresSecureConnection"
 #define WebKitAttachmentElementEnabledPreferenceKey @"WebKitAttachmentElementEnabled"
 #define WebKitIntersectionObserverEnabledPreferenceKey @"WebKitIntersectionObserverEnabled"
+#define WebKitMenuItemElementEnabledPreferenceKey @"WebKitMenuItemElementEnabled"
 #define WebKitDisplayContentsEnabledPreferenceKey @"WebKitDisplayContentsEnabled"
 #define WebKitUserTimingEnabledPreferenceKey @"WebKitUserTimingEnabled"
 #define WebKitResourceTimingEnabledPreferenceKey @"WebKitResourceTimingEnabled"
index a09548c..12ee510 100644 (file)
@@ -3103,6 +3103,16 @@ static NSString *classIBCreatorID = nil;
     [self _setBoolValue:flag forKey:WebKitIntersectionObserverEnabledPreferenceKey];
 }
 
+- (BOOL)menuItemElementEnabled
+{
+    return [self _boolValueForKey:WebKitMenuItemElementEnabledPreferenceKey];
+}
+
+- (void)setMenuItemElementEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitMenuItemElementEnabledPreferenceKey];
+}
+
 - (BOOL)displayContentsEnabled
 {
     return [self _boolValueForKey:WebKitDisplayContentsEnabledPreferenceKey];
index 79084c9..414fcd3 100644 (file)
@@ -581,6 +581,7 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification;
 @property (nonatomic) BOOL attachmentElementEnabled;
 @property (nonatomic) BOOL allowsInlineMediaPlaybackAfterFullscreen;
 @property (nonatomic) BOOL intersectionObserverEnabled;
+@property (nonatomic) BOOL menuItemElementEnabled;
 @property (nonatomic) BOOL displayContentsEnabled;
 @property (nonatomic) BOOL userTimingEnabled;
 @property (nonatomic) BOOL resourceTimingEnabled;
index 1a1e281..49e726e 100644 (file)
@@ -3038,7 +3038,8 @@ static bool needsSelfRetainWhileLoadingQuirk()
     RuntimeEnabledFeatures::sharedFeatures().setCredentialManagementEnabled(preferences.credentialManagementEnabled);
     RuntimeEnabledFeatures::sharedFeatures().setIsSecureContextAttributeEnabled(preferences.isSecureContextAttributeEnabled);
     RuntimeEnabledFeatures::sharedFeatures().setDirectoryUploadEnabled([preferences directoryUploadEnabled]);
-
+    RuntimeEnabledFeatures::sharedFeatures().setMenuItemElementEnabled([preferences menuItemElementEnabled]);
+    
 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
     RuntimeEnabledFeatures::sharedFeatures().setLegacyEncryptedMediaAPIEnabled(preferences.legacyEncryptedMediaAPIEnabled);
 #endif
index 04a9f23..837eefd 100644 (file)
@@ -1,3 +1,24 @@
+2017-11-04  Aishwarya Nirmal  <anirmal@apple.com>
+
+        [Touch Bar Web API] Add support for menuitem tag
+        https://bugs.webkit.org/show_bug.cgi?id=179020
+
+        Reviewed by Ryosuke Niwa.
+
+        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):
+
 2017-11-03  Andy Estes  <aestes@apple.com>
 
         [iOS] Append the platform name to the product directory on all embedded platforms
index 04df4cc..7372892 100644 (file)
@@ -31,6 +31,7 @@
 struct TestOptions {
     bool enableAttachmentElement { false };
     bool enableIntersectionObserver { false };
+    bool enableMenuItemElement { false };
     bool enableModernMediaControls { true };
     bool enablePointerLock { false };
     bool enableCredentialManagement { false };
index e978367..157965e 100644 (file)
@@ -82,6 +82,8 @@ TestOptions::TestOptions(NSURL *testURL, const TestCommand& command)
             this->enableAttachmentElement = parseBooleanTestHeaderValue(value);
         else if (key == "enableIntersectionObserver")
             this->enableIntersectionObserver = parseBooleanTestHeaderValue(value);
+        else if (key == "enableMenuItemElement")
+            this->enableMenuItemElement = parseBooleanTestHeaderValue(value);
         else if (key == "enableModernMediaControls")
             this->enableModernMediaControls = parseBooleanTestHeaderValue(value);
         else if (key == "enablePointerLock")
index 7132a45..f14ab20 100644 (file)
@@ -983,6 +983,7 @@ static void setWebPreferencesForTestOptions(const TestOptions& options)
 
     preferences.attachmentElementEnabled = options.enableAttachmentElement;
     preferences.intersectionObserverEnabled = options.enableIntersectionObserver;
+    preferences.menuItemElementEnabled = options.enableMenuItemElement;
     preferences.modernMediaControlsEnabled = options.enableModernMediaControls;
     preferences.credentialManagementEnabled = options.enableCredentialManagement;
     preferences.isSecureContextAttributeEnabled = options.enableIsSecureContextAttribute;
index 90df04a..e679874 100644 (file)
@@ -689,6 +689,7 @@ void TestController::resetPreferencesToConsistentValues(const TestOptions& optio
     WKPreferencesSetNeedsSiteSpecificQuirks(preferences, options.needsSiteSpecificQuirks);
     WKPreferencesSetAttachmentElementEnabled(preferences, options.enableAttachmentElement);
     WKPreferencesSetIntersectionObserverEnabled(preferences, options.enableIntersectionObserver);
+    WKPreferencesSetMenuItemElementEnabled(preferences, options.enableMenuItemElement);
     WKPreferencesSetModernMediaControlsEnabled(preferences, options.enableModernMediaControls);
     WKPreferencesSetCredentialManagementEnabled(preferences, options.enableCredentialManagement);
     WKPreferencesSetIsSecureContextAttributeEnabled(preferences, options.enableIsSecureContextAttribute);
@@ -1040,6 +1041,8 @@ static void updateTestOptionsFromTestHeader(TestOptions& testOptions, const std:
             testOptions.enableAttachmentElement = parseBooleanTestHeaderValue(value);
         if (key == "enableIntersectionObserver")
             testOptions.enableIntersectionObserver = parseBooleanTestHeaderValue(value);
+        if (key == "enableMenuItemElement")
+            testOptions.enableMenuItemElement = parseBooleanTestHeaderValue(value);
         if (key == "enableModernMediaControls")
             testOptions.enableModernMediaControls = parseBooleanTestHeaderValue(value);
         if (key == "enablePointerLock")
index f60951b..e652638 100644 (file)
@@ -45,6 +45,7 @@ struct TestOptions {
     bool useCharacterSelectionGranularity { false };
     bool enableAttachmentElement { false };
     bool enableIntersectionObserver { false };
+    bool enableMenuItemElement { false };
     bool enableModernMediaControls { true };
     bool enablePointerLock { false };
     bool enableCredentialManagement { false };
@@ -71,6 +72,7 @@ struct TestOptions {
             || useCharacterSelectionGranularity != options.useCharacterSelectionGranularity
             || enableAttachmentElement != options.enableAttachmentElement
             || enableIntersectionObserver != options.enableIntersectionObserver
+            || enableMenuItemElement != options.enableMenuItemElement
             || enableModernMediaControls != options.enableModernMediaControls
             || enablePointerLock != options.enablePointerLock
             || enableCredentialManagement != options.enableCredentialManagement