Add disabled highlight API skeleton
authormegan_gardner@apple.com <megan_gardner@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Dec 2019 05:48:46 +0000 (05:48 +0000)
committermegan_gardner@apple.com <megan_gardner@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Dec 2019 05:48:46 +0000 (05:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=204809

Reviewed by Ryosuke Niwa.

Source/WebCore:

Beginning implementation of https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/master/highlight/explainer.md
Spec not written yet, starting from the explainer for now.

Test: highlight/highlight-interfaces.html

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/highlight/HighlightMap.cpp: Added.
(WebCore::HighlightMap::addHighlightGroup):
(WebCore::HighlightMap::addFromMapLike):
(WebCore::HighlightMap::remove):
(WebCore::HighlightMap::namedItem const):
(WebCore::HighlightMap::setNamedItem):
(WebCore::HighlightMap::deleteNamedProperty):
(WebCore::HighlightMap::set):
* Modules/highlight/HighlightMap.h: Added.
(WebCore::HighlightMap::create):
(WebCore::HighlightMap::synchronizeBackingMap):
(WebCore::HighlightMap::backingMap):
(WebCore::HighlightMap::clear):
* Modules/highlight/HighlightMap.idl: Added.
* Modules/highlight/HighlightRangeGroup.cpp: Added.
(WebCore::HighlightRangeGroup::HighlightRangeGroup):
(WebCore::HighlightRangeGroup::create):
(WebCore::HighlightRangeGroup::addRange):
(WebCore::HighlightRangeGroup::removeRange):
(WebCore::HighlightRangeGroup::Iterator::Iterator):
(WebCore::HighlightRangeGroup::Iterator::next):
* Modules/highlight/HighlightRangeGroup.h: Added.
(WebCore::HighlightRangeGroup::createIterator):
* Modules/highlight/HighlightRangeGroup.idl: Added.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:
* css/DOMCSSNamespace.cpp:
(WebCore::DOMCSSNamespace::highlights):
* css/DOMCSSNamespace.h:
* css/DOMCSSNamespace.idl:
* dom/Document.cpp:
(WebCore::Document::highlightMap):
* dom/Document.h:
* dom/Range.idl:
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setHighlightAPIEnabled):
(WebCore::RuntimeEnabledFeatures::highlightAPIEnabled const):

Source/WebKit:

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

Source/WebKitLegacy/mac:

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences highlightAPIEnabled]):
(-[WebPreferences setHighlightAPIEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(enableExperimentalFeatures):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):

LayoutTests:

* highlight/highlight-interfaces-expected.txt: Added.
* highlight/highlight-interfaces.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253093 268f45cc-cd09-0410-ab3c-d52691b4dbfc

36 files changed:
LayoutTests/ChangeLog
LayoutTests/highlight/highlight-interfaces-expected.txt [new file with mode: 0644]
LayoutTests/highlight/highlight-interfaces.html [new file with mode: 0644]
LayoutTests/platform/win/TestExpectations
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources-input.xcfilelist
Source/WebCore/DerivedSources-output.xcfilelist
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/highlight/HighlightMap.cpp [new file with mode: 0644]
Source/WebCore/Modules/highlight/HighlightMap.h [new file with mode: 0644]
Source/WebCore/Modules/highlight/HighlightMap.idl [new file with mode: 0644]
Source/WebCore/Modules/highlight/HighlightRangeGroup.cpp [new file with mode: 0644]
Source/WebCore/Modules/highlight/HighlightRangeGroup.h [new file with mode: 0644]
Source/WebCore/Modules/highlight/HighlightRangeGroup.idl [new file with mode: 0644]
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/WebCoreBuiltinNames.h
Source/WebCore/css/DOMCSSNamespace.cpp
Source/WebCore/css/DOMCSSNamespace.h
Source/WebCore/css/DOMCSSNamespace.idl
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
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/mac/DumpRenderTree.mm
Tools/WebKitTestRunner/TestController.cpp

index b793f1e..7ae5a8e 100644 (file)
@@ -1,3 +1,13 @@
+2019-12-03  Megan Gardner  <megan_gardner@apple.com>
+
+        Add disabled highlight API skeleton
+        https://bugs.webkit.org/show_bug.cgi?id=204809
+
+        Reviewed by Ryosuke Niwa.
+
+        * highlight/highlight-interfaces-expected.txt: Added.
+        * highlight/highlight-interfaces.html: Added.
+
 2019-11-23  Ryosuke Niwa  <rniwa@webkit.org>
 
         Perform microtask checkpoint after each task as spec'ed
diff --git a/LayoutTests/highlight/highlight-interfaces-expected.txt b/LayoutTests/highlight/highlight-interfaces-expected.txt
new file mode 100644 (file)
index 0000000..557de07
--- /dev/null
@@ -0,0 +1,19 @@
+Tests the interfaces of the highlight API, which include HighlightRangeGroup, HighlightMap, and extensions to the CSS namespace.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing Highlight:
+PASS HighlightRangeGroup instanceof Function is true
+PASS typeof HighlightRangeGroup is "function"
+PASS new HighlightRangeGroup(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 2})) instanceof HighlightRangeGroup is true
+PASS HighlightMap instanceof Function is true
+PASS typeof HighlightMap is "function"
+PASS new HighlightMap() instanceof HighlightMap is true
+PASS new HighlightMap().set("foo-styling",new HighlightRangeGroup(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 2}))) is undefined.
+PASS CSS.highlights is defined.
+PASS CSS.highlights.set("foo-styling",new HighlightRangeGroup(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 2}))) is undefined.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/highlight/highlight-interfaces.html b/LayoutTests/highlight/highlight-interfaces.html
new file mode 100644 (file)
index 0000000..5358fc1
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ experimental:HighlightAPIEnabled=true ] -->
+<html>
+<body>
+<script src="../resources/js-test.js"></script>
+<script>
+
+description("Tests the interfaces of the highlight API, which include HighlightRangeGroup, HighlightMap, and extensions to the CSS namespace.");
+
+debug("Testing Highlight:");
+shouldBeTrue("HighlightRangeGroup instanceof Function");
+shouldBeEqualToString("typeof HighlightRangeGroup", "function");
+shouldBeTrue("new HighlightRangeGroup(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 2})) instanceof HighlightRangeGroup");
+shouldBeTrue("HighlightMap instanceof Function");
+shouldBeEqualToString("typeof HighlightMap", "function");
+shouldBeTrue("new HighlightMap() instanceof HighlightMap");
+shouldBeUndefined('new HighlightMap().set("foo-styling",new HighlightRangeGroup(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 2})))');
+shouldBeDefined('CSS.highlights');
+shouldBeUndefined('CSS.highlights.set("foo-styling",new HighlightRangeGroup(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 2})))');
+
+</script>
+</body>
+</html>
index c4830ef..03895a8 100644 (file)
@@ -403,6 +403,9 @@ fullscreen/ [ Skip ]
 # viewport meta tag support
 fast/viewport/ [ Skip ]
 
+# highlight API
+highlight/ [ Skip ]
+
 # Pre-HMTL5 parser quirks only apply to the mac port for now.
 fast/parser/pre-html5-parser-quirks.html [ Skip ]
 
index 4be8c0c..40f3dd9 100644 (file)
@@ -37,6 +37,7 @@ set(WebCore_PRIVATE_INCLUDE_DIRECTORIES
     "${WEBCORE_DIR}/Modules/entriesapi"
     "${WEBCORE_DIR}/Modules/fetch"
     "${WEBCORE_DIR}/Modules/geolocation"
+    "${WEBCORE_DIR}/Modules/highlight"
     "${WEBCORE_DIR}/Modules/indexeddb"
     "${WEBCORE_DIR}/Modules/indexeddb/client"
     "${WEBCORE_DIR}/Modules/indexeddb/server"
@@ -195,6 +196,7 @@ set(WebCore_IDL_INCLUDES
     Modules/entriesapi
     Modules/fetch
     Modules/geolocation
+    Modules/highlight
     Modules/indexeddb
     Modules/mediacapabilities
     Modules/mediarecorder
@@ -276,6 +278,9 @@ set(WebCore_NON_SVG_IDL_FILES
     Modules/geolocation/PositionErrorCallback.idl
     Modules/geolocation/PositionOptions.idl
 
+    Modules/highlight/HighlightMap.idl
+    Modules/highlight/HighlightRangeGroup.idl
+
     Modules/indexeddb/DOMWindowIndexedDatabase.idl
     Modules/indexeddb/IDBCursor.idl
     Modules/indexeddb/IDBCursorDirection.idl
index db79f25..1220cf8 100644 (file)
@@ -1,3 +1,58 @@
+2019-12-03  Megan Gardner  <megan_gardner@apple.com>
+
+        Add disabled highlight API skeleton
+        https://bugs.webkit.org/show_bug.cgi?id=204809
+
+        Reviewed by Ryosuke Niwa.
+
+        Beginning implementation of https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/master/highlight/explainer.md
+        Spec not written yet, starting from the explainer for now.
+
+        Test: highlight/highlight-interfaces.html
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Modules/highlight/HighlightMap.cpp: Added.
+        (WebCore::HighlightMap::addHighlightGroup):
+        (WebCore::HighlightMap::addFromMapLike):
+        (WebCore::HighlightMap::remove):
+        (WebCore::HighlightMap::namedItem const):
+        (WebCore::HighlightMap::setNamedItem):
+        (WebCore::HighlightMap::deleteNamedProperty):
+        (WebCore::HighlightMap::set):
+        * Modules/highlight/HighlightMap.h: Added.
+        (WebCore::HighlightMap::create):
+        (WebCore::HighlightMap::synchronizeBackingMap):
+        (WebCore::HighlightMap::backingMap):
+        (WebCore::HighlightMap::clear):
+        * Modules/highlight/HighlightMap.idl: Added.
+        * Modules/highlight/HighlightRangeGroup.cpp: Added.
+        (WebCore::HighlightRangeGroup::HighlightRangeGroup):
+        (WebCore::HighlightRangeGroup::create):
+        (WebCore::HighlightRangeGroup::addRange):
+        (WebCore::HighlightRangeGroup::removeRange):
+        (WebCore::HighlightRangeGroup::Iterator::Iterator):
+        (WebCore::HighlightRangeGroup::Iterator::next):
+        * Modules/highlight/HighlightRangeGroup.h: Added.
+        (WebCore::HighlightRangeGroup::createIterator):
+        * Modules/highlight/HighlightRangeGroup.idl: Added.
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/WebCoreBuiltinNames.h:
+        * css/DOMCSSNamespace.cpp:
+        (WebCore::DOMCSSNamespace::highlights):
+        * css/DOMCSSNamespace.h:
+        * css/DOMCSSNamespace.idl:
+        * dom/Document.cpp:
+        (WebCore::Document::highlightMap):
+        * dom/Document.h:
+        * dom/Range.idl:
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::setHighlightAPIEnabled):
+        (WebCore::RuntimeEnabledFeatures::highlightAPIEnabled const):
+
 2019-11-22  Ryosuke Niwa  <rniwa@webkit.org>
 
         Perform microtask checkpoint after each task as spec'ed
index f29279e..fec3c57 100644 (file)
@@ -113,6 +113,8 @@ $(PROJECT_DIR)/Modules/geolocation/PositionCallback.idl
 $(PROJECT_DIR)/Modules/geolocation/PositionError.idl
 $(PROJECT_DIR)/Modules/geolocation/PositionErrorCallback.idl
 $(PROJECT_DIR)/Modules/geolocation/PositionOptions.idl
+$(PROJECT_DIR)/Modules/highlight/HighlightMap.idl
+$(PROJECT_DIR)/Modules/highlight/HighlightRangeGroup.idl
 $(PROJECT_DIR)/Modules/indexeddb/DOMWindowIndexedDatabase.idl
 $(PROJECT_DIR)/Modules/indexeddb/IDBCursor.idl
 $(PROJECT_DIR)/Modules/indexeddb/IDBCursorDirection.idl
index 859aa34..5cdcb13 100644 (file)
@@ -691,6 +691,10 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGlobalEventHandlers.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGlobalEventHandlers.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGlobalPerformance.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGlobalPerformance.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHighlightMap.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHighlightMap.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHighlightRangeGroup.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHighlightRangeGroup.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHTMLAllCollection.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHTMLAllCollection.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHTMLAnchorElement.cpp
index fd72366..883ca39 100644 (file)
@@ -41,6 +41,7 @@ VPATH = \
     $(WebCore)/Modules/fetch \
     $(WebCore)/Modules/gamepad \
     $(WebCore)/Modules/geolocation \
+    $(WebCore)/Modules/highlight \
     $(WebCore)/Modules/indexeddb \
     $(WebCore)/Modules/indieui \
     $(WebCore)/Modules/mediacapabilities \
@@ -188,6 +189,8 @@ JS_BINDING_IDLS = \
     $(WebCore)/Modules/geolocation/PositionCallback.idl \
     $(WebCore)/Modules/geolocation/PositionErrorCallback.idl \
     $(WebCore)/Modules/geolocation/PositionOptions.idl \
+    $(WebCore)/Modules/highlight/HighlightMap.idl \
+    $(WebCore)/Modules/highlight/HighlightRangeGroup.idl \
     $(WebCore)/Modules/indexeddb/DOMWindowIndexedDatabase.idl \
     $(WebCore)/Modules/indexeddb/IDBCursor.idl \
     $(WebCore)/Modules/indexeddb/IDBCursorDirection.idl \
diff --git a/Source/WebCore/Modules/highlight/HighlightMap.cpp b/Source/WebCore/Modules/highlight/HighlightMap.cpp
new file mode 100644 (file)
index 0000000..7937409
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2019 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 "HighlightMap.h"
+
+namespace WebCore {
+
+void HighlightMap::addHighlightGroup(String& cssStyle, HighlightRangeGroup &group)
+{
+    UNUSED_PARAM(cssStyle);
+    UNUSED_PARAM(group);
+}
+
+bool HighlightMap::addFromMapLike(const String& value)
+{
+    UNUSED_PARAM(value);
+    return false;
+}
+
+bool HighlightMap::remove(const String& value)
+{
+    UNUSED_PARAM(value);
+    return false;
+}
+
+String HighlightMap::namedItem(const AtomString& name) const
+{
+    UNUSED_PARAM(name);
+    
+    return String { };
+}
+
+ExceptionOr<void> HighlightMap::setNamedItem(const String& name, const HighlightRangeGroup& value)
+{
+    UNUSED_PARAM(name);
+    UNUSED_PARAM(value);
+    
+    return { };
+}
+
+bool HighlightMap::deleteNamedProperty(const String& name)
+{
+    UNUSED_PARAM(name);
+    return false;
+}
+
+ExceptionOr<void> HighlightMap::set(const String& name, const HighlightRangeGroup& value)
+{
+    UNUSED_PARAM(name);
+    UNUSED_PARAM(value);
+    
+    return { };
+}
+
+}
diff --git a/Source/WebCore/Modules/highlight/HighlightMap.h b/Source/WebCore/Modules/highlight/HighlightMap.h
new file mode 100644 (file)
index 0000000..ecdac08
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2019 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 "HighlightRangeGroup.h"
+#include "JSDOMMapLike.h"
+#include <wtf/HashMap.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class DOMString;
+class HighlightRangeGroup;
+
+class HighlightMap : public RefCounted<HighlightMap> {
+public:
+    static Ref<HighlightMap> create() { return adoptRef(*new HighlightMap); }
+    
+    void addHighlightGroup(String&, HighlightRangeGroup&);
+    
+    void synchronizeBackingMap(Ref<DOMMapLike>&& mapLike) { m_mapLike = WTFMove(mapLike); }
+    DOMMapLike* backingMap() { return m_mapLike.get(); }
+
+    // Bindings support.
+    String namedItem(const AtomString& name) const;
+    ExceptionOr<void> setNamedItem(const String& name, const HighlightRangeGroup& value);
+    bool deleteNamedProperty(const String& name);
+    
+    ExceptionOr<void> set(const String& name, const HighlightRangeGroup& value);
+    
+    bool addFromMapLike(const String& value);
+    void clear() { };
+    bool remove(const String& value);
+    
+private:
+    HighlightMap() = default;
+    HashMap<String, RefPtr<HighlightRangeGroup>> m_map;
+    RefPtr<DOMMapLike> m_mapLike;
+};
+
+}
+
diff --git a/Source/WebCore/Modules/highlight/HighlightMap.idl b/Source/WebCore/Modules/highlight/HighlightMap.idl
new file mode 100644 (file)
index 0000000..a907919
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+[
+    Constructor(),
+    EnabledAtRuntime=HighlightAPI,
+    ImplementationLacksVTable
+] interface HighlightMap {
+    maplike<DOMString, HighlightRangeGroup>;
+    [CEReactions, MayThrowException] setter void (DOMString style, HighlightRangeGroup group);
+    [MayThrowException] void set(DOMString style, HighlightRangeGroup group);
+};
diff --git a/Source/WebCore/Modules/highlight/HighlightRangeGroup.cpp b/Source/WebCore/Modules/highlight/HighlightRangeGroup.cpp
new file mode 100644 (file)
index 0000000..856ba38
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2019 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 "HighlightRangeGroup.h"
+
+#include "PropertySetCSSStyleDeclaration.h"
+#include "StaticRange.h"
+#include "StyleProperties.h"
+
+namespace WebCore {
+
+HighlightRangeGroup::HighlightRangeGroup(StaticRange& range)
+{
+    addRange(range);
+}
+
+Ref<HighlightRangeGroup> HighlightRangeGroup::create(StaticRange& range)
+{
+    return adoptRef(*new HighlightRangeGroup(range));
+}
+
+ExceptionOr<void> HighlightRangeGroup::addRange(StaticRange& range)
+{
+    UNUSED_PARAM(range);
+
+    return { };
+}
+
+ExceptionOr<void> HighlightRangeGroup::removeRange(StaticRange& range)
+{
+    UNUSED_PARAM(range);
+    
+    return { };
+}
+
+HighlightRangeGroup::Iterator::Iterator(HighlightRangeGroup& group)
+    : m_group(group)
+{
+}
+
+RefPtr<StaticRange> HighlightRangeGroup::Iterator::next()
+{
+    if (m_index == m_group->ranges.size())
+        return nullptr;
+    return m_group->ranges[m_index++].ptr();
+}
+
+}
+
diff --git a/Source/WebCore/Modules/highlight/HighlightRangeGroup.h b/Source/WebCore/Modules/highlight/HighlightRangeGroup.h
new file mode 100644 (file)
index 0000000..b8bc8e2
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2019 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 "ExceptionOr.h"
+#include "StaticRange.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class CSSStyleDeclaration;
+class StaticRange;
+class PropertySetCSSStyleDeclaration;
+
+class HighlightRangeGroup : public RefCounted<HighlightRangeGroup> {
+public:
+    static Ref<HighlightRangeGroup> create(StaticRange&);
+
+    ExceptionOr<void> addRange(StaticRange&);
+    ExceptionOr<void> removeRange(StaticRange&);
+    
+    Vector<Ref<StaticRange>> ranges;
+
+    WEBCORE_EXPORT CSSStyleDeclaration& style();
+    
+    class Iterator {
+    public:
+        explicit Iterator(HighlightRangeGroup&);
+        RefPtr<StaticRange> next();
+        
+    private:
+        Ref<HighlightRangeGroup> m_group;
+        size_t m_index { 0 }; // FIXME: There needs to be a mechanism to handle when ranges are added or removed from the middle of the HighlightRangeGroup.
+    };
+    Iterator createIterator() { return Iterator(*this); }
+    
+private:
+    HighlightRangeGroup(StaticRange&);
+};
+
+}
+
diff --git a/Source/WebCore/Modules/highlight/HighlightRangeGroup.idl b/Source/WebCore/Modules/highlight/HighlightRangeGroup.idl
new file mode 100644 (file)
index 0000000..1ec20e9
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+[
+    Constructor(StaticRange range),
+    EnabledAtRuntime=HighlightAPI,
+    ImplementationLacksVTable
+] interface HighlightRangeGroup {
+    iterable<StaticRange>;  // FIXME: should be setlike
+    // FIXME: Add readonly attribute CSSStyleDeclaration style;
+};
index 9953d30..1cdc8a4 100644 (file)
@@ -79,6 +79,9 @@ Modules/geolocation/GeolocationController.cpp
 Modules/geolocation/GeolocationCoordinates.cpp
 Modules/geolocation/NavigatorGeolocation.cpp
 
