Title: [172090] branches/safari-600.1-branch/Source/WebCore

Diff

Modified: branches/safari-600.1-branch/Source/WebCore/ChangeLog (172089 => 172090)


--- branches/safari-600.1-branch/Source/WebCore/ChangeLog	2014-08-05 22:15:18 UTC (rev 172089)
+++ branches/safari-600.1-branch/Source/WebCore/ChangeLog	2014-08-05 22:18:17 UTC (rev 172090)
@@ -1,5 +1,37 @@
 2014-08-05  Lucas Forschler  <lforsch...@apple.com>
 
+        Merge r172013
+
+    2014-08-04  Tim Horton  <timothy_hor...@apple.com>
+
+            Selection services menu dropdown is in the wrong place when selecting some text on Yelp
+            https://bugs.webkit.org/show_bug.cgi?id=135582
+            <rdar://problem/17837636>
+
+            Reviewed by Simon Fraser.
+
+            * editing/SelectionRectGatherer.cpp:
+            (WebCore::SelectionRectGatherer::addRect):
+            (WebCore::SelectionRectGatherer::addGapRects):
+            (WebCore::SelectionRectGatherer::addRects): Deleted.
+            Rename addRects to addGapRects for clarity.
+            Map rects and gapRects to absolute RenderView coordinates so that
+            they are in a form WebKit2 can use. Previously they were sometimes
+            relative to a different repaint container, but that information was
+            lost when moving through SelectionRectGatherer.
+
+            Ideally we would keep selection rects as full quads instead of rects
+            for more of their life, but that problem is much deeper than just SelectionRectGatherer.
+
+            * editing/SelectionRectGatherer.h:
+            Add a comment clarifying the coordinate space of the stored selection rects.
+
+            * rendering/RenderView.cpp:
+            (WebCore::RenderView::applySubtreeSelection):
+            Rename addRects to addGapRects for clarity.
+
+2014-08-05  Lucas Forschler  <lforsch...@apple.com>
+
         Merge r172006
 
     2014-08-04  Joseph Pecoraro  <pecor...@apple.com>

Modified: branches/safari-600.1-branch/Source/WebCore/editing/SelectionRectGatherer.cpp (172089 => 172090)


--- branches/safari-600.1-branch/Source/WebCore/editing/SelectionRectGatherer.cpp	2014-08-05 22:15:18 UTC (rev 172089)
+++ branches/safari-600.1-branch/Source/WebCore/editing/SelectionRectGatherer.cpp	2014-08-05 22:18:17 UTC (rev 172090)
@@ -40,15 +40,21 @@
 {
 }
 
-void SelectionRectGatherer::addRect(const LayoutRect& rect)
+void SelectionRectGatherer::addRect(RenderLayerModelObject *repaintContainer, const LayoutRect& rect)
 {
-    if (!rect.isEmpty())
-        m_rects.append(rect);
+    if (!rect.isEmpty()) {
+        LayoutRect absoluteRect(repaintContainer->localToAbsoluteQuad(FloatQuad(rect)).boundingBox());
+        m_rects.append(absoluteRect);
+    }
 }
 
-void SelectionRectGatherer::addRects(const GapRects& rects)
+void SelectionRectGatherer::addGapRects(RenderLayerModelObject *repaintContainer, const GapRects& rects)
 {
-    m_gapRects.append(rects);
+    GapRects absoluteGapRects;
+    absoluteGapRects.uniteLeft(LayoutRect(repaintContainer->localToAbsoluteQuad(FloatQuad(rects.left())).boundingBox()));
+    absoluteGapRects.uniteCenter(LayoutRect(repaintContainer->localToAbsoluteQuad(FloatQuad(rects.center())).boundingBox()));
+    absoluteGapRects.uniteRight(LayoutRect(repaintContainer->localToAbsoluteQuad(FloatQuad(rects.right())).boundingBox()));
+    m_gapRects.append(absoluteGapRects);
 }
 
 SelectionRectGatherer::Notifier::Notifier(SelectionRectGatherer& gatherer)

Modified: branches/safari-600.1-branch/Source/WebCore/editing/SelectionRectGatherer.h (172089 => 172090)


--- branches/safari-600.1-branch/Source/WebCore/editing/SelectionRectGatherer.h	2014-08-05 22:15:18 UTC (rev 172089)
+++ branches/safari-600.1-branch/Source/WebCore/editing/SelectionRectGatherer.h	2014-08-05 22:18:17 UTC (rev 172090)
@@ -34,6 +34,7 @@
 namespace WebCore {
 
 class LayoutRect;
+class RenderLayerModelObject;
 class RenderView;
 
 struct GapRects;
@@ -44,8 +45,8 @@
 public:
     SelectionRectGatherer(RenderView&);
 
-    void addRect(const LayoutRect&);
-    void addRects(const GapRects&);
+    void addRect(RenderLayerModelObject *repaintContainer, const LayoutRect&);
+    void addGapRects(RenderLayerModelObject *repaintContainer, const GapRects&);
 
     class Notifier {
         WTF_MAKE_NONCOPYABLE(Notifier);
@@ -61,6 +62,8 @@
     
 private:
     RenderView& m_renderView;
+
+    // All rects are in RenderView coordinates.
     Vector<LayoutRect> m_rects;
     Vector<GapRects> m_gapRects;
 };

Modified: branches/safari-600.1-branch/Source/WebCore/rendering/RenderView.cpp (172089 => 172090)


--- branches/safari-600.1-branch/Source/WebCore/rendering/RenderView.cpp	2014-08-05 22:15:18 UTC (rev 172089)
+++ branches/safari-600.1-branch/Source/WebCore/rendering/RenderView.cpp	2014-08-05 22:18:17 UTC (rev 172090)
@@ -996,7 +996,7 @@
 
 #if ENABLE(SERVICE_CONTROLS)
             for (auto& rect : selectionInfo->rects())
-                m_selectionRectGatherer.addRect(rect);
+                m_selectionRectGatherer.addRect(selectionInfo->repaintContainer(), rect);
 #endif
 
             newSelectedObjects.set(o, WTF::move(selectionInfo));
@@ -1010,7 +1010,7 @@
                 cb = cb->containingBlock();
 
 #if ENABLE(SERVICE_CONTROLS)
-                m_selectionRectGatherer.addRects(blockInfo->rects());
+                m_selectionRectGatherer.addGapRects(blockInfo->repaintContainer(), blockInfo->rects());
 #endif
             }
         }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to