Title: [219923] branches/safari-604-branch/Source/WebCore
Revision
219923
Author
[email protected]
Date
2017-07-26 02:51:48 -0700 (Wed, 26 Jul 2017)

Log Message

Cherry-pick r219752. rdar://problem/33524766

Modified Paths

Diff

Modified: branches/safari-604-branch/Source/WebCore/ChangeLog (219922 => 219923)


--- branches/safari-604-branch/Source/WebCore/ChangeLog	2017-07-26 09:51:45 UTC (rev 219922)
+++ branches/safari-604-branch/Source/WebCore/ChangeLog	2017-07-26 09:51:48 UTC (rev 219923)
@@ -1,5 +1,25 @@
 2017-07-26  Jason Marcell  <[email protected]>
 
+        Cherry-pick r219752. rdar://problem/33524766
+
+    2017-07-21  Timothy Horton  <[email protected]>
+
+            TextIndicator::estimatedTextColorsForRange asserts inside HashSet code (inserting reserved value)
+            https://bugs.webkit.org/show_bug.cgi?id=174733
+
+            Reviewed by Wenson Hsieh.
+
+            * page/TextIndicator.cpp:
+            (WebCore::estimatedTextColorsForRange):
+            (WebCore::adjustTextIndicatorDataOptionsForEstimatedColorsIfNecessary):
+            RGBA32 isn't a valid hash key, because we have no traits that define the
+            empty or deleted values, nor do we have any bits we could feasibly
+            use -- the full range of RGBA32 is easy to reach with various colors.
+
+            Instead, hash Color directly.
+
+2017-07-26  Jason Marcell  <[email protected]>
+
         Cherry-pick r219751. rdar://problem/33523861
 
     2017-07-21  Nan Wang  <[email protected]>

Modified: branches/safari-604-branch/Source/WebCore/page/TextIndicator.cpp (219922 => 219923)


--- branches/safari-604-branch/Source/WebCore/page/TextIndicator.cpp	2017-07-26 09:51:45 UTC (rev 219922)
+++ branches/safari-604-branch/Source/WebCore/page/TextIndicator.cpp	2017-07-26 09:51:48 UTC (rev 219923)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "TextIndicator.h"
 
+#include "ColorHash.h"
 #include "Document.h"
 #include "Editor.h"
 #include "Element.h"
@@ -209,21 +210,15 @@
     return false;
 }
 
-static Vector<Color> estimatedTextColorsForRange(const Range& range)
+static HashSet<Color> estimatedTextColorsForRange(const Range& range)
 {
-    Vector<Color> colors;
-    HashSet<RGBA32> uniqueRGBValues;
+    HashSet<Color> colors;
     for (TextIterator iterator(&range); !iterator.atEnd(); iterator.advance()) {
         auto* node = iterator.node();
         if (!is<Text>(node) || !is<RenderText>(node->renderer()))
             continue;
 
-        auto& color = node->renderer()->style().color();
-        if (uniqueRGBValues.contains(color.rgb()))
-            continue;
-
-        uniqueRGBValues.add(color.rgb());
-        colors.append(color);
+        colors.add(node->renderer()->style().color());
     }
     return colors;
 }
@@ -264,7 +259,7 @@
     return estimatedBackgroundColor;
 }
 
-static void adjustTextIndicatorDataOptionsForEstimatedColorsIfNecessary(TextIndicatorData& data, const Color& backgroundColor, Vector<Color>&& textColors)
+static void adjustTextIndicatorDataOptionsForEstimatedColorsIfNecessary(TextIndicatorData& data, const Color& backgroundColor, HashSet<Color>&& textColors)
 {
     if (data.options & TextIndicatorOptionPaintAllContent)
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to