+Modules/highlight/HighlightMap.cpp
+Modules/highlight/HighlightRangeGroup.cpp
+
 Modules/indexeddb/DOMWindowIndexedDatabase.cpp
 Modules/indexeddb/IDBCursor.cpp
 Modules/indexeddb/IDBCursorWithValue.cpp
@@ -2900,6 +2903,8 @@ JSGeolocationPositionError.cpp
 JSGlobalCrypto.cpp
 JSGlobalEventHandlers.cpp
 JSGlobalPerformance.cpp
+JSHighlightMap.cpp
+JSHighlightRangeGroup.cpp
 JSHTMLAllCollection.cpp
 JSHTMLAnchorElement.cpp
 JSHTMLAppletElement.cpp
index 6c5bf27..ceea452 100644 (file)
                44D8DA9A139545CD00337B75 /* SVGAnimateMotionElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SVGAnimateMotionElement.idl; sourceTree = "<group>"; };
                44DAB5AF15A623580097C1E4 /* Extensions3DOpenGLCommon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Extensions3DOpenGLCommon.cpp; sourceTree = "<group>"; };
                44DAB5B015A623580097C1E4 /* Extensions3DOpenGLCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Extensions3DOpenGLCommon.h; sourceTree = "<group>"; };
+               44E88E4C2369128A009B4847 /* HighlightMap.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HighlightMap.idl; sourceTree = "<group>"; };
+               44E88E4D2369128B009B4847 /* HighlightRangeGroup.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HighlightRangeGroup.idl; sourceTree = "<group>"; };
+               44E88E50236A56AC009B4847 /* HighlightMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HighlightMap.h; sourceTree = "<group>"; };
+               44E88E51236A5C8D009B4847 /* HighlightRangeGroup.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HighlightRangeGroup.h; sourceTree = "<group>"; };
+               44E88E52236A667F009B4847 /* HighlightMap.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = HighlightMap.cpp; sourceTree = "<group>"; };
+               44E88E54236A66A1009B4847 /* HighlightRangeGroup.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = HighlightRangeGroup.cpp; sourceTree = "<group>"; };
                450CEBEE15073BBE002BB149 /* LabelableElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LabelableElement.cpp; sourceTree = "<group>"; };
                450CEBEF15073BBE002BB149 /* LabelableElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LabelableElement.h; sourceTree = "<group>"; };
                4512502015DCE37D002F84E2 /* SpinButtonElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpinButtonElement.cpp; sourceTree = "<group>"; };
                        path = ios;
                        sourceTree = "<group>";
                };
+               44E88E472368DF0F009B4847 /* highlight */ = {
+                       isa = PBXGroup;
+                       children = (
+                               44E88E52236A667F009B4847 /* HighlightMap.cpp */,
+                               44E88E50236A56AC009B4847 /* HighlightMap.h */,
+                               44E88E4C2369128A009B4847 /* HighlightMap.idl */,
+                               44E88E54236A66A1009B4847 /* HighlightRangeGroup.cpp */,
+                               44E88E51236A5C8D009B4847 /* HighlightRangeGroup.h */,
+                               44E88E4D2369128B009B4847 /* HighlightRangeGroup.idl */,
+                       );
+                       path = highlight;
+                       sourceTree = "<group>";
+               };
                4642404420EAF0BD00B29FD2 /* cocoa */ = {
                        isa = PBXGroup;
                        children = (
                                41F54F7C1C50C4F600338488 /* fetch */,
                                518F4FE9194CA4B60081BAAE /* gamepad */,
                                971145FF14EF007900674FD9 /* geolocation */,
+                               44E88E472368DF0F009B4847 /* highlight */,
                                9712A55315004E3C0048AF10 /* indexeddb */,
                                CDBD3D271FE85C920012C545 /* mediacapabilities */,
                                CD9A37F517C7D93600C5FA7A /* mediacontrols */,
index 8cea7c8..2f3985f 100644 (file)
@@ -112,6 +112,8 @@ namespace WebCore {
     macro(GPUTextureView) \
     macro(GPUUncapturedErrorEvent) \
     macro(GPUValidationError) \
+    macro(HighlightMap) \
+    macro(HighlightRangeGroup) \
     macro(HTMLAttachmentElement) \
     macro(HTMLAudioElement) \
     macro(HTMLDialogElement) \
index 9135237..55a3e1b 100644 (file)
@@ -33,6 +33,7 @@
 #include "CSSMarkup.h"
 #include "CSSParser.h"
 #include "CSSPropertyParser.h"
+#include "HighlightMap.h"
 #include "StyleProperties.h"
 #include <wtf/text/StringBuilder.h>
 #include <wtf/text/WTFString.h>
@@ -87,4 +88,9 @@ String DOMCSSNamespace::escape(const String& ident)
     return builder.toString();
 }
 
+HighlightMap& DOMCSSNamespace::highlights(Document& document)
+{
+    return document.highlightMap();
+}
+
 }
index 8cd28a2..3047e52 100644 (file)
 namespace WebCore {
 
 class Document;
+class HighlightMap;
+class HighlightRangeGroup;
 
 class DOMCSSNamespace final : public RefCounted<DOMCSSNamespace>, public Supplementable<DOMCSSNamespace> {
 public:
     static bool supports(Document&, const String& property, const String& value);
     static bool supports(Document&, const String& conditionText);
     static String escape(const String& ident);
+    static HighlightMap& highlights(Document&);
 };
 
 }
index 1f2d371..c979e86 100644 (file)
@@ -34,4 +34,5 @@
     [CallWith=Document] static boolean supports(DOMString property, DOMString value);
     [CallWith=Document] static boolean supports(DOMString conditionText);
     static DOMString escape(DOMString ident);
+    [EnabledAtRuntime=HighlightAPI, CallWith=Document] static readonly attribute HighlightMap highlights;
 };
