Bug 846412 - Don't close selection helper until after the user makes a decision in a selection context menu. r=mbrubeck

This commit is contained in:
Jim Mathies 2013-02-28 13:33:24 -06:00
Родитель 39b30d5cd5
Коммит 26ff566423
4 изменённых файлов: 15 добавлений и 29 удалений

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

@ -26,26 +26,10 @@ const BrowserTouchHandler = {
json: aMessage.json, json: aMessage.json,
target: aMessage.target }; target: aMessage.target };
// Touch input selection handling // Touch input selection handling
if (!InputSourceHelper.isPrecise) { if (!InputSourceHelper.isPrecise && !SelectionHelperUI.isActive &&
if (SelectionHelperUI.isActive) { SelectionHelperUI.canHandle(aMessage)) {
// Selection handler is active. SelectionHelperUI.openEditSession(aMessage);
if (aMessage.json.types.indexOf("selected-text") != -1) { return;
// long tap on existing selection. The incoming message has the
// string data, so reset the selection handler and invoke the
// context menu.
SelectionHelperUI.closeEditSession();
} else {
// Weird, context menu request with no selected text and
// SelectionHelperUI is active? Might be a bug, warn. Fall
// through anyway, the context menu handler will look in the
// incoming message for content types it knows how to handle.
Util.dumpLn("long tap on empty selection with SelectionHelperUI active?");
SelectionHelperUI.closeEditSession();
}
} else if (SelectionHelperUI.canHandle(aMessage)) {
SelectionHelperUI.openEditSession(aMessage);
return;
}
} }
// Check to see if we have context menu item(s) that apply to what // Check to see if we have context menu item(s) that apply to what

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

@ -33,6 +33,7 @@ var ContextCommands = {
this.clipboard.copyString(ContextMenuUI.popupState.string, this.clipboard.copyString(ContextMenuUI.popupState.string,
this.docRef); this.docRef);
this.showToast(Strings.browser.GetStringFromName("selectionHelper.textCopied")); this.showToast(Strings.browser.GetStringFromName("selectionHelper.textCopied"));
SelectionHelperUI.closeEditSessionAndClear();
} }
} else { } else {
// chrome // chrome
@ -52,6 +53,7 @@ var ContextCommands = {
let y = ContextMenuUI.popupState.y; let y = ContextMenuUI.popupState.y;
let json = {x: x, y: y, command: "paste" }; let json = {x: x, y: y, command: "paste" };
target.messageManager.sendAsyncMessage("Browser:ContextCommand", json); target.messageManager.sendAsyncMessage("Browser:ContextCommand", json);
SelectionHelperUI.closeEditSessionAndClear();
} else { } else {
// chrome // chrome
target.editor.paste(Ci.nsIClipboard.kGlobalClipboard); target.editor.paste(Ci.nsIClipboard.kGlobalClipboard);

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

@ -419,7 +419,11 @@
</deck> </deck>
</vbox> </vbox>
<flyoutpanel id="about-flyoutpanel" headertext="&aboutHeader.title;"> <!-- Selection overlay - this should be below any content that can have selectable text -->
<!-- onclick addresses dom bug 835175, str in bug 832957 -->
<box onclick="false" class="selection-overlay-hidden" id="selection-overlay"/>
<flyoutpanel id="about-flyoutpanel" headertext="&aboutHeader.title;">
<label id="about-product-label" value="&aboutHeader.product.label;"/> <label id="about-product-label" value="&aboutHeader.product.label;"/>
<label value="&aboutHeader.company.label;"/> <label value="&aboutHeader.company.label;"/>
#expand <label id="about-version-label">__MOZ_APP_VERSION__</label> #expand <label id="about-version-label">__MOZ_APP_VERSION__</label>
@ -679,10 +683,6 @@
<description id="alerts-text" flex="1"/> <description id="alerts-text" flex="1"/>
</vbox> </vbox>
</hbox> </hbox>
<!-- Selection overlay - this should be below any content that can have selectable text -->
<!-- onclick addresses dom bug 835175, str in bug 832957 -->
<box onclick="false" class="selection-overlay-hidden" id="selection-overlay"/>
</stack> </stack>
<svg:svg height="0"> <svg:svg height="0">

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

@ -345,8 +345,8 @@ var SelectionHelperUI = {
messageManager.addMessageListener("Content:SelectionDebugRect", this); messageManager.addMessageListener("Content:SelectionDebugRect", this);
// selection related events // selection related events
window.addEventListener("click", this, true); window.addEventListener("click", this, false);
window.addEventListener("dblclick", this, true); window.addEventListener("dblclick", this, false);
// Picking up scroll attempts // Picking up scroll attempts
window.addEventListener("touchstart", this, true); window.addEventListener("touchstart", this, true);
@ -374,8 +374,8 @@ var SelectionHelperUI = {
messageManager.removeMessageListener("Content:SelectionFail", this); messageManager.removeMessageListener("Content:SelectionFail", this);
messageManager.removeMessageListener("Content:SelectionDebugRect", this); messageManager.removeMessageListener("Content:SelectionDebugRect", this);
window.removeEventListener("click", this, true); window.removeEventListener("click", this, false);
window.removeEventListener("dblclick", this, true); window.removeEventListener("dblclick", this, false);
window.removeEventListener("touchstart", this, true); window.removeEventListener("touchstart", this, true);
window.removeEventListener("touchend", this, true); window.removeEventListener("touchend", this, true);