Title: [268774] trunk
Revision
268774
Author
megan_gard...@apple.com
Date
2020-10-20 16:58:03 -0700 (Tue, 20 Oct 2020)

Log Message

Rename HighlightMap to HighlightRegister and HighlightRangeGroup to Highlight to match current spec
https://bugs.webkit.org/show_bug.cgi?id=217919

Reviewed by Ryosuke Niwa.

No new tests, no new behavior, rename only.
https://drafts.csswg.org/css-highlight-api-1/

* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/highlight/Highlight.cpp: Renamed from Source/WebCore/Modules/highlight/HighlightRangeGroup.cpp.
(WebCore::Highlight::Highlight):
(WebCore::Highlight::create):
(WebCore::Highlight::initializeSetLike):
(WebCore::Highlight::removeFromSetLike):
(WebCore::Highlight::clearFromSetLike):
(WebCore::Highlight::addToSetLike):
* Modules/highlight/Highlight.h: Renamed from Source/WebCore/Modules/highlight/HighlightRangeGroup.h.
* Modules/highlight/Highlight.idl: Renamed from Source/WebCore/Modules/highlight/HighlightRangeGroup.idl.
* Modules/highlight/HighlightRegister.cpp: Renamed from Source/WebCore/Modules/highlight/HighlightMap.cpp.
(WebCore::HighlightRegister::initializeMapLike):
(WebCore::HighlightRegister::setFromMapLike):
(WebCore::HighlightRegister::clear):
(WebCore::HighlightRegister::remove):
* Modules/highlight/HighlightRegister.h: Renamed from Source/WebCore/Modules/highlight/HighlightMap.h.
(WebCore::HighlightRegister::create):
(WebCore::HighlightRegister::map const):
* Modules/highlight/HighlightRegister.idl: Renamed from Source/WebCore/Modules/highlight/HighlightMap.idl.
* 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::commonTeardown):
(WebCore::Document::highlightRegister):
(WebCore::Document::updateHighlightPositions):
(WebCore::Document::highlightMap): Deleted.
* dom/Document.h:
* rendering/HighlightData.cpp:
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::collectMarkedTextsForHighlights const):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::calculateHighlightColor const):
* rendering/SelectionRangeData.cpp:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/highlight/highlight-interfaces-expected.txt (268773 => 268774)


--- trunk/LayoutTests/highlight/highlight-interfaces-expected.txt	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/LayoutTests/highlight/highlight-interfaces-expected.txt	2020-10-20 23:58:03 UTC (rev 268774)
@@ -1,18 +1,18 @@
-Tests the interfaces of the highlight API, which include HighlightRangeGroup, HighlightMap, and extensions to the CSS namespace.
+Tests the interfaces of the highlight API, which include Highlight, HighlightRegister, 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 defined.
+PASS Highlight instanceof Function is true
+PASS typeof Highlight is "function"
+PASS new Highlight(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 2})) instanceof Highlight is true
+PASS HighlightRegister instanceof Function is true
+PASS typeof HighlightRegister is "function"
+PASS new HighlightRegister() instanceof HighlightRegister is true
+PASS new HighlightRegister().set("foo-styling",new Highlight(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 2}))) is defined.
 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 CSS.highlights
+PASS CSS.highlights.set("foo-styling",new Highlight(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 2}))) is CSS.highlights
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/highlight/highlight-interfaces.html (268773 => 268774)


--- trunk/LayoutTests/highlight/highlight-interfaces.html	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/LayoutTests/highlight/highlight-interfaces.html	2020-10-20 23:58:03 UTC (rev 268774)
@@ -4,18 +4,18 @@
 <script src=""
 <script>
 
-description("Tests the interfaces of the highlight API, which include HighlightRangeGroup, HighlightMap, and extensions to the CSS namespace.");
+description("Tests the interfaces of the highlight API, which include Highlight, HighlightRegister, 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");
-shouldBeDefined('new HighlightMap().set("foo-styling",new HighlightRangeGroup(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 2})))');
+shouldBeTrue("Highlight instanceof Function");
+shouldBeEqualToString("typeof Highlight", "function");
+shouldBeTrue("new Highlight(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 2})) instanceof Highlight");
+shouldBeTrue("HighlightRegister instanceof Function");
+shouldBeEqualToString("typeof HighlightRegister", "function");
+shouldBeTrue("new HighlightRegister() instanceof HighlightRegister");
+shouldBeDefined('new HighlightRegister().set("foo-styling",new Highlight(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 2})))');
 shouldBeDefined('CSS.highlights');
-shouldBe('CSS.highlights.set("foo-styling",new HighlightRangeGroup(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 2})))', 'CSS.highlights');
+shouldBe('CSS.highlights.set("foo-styling",new Highlight(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 2})))', 'CSS.highlights');
 
 </script>
 </body>

Modified: trunk/LayoutTests/highlight/highlight-map-and-group-expected.txt (268773 => 268774)


--- trunk/LayoutTests/highlight/highlight-map-and-group-expected.txt	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/LayoutTests/highlight/highlight-map-and-group-expected.txt	2020-10-20 23:58:03 UTC (rev 268774)
@@ -1,6 +1,6 @@
-PASS highlightRangeGroup1.size is 1
-PASS highlightRangeGroup2.size is 2
-PASS highlightRangeGroup3.size is 3
+PASS highlight1.size is 1
+PASS highlight2.size is 2
+PASS highlight3.size is 3
 PASS CSS.highlights.size is 3
 PASS CSS.highlights.has("example-highlight1") is true
 PASS CSS.highlights.has("example-highlight2") is true

Modified: trunk/LayoutTests/highlight/highlight-map-and-group.html (268773 => 268774)


--- trunk/LayoutTests/highlight/highlight-map-and-group.html	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/LayoutTests/highlight/highlight-map-and-group.html	2020-10-20 23:58:03 UTC (rev 268774)
@@ -20,23 +20,23 @@
     <body><span>One </span><span>two </span><span>three...</span>
 
     <script>
-        let highlightRangeGroup1 = new HighlightRangeGroup(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 2}));
+        let highlight1 = new Highlight(new StaticRange({startContainer: document.body, startOffset: 1, endContainer: document.body, endOffset: 2}));
 
-        let highlightRangeGroup2 = new HighlightRangeGroup(new StaticRange({startContainer: document.body, startOffset: 2, endContainer: document.body, endOffset: 3}));
-        highlightRangeGroup2.add(new StaticRange({startContainer: document.body, startOffset: 4, endContainer: document.body, endOffset: 5}));
+        let highlight2 = new Highlight(new StaticRange({startContainer: document.body, startOffset: 2, endContainer: document.body, endOffset: 3}));
+        highlight2.add(new StaticRange({startContainer: document.body, startOffset: 4, endContainer: document.body, endOffset: 5}));
 
-        let highlightRangeGroup3 = new HighlightRangeGroup(new StaticRange({startContainer: document.body, startOffset: 4, endContainer: document.body, endOffset: 8}));
-        highlightRangeGroup3.add(new StaticRange({startContainer: document.body, startOffset: 10, endContainer: document.body, endOffset: 12}));
-        highlightRangeGroup3.add(new StaticRange({startContainer: document.body, startOffset: 5, endContainer: document.body, endOffset: 6}));
+        let highlight3 = new Highlight(new StaticRange({startContainer: document.body, startOffset: 4, endContainer: document.body, endOffset: 8}));
+        highlight3.add(new StaticRange({startContainer: document.body, startOffset: 10, endContainer: document.body, endOffset: 12}));
+        highlight3.add(new StaticRange({startContainer: document.body, startOffset: 5, endContainer: document.body, endOffset: 6}));
         
 
-        CSS.highlights.set("example-highlight1", highlightRangeGroup1);
-        CSS.highlights.set("example-highlight2", highlightRangeGroup2);
-        CSS.highlights.set("example-highlight3", highlightRangeGroup3);
+        CSS.highlights.set("example-highlight1", highlight1);
+        CSS.highlights.set("example-highlight2", highlight2);
+        CSS.highlights.set("example-highlight3", highlight3);
 
-        shouldBe("highlightRangeGroup1.size","1");
-        shouldBe("highlightRangeGroup2.size","2");
-        shouldBe("highlightRangeGroup3.size","3");
+        shouldBe("highlight1.size","1");
+        shouldBe("highlight2.size","2");
+        shouldBe("highlight3.size","3");
 
         shouldBe("CSS.highlights.size","3");
 

Modified: trunk/LayoutTests/highlight/resources/highlight-frame.html (268773 => 268774)


--- trunk/LayoutTests/highlight/resources/highlight-frame.html	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/LayoutTests/highlight/resources/highlight-frame.html	2020-10-20 23:58:03 UTC (rev 268774)
@@ -13,6 +13,6 @@
 
 <script>
 let highlight = document.getElementById('highlight');
-let highlightRangeGroup = new HighlightRangeGroup(new StaticRange({startContainer: highlight.childNodes[0], startOffset: 0, endContainer: highlight.childNodes[0], endOffset: 4}));
-CSS.highlights.set("example", highlightRangeGroup);
+let highlight1 = new Highlight(new StaticRange({startContainer: highlight.childNodes[0], startOffset: 0, endContainer: highlight.childNodes[0], endOffset: 4}));
+CSS.highlights.set("example", highlight1);
 </script>

Modified: trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-image.html (268773 => 268774)


--- trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-image.html	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-image.html	2020-10-20 23:58:03 UTC (rev 268774)
@@ -18,10 +18,10 @@
 
     <script>
         let imageElement1 = document.getElementById('img1');
-        let highlightRangeGroup1 = new HighlightRangeGroup(new StaticRange({startContainer: imageElement1.childNodes[0], startOffset: 0, endContainer: imageElement1.childNodes[0], endOffset: 1}));
+        let highlight1 = new Highlight(new StaticRange({startContainer: imageElement1.childNodes[0], startOffset: 0, endContainer: imageElement1.childNodes[0], endOffset: 1}));
 
 
-        CSS.highlights.set("example-highlight1", highlightRangeGroup1);
+        CSS.highlights.set("example-highlight1", highlight1);
 
     </script>
 </body>

Modified: trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text-across-elements.html (268773 => 268774)


--- trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text-across-elements.html	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text-across-elements.html	2020-10-20 23:58:03 UTC (rev 268774)
@@ -34,16 +34,16 @@
         let textElement3 = document.getElementById('text3');
         let textElement4 = document.getElementById('text4');
         let textElement5 = document.getElementById('text5');
-        let highlightRangeGroup1 = new HighlightRangeGroup(new StaticRange({startContainer: textElement1.childNodes[0], startOffset: 4, endContainer: textElement1.childNodes[0], endOffset: 7}));
+        let highlight1 = new Highlight(new StaticRange({startContainer: textElement1.childNodes[0], startOffset: 4, endContainer: textElement1.childNodes[0], endOffset: 7}));
 
-        let highlightRangeGroup2 = new HighlightRangeGroup(new StaticRange({startContainer: textElement1.childNodes[0], startOffset: 10, endContainer: textElement2.childNodes[0], endOffset: 4}));
-        highlightRangeGroup2.add(new StaticRange({startContainer: textElement2.childNodes[0], startOffset: 10, endContainer: textElement3.childNodes[0], endOffset: 5}));
+        let highlight2 = new Highlight(new StaticRange({startContainer: textElement1.childNodes[0], startOffset: 10, endContainer: textElement2.childNodes[0], endOffset: 4}));
+        highlight2.add(new StaticRange({startContainer: textElement2.childNodes[0], startOffset: 10, endContainer: textElement3.childNodes[0], endOffset: 5}));
 
-        let highlightRangeGroup3 = new HighlightRangeGroup(new StaticRange({startContainer: textElement3.childNodes[0], startOffset: 10, endContainer: textElement5.childNodes[0], endOffset: 12}));
+        let highlight3 = new Highlight(new StaticRange({startContainer: textElement3.childNodes[0], startOffset: 10, endContainer: textElement5.childNodes[0], endOffset: 12}));
 
-        CSS.highlights.set("example-highlight1", highlightRangeGroup1);
-        CSS.highlights.set("example-highlight2", highlightRangeGroup2);
-        CSS.highlights.set("example-highlight3", highlightRangeGroup3);
+        CSS.highlights.set("example-highlight1", highlight1);
+        CSS.highlights.set("example-highlight2", highlight2);
+        CSS.highlights.set("example-highlight3", highlight3);
     </script>
 </body>
 </html>

Modified: trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text-cascade.html (268773 => 268774)


--- trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text-cascade.html	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text-cascade.html	2020-10-20 23:58:03 UTC (rev 268774)
@@ -26,10 +26,10 @@
         let textElement1 = document.getElementById('text1');
         let textElement2 = document.getElementById('text2');
         let textElement3 = document.getElementById('text3');
-        let highlightRangeGroup = new HighlightRangeGroup(new StaticRange({startContainer: textElement1.childNodes[0], startOffset: 0, endContainer: textElement1.childNodes[0], endOffset: 3}));
-        highlightRangeGroup.add(new StaticRange({startContainer: textElement2.childNodes[0], startOffset: 5, endContainer: textElement2.childNodes[0], endOffset: 9}));
+        let highlight = new Highlight(new StaticRange({startContainer: textElement1.childNodes[0], startOffset: 0, endContainer: textElement1.childNodes[0], endOffset: 3}));
+        highlight.add(new StaticRange({startContainer: textElement2.childNodes[0], startOffset: 5, endContainer: textElement2.childNodes[0], endOffset: 9}));
 