index abe4cfe..cf4cda7 100644 (file)
 #include "HTTPHeaderNames.h"
 #include "HTTPParsers.h"
 #include "HashChangeEvent.h"
+#include "HighlightMap.h"
 #include "History.h"
 #include "HitTestResult.h"
 #include "IdleCallbackController.h"
@@ -2718,6 +2719,13 @@ Ref<DocumentParser> Document::createParser()
     return XMLDocumentParser::create(*this, view());
 }
 
+HighlightMap& Document::highlightMap()
+{
+    if (!m_highlightMap)
+        m_highlightMap = HighlightMap::create();
+    return *m_highlightMap;
+}
+
 ScriptableDocumentParser* Document::scriptableDocumentParser() const
 {
     return parser() ? parser()->asScriptableDocumentParser() : nullptr;
index 8225fd0..e84d8e4 100644 (file)
@@ -145,6 +145,7 @@ class HTMLMapElement;
 class HTMLMediaElement;
 class HTMLVideoElement;
 class HTMLScriptElement;
+class HighlightMap;
 class HitTestLocation;
 class HitTestRequest;
 class HitTestResult;
@@ -1565,6 +1566,8 @@ public:
 
     WEBCORE_EXPORT TextManipulationController& textManipulationController();
     TextManipulationController* textManipulationControllerIfExists() { return m_textManipulationController.get(); }
+        
+    HighlightMap& highlightMap();
 
 protected:
     enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 };
