Bug 895284 - Fix plus tests for caret and selection monocles appearing at the same time after a urlbar tap. r=jwilde

This commit is contained in:
Jim Mathies 2013-07-19 08:55:21 -05:00
parent 35e9397d58
commit c1673a63e6
2 changed files with 32 additions and 4 deletions

View File

@ -844,10 +844,7 @@ var SelectionHelperUI = {
if (this._hitTestSelection(aEvent) && this._targetIsEditable) {
// Attach to the newly placed caret position
this._sendAsyncMessage("Browser:CaretAttach", {
xPos: aEvent.clientX,
yPos: aEvent.clientY
});
this.attachToCaret(this._msgTarget, aEvent.clientX, aEvent.clientY);
return;
}

View File

@ -88,6 +88,37 @@ gTests.push({
sendElementTap(window, paste);
ok(edit.popup.popupOpen, "bug: popup should be showing");
clearSelection(edit);
delete window.r;
}
});
gTests.push({
desc: "bug 895284 - tap selection",
run: function bug887120_test() {
gWindow = window;
yield showNavBar();
let edit = document.getElementById("urlbar-edit");
edit.value = "wikipedia.org";
edit.select();
let editCoords = logicalCoordsForElement(edit);
SelectionHelperUI.attachEditSession(ChromeSelectionHandler, editCoords.x, editCoords.y);
ok(SelectionHelperUI.isSelectionUIVisible, "selection enabled");
let selection = edit.QueryInterface(Components.interfaces.nsIDOMXULTextBoxElement)
.editor.selection;
let rects = selection.getRangeAt(0).getClientRects();
let midX = Math.ceil(((rects[0].right - rects[0].left) * .5) + rects[0].left);
let midY = Math.ceil(((rects[0].bottom - rects[0].top) * .5) + rects[0].top);
sendTap(window, midX, midY);
ok(SelectionHelperUI.isCaretUIVisible, "caret browsing enabled");
clearSelection(edit);
delete window.r;
}
});