Fix GTK Debug bots after r204400
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 14 Aug 2016 18:29:24 +0000 (18:29 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 14 Aug 2016 18:29:24 +0000 (18:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=160818

Reviewed by Carlos Garcia Campos.

Because the GTK EWS bot doesn't run tests, I missed this.

No new tests because there is no behavior change.

* platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
(WebCore::HarfBuzzShaper::selectionRect):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.cpp

index 066bac5..4888e12 100644 (file)
@@ -1,3 +1,17 @@
+2016-08-14  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Fix GTK Debug bots after r204400
+        https://bugs.webkit.org/show_bug.cgi?id=160818
+
+        Reviewed by Carlos Garcia Campos.
+
+        Because the GTK EWS bot doesn't run tests, I missed this.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
+        (WebCore::HarfBuzzShaper::selectionRect):
+
 2016-08-13  Chris Dumez  <cdumez@apple.com>
 
         'compatMode' property should be on Document, not HTMLDocument
index ba9e411..a716558 100644 (file)
@@ -648,26 +648,33 @@ FloatRect HarfBuzzShaper::selectionRect(const FloatPoint& point, int height, uns
     bool foundFromX = false;
     bool foundToX = false;
 
+    Optional<unsigned> fromIndex = from;
+    Optional<unsigned> toIndex = to;
+
     if (m_run.rtl())
         currentX = m_totalWidth;
     for (unsigned i = 0; i < m_harfBuzzRuns.size(); ++i) {
         if (m_run.rtl())
             currentX -= m_harfBuzzRuns[i]->width();
         unsigned numCharacters = m_harfBuzzRuns[i]->numCharacters();
-        if (!foundFromX && from < numCharacters) {
-            fromX = m_harfBuzzRuns[i]->xPositionForOffset(from) + currentX;
+        if (!foundFromX && fromIndex.value() < numCharacters) {
+            fromX = m_harfBuzzRuns[i]->xPositionForOffset(fromIndex.value()) + currentX;
             foundFromX = true;
         } else {
-            ASSERT(from >= numCharacters);
-            from -= numCharacters;
+            if (fromIndex && fromIndex.value() >= numCharacters)
+                fromIndex.value() -= numCharacters;
+            else
+                fromIndex = Nullopt;
         }
 
-        if (!foundToX && to < numCharacters) {
-            toX = m_harfBuzzRuns[i]->xPositionForOffset(to) + currentX;
+        if (!foundToX && toIndex.value() < numCharacters) {
+            toX = m_harfBuzzRuns[i]->xPositionForOffset(toIndex.value()) + currentX;
             foundToX = true;
         } else {
-            ASSERT(to >= numCharacters);
-            to -= numCharacters;
+            if (toIndex && toIndex.value() >= numCharacters)
+                toIndex.value() -= numCharacters;
+            else
+                toIndex = Nullopt;
         }
 
         if (foundFromX && foundToX)