@@ -1887,6 +1890,8 @@ private:
 #if ENABLE(TEXT_AUTOSIZING)
     std::unique_ptr<TextAutoSizing> m_textAutoSizing;
 #endif
+        
+    RefPtr<HighlightMap> m_highlightMap;
 
     Timer m_visualUpdatesSuppressionTimer;
 
index 1637578..25f6e36 100644 (file)
@@ -214,6 +214,9 @@ public:
 
     void setKeygenElementEnabled(bool isEnabled) { m_keygenElementEnabled = isEnabled; }
     bool keygenElementEnabled() const { return m_keygenElementEnabled; }
+    
+    void setHighlightAPIEnabled(bool isEnabled) { m_highlightAPIEnabled = isEnabled; }
+    bool highlightAPIEnabled() const { return m_highlightAPIEnabled; }
 
 #if ENABLE(ATTACHMENT_ELEMENT)
     void setAttachmentElementEnabled(bool areEnabled) { m_isAttachmentElementEnabled = areEnabled; }
@@ -447,6 +450,7 @@ private:
     bool m_webSQLEnabled { true };
     bool m_keygenElementEnabled { false };
     bool m_pageAtRuleSupportEnabled { false };
+    bool m_highlightAPIEnabled { false };
 
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
     bool m_layoutFormattingContextEnabled { false };