-        CSS.highlights.set("example-highlight", highlightRangeGroup);
+        CSS.highlights.set("example-highlight", highlight);
     </script>
 </body>
 </html>

Modified: trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text-decorations.html (268773 => 268774)


--- trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text-decorations.html	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text-decorations.html	2020-10-20 23:58:03 UTC (rev 268774)
@@ -51,13 +51,13 @@
 
     <script>
         let textElement = document.getElementById('text1');
-        let highlightRangeGroup1 = new HighlightRangeGroup(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 1, endContainer: textElement.childNodes[0], endOffset: 2}));
-        let highlightRangeGroup2 = new HighlightRangeGroup(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 5, endContainer: textElement.childNodes[0], endOffset: 6}));
-        let highlightRangeGroup3 = new HighlightRangeGroup(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 10, endContainer: textElement.childNodes[0], endOffset: 13}));
+        let highlight1 = new Highlight(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 1, endContainer: textElement.childNodes[0], endOffset: 2}));
+        let highlight2 = new Highlight(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 5, endContainer: textElement.childNodes[0], endOffset: 6}));
+        let highlight3 = new Highlight(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 10, endContainer: textElement.childNodes[0], endOffset: 13}));
 
-        CSS.highlights.set("example-highlight1", highlightRangeGroup1);
-        CSS.highlights.set("example-highlight2", highlightRangeGroup2);
-        CSS.highlights.set("example-highlight3", highlightRangeGroup3);
+        CSS.highlights.set("example-highlight1", highlight1);
+        CSS.highlights.set("example-highlight2", highlight2);
+        CSS.highlights.set("example-highlight3", highlight3);
     </script>
 </body>
 </html>

Modified: trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text-repaint.html (268773 => 268774)


--- trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text-repaint.html	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text-repaint.html	2020-10-20 23:58:03 UTC (rev 268774)
@@ -5,7 +5,7 @@
     <title>Multiple custom highlight pseudo elements.</title>
     <link rel="help" href=""
     <link rel="match" href=""
-    <meta name="assert" content="Highlight Ranges should be able to be added and removed from the HighlightRangeGroup.">
+    <meta name="assert" content="Highlight Ranges should be able to be added and removed from the Highlight.">
     <style>
         ::highlight(example-highlight) {
             background-color: blue;
@@ -42,12 +42,12 @@
             let range2 = new StaticRange({startContainer: textElement.childNodes[0], startOffset: 3, endContainer: textElement.childNodes[0], endOffset: 4});
             let range3 = new StaticRange({startContainer: textElement.childNodes[0], startOffset: 8, endContainer: textElement.childNodes[0], endOffset: 12});
 
-            let highlightRangeGroup1 = new HighlightRangeGroup(range1);
-            CSS.highlights.set("example-highlight", highlightRangeGroup1);
+            let highlight1 = new Highlight(range1);
+            CSS.highlights.set("example-highlight", highlight1);
 
-            highlightRangeGroup1.add(range2);
-            highlightRangeGroup1.delete(range1);
-            highlightRangeGroup1.add(range3);
+            highlight1.add(range2);
+            highlight1.delete(range1);
+            highlight1.add(range3);
 
             var repaintRects = window.internals.repaintRectsAsText();
             window.internals.stopTrackingRepaints();

Modified: trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text-replace.html (268773 => 268774)


--- trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text-replace.html	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text-replace.html	2020-10-20 23:58:03 UTC (rev 268774)
@@ -18,13 +18,13 @@
 
     <script>
         let textElement = document.getElementById('text1');
-        let highlightRangeGroup1 = new HighlightRangeGroup(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 1, endContainer: textElement.childNodes[0], endOffset: 2}));
+        let highlight1 = new Highlight(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 1, endContainer: textElement.childNodes[0], endOffset: 2}));
 
-        let highlightRangeGroup2 = new HighlightRangeGroup(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 3, endContainer: textElement.childNodes[0], endOffset: 4}));
-        highlightRangeGroup2.add(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 5, endContainer: textElement.childNodes[0], endOffset: 6}));        
+        let highlight2 = new Highlight(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 3, endContainer: textElement.childNodes[0], endOffset: 4}));
+        highlight2.add(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 5, endContainer: textElement.childNodes[0], endOffset: 6}));        
 
-        CSS.highlights.set("example-highlight", highlightRangeGroup1);
-        CSS.highlights.set("example-highlight", highlightRangeGroup2);
+        CSS.highlights.set("example-highlight", highlight1);
+        CSS.highlights.set("example-highlight", highlight2);
     </script>
 </body>
 </html>

Modified: trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text.html (268773 => 268774)


--- trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text.html	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/LayoutTests/http/wpt/css/css-highlight-api/highlight-text.html	2020-10-20 23:58:03 UTC (rev 268774)
@@ -26,19 +26,19 @@
 
     <script>
         let textElement = document.getElementById('text1');
-        let highlightRangeGroup1 = new HighlightRangeGroup(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 1, endContainer: textElement.childNodes[0], endOffset: 2}));
+        let highlight1 = new Highlight(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 1, endContainer: textElement.childNodes[0], endOffset: 2}));
 
-        let highlightRangeGroup2 = new HighlightRangeGroup(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 3, endContainer: textElement.childNodes[0], endOffset: 4}));
-        highlightRangeGroup2.add(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 5, endContainer: textElement.childNodes[0], endOffset: 6}));
+        let highlight2 = new Highlight(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 3, endContainer: textElement.childNodes[0], endOffset: 4}));
+        highlight2.add(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 5, endContainer: textElement.childNodes[0], endOffset: 6}));
 
-        let highlightRangeGroup3 = new HighlightRangeGroup(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 7, endContainer: textElement.childNodes[0], endOffset: 8}));
-        highlightRangeGroup3.add(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 9, endContainer: textElement.childNodes[0], endOffset: 10}));
-        highlightRangeGroup3.add(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 12, endContainer: textElement.childNodes[0], endOffset: 13}));
+        let highlight3 = new Highlight(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 7, endContainer: textElement.childNodes[0], endOffset: 8}));
+        highlight3.add(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 9, endContainer: textElement.childNodes[0], endOffset: 10}));
+        highlight3.add(new StaticRange({startContainer: textElement.childNodes[0], startOffset: 12, endContainer: textElement.childNodes[0], endOffset: 13}));
         
 
-        CSS.highlights.set("example-highlight1", highlightRangeGroup1);
-        CSS.highlights.set("example-highlight2", highlightRangeGroup2);
-        CSS.highlights.set("example-highlight3", highlightRangeGroup3);
+        CSS.highlights.set("example-highlight1", highlight1);
+        CSS.highlights.set("example-highlight2", highlight2);
+        CSS.highlights.set("example-highlight3", highlight3);
     </script>
 </body>
 </html>

