Title: [224457] trunk
Revision
224457
Author
[email protected]
Date
2017-11-04 01:20:03 -0700 (Sat, 04 Nov 2017)

Log Message

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (224456 => 224457)


--- trunk/LayoutTests/ChangeLog	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/LayoutTests/ChangeLog	2017-11-04 08:20:03 UTC (rev 224457)
@@ -1,3 +1,16 @@
+2017-11-04  Aishwarya Nirmal  <[email protected]>
+
+        [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  <[email protected]>
 
         Implement ServiceWorkerContainer.getRegistration

Added: trunk/LayoutTests/fast/html/menuitem-element-expected.txt (0 => 224457)


--- trunk/LayoutTests/fast/html/menuitem-element-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/html/menuitem-element-expected.txt	2017-11-04 08:20:03 UTC (rev 224457)
@@ -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
+

Added: trunk/LayoutTests/fast/html/menuitem-element.html (0 => 224457)


--- trunk/LayoutTests/fast/html/menuitem-element.html	                        (rev 0)
+++ trunk/LayoutTests/fast/html/menuitem-element.html	2017-11-04 08:20:03 UTC (rev 224457)
@@ -0,0 +1,16 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableMenuItemElement=true ] -->
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script>
+description('Various tests for the menuitem element.');
+
+debug('MenuItem is recognized:')
+shouldBeTrue('document.createElement("menuitem") instanceof HTMLMenuItemElement');
+
+</script>
+<script src=""
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/CMakeLists.txt (224456 => 224457)


--- trunk/Source/WebCore/CMakeLists.txt	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebCore/CMakeLists.txt	2017-11-04 08:20:03 UTC (rev 224457)
@@ -650,6 +650,7 @@
     html/HTMLMarqueeElement.idl
     html/HTMLMediaElement.idl
     html/HTMLMenuElement.idl
+    html/HTMLMenuItemElement.idl
     html/HTMLMetaElement.idl
     html/HTMLMeterElement.idl
     html/HTMLModElement.idl

Modified: trunk/Source/WebCore/ChangeLog (224456 => 224457)


--- trunk/Source/WebCore/ChangeLog	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebCore/ChangeLog	2017-11-04 08:20:03 UTC (rev 224457)
@@ -1,3 +1,39 @@
+2017-11-04  Aishwarya Nirmal  <[email protected]>
+
+        [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  <[email protected]>
 
         LayoutState should take RenderBox reference.

Modified: trunk/Source/WebCore/DerivedSources.cpp (224456 => 224457)


--- trunk/Source/WebCore/DerivedSources.cpp	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebCore/DerivedSources.cpp	2017-11-04 08:20:03 UTC (rev 224457)
@@ -254,6 +254,7 @@
 #include "JSHTMLMediaElement.cpp"
 #include "JSHTMLMediaElementMediaSession.cpp"
 #include "JSHTMLMenuElement.cpp"
+#include "JSHTMLMenuItemElement.cpp"
 #include "JSHTMLMetaElement.cpp"
 #include "JSHTMLMeterElement.cpp"
 #include "JSHTMLModElement.cpp"

Modified: trunk/Source/WebCore/DerivedSources.make (224456 => 224457)


--- trunk/Source/WebCore/DerivedSources.make	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebCore/DerivedSources.make	2017-11-04 08:20:03 UTC (rev 224457)
@@ -563,6 +563,7 @@
     $(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 \

Modified: trunk/Source/WebCore/Sources.txt (224456 => 224457)


--- trunk/Source/WebCore/Sources.txt	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebCore/Sources.txt	2017-11-04 08:20:03 UTC (rev 224457)
@@ -953,6 +953,7 @@
 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 @@
 JSHTMLMediaElement.cpp
 JSHTMLMediaElementMediaSession.cpp
 JSHTMLMenuElement.cpp
+JSHTMLMenuItemElement.cpp
 JSHTMLMetaElement.cpp
 JSHTMLMeterElement.cpp
 JSHTMLModElement.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (224456 => 224457)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-11-04 08:20:03 UTC (rev 224457)
@@ -803,6 +803,7 @@
 		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 */; };
@@ -6453,6 +6454,9 @@
 		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>"; };
@@ -19614,6 +19618,9 @@
 				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 */,
@@ -26982,6 +26989,7 @@
 				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 */,

Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (224456 => 224457)


--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2017-11-04 08:20:03 UTC (rev 224457)
@@ -62,6 +62,7 @@
     macro(GamepadEvent) \
     macro(HTMLAttachmentElement) \
     macro(HTMLAudioElement) \
+    macro(HTMLMenuItemElement) \
     macro(HTMLSlotElement) \
     macro(Headers) \
     macro(IDBCursor) \

Modified: trunk/Source/WebCore/html/HTMLElementsAllInOne.cpp (224456 => 224457)


--- trunk/Source/WebCore/html/HTMLElementsAllInOne.cpp	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebCore/html/HTMLElementsAllInOne.cpp	2017-11-04 08:20:03 UTC (rev 224457)
@@ -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"

Copied: trunk/Source/WebCore/html/HTMLMenuItemElement.cpp (from rev 224456, trunk/Tools/DumpRenderTree/TestOptions.h) (0 => 224457)


--- trunk/Source/WebCore/html/HTMLMenuItemElement.cpp	                        (rev 0)
+++ trunk/Source/WebCore/html/HTMLMenuItemElement.cpp	2017-11-04 08:20:03 UTC (rev 224457)
@@ -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));
+}
+    
+}