index 83792fb..1e5abb4 100644 (file)
@@ -1,3 +1,16 @@
+2019-12-03  Megan Gardner  <megan_gardner@apple.com>
+
+        Add disabled highlight API skeleton
+        https://bugs.webkit.org/show_bug.cgi?id=204809
+
+        Reviewed by Ryosuke Niwa.
+
+        * Shared/WebPreferences.yaml:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetHighlightAPIEnabled):
+        (WKPreferencesGetHighlightAPIEnabled):
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+
 2019-12-03  Ryosuke Niwa  <rniwa@webkit.org>
 
         Replace customJavaScriptUserAgentAsSiteSpecificQuirks with customUserAgentAsSiteSpecificQuirks
index f9cf669..c6ef83e 100644 (file)
@@ -750,6 +750,14 @@ GamepadsEnabled:
   humanReadableDescription: "Web Gamepad API support"
   webcoreBinding: RuntimeEnabledFeatures
   condition: ENABLE(GAMEPAD)
+  
+HighlightAPIEnabled:
+    type: bool
+    defaultValue: false
+    humanReadableName: "Highlight API"
+    humanReadableDescription: "Highlight API support"
+    webcoreBinding: RuntimeEnabledFeatures
+    category: experimental
 
 InputEventsEnabled:
   type: bool