Modified: trunk/Source/WebCore/CMakeLists.txt (268773 => 268774)


--- trunk/Source/WebCore/CMakeLists.txt	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/CMakeLists.txt	2020-10-20 23:58:03 UTC (rev 268774)
@@ -290,8 +290,8 @@
     Modules/geolocation/PositionErrorCallback.idl
     Modules/geolocation/PositionOptions.idl
 
-    Modules/highlight/HighlightMap.idl
-    Modules/highlight/HighlightRangeGroup.idl
+    Modules/highlight/Highlight.idl
+    Modules/highlight/HighlightRegister.idl
 
     Modules/indexeddb/DOMWindow+IndexedDatabase.idl
     Modules/indexeddb/IDBCursor.idl

Modified: trunk/Source/WebCore/ChangeLog (268773 => 268774)


--- trunk/Source/WebCore/ChangeLog	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/ChangeLog	2020-10-20 23:58:03 UTC (rev 268774)
@@ -1,3 +1,54 @@
+2020-10-20  Megan Gardner  <megan_gard...@apple.com>
+
+        Rename HighlightMap to HighlightRegister and HighlightRangeGroup to Highlight to match current spec
+        https://bugs.webkit.org/show_bug.cgi?id=217919
+
+        Reviewed by Ryosuke Niwa.
+
+        No new tests, no new behavior, rename only.
+        https://drafts.csswg.org/css-highlight-api-1/
+
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Modules/highlight/Highlight.cpp: Renamed from Source/WebCore/Modules/highlight/HighlightRangeGroup.cpp.
+        (WebCore::Highlight::Highlight):
+        (WebCore::Highlight::create):
+        (WebCore::Highlight::initializeSetLike):
+        (WebCore::Highlight::removeFromSetLike):
+        (WebCore::Highlight::clearFromSetLike):
+        (WebCore::Highlight::addToSetLike):
+        * Modules/highlight/Highlight.h: Renamed from Source/WebCore/Modules/highlight/HighlightRangeGroup.h.
+        * Modules/highlight/Highlight.idl: Renamed from Source/WebCore/Modules/highlight/HighlightRangeGroup.idl.
+        * Modules/highlight/HighlightRegister.cpp: Renamed from Source/WebCore/Modules/highlight/HighlightMap.cpp.
+        (WebCore::HighlightRegister::initializeMapLike):
+        (WebCore::HighlightRegister::setFromMapLike):
+        (WebCore::HighlightRegister::clear):
+        (WebCore::HighlightRegister::remove):
+        * Modules/highlight/HighlightRegister.h: Renamed from Source/WebCore/Modules/highlight/HighlightMap.h.
+        (WebCore::HighlightRegister::create):
+        (WebCore::HighlightRegister::map const):
+        * Modules/highlight/HighlightRegister.idl: Renamed from Source/WebCore/Modules/highlight/HighlightMap.idl.
+        * 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::commonTeardown):
+        (WebCore::Document::highlightRegister):
+        (WebCore::Document::updateHighlightPositions):
+        (WebCore::Document::highlightMap): Deleted.
+        * dom/Document.h:
+        * rendering/HighlightData.cpp:
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::collectMarkedTextsForHighlights const):
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::calculateHighlightColor const):
+        * rendering/SelectionRangeData.cpp:
+
 2020-10-20  Antoine Quint  <grao...@webkit.org>
 
         REGRESSION (r268483): Map jumps around while zooming on windy.com, strava.com

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (268773 => 268774)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2020-10-20 23:58:03 UTC (rev 268774)
@@ -129,8 +129,8 @@
 $(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/highlight/HighlightRegister.idl
+$(PROJECT_DIR)/Modules/highlight/Highlight.idl
 $(PROJECT_DIR)/Modules/indexeddb/DOMWindow+IndexedDatabase.idl
 $(PROJECT_DIR)/Modules/indexeddb/IDBCursor.idl
 $(PROJECT_DIR)/Modules/indexeddb/IDBCursorDirection.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (268773 => 268774)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2020-10-20 23:58:03 UTC (rev 268774)
@@ -1110,10 +1110,10 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHashChangeEvent.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHdrMetadataType.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHdrMetadataType.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/JSHighlightRegister.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHighlightRegister.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHighlight.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHighlight.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHistory.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHistory.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSHkdfParams.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (268773 => 268774)


--- trunk/Source/WebCore/DerivedSources.make	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/DerivedSources.make	2020-10-20 23:58:03 UTC (rev 268774)
@@ -155,8 +155,8 @@
     $(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/highlight/HighlightRegister.idl \
+    $(WebCore)/Modules/highlight/Highlight.idl \
     $(WebCore)/Modules/indexeddb/DOMWindow+IndexedDatabase.idl \
     $(WebCore)/Modules/indexeddb/IDBCursor.idl \
     $(WebCore)/Modules/indexeddb/IDBCursorDirection.idl \

Copied: trunk/Source/WebCore/Modules/highlight/Highlight.cpp (from rev 268773, trunk/Source/WebCore/Modules/highlight/HighlightRangeGroup.cpp) (0 => 268774)


--- trunk/Source/WebCore/Modules/highlight/Highlight.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/highlight/Highlight.cpp	2020-10-20 23:58:03 UTC (rev 268774)
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2019-2020 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 "Highlight.h"
+
+#include "IDLTypes.h"
+#include "JSDOMSetLike.h"
+#include "JSStaticRange.h"
+#include "NodeTraversal.h"
+#include "PropertySetCSSStyleDeclaration.h"
+#include "RenderObject.h"
+#include "StaticRange.h"
+#include "StyleProperties.h"
+#include <wtf/Ref.h>
+
+namespace WebCore {
+
+Highlight::Highlight(Ref<StaticRange>&& range)
+{
+    auto myRange = WTFMove(range);
+    addToSetLike(myRange.get());
+}
+
+Ref<Highlight> Highlight::create(StaticRange& range)
+{
+    return adoptRef(*new Highlight(range));
+}
+
+void Highlight::initializeSetLike(DOMSetAdapter& set)
+{
+    for (auto& rangeData : m_rangesData)
+        set.add<IDLInterface<StaticRange>>(rangeData->range);
+}
+
+static void repaintRange(const StaticRange& range)
+{
+    auto startNode = makeRefPtr(&range.startContainer());
+    auto endNode = makeRefPtr(&range.endContainer());
+    auto ordering = documentOrder(*startNode.get(), *endNode.get());
+    if (is_eq(ordering)) {
+        if (auto renderer = startNode->renderer())
+            renderer->repaint();
+        return;
+    }
+    if (is_gt(ordering)) {
+        startNode = &range.endContainer();
+        endNode = &range.startContainer();
+    }
+    auto simpleRange = makeSimpleRange(makeBoundaryPointBeforeNode(*startNode.get()), makeBoundaryPointAfterNode(*endNode.get()));
+    if (simpleRange) {
+        for (auto& node : intersectingNodes(simpleRange.value())) {
+            if (auto renderer = node.renderer())
+                renderer->repaint();
+        }
+    }
+}
+
+bool Highlight::removeFromSetLike(const StaticRange& range)
+{
+    return m_rangesData.removeFirstMatching([&range](const Ref<HighlightRangeData>& current) {
+        repaintRange(range);
+        return current.get().range.get() == range;
+    });
+}
+
+void Highlight::clearFromSetLike()
+{
+    for (auto& data : m_rangesData)
+        repaintRange(data->range);
+
+    m_rangesData.clear();
+}
+
+bool Highlight::addToSetLike(StaticRange& range)
+{
+    if (notFound != m_rangesData.findMatching([&range](const Ref<HighlightRangeData>& current) { return current.get().range.get() == range; }))
+        return false;
+    repaintRange(range);
+    m_rangesData.append(HighlightRangeData::create(range));
+    
+    return true;
+}
+
+}
+

Copied: trunk/Source/WebCore/Modules/highlight/Highlight.h (from rev 268773, trunk/Source/WebCore/Modules/highlight/HighlightRangeGroup.h) (0 => 268774)


--- trunk/Source/WebCore/Modules/highlight/Highlight.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/highlight/Highlight.h	2020-10-20 23:58:03 UTC (rev 268774)
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2019-2020 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 "Position.h"
+#include "StaticRange.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class CSSStyleDeclaration;
+class DOMSetAdapter;
+class PropertySetCSSStyleDeclaration;
+class StaticRange;
+
+
+struct HighlightRangeData : RefCounted<HighlightRangeData>, public CanMakeWeakPtr<HighlightRangeData> {
+    HighlightRangeData(Ref<StaticRange>&& range)
+        : range(WTFMove(range))
+    {
+    }
+    static Ref<HighlightRangeData> create(Ref<StaticRange>&& range)
+    {
+        return adoptRef(*new HighlightRangeData(WTFMove(range)));
+    }
+    Ref<StaticRange> range;
+    Optional<Position> startPosition;
+    Optional<Position> endPosition;
+};
+
+class Highlight : public RefCounted<Highlight> {
+public:
+    static Ref<Highlight> create(StaticRange&);
+    void clearFromSetLike();
+    bool addToSetLike(StaticRange&);
+    bool removeFromSetLike(const StaticRange&);
+    void initializeSetLike(DOMSetAdapter&);
+    const Vector<Ref<HighlightRangeData>>& rangesData() const { return m_rangesData; }
+
+    // FIXME: Add WEBCORE_EXPORT CSSStyleDeclaration& style();
+private:
+    Vector<Ref<HighlightRangeData>> m_rangesData; // FIXME: use a HashSet instead of a Vector <rdar://problem/57760614>
+    explicit Highlight(Ref<StaticRange>&&);
+};
+
+}
+

Copied: trunk/Source/WebCore/Modules/highlight/Highlight.idl (from rev 268773, trunk/Source/WebCore/Modules/highlight/HighlightRangeGroup.idl) (0 => 268774)


--- trunk/Source/WebCore/Modules/highlight/Highlight.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/highlight/Highlight.idl	2020-10-20 23:58:03 UTC (rev 268774)
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+[
+    EnabledAtRuntime=HighlightAPI,
+    ImplementationLacksVTable,
+    Exposed=Window
+] interface Highlight {
+    constructor(StaticRange range);
+
+    setlike<StaticRange>;
+    // FIXME: Add readonly attribute CSSStyleDeclaration style;
+};

Deleted: trunk/Source/WebCore/Modules/highlight/HighlightMap.cpp (268773 => 268774)


--- trunk/Source/WebCore/Modules/highlight/HighlightMap.cpp	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/Modules/highlight/HighlightMap.cpp	2020-10-20 23:58:03 UTC (rev 268774)
@@ -1,56 +0,0 @@
-/*
- * 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"
-
-#include "IDLTypes.h"
-#include "JSDOMMapLike.h"
-#include "JSHighlightRangeGroup.h"
-
-namespace WebCore {
-    
-void HighlightMap::initializeMapLike(DOMMapAdapter& map)
-{
-    for (auto& keyValue : m_map)
-        map.set<IDLDOMString, IDLInterface<HighlightRangeGroup>>(keyValue.key, keyValue.value);
-}
-
-void HighlightMap::setFromMapLike(String&& key, Ref<HighlightRangeGroup>&& value)
-{
-    m_map.set(WTFMove(key), WTFMove(value));
-}
-
-void HighlightMap::clear()
-{
-    m_map.clear();
-}
-
-bool HighlightMap::remove(const String& key)
-{
-    return m_map.remove(key);
-}
-
-}

Deleted: trunk/Source/WebCore/Modules/highlight/HighlightMap.h (268773 => 268774)


--- trunk/Source/WebCore/Modules/highlight/HighlightMap.h	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/Modules/highlight/HighlightMap.h	2020-10-20 23:58:03 UTC (rev 268774)
@@ -1,55 +0,0 @@
-/*
- * 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 <wtf/HashMap.h>
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
-class DOMMapAdapter;
-class DOMString;
-class HighlightRangeGroup;
-
-class HighlightMap : public RefCounted<HighlightMap> {
-public:
-    static Ref<HighlightMap> create() { return adoptRef(*new HighlightMap); }
-
-    void initializeMapLike(DOMMapAdapter&);
-    void setFromMapLike(String&&, Ref<HighlightRangeGroup>&&);
-    void clear();
-    bool remove(const String&);
-    
-    const HashMap<String, Ref<HighlightRangeGroup>>& map() const { return m_map; }
-    
-private:
-    HighlightMap() = default;
-    HashMap<String, Ref<HighlightRangeGroup>> m_map;
-};
-
-}
-

Deleted: trunk/Source/WebCore/Modules/highlight/HighlightMap.idl (268773 => 268774)


--- trunk/Source/WebCore/Modules/highlight/HighlightMap.idl	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/Modules/highlight/HighlightMap.idl	2020-10-20 23:58:03 UTC (rev 268774)
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-
-[
-    EnabledAtRuntime=HighlightAPI,
-    ImplementationLacksVTable,
-    Exposed=Window
-] interface HighlightMap {
-    constructor();
-
-    maplike<DOMString, HighlightRangeGroup>;
-};

Deleted: trunk/Source/WebCore/Modules/highlight/HighlightRangeGroup.cpp (268773 => 268774)


--- trunk/Source/WebCore/Modules/highlight/HighlightRangeGroup.cpp	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/Modules/highlight/HighlightRangeGroup.cpp	2020-10-20 23:58:03 UTC (rev 268774)
@@ -1,108 +0,0 @@
-/*
- * 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 "IDLTypes.h"
-#include "JSDOMSetLike.h"
-#include "JSStaticRange.h"
-#include "NodeTraversal.h"
-#include "PropertySetCSSStyleDeclaration.h"
-#include "RenderObject.h"
-#include "StaticRange.h"
-#include "StyleProperties.h"
-#include <wtf/Ref.h>
-
-namespace WebCore {
-
-HighlightRangeGroup::HighlightRangeGroup(Ref<StaticRange>&& range)
-{
-    auto myRange = WTFMove(range);
-    addToSetLike(myRange.get());
-}
-
-Ref<HighlightRangeGroup> HighlightRangeGroup::create(StaticRange& range)
-{
-    return adoptRef(*new HighlightRangeGroup(range));
-}
-
-void HighlightRangeGroup::initializeSetLike(DOMSetAdapter& set)
-{
-    for (auto& rangeData : m_rangesData)
-        set.add<IDLInterface<StaticRange>>(rangeData->range);
-}
-
-static void repaintRange(const StaticRange& range)
-{
-    auto* startNode = &range.startContainer();
-    auto* endNode = &range.endContainer();
-    auto ordering = documentOrder(*startNode, *endNode);
-    if (is_eq(ordering)) {
-        if (auto renderer = startNode->renderer())
-            renderer->repaint();
-        return;
-    }
-    if (is_gt(ordering)) {
-        startNode = &range.endContainer();
-        endNode = &range.startContainer();
-    }
-
-    auto node = startNode;
-    while (node != endNode) {
-        if (auto renderer = node->renderer())
-            renderer->repaint();
-        node = NodeTraversal::next(*node);
-    }
-}
-
-bool HighlightRangeGroup::removeFromSetLike(const StaticRange& range)
-{
-    return m_rangesData.removeFirstMatching([&range](const Ref<HighlightRangeData>& current) {
-        repaintRange(range);
-        return current.get().range.get() == range;
-    });
-}
-
-void HighlightRangeGroup::clearFromSetLike()
-{
-    for (auto& data : m_rangesData)
-        repaintRange(data->range);
-
-    m_rangesData.clear();
-}
-
-bool HighlightRangeGroup::addToSetLike(StaticRange& range)
-{
-    if (notFound != m_rangesData.findMatching([&range](const Ref<HighlightRangeData>& current) { return current.get().range.get() == range; }))
-        return false;
-    repaintRange(range);
-    m_rangesData.append(HighlightRangeData::create(range));
-    
-    return true;
-}
-
-}
-

Deleted: trunk/Source/WebCore/Modules/highlight/HighlightRangeGroup.h (268773 => 268774)


--- trunk/Source/WebCore/Modules/highlight/HighlightRangeGroup.h	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/Modules/highlight/HighlightRangeGroup.h	2020-10-20 23:58:03 UTC (rev 268774)
@@ -1,76 +0,0 @@
-/*
- * 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 "Position.h"
-#include "StaticRange.h"
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
-class CSSStyleDeclaration;
-class DOMSetAdapter;
-class StaticRange;
-class PropertySetCSSStyleDeclaration;
-
-struct HighlightRangeData : RefCounted<HighlightRangeData>, public CanMakeWeakPtr<HighlightRangeData> {
-    
-    HighlightRangeData(Ref<StaticRange>&& range)
-        : range(WTFMove(range))
-    {
-    }
-    
-    static Ref<HighlightRangeData> create(Ref<StaticRange>&& range)
-    {
-        return adoptRef(*new HighlightRangeData(WTFMove(range)));
-    }
-    
-    Ref<StaticRange> range;
-    Optional<Position> startPosition;
-    Optional<Position> endPosition;
-};
-
-class HighlightRangeGroup : public RefCounted<HighlightRangeGroup> {
-public:
-    static Ref<HighlightRangeGroup> create(StaticRange&);
-    
-    void clearFromSetLike();
-    bool addToSetLike(StaticRange&);
-    bool removeFromSetLike(const StaticRange&);
-    void initializeSetLike(DOMSetAdapter&);
-    
-    const Vector<Ref<HighlightRangeData>>& rangesData() const { return m_rangesData; }
-
-    // FIXME: Add WEBCORE_EXPORT CSSStyleDeclaration& style();
-    
-private:
-    Vector<Ref<HighlightRangeData>> m_rangesData; // FIXME: use a HashSet instead of a Vector <rdar://problem/57760614>
-    explicit HighlightRangeGroup(Ref<StaticRange>&&);
-};
-
-}
-

Deleted: trunk/Source/WebCore/Modules/highlight/HighlightRangeGroup.idl (268773 => 268774)


--- trunk/Source/WebCore/Modules/highlight/HighlightRangeGroup.idl	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/Modules/highlight/HighlightRangeGroup.idl	2020-10-20 23:58:03 UTC (rev 268774)
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-[
-    EnabledAtRuntime=HighlightAPI,
-    ImplementationLacksVTable,
-    Exposed=Window
-] interface HighlightRangeGroup {
-    constructor(StaticRange range);
-
-    setlike<StaticRange>;
-    // FIXME: Add readonly attribute CSSStyleDeclaration style;
-};

Copied: trunk/Source/WebCore/Modules/highlight/HighlightRegister.cpp (from rev 268773, trunk/Source/WebCore/Modules/highlight/HighlightMap.cpp) (0 => 268774)


--- trunk/Source/WebCore/Modules/highlight/HighlightRegister.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/highlight/HighlightRegister.cpp	2020-10-20 23:58:03 UTC (rev 268774)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2019-2020 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 "HighlightRegister.h"
+
+#include "IDLTypes.h"
+#include "JSDOMMapLike.h"
+#include "JSHighlight.h"
+
+namespace WebCore {
+    
+void HighlightRegister::initializeMapLike(DOMMapAdapter& map)
+{
+    for (auto& keyValue : m_map)
+        map.set<IDLDOMString, IDLInterface<Highlight>>(keyValue.key, keyValue.value);
+}
+
+void HighlightRegister::setFromMapLike(String&& key, Ref<Highlight>&& value)
+{
+    m_map.set(WTFMove(key), WTFMove(value));
+}
+
+void HighlightRegister::clear()
+{
+    m_map.clear();
+}
+
+bool HighlightRegister::remove(const String& key)
+{
+    return m_map.remove(key);
+}
+
+}

Copied: trunk/Source/WebCore/Modules/highlight/HighlightRegister.h (from rev 268773, trunk/Source/WebCore/Modules/highlight/HighlightMap.h) (0 => 268774)


--- trunk/Source/WebCore/Modules/highlight/HighlightRegister.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/highlight/HighlightRegister.h	2020-10-20 23:58:03 UTC (rev 268774)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2019-2020 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 "Highlight.h"
+#include <wtf/HashMap.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class DOMMapAdapter;
+class DOMString;
+class Highlight;
+
+class HighlightRegister : public RefCounted<HighlightRegister> {
+public:
+    static Ref<HighlightRegister> create() { return adoptRef(*new HighlightRegister); }
+
+    void initializeMapLike(DOMMapAdapter&);
+    void setFromMapLike(String&&, Ref<Highlight>&&);
+    void clear();
+    bool remove(const String&);
+    
+    const HashMap<String, Ref<Highlight>>& map() const { return m_map; }
+    
+private:
+    HighlightRegister() = default;
+    HashMap<String, Ref<Highlight>> m_map;
+};
+
+}
+

Copied: trunk/Source/WebCore/Modules/highlight/HighlightRegister.idl (from rev 268773, trunk/Source/WebCore/Modules/highlight/HighlightMap.idl) (0 => 268774)


--- trunk/Source/WebCore/Modules/highlight/HighlightRegister.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/highlight/HighlightRegister.idl	2020-10-20 23:58:03 UTC (rev 268774)
@@ -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.
+ */
+
+[
+    EnabledAtRuntime=HighlightAPI,
+    ImplementationLacksVTable,
+    Exposed=Window
+] interface HighlightRegister {
+    constructor();
+
+    maplike<DOMString, Highlight>;
+};

Modified: trunk/Source/WebCore/Sources.txt (268773 => 268774)


--- trunk/Source/WebCore/Sources.txt	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/Sources.txt	2020-10-20 23:58:03 UTC (rev 268774)
@@ -64,8 +64,8 @@
 Modules/geolocation/GeolocationController.cpp
 Modules/geolocation/GeolocationCoordinates.cpp
 Modules/geolocation/NavigatorGeolocation.cpp
-Modules/highlight/HighlightMap.cpp
-Modules/highlight/HighlightRangeGroup.cpp
+Modules/highlight/HighlightRegister.cpp
+Modules/highlight/Highlight.cpp
 Modules/indexeddb/DOMWindowIndexedDatabase.cpp
 Modules/indexeddb/IDBCursor.cpp
 Modules/indexeddb/IDBCursorWithValue.cpp
@@ -3061,8 +3061,8 @@
 JSHTMLVideoElement.cpp
 JSHashChangeEvent.cpp
 JSHdrMetadataType.cpp
-JSHighlightMap.cpp
-JSHighlightRangeGroup.cpp
+JSHighlightRegister.cpp
+JSHighlight.cpp
 JSHistory.cpp
 JSHkdfParams.cpp
 JSHmacKeyParams.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (268773 => 268774)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-10-20 23:58:03 UTC (rev 268774)
@@ -7951,12 +7951,12 @@
 		44D8DA98139545BE00337B75 /* SVGMPathElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SVGMPathElement.idl; sourceTree = "<group>"; };
 		44D8DA9A139545CD00337B75 /* SVGAnimateMotionElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SVGAnimateMotionElement.idl; sourceTree = "<group>"; };
 		44E349F7246F4DC70068479C /* LibWebRTCEnumTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LibWebRTCEnumTraits.h; path = libwebrtc/LibWebRTCEnumTraits.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>"; };
+		44E88E4C2369128A009B4847 /* HighlightRegister.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HighlightRegister.idl; sourceTree = "<group>"; };
+		44E88E4D2369128B009B4847 /* Highlight.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Highlight.idl; sourceTree = "<group>"; };
+		44E88E50236A56AC009B4847 /* HighlightRegister.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HighlightRegister.h; sourceTree = "<group>"; };
+		44E88E51236A5C8D009B4847 /* Highlight.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Highlight.h; sourceTree = "<group>"; };
+		44E88E52236A667F009B4847 /* HighlightRegister.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = HighlightRegister.cpp; sourceTree = "<group>"; };
+		44E88E54236A66A1009B4847 /* Highlight.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Highlight.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>"; };
@@ -19439,12 +19439,12 @@
 		44E88E472368DF0F009B4847 /* highlight */ = {
 			isa = PBXGroup;
 			children = (
-				44E88E52236A667F009B4847 /* HighlightMap.cpp */,
-				44E88E50236A56AC009B4847 /* HighlightMap.h */,
-				44E88E4C2369128A009B4847 /* HighlightMap.idl */,
-				44E88E54236A66A1009B4847 /* HighlightRangeGroup.cpp */,
-				44E88E51236A5C8D009B4847 /* HighlightRangeGroup.h */,
-				44E88E4D2369128B009B4847 /* HighlightRangeGroup.idl */,
+				44E88E54236A66A1009B4847 /* Highlight.cpp */,
+				44E88E51236A5C8D009B4847 /* Highlight.h */,
+				44E88E4D2369128B009B4847 /* Highlight.idl */,
+				44E88E52236A667F009B4847 /* HighlightRegister.cpp */,
+				44E88E50236A56AC009B4847 /* HighlightRegister.h */,
+				44E88E4C2369128A009B4847 /* HighlightRegister.idl */,
 			);
 			path = highlight;
 			sourceTree = "<group>";

Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (268773 => 268774)


--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2020-10-20 23:58:03 UTC (rev 268774)
@@ -129,8 +129,8 @@
     macro(GPUTextureView) \
     macro(GPUUncapturedErrorEvent) \
     macro(GPUValidationError) \
-    macro(HighlightMap) \
-    macro(HighlightRangeGroup) \
+    macro(HighlightRegister) \
+    macro(Highlight) \
     macro(HTMLAttachmentElement) \
     macro(HTMLAudioElement) \
     macro(HTMLDialogElement) \

Modified: trunk/Source/WebCore/css/DOMCSSNamespace.cpp (268773 => 268774)


--- trunk/Source/WebCore/css/DOMCSSNamespace.cpp	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/css/DOMCSSNamespace.cpp	2020-10-20 23:58:03 UTC (rev 268774)
@@ -34,7 +34,7 @@
 #include "CSSParser.h"
 #include "CSSPropertyParser.h"
 #include "Document.h"
-#include "HighlightMap.h"
+#include "HighlightRegister.h"
 #include "StyleProperties.h"
 #include <wtf/text/StringBuilder.h>
 #include <wtf/text/WTFString.h>
@@ -89,9 +89,9 @@
     return builder.toString();
 }
 
-HighlightMap& DOMCSSNamespace::highlights(Document& document)
+HighlightRegister& DOMCSSNamespace::highlights(Document& document)
 {
-    return document.highlightMap();
+    return document.highlightRegister();
 }
 
 }