Copied: trunk/Source/WebCore/html/HTMLMenuItemElement.h (from rev 224456, trunk/Tools/DumpRenderTree/TestOptions.h) (0 => 224457)


--- trunk/Source/WebCore/html/HTMLMenuItemElement.h	                        (rev 0)
+++ trunk/Source/WebCore/html/HTMLMenuItemElement.h	2017-11-04 08:20:03 UTC (rev 224457)
@@ -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

Copied: trunk/Source/WebCore/html/HTMLMenuItemElement.idl (from rev 224456, trunk/Tools/DumpRenderTree/TestOptions.h) (0 => 224457)


--- trunk/Source/WebCore/html/HTMLMenuItemElement.idl	                        (rev 0)
+++ trunk/Source/WebCore/html/HTMLMenuItemElement.idl	2017-11-04 08:20:03 UTC (rev 224457)
@@ -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 {
+};

Modified: trunk/Source/WebCore/html/HTMLTagNames.in (224456 => 224457)


--- trunk/Source/WebCore/html/HTMLTagNames.in	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebCore/html/HTMLTagNames.in	2017-11-04 08:20:03 UTC (rev 224457)
@@ -83,6 +83,7 @@
 mark interfaceName=HTMLElement
 marquee
 menu
+menuitem interfaceName=HTMLMenuItemElement, runtimeEnabled=menuItemElement
 meta
 meter interfaceName=HTMLMeterElement, conditional=METER_ELEMENT
 nav interfaceName=HTMLElement

Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (224456 => 224457)


--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2017-11-04 08:20:03 UTC (rev 224457)
@@ -73,6 +73,9 @@
     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 @@
     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 };

Modified: trunk/Source/WebKit/ChangeLog (224456 => 224457)


--- trunk/Source/WebKit/ChangeLog	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebKit/ChangeLog	2017-11-04 08:20:03 UTC (rev 224457)
@@ -1,3 +1,19 @@
+2017-11-04  Aishwarya Nirmal  <[email protected]>
+
+        [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  <[email protected]>
 
         Unreviewed, rolling out r224438.

Modified: trunk/Source/WebKit/Shared/WebPreferences.yaml (224456 => 224457)


--- trunk/Source/WebKit/Shared/WebPreferences.yaml	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebKit/Shared/WebPreferences.yaml	2017-11-04 08:20:03 UTC (rev 224457)
@@ -639,6 +639,11 @@
   defaultValue: true
   webcoreBinding: RuntimeEnabledFeatures
 
+MenuItemElementEnabled:
+  type: bool
+  defaultValue: false
+  webcoreBinding: RuntimeEnabledFeatures
+
 EncryptedMediaAPIEnabled:
   type: bool
   defaultValue: false

Modified: trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp (224456 => 224457)


--- trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPreferences.cpp	2017-11-04 08:20:03 UTC (rev 224457)
@@ -1720,6 +1720,16 @@
     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);

Modified: trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h (224456 => 224457)


--- trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h	2017-11-04 08:20:03 UTC (rev 224457)
@@ -470,6 +470,10 @@
 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);
     

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (224456 => 224457)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2017-11-04 08:20:03 UTC (rev 224457)
@@ -1,3 +1,21 @@
+2017-11-04  Aishwarya Nirmal  <[email protected]>
+
+        [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  <[email protected]>
 
         Use CompletionHandlers for redirects

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h (224456 => 224457)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h	2017-11-04 08:20:03 UTC (rev 224457)
@@ -243,6 +243,7 @@
 #define WebKitMediaCaptureRequiresSecureConnectionPreferenceKey @"WebKitMediaCaptureRequiresSecureConnection"
 #define WebKitAttachmentElementEnabledPreferenceKey @"WebKitAttachmentElementEnabled"
 #define WebKitIntersectionObserverEnabledPreferenceKey @"WebKitIntersectionObserverEnabled"
+#define WebKitMenuItemElementEnabledPreferenceKey @"WebKitMenuItemElementEnabled"
 #define WebKitDisplayContentsEnabledPreferenceKey @"WebKitDisplayContentsEnabled"
 #define WebKitUserTimingEnabledPreferenceKey @"WebKitUserTimingEnabled"
 #define WebKitResourceTimingEnabledPreferenceKey @"WebKitResourceTimingEnabled"

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm (224456 => 224457)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm	2017-11-04 08:20:03 UTC (rev 224457)
@@ -3103,6 +3103,16 @@
     [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];

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h (224456 => 224457)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h	2017-11-04 08:20:03 UTC (rev 224457)
@@ -581,6 +581,7 @@
 @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;

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (224456 => 224457)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2017-11-04 08:20:03 UTC (rev 224457)
@@ -3038,7 +3038,8 @@
     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

Modified: trunk/Tools/ChangeLog (224456 => 224457)


--- trunk/Tools/ChangeLog	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Tools/ChangeLog	2017-11-04 08:20:03 UTC (rev 224457)
@@ -1,3 +1,24 @@
+2017-11-04  Aishwarya Nirmal  <[email protected]>
+
+        [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  <[email protected]>
 
         [iOS] Append the platform name to the product directory on all embedded platforms

Modified: trunk/Tools/DumpRenderTree/TestOptions.h (224456 => 224457)


--- trunk/Tools/DumpRenderTree/TestOptions.h	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Tools/DumpRenderTree/TestOptions.h	2017-11-04 08:20:03 UTC (rev 224457)
@@ -31,6 +31,7 @@
 struct TestOptions {
     bool enableAttachmentElement { false };
     bool enableIntersectionObserver { false };
+    bool enableMenuItemElement { false };
     bool enableModernMediaControls { true };
     bool enablePointerLock { false };
     bool enableCredentialManagement { false };

Modified: trunk/Tools/DumpRenderTree/TestOptions.mm (224456 => 224457)


--- trunk/Tools/DumpRenderTree/TestOptions.mm	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Tools/DumpRenderTree/TestOptions.mm	2017-11-04 08:20:03 UTC (rev 224457)
@@ -82,6 +82,8 @@
             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")

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (224456 => 224457)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2017-11-04 08:20:03 UTC (rev 224457)
@@ -983,6 +983,7 @@
 
     preferences.attachmentElementEnabled = options.enableAttachmentElement;
     preferences.intersectionObserverEnabled = options.enableIntersectionObserver;
+    preferences.menuItemElementEnabled = options.enableMenuItemElement;
     preferences.modernMediaControlsEnabled = options.enableModernMediaControls;
     preferences.credentialManagementEnabled = options.enableCredentialManagement;
     preferences.isSecureContextAttributeEnabled = options.enableIsSecureContextAttribute;

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (224456 => 224457)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2017-11-04 08:20:03 UTC (rev 224457)
@@ -689,6 +689,7 @@
     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 @@
             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")

Modified: trunk/Tools/WebKitTestRunner/TestOptions.h (224456 => 224457)


--- trunk/Tools/WebKitTestRunner/TestOptions.h	2017-11-04 08:03:32 UTC (rev 224456)
+++ trunk/Tools/WebKitTestRunner/TestOptions.h	2017-11-04 08:20:03 UTC (rev 224457)
@@ -45,6 +45,7 @@
     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 @@
             || useCharacterSelectionGranularity != options.useCharacterSelectionGranularity
             || enableAttachmentElement != options.enableAttachmentElement
             || enableIntersectionObserver != options.enableIntersectionObserver
+            || enableMenuItemElement != options.enableMenuItemElement
             || enableModernMediaControls != options.enableModernMediaControls
             || enablePointerLock != options.enablePointerLock
             || enableCredentialManagement != options.enableCredentialManagement
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to