index 71a6ed2..e39a902 100644 (file)
@@ -1539,6 +1539,16 @@ bool WKPreferencesGetGamepadsEnabled(WKPreferencesRef preferencesRef)
     return toImpl(preferencesRef)->gamepadsEnabled();
 }
 
+void WKPreferencesSetHighlightAPIEnabled(WKPreferencesRef preferencesRef, bool enabled)
+{
+    toImpl(preferencesRef)->setHighlightAPIEnabled(enabled);
+}
+
+bool WKPreferencesGetHighlightAPIEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->highlightAPIEnabled();
+}
+
 // FIXME: Remove these when possible.
 void WKPreferencesSetLongMousePressEnabled(WKPreferencesRef preferencesRef, bool enabled)
 {
index 05a89b8..8c65c2e 100644 (file)
@@ -391,6 +391,10 @@ WK_EXPORT bool WKPreferencesGetImageControlsEnabled(WKPreferencesRef preferences
 WK_EXPORT void WKPreferencesSetGamepadsEnabled(WKPreferencesRef preferencesRef, bool enabled);
 WK_EXPORT bool WKPreferencesGetGamepadsEnabled(WKPreferencesRef preferencesRef);
 
+// Default to false.
+WK_EXPORT void WKPreferencesSetHighlightAPIEnabled(WKPreferencesRef preferencesRef, bool enabled);
+WK_EXPORT bool WKPreferencesGetHighlightAPIEnabled(WKPreferencesRef preferencesRef);
+
 // Not implemented, should be deleted once there are no callers.
 WK_EXPORT void WKPreferencesSetLongMousePressEnabled(WKPreferencesRef preferencesRef, bool enabled);
 WK_EXPORT bool WKPreferencesGetLongMousePressEnabled(WKPreferencesRef preferencesRef);
index 817d969..a32adf7 100644 (file)
@@ -1,3 +1,19 @@
+2019-12-03  Megan Gardner  <megan_gardner@apple.com>
+
+        Add disabled highlight API skeleton
+        https://bugs.webkit.org/show_bug.cgi?id=204809
+
+        Reviewed by Ryosuke Niwa.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences highlightAPIEnabled]):
+        (-[WebPreferences setHighlightAPIEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2019-12-03  Eric Carlson  <eric.carlson@apple.com>
 
         Add a runtime setting for media in the GPU process
index 2afca77..a3020da 100644 (file)
 #define WebKitShouldConvertPositionStyleOnCopyPreferenceKey @"WebKitShouldConvertPositionStyleOnCopy"
 #define WebKitImageControlsEnabledPreferenceKey @"WebKitImageControlsEnabled"
 #define WebKitGamepadsEnabledPreferenceKey @"WebKitGamepadsEnabled"
+#define WebKitHighlightAPIEnabledPreferenceKey @"WebKitHighlightAPIEnabled"
 #define WebKitServiceControlsEnabledPreferenceKey @"WebKitServiceControlsEnabled"
 #define WebKitMediaKeysStorageDirectoryKey @"WebKitMediaKeysStorageDirectory"
 #define WebKitShadowDOMEnabledPreferenceKey @"WebKitShadowDOMEnabled"
index a859f4c..05d03e0 100644 (file)
@@ -631,6 +631,7 @@ public:
         @YES, WebKitDataTransferItemsEnabledPreferenceKey,
         @NO, WebKitCustomPasteboardDataEnabledPreferenceKey,
         @NO, WebKitDialogElementEnabledPreferenceKey,
+        @NO, WebKitHighlightAPIEnabledPreferenceKey,
         @YES, WebKitModernMediaControlsEnabledPreferenceKey,
         @NO, WebKitWebAnimationsCSSIntegrationEnabledPreferenceKey,
 
@@ -2850,6 +2851,16 @@ static NSString *classIBCreatorID = nil;
     [self _setBoolValue:flag forKey:WebKitGamepadsEnabledPreferenceKey];
 }
 
+- (BOOL)highlightAPIEnabled
+{
+    return [self _boolValueForKey:WebKitHighlightAPIEnabledPreferenceKey];
+}
+
+- (void)setHighlightAPIEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitHighlightAPIEnabledPreferenceKey];
+}
+
 - (BOOL)shouldConvertPositionStyleOnCopy
 {
     return [self _boolValueForKey:WebKitShouldConvertPositionStyleOnCopyPreferenceKey];
index a20cc60..29d70ed 100644 (file)
@@ -510,6 +510,9 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification WEBKIT_DEPR
 - (void)setGamepadsEnabled:(BOOL)flag;
 - (BOOL)gamepadsEnabled;
 
+- (void)setHighlightAPIEnabled:(BOOL)flag;
+- (BOOL)highlightAPIEnabled;
+
 - (void)setMediaPreloadingEnabled:(BOOL)flag;
 - (BOOL)mediaPreloadingEnabled;
 
index bdddfe4..bdd6f0d 100644 (file)
@@ -3132,6 +3132,8 @@ static bool needsSelfRetainWhileLoadingQuirk()
     RuntimeEnabledFeatures::sharedFeatures().setGamepadsEnabled([preferences gamepadsEnabled]);
 #endif
 
+    RuntimeEnabledFeatures::sharedFeatures().setHighlightAPIEnabled([preferences highlightAPIEnabled]);
+
     RuntimeEnabledFeatures::sharedFeatures().setShadowDOMEnabled([preferences shadowDOMEnabled]);
     RuntimeEnabledFeatures::sharedFeatures().setCustomElementsEnabled([preferences customElementsEnabled]);
     RuntimeEnabledFeatures::sharedFeatures().setDataTransferItemsEnabled([preferences dataTransferItemsEnabled]);
index 970ae09..96ef0e3 100644 (file)
@@ -1,3 +1,15 @@
+2019-12-03  Megan Gardner  <megan_gardner@apple.com>
+
+        Add disabled highlight API skeleton
+        https://bugs.webkit.org/show_bug.cgi?id=204809
+
+        Reviewed by Ryosuke Niwa.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (enableExperimentalFeatures):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::resetPreferencesToConsistentValues):
+
 2019-12-03  Ryosuke Niwa  <rniwa@webkit.org>
 
         Replace customJavaScriptUserAgentAsSiteSpecificQuirks with customUserAgentAsSiteSpecificQuirks
index 6f91529..ccffe05 100644 (file)
@@ -857,6 +857,7 @@ static void enableExperimentalFeatures(WebPreferences* preferences)
 {
     // FIXME: SpringTimingFunction
     [preferences setGamepadsEnabled:YES];
+    [preferences setHighlightAPIEnabled:YES];
     [preferences setLinkPreloadEnabled:YES];
     [preferences setMediaPreloadingEnabled:YES];
     // FIXME: InputEvents
index 42b7ef2..8167be5 100644 (file)
@@ -884,6 +884,7 @@ void TestController::resetPreferencesToConsistentValues(const TestOptions& optio
     WKPreferencesSetMediaSourceEnabled(preferences, true);
     WKPreferencesSetSourceBufferChangeTypeEnabled(preferences, true);
 #endif
+    WKPreferencesSetHighlightAPIEnabled(preferences, true);
 
     WKPreferencesSetHiddenPageDOMTimerThrottlingEnabled(preferences, false);
     WKPreferencesSetHiddenPageCSSAnimationSuspensionEnabled(preferences, false);