Modified: trunk/Source/WebCore/css/DOMCSSNamespace.h (268773 => 268774)


--- trunk/Source/WebCore/css/DOMCSSNamespace.h	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/css/DOMCSSNamespace.h	2020-10-20 23:58:03 UTC (rev 268774)
@@ -37,8 +37,8 @@
 namespace WebCore {
 
 class Document;
-class HighlightMap;
-class HighlightRangeGroup;
+class HighlightRegister;
+class Highlight;
 
 class DOMCSSNamespace final : public RefCounted<DOMCSSNamespace>, public Supplementable<DOMCSSNamespace> {
 public:
@@ -45,7 +45,7 @@
     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&);
+    static HighlightRegister& highlights(Document&);
 };
 
 }

Modified: trunk/Source/WebCore/css/DOMCSSNamespace.idl (268773 => 268774)


--- trunk/Source/WebCore/css/DOMCSSNamespace.idl	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/css/DOMCSSNamespace.idl	2020-10-20 23:58:03 UTC (rev 268774)
@@ -35,5 +35,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;
+    [EnabledAtRuntime=HighlightAPI, CallWith=Document] static readonly attribute HighlightRegister highlights;
 };

Modified: trunk/Source/WebCore/dom/Document.cpp (268773 => 268774)


--- trunk/Source/WebCore/dom/Document.cpp	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/dom/Document.cpp	2020-10-20 23:58:03 UTC (rev 268774)
@@ -111,7 +111,7 @@
 #include "HTTPHeaderNames.h"
 #include "HTTPParsers.h"
 #include "HashChangeEvent.h"
