Bug 845595 - Make nsIDOMWindowUtils::selectAtPoint coordinates relative to the DWU's document. r=jimm

This commit is contained in:
Markus Stange 2013-02-27 15:12:39 +01:00
Родитель 2e8db46be9
Коммит a5307d1c97
2 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -3011,8 +3011,9 @@ nsDOMWindowUtils::SelectAtPoint(float aX, float aY, uint32_t aSelectBehavior,
}
// Get the target frame at the client coordinates passed to us
nsCOMPtr<nsIWidget> widget = GetWidget();
nsIntPoint pt(aX, aY);
nsPoint offset;
nsCOMPtr<nsIWidget> widget = GetWidget(&offset);
nsIntPoint pt = ToWidgetPoint(aX, aY, offset, GetPresContext());
nsPoint ptInRoot =
nsLayoutUtils::GetEventCoordinatesRelativeTo(widget, pt, rootFrame);
nsIFrame* targetFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, ptInRoot);

Просмотреть файл

@ -164,8 +164,8 @@
let rect = frame.getBoundingClientRect();
let targetPoint = { xPos: rect.left + (charDims.width / 2),
yPos: rect.top + (charDims.height / 2) };
let targetPoint = { xPos: charDims.width / 2,
yPos: charDims.height / 2 };
setSingle(dwuFrame, targetPoint.xPos, targetPoint.yPos, Ci.nsIDOMWindowUtils.SELECT_WORDNOSPACE);
checkSelection(frame.contentWindow.document, "SELECT_WORDNOSPACE", "ttestselection2");
setSingle(dwuFrame, targetPoint.xPos, targetPoint.yPos, Ci.nsIDOMWindowUtils.SELECT_WORD);