Title: [172492] branches/safari-600.1-branch/Source/WebKit2
Revision
172492
Author
[email protected]
Date
2014-08-12 13:56:24 -0700 (Tue, 12 Aug 2014)

Log Message

Rollout172395. <rdar://problem/17837670>

Modified Paths


Diff

Modified: branches/safari-600.1-branch/Source/WebKit2/ChangeLog (172491 => 172492)


--- branches/safari-600.1-branch/Source/WebKit2/ChangeLog	2014-08-12 20:53:38 UTC (rev 172491)
+++ branches/safari-600.1-branch/Source/WebKit2/ChangeLog	2014-08-12 20:56:24 UTC (rev 172492)
@@ -1,3 +1,7 @@
+2014-08-12  Matthew Hanson  <[email protected]>
+
+        Rollout 172395. <rdar://problem/17837670>
+
 2014-08-12  Lucas Forschler  <[email protected]>
 
         Merge r172379

Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm (172491 => 172492)


--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm	2014-08-12 20:53:38 UTC (rev 172491)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm	2014-08-12 20:56:24 UTC (rev 172492)
@@ -147,59 +147,22 @@
     }
 }
 
-static inline void stitchRects(Vector<LayoutRect>& rects)
+static void compactRectsWithGapRects(Vector<LayoutRect>& rects, const Vector<GapRects>& gapRects)
 {
-    if (rects.size() <= 1)
+    if (rects.isEmpty())
         return;
-    
-    Vector<LayoutRect> newRects;
-    
-    // FIXME: Need to support vertical layout.
-    // First stitch together all the rects on the first line of the selection.
-    size_t indexFromStart = 0;
-    LayoutUnit firstTop = rects[indexFromStart].y();
-    LayoutRect& currentRect = rects[indexFromStart++];
-    while (indexFromStart < rects.size() && rects[indexFromStart].y() == firstTop)
-        currentRect.unite(rects[indexFromStart++]);
-    
-    newRects.append(currentRect);
-    if (indexFromStart == rects.size()) {
-        // All the rects are on one line. There is nothing else to do.
-        rects.swap(newRects);
-        return;
-    }
-    
-    // Next stitch together all the rects on the last line of the selection.
-    size_t indexFromEnd = rects.size() - 1;
-    LayoutUnit lastTop = rects[indexFromEnd].y();
-    LayoutRect lastRect = rects[indexFromEnd];
-    while (indexFromEnd != indexFromStart && rects[--indexFromEnd].y() == lastTop)
-        lastRect.unite(rects[indexFromEnd]);
-    
-    if (indexFromEnd == indexFromStart) {
-        // All the rects are on two lines only. There is nothing else to do.
-        newRects.append(lastRect);
-        rects.swap(newRects);
-        return;
-    }
-    
-    // indexFromStart is the index of the first rectangle on the second line.
-    // indexFromEnd is the index of the last rectangle on the second to the last line.
-    // Stitch together all the rects after the first line until the second to the last included.
-    currentRect = rects[indexFromStart];
-    while (indexFromStart != indexFromEnd)
-        currentRect.unite(rects[++indexFromStart]);
-    
-    newRects.append(currentRect);
-    newRects.append(lastRect);
 
-    rects.swap(newRects);
-}
+    // All of the middle rects - everything but the first and last - can be unioned together.
+    if (rects.size() > 3) {
+        LayoutRect united;
+        for (unsigned i = 1; i < rects.size() - 1; ++i)
+            united.unite(rects[i]);
 
-static void compactRectsWithGapRects(Vector<LayoutRect>& rects, const Vector<GapRects>& gapRects)
-{
-    stitchRects(rects);
-    
+        rects[1] = united;
+        rects[2] = rects.last();
+        rects.shrink(3);
+    }
+
     // FIXME: The following alignments are correct for LTR text.
     // We should also account for RTL.
     uint8_t alignments[3];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to