-#include "HighlightMap.h"
+#include "HighlightRegister.h"
 #include "History.h"
 #include "HitTestResult.h"
 #include "IdleCallbackController.h"
@@ -792,8 +792,8 @@
 
     clearScriptedAnimationController();
     
-    if (m_highlightMap)
-        m_highlightMap->clear();
+    if (m_highlightRegister)
+        m_highlightRegister->clear();
 
     m_pendingScrollEventTargetList = nullptr;
 
@@ -2767,18 +2767,18 @@
     return XMLDocumentParser::create(*this, view());
 }
 
-HighlightMap& Document::highlightMap()
+HighlightRegister& Document::highlightRegister()
 {
-    if (!m_highlightMap)
-        m_highlightMap = HighlightMap::create();
-    return *m_highlightMap;
+    if (!m_highlightRegister)
+        m_highlightRegister = HighlightRegister::create();
+    return *m_highlightRegister;
 }
 
 void Document::updateHighlightPositions()
 {
     Vector<WeakPtr<HighlightRangeData>> rangesData;
-    if (m_highlightMap) {
-        for (auto& highlight : m_highlightMap->map()) {
+    if (m_highlightRegister) {
+        for (auto& highlight : m_highlightRegister->map()) {
             for (auto& rangeData : highlight.value->rangesData()) {
                 if (rangeData->startPosition && rangeData->endPosition)
                     continue;

Modified: trunk/Source/WebCore/dom/Document.h (268773 => 268774)


--- trunk/Source/WebCore/dom/Document.h	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/dom/Document.h	2020-10-20 23:58:03 UTC (rev 268774)
@@ -156,7 +156,7 @@
 class HTMLMapElement;
 class HTMLMediaElement;
 class HTMLVideoElement;
-class HighlightMap;
+class HighlightRegister;
 class HitTestLocation;
 class HitTestRequest;
 class HitTestResult;
@@ -1569,7 +1569,7 @@
     WEBCORE_EXPORT TextManipulationController& textManipulationController();
     TextManipulationController* textManipulationControllerIfExists() { return m_textManipulationController.get(); }
         
-    HighlightMap& highlightMap();
+    HighlightRegister& highlightRegister();
     void updateHighlightPositions();
 
     bool allowsContentJavaScript() const;
@@ -1924,7 +1924,7 @@
     std::unique_ptr<TextAutoSizing> m_textAutoSizing;
 #endif
         
-    RefPtr<HighlightMap> m_highlightMap;
+    RefPtr<HighlightRegister> m_highlightRegister;
 
     Timer m_visualUpdatesSuppressionTimer;
 

Modified: trunk/Source/WebCore/rendering/HighlightData.cpp (268773 => 268774)


--- trunk/Source/WebCore/rendering/HighlightData.cpp	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/rendering/HighlightData.cpp	2020-10-20 23:58:03 UTC (rev 268774)
@@ -33,7 +33,7 @@
 
 #include "Document.h"
 #include "FrameSelection.h"
-#include "HighlightRangeGroup.h"
+#include "Highlight.h"
 #include "Logging.h"
 #include "Position.h"
 #include "Range.h"

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (268773 => 268774)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2020-10-20 23:58:03 UTC (rev 268774)
@@ -36,7 +36,7 @@
 #include "Frame.h"
 #include "GraphicsContext.h"
 #include "HighlightData.h"
-#include "HighlightMap.h"
+#include "HighlightRegister.h"
 #include "HitTestResult.h"
 #include "ImageBuffer.h"
 #include "InlineTextBoxStyle.h"
@@ -1051,7 +1051,7 @@
     auto& parentRenderer = parent()->renderer();
     auto& parentStyle = parentRenderer.style();
     HighlightData highlightData;
-    for (auto& highlight : renderer().document().highlightMap().map()) {
+    for (auto& highlight : renderer().document().highlightRegister().map()) {
         auto renderStyle = parentRenderer.getUncachedPseudoStyle({ PseudoId::Highlight, highlight.key }, &parentStyle);
         if (!renderStyle)
             continue;

Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (268773 => 268774)


--- trunk/Source/WebCore/rendering/RenderReplaced.cpp	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp	2020-10-20 23:58:03 UTC (rev 268774)
@@ -33,7 +33,7 @@
 #include "HTMLImageElement.h"
 #include "HTMLParserIdioms.h"
 #include "HighlightData.h"
-#include "HighlightMap.h"
+#include "HighlightRegister.h"
 #include "InlineElementBox.h"
 #include "LayoutIntegrationLineIterator.h"
 #include "LayoutIntegrationRunIterator.h"
@@ -154,7 +154,7 @@
 Color RenderReplaced::calculateHighlightColor() const
 {
     HighlightData highlightData;
-    for (auto& highlight : document().highlightMap().map()) {
+    for (auto& highlight : document().highlightRegister().map()) {
         for (auto& rangeData : highlight.value->rangesData()) {
             if (!highlightData.setRenderRange(rangeData))
                 continue;

Modified: trunk/Source/WebCore/rendering/SelectionRangeData.cpp (268773 => 268774)


--- trunk/Source/WebCore/rendering/SelectionRangeData.cpp	2020-10-20 23:33:03 UTC (rev 268773)
+++ trunk/Source/WebCore/rendering/SelectionRangeData.cpp	2020-10-20 23:58:03 UTC (rev 268774)
@@ -32,7 +32,7 @@
 
 #include "Document.h"
 #include "FrameSelection.h"
-#include "HighlightRangeGroup.h"
+#include "Highlight.h"
 #include "Logging.h"
 #include "Position.h"
 #include "Range.h"
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to