From 0b661e14eb000a1e7cd18c0a4468a02f8665df4f Mon Sep 17 00:00:00 2001 From: Steffen Wilberg Date: Sun, 20 Sep 2015 17:59:53 +0200 Subject: [PATCH 1/7] Bug 1204836: In about:home, make any searchable keypress focus the search box. ui-review=philipp, r=gijs --HG-- extra : commitid : 3FMiD2yKnNn extra : rebase_source : 1e82ad2f38d6ddb66bd56f13ff206c81df257cdd extra : amend_source : d04c5c22c9ad4fb73df7576d9275b742d7abce29 --- browser/base/content/abouthome/aboutHome.js | 23 +++++++++++------- .../base/content/abouthome/aboutHome.xhtml | 2 +- .../content/test/general/browser_aboutHome.js | 24 +++++++++++++++++-- .../en-US/chrome/browser/aboutHome.dtd | 4 ---- 4 files changed, 37 insertions(+), 16 deletions(-) diff --git a/browser/base/content/abouthome/aboutHome.js b/browser/base/content/abouthome/aboutHome.js index b734c507eb8b..4abb38fdf3da 100644 --- a/browser/base/content/abouthome/aboutHome.js +++ b/browser/base/content/abouthome/aboutHome.js @@ -21,7 +21,7 @@ const DATABASE_NAME = "abouthome"; const DATABASE_VERSION = 1; const DATABASE_STORAGE = "persistent"; const SNIPPETS_OBJECTSTORE_NAME = "snippets"; -var searchText, findKey; +var searchText; // This global tracks if the page has been set up before, to prevent double inits var gInitialized = false; @@ -55,14 +55,20 @@ window.addEventListener("pagehide", function() { window.removeEventListener("resize", fitToWidth); }); -// make Accel+f focus the search box window.addEventListener("keypress", ev => { - // Make Ctrl/Cmd+f focus the search box. - let modifiers = ev.ctrlKey + ev.altKey + ev.shiftKey + ev.metaKey; - if (ev.getModifierState("Accel") && modifiers == 1 && ev.key == findKey) { - searchText.focus(); - ev.preventDefault(); - } + // focus the search-box on keypress + if (document.activeElement.id == "searchText") // unless already focussed + return; + + let modifiers = ev.ctrlKey + ev.altKey + ev.metaKey; + // ignore Ctrl/Cmd/Alt, but not Shift + // also ignore Tab, Insert, PageUp, etc., and Space + if (modifiers != 0 || ev.charCode == 0 || ev.charCode == 32) + return; + + searchText.focus(); + // need to send the first keypress outside the search-box manually to it + searchText.value += ev.key; }); // This object has the same interface as Map and is used to store and retrieve @@ -195,7 +201,6 @@ function setupSearch() searchText.removeEventListener("blur", searchText_onBlur); searchText.removeAttribute("autofocus"); }); - findKey = searchText.dataset.findkey; if (!gContentSearchController) { gContentSearchController = diff --git a/browser/base/content/abouthome/aboutHome.xhtml b/browser/base/content/abouthome/aboutHome.xhtml index defd49172c22..ac31059ee50d 100644 --- a/browser/base/content/abouthome/aboutHome.xhtml +++ b/browser/base/content/abouthome/aboutHome.xhtml @@ -43,7 +43,7 @@
+ dir="auto"/>
diff --git a/browser/base/content/test/general/browser_aboutHome.js b/browser/base/content/test/general/browser_aboutHome.js index 63659ab817d4..fd5a1a3035cd 100644 --- a/browser/base/content/test/general/browser_aboutHome.js +++ b/browser/base/content/test/general/browser_aboutHome.js @@ -420,7 +420,7 @@ var gTests = [ } }, { - desc: "Cmd+f should focus the search box in the page", + desc: "Pressing any key should focus the search box in the page, and send the key to it", setup: function () {}, run: Task.async(function* () { let doc = gBrowser.selectedBrowser.contentDocument; @@ -430,9 +430,10 @@ var gTests = [ EventUtils.synthesizeMouseAtCenter(logo, {}); isnot(searchInput, doc.activeElement, "Search input should not be the active element."); - EventUtils.synthesizeKey("f", { accelKey: true }); + EventUtils.synthesizeKey("a", {}); yield promiseWaitForCondition(() => doc.activeElement === searchInput); is(searchInput, doc.activeElement, "Search input should be the active element."); + is(searchInput.value, "a", "Search input should be 'a'."); }) }, { @@ -491,6 +492,25 @@ var gTests = [ is(result.pane, "paneSync", "openPreferences should be called with paneSync"); is(result.params.urlParams.entrypoint, "abouthome", "openPreferences should be called with abouthome entrypoint"); }) +}, +{ + desc: "Pressing Space while the Addons button is focussed should activate it", + setup: function () {}, + run: Task.async(function* () { + // Skip this test on Mac, because Space doesn't activate the button there. + if (navigator.platform.indexOf("Mac") == 0) { + return Promise.resolve(); + } + + info("Waiting for about:addons tab to open..."); + let promiseTabOpened = BrowserTestUtils.waitForNewTab(gBrowser, "about:addons"); + let addOnsButton = gBrowser.selectedBrowser.contentDocument.getElementById("addons"); + addOnsButton.focus(); + EventUtils.synthesizeKey(" ", {}); + let tab = yield promiseTabOpened; + is(tab.linkedBrowser.currentURI.spec, "about:addons", "Should have seen the about:addons tab"); + yield BrowserTestUtils.removeTab(tab); + }) } ]; diff --git a/browser/locales/en-US/chrome/browser/aboutHome.dtd b/browser/locales/en-US/chrome/browser/aboutHome.dtd index 18862cfebe04..6d6d1c59d8f8 100644 --- a/browser/locales/en-US/chrome/browser/aboutHome.dtd +++ b/browser/locales/en-US/chrome/browser/aboutHome.dtd @@ -37,7 +37,3 @@ - - - From a9704b6bdfa978861deb44dc2d3405eb18d2e81a Mon Sep 17 00:00:00 2001 From: Nick Alexander Date: Fri, 2 Oct 2015 16:06:34 -0700 Subject: [PATCH 2/7] Bug 1185783 - Part 1: Add head.js with promiseBrowserEvent. r=margaret --HG-- extra : commitid : An6mFh2TGgD extra : rebase_source : 0e752d61cfc4d5bbce602fd808b8ec61277c54a7 --- .../android/tests/browser/chrome/chrome.ini | 1 + mobile/android/tests/browser/chrome/head.js | 20 ++++++++++++++ .../chrome/test_desktop_useragent.html | 19 +------------- .../browser/chrome/test_offline_page.html | 19 +------------- .../browser/chrome/test_reader_view.html | 19 +------------- .../chrome/test_session_form_data.html | 26 +++---------------- 6 files changed, 28 insertions(+), 76 deletions(-) create mode 100644 mobile/android/tests/browser/chrome/head.js diff --git a/mobile/android/tests/browser/chrome/chrome.ini b/mobile/android/tests/browser/chrome/chrome.ini index f7cdcdffa70f..791bb7064457 100644 --- a/mobile/android/tests/browser/chrome/chrome.ini +++ b/mobile/android/tests/browser/chrome/chrome.ini @@ -4,6 +4,7 @@ support-files = basic_article.html desktopmode_user_agent.sjs devicesearch.xml + head.js session_formdata_sample.html simpleservice.xml video_controls.html diff --git a/mobile/android/tests/browser/chrome/head.js b/mobile/android/tests/browser/chrome/head.js new file mode 100644 index 000000000000..caa7c489014c --- /dev/null +++ b/mobile/android/tests/browser/chrome/head.js @@ -0,0 +1,20 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +function promiseBrowserEvent(browser, eventType) { + return new Promise((resolve) => { + function handle(event) { + // Since we'll be redirecting, don't make assumptions about the given URL and the loaded URL + if (event.target != browser.contentDocument || event.target.location.href == "about:blank") { + info("Skipping spurious '" + eventType + "' event" + " for " + event.target.location.href); + return; + } + info("Received event " + eventType + " from browser"); + browser.removeEventListener(eventType, handle, true); + resolve(event); + } + + browser.addEventListener(eventType, handle, true); + info("Now waiting for " + eventType + " event from browser"); + }); +} diff --git a/mobile/android/tests/browser/chrome/test_desktop_useragent.html b/mobile/android/tests/browser/chrome/test_desktop_useragent.html index 8bde358f0982..cfa82659a211 100644 --- a/mobile/android/tests/browser/chrome/test_desktop_useragent.html +++ b/mobile/android/tests/browser/chrome/test_desktop_useragent.html @@ -11,6 +11,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186 + + + + + - + From 2236535827580bb0a3bf79ab5792b929ff0edfdd Mon Sep 17 00:00:00 2001 From: Chris Rafuse Date: Sun, 4 Oct 2015 16:43:21 -0700 Subject: [PATCH 6/7] Bug 1204345 - Last letter at bottom right can be cut off, r=dmose --- .../loop/content/shared/css/conversation.css | 132 ++++++++---------- .../loop/content/shared/js/textChatView.js | 2 +- .../loop/content/shared/js/textChatView.jsx | 2 +- .../loop/test/shared/textChatView_test.js | 2 +- 4 files changed, 61 insertions(+), 77 deletions(-) diff --git a/browser/components/loop/content/shared/css/conversation.css b/browser/components/loop/content/shared/css/conversation.css index 601851e4c259..d77ba7f8c9d4 100644 --- a/browser/components/loop/content/shared/css/conversation.css +++ b/browser/components/loop/content/shared/css/conversation.css @@ -757,9 +757,7 @@ body[platform="win"] .share-service-dropdown.overflow > .dropdown-menu-item { } .context-url-view-wrapper { - /* 18px for indent of .text-chat-arrow, 1px for border of .text-chat-entry > p, - 0.5rem for padding of .text-chat-entry > p */ - padding: calc(18px - 1px - 0.5rem); + padding: 12px; margin-bottom: 0.5em; background-color: #dbf7ff; } @@ -1182,32 +1180,44 @@ body[platform="win"] .share-service-dropdown.overflow > .dropdown-menu-item { background: white; } -.text-chat-box { - flex: 0 0 auto; - max-height: 40px; - min-height: 40px; - width: 100%; -} - .text-chat-entries { overflow: auto; } -.text-chat-entry { +.text-chat-entry, +.text-chat-header { display: flex; - flex-direction: row; - margin-right: .2em; margin-bottom: .5em; - text-align: start; - flex-wrap: nowrap; - justify-content: flex-start; - align-content: stretch; align-items: flex-start; } -html[dir="rtl"] .text-chat-entry { - margin-right: auto; - margin-left: .2em; +.text-chat-entry { + /* aligns paragraph to side where reading starts from */ + text-align: start; +} + +/* Sent text chat entries should be on the right */ +.text-chat-entry.sent { + /* aligns paragraph to right side */ + justify-content: flex-end; + margin-left: 0; + margin-right: 5px; +} + +.text-chat-entry.received { + margin-left: 4px; + margin-right: 0; +} + +html[dir="rtl"] .text-chat-entry.sent { + margin-left: 5px; + margin-right: 0; +} + + +html[dir="rtl"] .text-chat-entry.received { + margin-left: 0; + margin-right: 5px; } /* If you change this entry, check it doesn't affect the "special" text @@ -1217,57 +1227,34 @@ html[dir="rtl"] .text-chat-entry { z-index: 10; /* Drop the default margins from the 'p' element. */ margin: 0; - padding: .5rem; + padding: .8rem; /* leave some room for the chat bubble arrow */ - max-width: 80%; - border-width: 1px; - border-style: solid; - border-color: #5cccee; + max-width: 70%; + border-radius: 15px; + border: 1px solid #5cccee; background: #fff; word-wrap: break-word; flex: 0 1 auto; - align-self: auto; -} - -.text-chat-entry.sent > p, -.text-chat-entry.received > p { - background: #fff; + order: 1; } .text-chat-entry.sent > p { - border-radius: 15px; border-bottom-right-radius: 0; } .text-chat-entry.received > p { - border-radius: 15px; border-top-left-radius: 0; + border-color: #d8d8d8; } html[dir="rtl"] .text-chat-entry.sent > p { - border-radius: 15px; border-bottom-left-radius: 0; + border-bottom-right-radius: 15px; } html[dir="rtl"] .text-chat-entry.received > p { - border-radius: 15px; border-top-right-radius: 0; -} - -.text-chat-entry.received > p { - order: 1; -} - -.text-chat-entry.sent > p { - order: 1; -} - -.text-chat-entry.received { - text-align: start; -} - -.text-chat-entry.received > p { - border-color: #d8d8d8; + border-top-left-radius: 15px; } /* Text chat entry timestamp */ @@ -1280,38 +1267,34 @@ html[dir="rtl"] .text-chat-entry.received > p { align-self: center; } -/* Sent text chat entries should be on the right */ -.text-chat-entry.sent { - justify-content: flex-end; -} - .received > .text-chat-entry-timestamp { order: 2; } -/* Pseudo element used to cover part between chat bubble and chat arrow. */ +/* Pseudo element used to cover part between chat bubble and chat arrow. + dimensions may change for each position */ .text-chat-entry > p:after { position: absolute; background: #fff; content: ""; + /* default dimensions */ + width: 6px; + height: 7px; } .text-chat-entry.sent > p:after { - right: -2px; + right: -1px; bottom: 0; - width: 15px; - height: 9px; - border-top-left-radius: 15px; - border-top-right-radius: 22px; + width: 7px; + border-top-left-radius: 4px; + border-top-right-radius: 4px; } .text-chat-entry.received > p:after { top: 0; - left: -2px; - width: 15px; - height: 9px; - border-bottom-left-radius: 22px; - border-bottom-right-radius: 15px; + left: -1px; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; } html[dir="rtl"] .text-chat-entry.sent > p:after { @@ -1319,16 +1302,13 @@ html[dir="rtl"] .text-chat-entry.sent > p:after { right: auto; left: -1px; bottom: 0; - width: 15px; - height: 9px; } html[dir="rtl"] .text-chat-entry.received > p:after { /* Reset */ - left: auto; top: 0; right: -1px; - width: 15px; + width: 9px; height: 6px; } @@ -1374,7 +1354,7 @@ html[dir="rtl"] .text-chat-entry.received .text-chat-arrow { margin-left: -10px; } -.text-chat-entry.special.room-name { +.text-chat-header.special.room-name { color: black; font-weight: bold; text-align: start; @@ -1383,7 +1363,7 @@ html[dir="rtl"] .text-chat-entry.received .text-chat-arrow { margin-right: 0; } -.text-chat-entry.special.room-name p { +.text-chat-header.special.room-name p { background: #dbf7ff; max-width: 100%; /* 18px for indent of .text-chat-arrow, 1px for border of .text-chat-entry > p, @@ -1391,12 +1371,16 @@ html[dir="rtl"] .text-chat-entry.received .text-chat-arrow { padding: calc(18px - 1px - 0.5rem); } -.text-chat-entry.special > p { +.text-chat-header.special > p { border: none; } .text-chat-box { margin: auto; + flex: 0 0 auto; + max-height: 40px; + min-height: 40px; + width: 100%; } .text-chat-box > form > input { diff --git a/browser/components/loop/content/shared/js/textChatView.js b/browser/components/loop/content/shared/js/textChatView.js index d655587211f9..11f7715ce19f 100644 --- a/browser/components/loop/content/shared/js/textChatView.js +++ b/browser/components/loop/content/shared/js/textChatView.js @@ -81,7 +81,7 @@ loop.shared.views.chat = (function(mozL10n) { render: function() { return ( - React.createElement("div", {className: "text-chat-entry special room-name"}, + React.createElement("div", {className: "text-chat-header special room-name"}, React.createElement("p", null, mozL10n.get("rooms_welcome_title", {conversationName: this.props.message})) ) ); diff --git a/browser/components/loop/content/shared/js/textChatView.jsx b/browser/components/loop/content/shared/js/textChatView.jsx index 86d86d98c6bb..668b78374dfb 100644 --- a/browser/components/loop/content/shared/js/textChatView.jsx +++ b/browser/components/loop/content/shared/js/textChatView.jsx @@ -81,7 +81,7 @@ loop.shared.views.chat = (function(mozL10n) { render: function() { return ( -
+

{mozL10n.get("rooms_welcome_title", {conversationName: this.props.message})}

); diff --git a/browser/components/loop/test/shared/textChatView_test.js b/browser/components/loop/test/shared/textChatView_test.js index 17ed7e18572d..8d6977b0f5a5 100644 --- a/browser/components/loop/test/shared/textChatView_test.js +++ b/browser/components/loop/test/shared/textChatView_test.js @@ -580,7 +580,7 @@ describe("loop.shared.views.TextChatView", function () { var node = view.getDOMNode(); expect(node.querySelector(".text-chat-entries")).to.not.eql(null); - var entries = node.querySelectorAll(".text-chat-entry"); + var entries = node.querySelectorAll(".text-chat-header"); expect(entries.length).eql(1); expect(entries[0].classList.contains("special")).eql(true); expect(entries[0].classList.contains("room-name")).eql(true); From fdd9597e7c73e5fd2638ea06f6740c00db74919f Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Sun, 4 Oct 2015 18:27:27 -0700 Subject: [PATCH 7/7] Bug 1208727 - Disable test-ui-action-button.js on all debug and ASan builds for frequent timeouts --- addon-sdk/source/test/jetpack-package.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon-sdk/source/test/jetpack-package.ini b/addon-sdk/source/test/jetpack-package.ini index c113ed311a69..32f8f202e768 100644 --- a/addon-sdk/source/test/jetpack-package.ini +++ b/addon-sdk/source/test/jetpack-package.ini @@ -144,7 +144,7 @@ skip-if = true [test-timer.js] [test-traceback.js] [test-ui-action-button.js] -skip-if = (os == "linux" || os == "win") && debug +skip-if = debug || asan # Bug 1208727 [test-ui-frame.js] [test-ui-id.js] [test-ui-sidebar-private-browsing.js]