Title: [172013] trunk/Source/WebCore
- Revision
- 172013
- Author
- [email protected]
- Date
- 2014-08-04 17:28:25 -0700 (Mon, 04 Aug 2014)
Log Message
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.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (172012 => 172013)
--- trunk/Source/WebCore/ChangeLog 2014-08-04 23:06:09 UTC (rev 172012)
+++ trunk/Source/WebCore/ChangeLog 2014-08-05 00:28:25 UTC (rev 172013)
@@ -1,3 +1,31 @@
+2014-08-04 Tim Horton <[email protected]>
+
+ 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-04 Bem Jones-Bey <[email protected]>
[CSS Shapes] shape-margin not respected when it extends beyond an explicitly set margin
Modified: trunk/Source/WebCore/editing/SelectionRectGatherer.cpp (172012 => 172013)
--- trunk/Source/WebCore/editing/SelectionRectGatherer.cpp 2014-08-04 23:06:09 UTC (rev 172012)
+++ trunk/Source/WebCore/editing/SelectionRectGatherer.cpp 2014-08-05 00:28:25 UTC (rev 172013)
@@ -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: trunk/Source/WebCore/editing/SelectionRectGatherer.h (172012 => 172013)
--- trunk/Source/WebCore/editing/SelectionRectGatherer.h 2014-08-04 23:06:09 UTC (rev 172012)
+++ trunk/Source/WebCore/editing/SelectionRectGatherer.h 2014-08-05 00:28:25 UTC (rev 172013)
@@ -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: trunk/Source/WebCore/rendering/RenderView.cpp (172012 => 172013)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2014-08-04 23:06:09 UTC (rev 172012)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2014-08-05 00:28:25 UTC (rev 172013)
@@ -1013,7 +1013,7 @@
#if ENABLE(SERVICE_CONTROLS)
for (auto& rect : selectionInfo->collectedSelectionRects())
- m_selectionRectGatherer.addRect(rect);
+ m_selectionRectGatherer.addRect(selectionInfo->repaintContainer(), rect);
#endif
newSelectedObjects.set(o, WTF::move(selectionInfo));
@@ -1027,7 +1027,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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes