From 0b36e5d6bc69de8ed6108fd6c54b35cca97815e4 Mon Sep 17 00:00:00 2001 From: Mark Hammond Date: Wed, 30 Apr 2014 17:42:51 +1000 Subject: [PATCH 01/11] Bug 972100 - avoid an info/collections call as sync starts. r=rnewman --- services/sync/modules/service.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/sync/modules/service.js b/services/sync/modules/service.js index 872b6393eae..42f6707a46a 100644 --- a/services/sync/modules/service.js +++ b/services/sync/modules/service.js @@ -711,7 +711,7 @@ Sync11Service.prototype = { // Go ahead and do remote setup, so that we can determine // conclusively that our passphrase is correct. - if (this._remoteSetup()) { + if (this._remoteSetup(test)) { // Username/password verified. this.status.login = LOGIN_SUCCEEDED; return true; From f82843da752c4f943a743c164f9486979c06e74b Mon Sep 17 00:00:00 2001 From: "Roberto A. Vitillo" Date: Wed, 30 Apr 2014 11:33:58 +0100 Subject: [PATCH 02/11] Bug 785487 - Have AboutHomeUtils use the asynchronous search service initialization API and adjust browser_aboutHome.js accordingly. r=felipe, r=gavin --- .../test/general/aboutHome_content_script.js | 6 +++ browser/base/content/test/general/browser.ini | 1 + .../content/test/general/browser_aboutHome.js | 21 +++++----- browser/modules/AboutHome.jsm | 39 ++++++++++++++++--- toolkit/components/search/nsSearchService.js | 5 ++- 5 files changed, 53 insertions(+), 19 deletions(-) create mode 100644 browser/base/content/test/general/aboutHome_content_script.js diff --git a/browser/base/content/test/general/aboutHome_content_script.js b/browser/base/content/test/general/aboutHome_content_script.js new file mode 100644 index 00000000000..28d0e617e73 --- /dev/null +++ b/browser/base/content/test/general/aboutHome_content_script.js @@ -0,0 +1,6 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +addMessageListener("AboutHome:SearchTriggered", function (msg) { + sendAsyncMessage("AboutHomeTest:CheckRecordedSearch", msg.data); +}); diff --git a/browser/base/content/test/general/browser.ini b/browser/base/content/test/general/browser.ini index e450181cb57..55f2d48d025 100644 --- a/browser/base/content/test/general/browser.ini +++ b/browser/base/content/test/general/browser.ini @@ -6,6 +6,7 @@ support-files = app_bug575561.html app_subframe_bug575561.html authenticate.sjs + aboutHome_content_script.js browser_bug479408_sample.html browser_bug678392-1.html browser_bug678392-2.html diff --git a/browser/base/content/test/general/browser_aboutHome.js b/browser/base/content/test/general/browser_aboutHome.js index a1a0e229cc7..a63e11319ea 100644 --- a/browser/base/content/test/general/browser_aboutHome.js +++ b/browser/base/content/test/general/browser_aboutHome.js @@ -9,6 +9,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task", XPCOMUtils.defineLazyModuleGetter(this, "AboutHomeUtils", "resource:///modules/AboutHome.jsm"); +const TEST_CONTENT_HELPER = "chrome://mochitests/content/browser/browser/base/content/test/general/aboutHome_content_script.js"; let gRightsVersion = Services.prefs.getIntPref("browser.rights.version"); registerCleanupFunction(function() { @@ -110,21 +111,19 @@ let gTests = [ let searchEventDeferred = Promise.defer(); let doc = gBrowser.contentDocument; let engineName = doc.documentElement.getAttribute("searchEngineName"); + let mm = gBrowser.selectedTab.linkedBrowser.messageManager; - doc.addEventListener("AboutHomeSearchEvent", function onSearch(e) { - let data = JSON.parse(e.detail); + mm.loadFrameScript(TEST_CONTENT_HELPER, false); + + mm.addMessageListener("AboutHomeTest:CheckRecordedSearch", function (msg) { + let data = JSON.parse(msg.data); is(data.engineName, engineName, "Detail is search engine name"); - // We use executeSoon() to ensure that this code runs after the - // count has been updated in browser.js, since it uses the same - // event. - executeSoon(function () { - getNumberOfSearches(engineName).then(num => { - is(num, numSearchesBefore + 1, "One more search recorded."); - searchEventDeferred.resolve(); - }); + getNumberOfSearches(engineName).then(num => { + is(num, numSearchesBefore + 1, "One more search recorded."); + searchEventDeferred.resolve(); }); - }, true, true); + }); // Get the current number of recorded searches. let searchStr = "a search"; diff --git a/browser/modules/AboutHome.jsm b/browser/modules/AboutHome.jsm index 06d0fff074c..da8f462597a 100644 --- a/browser/modules/AboutHome.jsm +++ b/browser/modules/AboutHome.jsm @@ -17,6 +17,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils", "resource://gre/modules/PrivateBrowsingUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "fxAccounts", "resource://gre/modules/FxAccounts.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "Promise", + "resource://gre/modules/Promise.jsm"); // Url to fetch snippets, in the urlFormatter service format. const SNIPPETS_URL_PREF = "browser.aboutHomeSnippets.updateUrl"; @@ -181,13 +183,25 @@ let AboutHome = { Cu.reportError(ex); break; } - let engine = Services.search.currentEngine; + + Services.search.init(function(status) { + if (!Components.isSuccessCode(status)) { + return; + } + + let engine = Services.search.currentEngine; #ifdef MOZ_SERVICES_HEALTHREPORT - window.BrowserSearch.recordSearchInHealthReport(engine, "abouthome"); + window.BrowserSearch.recordSearchInHealthReport(engine, "abouthome"); #endif - // Trigger a search through nsISearchEngine.getSubmission() - let submission = engine.getSubmission(data.searchTerms, null, "homepage"); - window.loadURI(submission.uri.spec, null, submission.postData); + // Trigger a search through nsISearchEngine.getSubmission() + let submission = engine.getSubmission(data.searchTerms, null, "homepage"); + window.loadURI(submission.uri.spec, null, submission.postData); + + // Used for testing + let mm = aMessage.target.messageManager; + mm.sendAsyncMessage("AboutHome:SearchTriggered", aMessage.data.searchData); + }); + break; } }, @@ -199,13 +213,26 @@ let AboutHome = { Components.utils.import("resource:///modules/sessionstore/SessionStore.jsm", wrapper); let ss = wrapper.SessionStore; + ss.promiseInitialized.then(function() { + let deferred = Promise.defer(); + + Services.search.init(function (status){ + if (!Components.isSuccessCode(status)) { + deferred.reject(status); + } else { + deferred.resolve(Services.search.defaultEngine.name); + } + }); + + return deferred.promise; + }).then(function(engineName) { let data = { showRestoreLastSession: ss.canRestoreLastSession, snippetsURL: AboutHomeUtils.snippetsURL, showKnowYourRights: AboutHomeUtils.showKnowYourRights, snippetsVersion: AboutHomeUtils.snippetsVersion, - defaultEngineName: Services.search.defaultEngine.name + defaultEngineName: engineName }; if (AboutHomeUtils.showKnowYourRights) { diff --git a/toolkit/components/search/nsSearchService.js b/toolkit/components/search/nsSearchService.js index f47fe098d70..aeb2038696d 100644 --- a/toolkit/components/search/nsSearchService.js +++ b/toolkit/components/search/nsSearchService.js @@ -21,6 +21,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch", "resource://gre/modules/TelemetryStopwatch.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "Deprecated", + "resource://gre/modules/Deprecated.jsm"); // A text encoder to UTF8, used whenever we commit the // engine metadata to disk. @@ -2877,8 +2879,7 @@ SearchService.prototype = { "Search service falling back to synchronous initialization. " + "This is generally the consequence of an add-on using a deprecated " + "search service API."; - // Bug 785487 - Disable warning until our own callers are fixed. - //Deprecated.warning(warning, "https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIBrowserSearchService#async_warning"); + Deprecated.warning(warning, "https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIBrowserSearchService#async_warning"); LOG(warning); engineMetadataService.syncInit(); From 8b4ca2810b57ef63db72185b9a6aa2714d686aab Mon Sep 17 00:00:00 2001 From: Eddy Bruel Date: Wed, 30 Apr 2014 15:24:42 +0200 Subject: [PATCH 03/11] Bug 859372 - Fix for root.js refactor;r=past --- toolkit/devtools/server/actors/root.js | 1 + 1 file changed, 1 insertion(+) diff --git a/toolkit/devtools/server/actors/root.js b/toolkit/devtools/server/actors/root.js index 0b47d8b20ef..e63ece1c91e 100644 --- a/toolkit/devtools/server/actors/root.js +++ b/toolkit/devtools/server/actors/root.js @@ -6,6 +6,7 @@ "use strict"; +const { Ci } = require("chrome"); const Services = require("Services"); const { ActorPool, appendExtraActors, createExtraActors } = require("devtools/server/actors/common"); const { DebuggerServer } = require("devtools/server/main"); From 9c0e3d9c53f82bf2f3c64b10246fd8d3d22a5f1e Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Wed, 30 Apr 2014 07:31:55 +0200 Subject: [PATCH 04/11] Bug 1003096 - Remove tab reordering feature implemented in bug 480148 to unblock bug 715376 r=smacleod --- .../sessionstore/src/SessionStore.jsm | 91 +------- .../components/sessionstore/test/browser.ini | 1 - .../sessionstore/test/browser_480148.js | 216 ------------------ 3 files changed, 7 insertions(+), 301 deletions(-) delete mode 100644 browser/components/sessionstore/test/browser_480148.js diff --git a/browser/components/sessionstore/src/SessionStore.jsm b/browser/components/sessionstore/src/SessionStore.jsm index 784f0bc08b3..cff3994d7a9 100644 --- a/browser/components/sessionstore/src/SessionStore.jsm +++ b/browser/components/sessionstore/src/SessionStore.jsm @@ -2400,86 +2400,6 @@ let SessionStoreInternal = { this._sendRestoreCompletedNotifications(); }, - /** - * Sets the tabs restoring order with the following priority: - * Selected tab, pinned tabs, optimized visible tabs, other visible tabs and - * hidden tabs. - * @param aTabBrowser - * Tab browser object - * @param aTabs - * Array of tab references - * @param aTabData - * Array of tab data - * @param aSelectedTab - * Index of selected tab (1 is first tab, 0 no selected tab) - */ - _setTabsRestoringOrder : function ssi__setTabsRestoringOrder( - aTabBrowser, aTabs, aTabData, aSelectedTab) { - - // Store the selected tab. Need to substract one to get the index in aTabs. - let selectedTab; - if (aSelectedTab > 0 && aTabs[aSelectedTab - 1]) { - selectedTab = aTabs[aSelectedTab - 1]; - } - - // Store the pinned tabs and hidden tabs. - let pinnedTabs = []; - let pinnedTabsData = []; - let hiddenTabs = []; - let hiddenTabsData = []; - if (aTabs.length > 1) { - for (let t = aTabs.length - 1; t >= 0; t--) { - if (aTabData[t].pinned) { - pinnedTabs.unshift(aTabs.splice(t, 1)[0]); - pinnedTabsData.unshift(aTabData.splice(t, 1)[0]); - } else if (aTabData[t].hidden) { - hiddenTabs.unshift(aTabs.splice(t, 1)[0]); - hiddenTabsData.unshift(aTabData.splice(t, 1)[0]); - } - } - } - - // Optimize the visible tabs only if there is a selected tab. - if (selectedTab) { - let selectedTabIndex = aTabs.indexOf(selectedTab); - if (selectedTabIndex > 0) { - let scrollSize = aTabBrowser.tabContainer.mTabstrip.scrollClientSize; - let tabWidth = aTabs[0].getBoundingClientRect().width; - let maxVisibleTabs = Math.ceil(scrollSize / tabWidth); - if (maxVisibleTabs < aTabs.length) { - let firstVisibleTab = 0; - let nonVisibleTabsCount = aTabs.length - maxVisibleTabs; - if (nonVisibleTabsCount >= selectedTabIndex) { - // Selected tab is leftmost since we scroll to it when possible. - firstVisibleTab = selectedTabIndex; - } else { - // Selected tab is rightmost or no more room to scroll right. - firstVisibleTab = nonVisibleTabsCount; - } - aTabs = aTabs.splice(firstVisibleTab, maxVisibleTabs).concat(aTabs); - aTabData = - aTabData.splice(firstVisibleTab, maxVisibleTabs).concat(aTabData); - } - } - } - - // Merge the stored tabs in order. - aTabs = pinnedTabs.concat(aTabs, hiddenTabs); - aTabData = pinnedTabsData.concat(aTabData, hiddenTabsData); - - // Load the selected tab to the first position and select it. - if (selectedTab) { - let selectedTabIndex = aTabs.indexOf(selectedTab); - if (selectedTabIndex > 0) { - aTabs = aTabs.splice(selectedTabIndex, 1).concat(aTabs); - aTabData = aTabData.splice(selectedTabIndex, 1).concat(aTabData); - } - aTabBrowser.selectedTab = selectedTab; - } - - return [aTabs, aTabData]; - }, - /** * Manage history restoration for a window * @param aWindow @@ -2489,7 +2409,9 @@ let SessionStoreInternal = { * @param aTabData * Array of tab data * @param aSelectTab - * Index of selected tab + * Index of the tab to select. This is a 1-based index where "1" + * indicates the first tab should be selected, and "0" indicates that + * the currently selected tab will not be changed. * @param aRestoreImmediately * Flag to indicate whether the given set of tabs aTabs should be * restored/loaded immediately even if restore_on_demand = true @@ -2525,9 +2447,10 @@ let SessionStoreInternal = { return; } - // Sets the tabs restoring order. - [aTabs, aTabData] = - this._setTabsRestoringOrder(tabbrowser, aTabs, aTabData, aSelectTab); + // If provided, set the selected tab. + if (aSelectTab > 0 && aSelectTab <= aTabs.length) { + tabbrowser.selectedTab = aTabs[aSelectTab - 1]; + } // Prepare the tabs so that they can be properly restored. We'll pin/unpin // and show/hide tabs as necessary. We'll also set the labels, user typed diff --git a/browser/components/sessionstore/test/browser.ini b/browser/components/sessionstore/test/browser.ini index fea0361033e..da2e7f9eb63 100644 --- a/browser/components/sessionstore/test/browser.ini +++ b/browser/components/sessionstore/test/browser.ini @@ -111,7 +111,6 @@ skip-if = true [browser_466937.js] [browser_467409-backslashplosion.js] [browser_477657.js] -[browser_480148.js] [browser_480893.js] [browser_485482.js] [browser_485563.js] diff --git a/browser/components/sessionstore/test/browser_480148.js b/browser/components/sessionstore/test/browser_480148.js deleted file mode 100644 index a88882fe7b2..00000000000 --- a/browser/components/sessionstore/test/browser_480148.js +++ /dev/null @@ -1,216 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -function test() { - /** Test for Bug 484108 **/ - waitForExplicitFinish(); - requestLongerTimeout(5); - - // builds the tests state based on a few parameters - function buildTestState(num, selected, hidden, pinned) { - let state = { windows: [ { "tabs": [], "selected": selected + 1 } ] }; - while (num--) { - state.windows[0].tabs.push({ - entries: [ - { url: "http://example.com/?t=" + state.windows[0].tabs.length } - ] - }); - let i = state.windows[0].tabs.length - 1; - if (hidden.length > 0 && i == hidden[0]) { - state.windows[0].tabs[i].hidden = true; - hidden.splice(0, 1); - } - if (pinned.length > 0 && i == pinned[0]) { - state.windows[0].tabs[i].pinned = true; - pinned.splice(0, 1); - } - } - return state; - } - - let tests = [ - { testNum: 1, - totalTabs: 13, - selectedTab: 0, - shownTabs: 6, - hiddenTabs: [], - pinnedTabs: [], - order: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] - }, - { testNum: 2, - totalTabs: 13, - selectedTab: 12, - shownTabs: 6, - hiddenTabs: [], - pinnedTabs: [], - order: [12, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6] - }, - { testNum: 3, - totalTabs: 13, - selectedTab: 3, - shownTabs: 6, - hiddenTabs: [], - pinnedTabs: [], - order: [3, 4, 5, 6, 7, 8, 0, 1, 2, 9, 10, 11, 12] - }, - { testNum: 4, - totalTabs: 13, - selectedTab: 10, - shownTabs: 6, - hiddenTabs: [], - pinnedTabs: [], - order: [10, 7, 8, 9, 11, 12, 0, 1, 2, 3, 4, 5, 6] - }, - { testNum: 5, - totalTabs: 13, - selectedTab: 12, - shownTabs: 6, - hiddenTabs: [0, 4, 9], - pinnedTabs: [], - order: [12, 6, 7, 8, 10, 11, 1, 2, 3, 5, 0, 4, 9] - }, - { testNum: 6, - totalTabs: 13, - selectedTab: 3, - shownTabs: 6, - hiddenTabs: [1, 7, 12], - pinnedTabs: [], - order: [3, 4, 5, 6, 8, 9, 0, 2, 10, 11, 1, 7, 12] - }, - { testNum: 7, - totalTabs: 13, - selectedTab: 3, - shownTabs: 6, - hiddenTabs: [0, 1, 2], - pinnedTabs: [], - order: [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 1, 2] - }, - { testNum: 8, - totalTabs: 13, - selectedTab: 0, - shownTabs: 6, - hiddenTabs: [], - pinnedTabs: [0], - order: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] - }, - { testNum: 9, - totalTabs: 13, - selectedTab: 1, - shownTabs: 6, - hiddenTabs: [], - pinnedTabs: [0], - order: [1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] - }, - { testNum: 10, - totalTabs: 13, - selectedTab: 3, - shownTabs: 6, - hiddenTabs: [2], - pinnedTabs: [0,1], - order: [3, 0, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 2] - }, - { testNum: 11, - totalTabs: 13, - selectedTab: 12, - shownTabs: 6, - hiddenTabs: [], - pinnedTabs: [0,1,2], - order: [12, 0, 1, 2, 7, 8, 9, 10, 11, 3, 4, 5, 6] - }, - { testNum: 12, - totalTabs: 13, - selectedTab: 6, - shownTabs: 6, - hiddenTabs: [3,4,5], - pinnedTabs: [0,1,2], - order: [6, 0, 1, 2, 7, 8, 9, 10, 11, 12, 3, 4, 5] - }, - { testNum: 13, - totalTabs: 13, - selectedTab: 1, - shownTabs: 6, - hiddenTabs: [3,4,5], - pinnedTabs: [0,1,2], - order: [1, 0, 2, 6, 7, 8, 9, 10, 11, 12, 3, 4, 5] - }, - { testNum: 14, - totalTabs: 13, - selectedTab: 2, - shownTabs: 6, - hiddenTabs: [], - pinnedTabs: [0,1,2], - order: [2, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] - }, - { testNum: 15, - totalTabs: 13, - selectedTab: 3, - shownTabs: 6, - hiddenTabs: [1,4], - pinnedTabs: [0,1,2], - order: [3, 0, 1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 4] - } - ]; - - let tabMinWidth = - parseInt(getComputedStyle(gBrowser.selectedTab, null).minWidth); - let testIndex = 0; - - function runNextTest() { - if (tests.length == 0) { - finish(); - return; - } - - let wu = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) - .getInterface(Components.interfaces.nsIDOMWindowUtils); - wu.garbageCollect(); - - setTimeout(function() { - info ("Starting test " + (++testIndex)); - let test = tests.shift(); - let state = buildTestState(test.totalTabs, test.selectedTab, - test.hiddenTabs, test.pinnedTabs); - let tabbarWidth = Math.floor((test.shownTabs - 0.5) * tabMinWidth); - let win = openDialog(location, "_blank", "chrome,all,dialog=no"); - let tabsRestored = []; - - win.addEventListener("SSTabRestoring", function onSSTabRestoring(aEvent) { - let tab = aEvent.originalTarget; - let tabLink = tab.linkedBrowser.currentURI.spec; - let tabIndex = - tabLink.substring(tabLink.indexOf("?t=") + 3, tabLink.length); - - // we need to compare with the tab's restoring index, no with the - // position index, since the pinned tabs change the positions in the - // tabbar. - tabsRestored.push(tabIndex); - - if (tabsRestored.length < state.windows[0].tabs.length) - return; - - // all of the tabs should be restoring or restored by now - is(tabsRestored.length, state.windows[0].tabs.length, - "Test #" + testIndex + ": Number of restored tabs is as expected"); - - is(tabsRestored.join(" "), test.order.join(" "), - "Test #" + testIndex + ": 'visible' tabs restored first"); - - // cleanup - win.removeEventListener("SSTabRestoring", onSSTabRestoring, false); - win.close(); - executeSoon(runNextTest); - }, false); - - whenWindowLoaded(win, function(aEvent) { - let extent = - win.outerWidth - win.gBrowser.tabContainer.mTabstrip.scrollClientSize; - let windowWidth = tabbarWidth + extent; - win.resizeTo(windowWidth, win.outerHeight); - ss.setWindowState(win, JSON.stringify(state), true); - }); - }, 1000); - }; - - runNextTest(); -} From 71cfa2eec603df89c2006683e7299949337b7f46 Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Wed, 30 Apr 2014 12:30:56 +0200 Subject: [PATCH 05/11] Bug 1003096 - Make browser_tabview_bug595601.js wait until the test session is restored r=smacleod --- .../tabview/test/browser_tabview_bug595601.js | 49 +++++++------------ 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/browser/components/tabview/test/browser_tabview_bug595601.js b/browser/components/tabview/test/browser_tabview_bug595601.js index 26d1677fe89..5e36e2b2180 100644 --- a/browser/components/tabview/test/browser_tabview_bug595601.js +++ b/browser/components/tabview/test/browser_tabview_bug595601.js @@ -47,16 +47,14 @@ function test() { } function testRestoreWithHiddenTabs() { - let checked = false; - let ssReady = false; - let tabsRestored = false; - - let check = function () { - if (checked || !ssReady || !tabsRestored) - return; - - checked = true; + TabsProgressListener.setCallback(function (needsRestore, isRestoring) { + if (needsRestore <= 4) { + TabsProgressListener.unsetCallback(); + is(needsRestore, 4, "4/8 tabs restored"); + } + }); + waitForBrowserState(state, 4, function () { is(gBrowser.tabs.length, 8, "there are now eight tabs"); is(gBrowser.visibleTabs.length, 4, "four visible tabs"); @@ -64,25 +62,7 @@ function testRestoreWithHiddenTabs() { is(cw.GroupItems.groupItems.length, 2, "there are now two groupItems"); testSwitchToInactiveGroup(); - } - - whenSessionStoreReady(function () { - ssReady = true; - check(); }); - - TabsProgressListener.setCallback(function (needsRestore, isRestoring) { - if (4 < needsRestore) - return; - - TabsProgressListener.unsetCallback(); - is(needsRestore, 4, "4/8 tabs restored"); - - tabsRestored = true; - check(); - }); - - ss.setBrowserState(JSON.stringify(state)); } function testSwitchToInactiveGroup() { @@ -108,11 +88,16 @@ function testSwitchToInactiveGroup() { gBrowser.selectedTab = gBrowser.tabs[4]; } -function whenSessionStoreReady(callback) { - window.addEventListener("SSWindowStateReady", function onReady() { - window.removeEventListener("SSWindowStateReady", onReady, false); - executeSoon(callback); - }, false); +function waitForBrowserState(state, numTabs, callback) { + let tabContainer = gBrowser.tabContainer; + tabContainer.addEventListener("SSTabRestored", function onRestored() { + if (--numTabs <= 0) { + tabContainer.removeEventListener("SSTabRestored", onRestored, true); + executeSoon(callback); + } + }, true); + + ss.setBrowserState(JSON.stringify(state)); } function countTabs() { From 2e5e8fc012882abd0e06dce9dca34c81a5603529 Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Wed, 30 Apr 2014 16:02:25 +0200 Subject: [PATCH 06/11] no bug - fix b2g bustage --HG-- extra : amend_source : 133baf21b99de14e49ae0057352991428698e657 --- b2g/config/emulator/sources.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 28d0f75d3a9..c3fe34774e7 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,11 +19,7 @@ -<<<<<<< local - -======= ->>>>>>> other From a4ee98df03d109a30aae3e1f0dd2e811caca5474 Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Wed, 30 Apr 2014 10:25:33 -0700 Subject: [PATCH 07/11] Bug 1000149 - Part 1: Remove go button from toolbar. r=lucasr --- .../resources/drawable-hdpi/ic_url_bar_go.png | Bin 296 -> 0 bytes .../resources/drawable-mdpi/ic_url_bar_go.png | Bin 253 -> 0 bytes .../drawable-xhdpi/ic_url_bar_go.png | Bin 322 -> 0 bytes .../base/resources/layout/browser_toolbar.xml | 1 + .../resources/layout/toolbar_edit_layout.xml | 6 -- .../tests/components/ToolbarComponent.java | 10 +-- .../android/base/toolbar/BrowserToolbar.java | 8 +- .../base/toolbar/ToolbarEditLayout.java | 81 +----------------- 8 files changed, 8 insertions(+), 98 deletions(-) delete mode 100644 mobile/android/base/resources/drawable-hdpi/ic_url_bar_go.png delete mode 100644 mobile/android/base/resources/drawable-mdpi/ic_url_bar_go.png delete mode 100644 mobile/android/base/resources/drawable-xhdpi/ic_url_bar_go.png diff --git a/mobile/android/base/resources/drawable-hdpi/ic_url_bar_go.png b/mobile/android/base/resources/drawable-hdpi/ic_url_bar_go.png deleted file mode 100644 index b0420db296ec485587e749815603c8b340d8856a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 296 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k3?#4J%UA`ZSkfJR9T^xl_H+M9WCijWi-X*q z7}lMWc?sk=1^9%x0_phV3`)?8BFig4Q$$OG{DK)i1ee$RG-ZCbK$Gq8qpSq0Ir`i` zUhTZF45%R4)5S5w;`Gxi2l*Tf1X><0-EvE-tMY%iYK+OjFKUn8!vvJd$qH=FN5v f+`OMj{eK2Cv#hXxl<|W=pmhwMu6{1-oD!M<54CL5 diff --git a/mobile/android/base/resources/drawable-mdpi/ic_url_bar_go.png b/mobile/android/base/resources/drawable-mdpi/ic_url_bar_go.png deleted file mode 100644 index 8afde62835da63101a1b7bb7bcb7181ea101f201..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 253 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM3?#3wJbMaAv7|ftIx;Y9?C1WI$O_~$76-XI zF|0c$^AgB03-AeX1=8`!8Kk0xkGJdv>J%&q@(X70WO@AOqt#FMI8**-wKIZmOf_3v z1C;deba4#PIG>!LAYZ^?kRN9&53p2ypKRL89ZJ6T-G@yGywo-lT=#( diff --git a/mobile/android/base/resources/drawable-xhdpi/ic_url_bar_go.png b/mobile/android/base/resources/drawable-xhdpi/ic_url_bar_go.png deleted file mode 100644 index 91fb5f788f0617851a730e6c2fb39f5d4204a93f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 322 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA3?vioaBc-sEa{HEjtmSN`?>!lvI6;x#X;^) z4C~IxyaaMQ0(?STfpmOw2Ia_AN@f$#Eb)>czhH(K&K;~j|GZlp@YHIHa<-z+p6iRx zcYpFc*02qzq}0>JF~sBe+o>n{8Wea~yPG!ccyR0g|6tpSpbL8{E|r`!&b&3jK}CjT zx#IrhZBm~XIvFOnrf%pEjndGx3uZZA&SUkxt|%tWFVdQ&MBb@0CYWh A)Bpeg diff --git a/mobile/android/base/resources/layout/browser_toolbar.xml b/mobile/android/base/resources/layout/browser_toolbar.xml index 2404e4d2142..a04ce405a41 100644 --- a/mobile/android/base/resources/layout/browser_toolbar.xml +++ b/mobile/android/base/resources/layout/browser_toolbar.xml @@ -123,6 +123,7 @@ android:layout_marginLeft="4dp" android:layout_marginRight="4dp" android:paddingLeft="8dp" + android:paddingRight="8dp" android:visibility="gone"/> - - diff --git a/mobile/android/base/tests/components/ToolbarComponent.java b/mobile/android/base/tests/components/ToolbarComponent.java index dd8043e6e0b..a22f0e56522 100644 --- a/mobile/android/base/tests/components/ToolbarComponent.java +++ b/mobile/android/base/tests/components/ToolbarComponent.java @@ -20,6 +20,7 @@ import android.widget.ImageButton; import android.widget.TextView; import com.jayway.android.robotium.solo.Condition; +import com.jayway.android.robotium.solo.Solo; /** * A class representing any interactions that take place on the Toolbar. @@ -69,13 +70,6 @@ public class ToolbarComponent extends BaseComponent { return (TextView) getToolbarView().findViewById(R.id.url_bar_title); } - /** - * Returns the View for the go button in the browser toolbar. - */ - private ImageButton getGoButton() { - return (ImageButton) getToolbarView().findViewById(R.id.go); - } - private ImageButton getBackButton() { DeviceHelper.assertIsTablet(); return (ImageButton) getToolbarView().findViewById(R.id.back); @@ -141,7 +135,7 @@ public class ToolbarComponent extends BaseComponent { WaitHelper.waitForPageLoad(new Runnable() { @Override public void run() { - mSolo.clickOnView(getGoButton()); + mSolo.sendKey(Solo.ENTER); } }); waitForNotEditing(); diff --git a/mobile/android/base/toolbar/BrowserToolbar.java b/mobile/android/base/toolbar/BrowserToolbar.java index 38f7ea817ef..a9770b5da63 100644 --- a/mobile/android/base/toolbar/BrowserToolbar.java +++ b/mobile/android/base/toolbar/BrowserToolbar.java @@ -328,6 +328,7 @@ public class BrowserToolbar extends ThemedRelativeLayout urlEditLayout.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { + // This will select the url bar when entering editing mode. setSelected(hasFocus); if (focusChangeListener != null) { focusChangeListener.onFocusChange(v, hasFocus); @@ -850,7 +851,9 @@ public class BrowserToolbar extends ThemedRelativeLayout } private void setUrlEditLayoutVisibility(final boolean showEditLayout, PropertyAnimator animator) { - urlEditLayout.prepareAnimation(showEditLayout, animator); + if (showEditLayout) { + urlEditLayout.prepareShowAnimation(animator); + } final View viewToShow = (showEditLayout ? urlEditLayout : urlDisplayLayout); final View viewToHide = (showEditLayout ? urlDisplayLayout : urlEditLayout); @@ -1021,9 +1024,6 @@ public class BrowserToolbar extends ThemedRelativeLayout if (isAnimatingEntry) return; - // Highlight the toolbar from the start of the animation. - setSelected(true); - urlDisplayLayout.prepareStartEditingAnimation(); // Slide toolbar elements. diff --git a/mobile/android/base/toolbar/ToolbarEditLayout.java b/mobile/android/base/toolbar/ToolbarEditLayout.java index 0f670f40be4..b070b8be6a0 100644 --- a/mobile/android/base/toolbar/ToolbarEditLayout.java +++ b/mobile/android/base/toolbar/ToolbarEditLayout.java @@ -8,12 +8,9 @@ package org.mozilla.gecko.toolbar; import org.mozilla.gecko.R; import org.mozilla.gecko.animation.PropertyAnimator; import org.mozilla.gecko.animation.PropertyAnimator.PropertyAnimationListener; -import org.mozilla.gecko.animation.ViewHelper; import org.mozilla.gecko.toolbar.BrowserToolbar.OnCommitListener; import org.mozilla.gecko.toolbar.BrowserToolbar.OnDismissListener; import org.mozilla.gecko.toolbar.BrowserToolbar.OnFilterListener; -import org.mozilla.gecko.toolbar.ToolbarEditText.OnTextTypeChangeListener; -import org.mozilla.gecko.toolbar.ToolbarEditText.TextType; import org.mozilla.gecko.widget.ThemedLinearLayout; import android.content.Context; @@ -21,9 +18,7 @@ import android.util.AttributeSet; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; -import android.view.View.OnFocusChangeListener; import android.view.inputmethod.InputMethodManager; -import android.widget.ImageButton; /** * {@code ToolbarEditLayout} is the UI for when the toolbar is in @@ -34,9 +29,7 @@ import android.widget.ImageButton; public class ToolbarEditLayout extends ThemedLinearLayout { private final ToolbarEditText mEditText; - private final ImageButton mGo; - private OnCommitListener mCommitListener; private OnFocusChangeListener mFocusChangeListener; public ToolbarEditLayout(Context context, AttributeSet attrs) { @@ -45,28 +38,11 @@ public class ToolbarEditLayout extends ThemedLinearLayout { setOrientation(HORIZONTAL); LayoutInflater.from(context).inflate(R.layout.toolbar_edit_layout, this); - mGo = (ImageButton) findViewById(R.id.go); mEditText = (ToolbarEditText) findViewById(R.id.url_edit_text); } @Override public void onAttachedToWindow() { - mGo.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - if (mCommitListener != null) { - mCommitListener.onCommit(); - } - } - }); - - mEditText.setOnTextTypeChangeListener(new OnTextTypeChangeListener() { - @Override - public void onTextTypeChange(ToolbarEditText editText, TextType textType) { - updateGoButton(textType); - } - }); - mEditText.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { @@ -85,8 +61,6 @@ public class ToolbarEditLayout extends ThemedLinearLayout { @Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); - - mGo.setEnabled(enabled); mEditText.setEnabled(enabled); } @@ -96,44 +70,13 @@ public class ToolbarEditLayout extends ThemedLinearLayout { mEditText.setPrivateMode(isPrivate); } - private void updateGoButton(TextType textType) { - if (textType == TextType.EMPTY) { - mGo.setVisibility(View.GONE); - return; - } - - mGo.setVisibility(View.VISIBLE); - - final int imageResource; - final String contentDescription; - - if (textType == TextType.SEARCH_QUERY) { - imageResource = R.drawable.ic_url_bar_search; - contentDescription = getContext().getString(R.string.search); - } else { - imageResource = R.drawable.ic_url_bar_go; - contentDescription = getContext().getString(R.string.go); - } - - mGo.setImageResource(imageResource); - mGo.setContentDescription(contentDescription); - } - private void showSoftInput() { InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(mEditText, InputMethodManager.SHOW_IMPLICIT); } - void prepareAnimation(final boolean showing, final PropertyAnimator animator) { - if (showing) { - prepareShowAnimation(animator); - } else { - prepareHideAnimation(animator); - } - } - - private void prepareShowAnimation(final PropertyAnimator animator) { + void prepareShowAnimation(final PropertyAnimator animator) { if (animator == null) { mEditText.requestFocus(); showSoftInput(); @@ -143,39 +86,17 @@ public class ToolbarEditLayout extends ThemedLinearLayout { animator.addPropertyAnimationListener(new PropertyAnimationListener() { @Override public void onPropertyAnimationStart() { - ViewHelper.setAlpha(mGo, 0.0f); mEditText.requestFocus(); } @Override public void onPropertyAnimationEnd() { - ViewHelper.setAlpha(mGo, 1.0f); showSoftInput(); } }); } - private void prepareHideAnimation(final PropertyAnimator animator) { - if (animator == null) { - return; - } - - animator.addPropertyAnimationListener(new PropertyAnimationListener() { - @Override - public void onPropertyAnimationStart() { - ViewHelper.setAlpha(mGo, 0.0f); - } - - @Override - public void onPropertyAnimationEnd() { - // The enclosing view is invisible, so unhide the go button. - ViewHelper.setAlpha(mGo, 1.0f); - } - }); - } - void setOnCommitListener(OnCommitListener listener) { - mCommitListener = listener; mEditText.setOnCommitListener(listener); } From f64406a6d012f6839e86a260148c91b15586aa8c Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Wed, 30 Apr 2014 10:25:42 -0700 Subject: [PATCH 08/11] Bug 1000149 - Part 2: Remove edit separator. r=lucasr --- .../base/resources/drawable/toolbar_separator.xml | 12 ------------ .../resources/drawable/toolbar_separator_pb.xml | 12 ------------ .../drawable/toolbar_separator_selector.xml | 15 --------------- .../base/resources/layout/browser_toolbar.xml | 13 +------------ mobile/android/base/toolbar/BrowserToolbar.java | 15 ++++----------- 5 files changed, 5 insertions(+), 62 deletions(-) delete mode 100644 mobile/android/base/resources/drawable/toolbar_separator.xml delete mode 100644 mobile/android/base/resources/drawable/toolbar_separator_pb.xml delete mode 100644 mobile/android/base/resources/drawable/toolbar_separator_selector.xml diff --git a/mobile/android/base/resources/drawable/toolbar_separator.xml b/mobile/android/base/resources/drawable/toolbar_separator.xml deleted file mode 100644 index 6c7b02009e8..00000000000 --- a/mobile/android/base/resources/drawable/toolbar_separator.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - diff --git a/mobile/android/base/resources/drawable/toolbar_separator_pb.xml b/mobile/android/base/resources/drawable/toolbar_separator_pb.xml deleted file mode 100644 index 2b639460910..00000000000 --- a/mobile/android/base/resources/drawable/toolbar_separator_pb.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - diff --git a/mobile/android/base/resources/drawable/toolbar_separator_selector.xml b/mobile/android/base/resources/drawable/toolbar_separator_selector.xml deleted file mode 100644 index e59860f90a3..00000000000 --- a/mobile/android/base/resources/drawable/toolbar_separator_selector.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - diff --git a/mobile/android/base/resources/layout/browser_toolbar.xml b/mobile/android/base/resources/layout/browser_toolbar.xml index a04ce405a41..8df7416111d 100644 --- a/mobile/android/base/resources/layout/browser_toolbar.xml +++ b/mobile/android/base/resources/layout/browser_toolbar.xml @@ -106,20 +106,9 @@ android:contentDescription="@string/edit_mode_cancel" android:visibility="invisible"/> - - focusOrder; - private final ThemedView editSeparator; private final View editCancel; private boolean shouldShrinkURLBar = false; @@ -220,7 +218,6 @@ public class BrowserToolbar extends ThemedRelativeLayout actionItemBar = (LinearLayout) findViewById(R.id.menu_items); hasSoftMenuButton = !HardwareUtils.hasMenuButton(); - editSeparator = (ThemedView) findViewById(R.id.edit_separator); editCancel = findViewById(R.id.edit_cancel); // We use different layouts on phones and tablets, so adjust the focus @@ -601,15 +598,15 @@ public class BrowserToolbar extends ThemedRelativeLayout } private int getUrlBarEntryTranslation() { - if (editSeparator == null) { + if (editCancel == null) { // We are on tablet, and there is no animation so return a translation of 0. return 0; } // We would ideally use the right-most point of the edit layout instead of the // edit separator and its margin, but it is not inflated when this code initially runs. - final LayoutParams lp = (LayoutParams) editSeparator.getLayoutParams(); - return editSeparator.getLeft() - lp.leftMargin - urlBarEntry.getRight(); + final LayoutParams lp = (LayoutParams) editCancel.getLayoutParams(); + return editCancel.getLeft() - lp.leftMargin - urlBarEntry.getRight(); } private int getUrlBarCurveTranslation() { @@ -897,8 +894,7 @@ public class BrowserToolbar extends ThemedRelativeLayout } private void setCancelVisibility(final int visibility) { - if (editSeparator != null && editCancel != null) { - editSeparator.setVisibility(visibility); + if (editCancel != null) { editCancel.setVisibility(visibility); } } @@ -1338,9 +1334,6 @@ public class BrowserToolbar extends ThemedRelativeLayout menuButton.setPrivateMode(isPrivate); menuIcon.setPrivateMode(isPrivate); urlEditLayout.setPrivateMode(isPrivate); - if (editSeparator != null) { - editSeparator.setPrivateMode(isPrivate); - } if (backButton instanceof BackButton) { ((BackButton) backButton).setPrivateMode(isPrivate); From b2029e8c40ca4597cf1c1755008db58cc8ce63c2 Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Wed, 30 Apr 2014 10:25:51 -0700 Subject: [PATCH 09/11] Bug 1000149 - Part 3: Update close button size and toolbar spacing. r=lucasr --- .../drawable-hdpi/close_edit_mode.png | Bin 301 -> 550 bytes .../drawable-mdpi/close_edit_mode.png | Bin 205 -> 473 bytes .../drawable-xhdpi/close_edit_mode.png | Bin 370 -> 679 bytes .../base/resources/layout/browser_toolbar.xml | 15 +++++++++------ .../android/base/toolbar/BrowserToolbar.java | 17 +++++++++++------ 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/mobile/android/base/resources/drawable-hdpi/close_edit_mode.png b/mobile/android/base/resources/drawable-hdpi/close_edit_mode.png index 70caf842d33e52296d730f9016c4c50bf89b0838..efb5ab8e7474a84d0cbf37fa22702768b2d0ffa6 100644 GIT binary patch literal 550 zcmeAS@N?(olHy`uVBq!ia0vp^Y9P$P3?%12mYf5mSkfJR9T^xl_H+M9WCijSl0AZa z85pX73L9D&7=8hT8eT9klo~KFyh>nTu$sZZAYL$MSD+10!Y05c#1%-#CuhVZrANdh zre_x>q+|lQ#GwEG|Eo4Wj05TyDhcun2GT$vC#Jb^p~Alnn3f}>VLzVH9@5NnBDA2K!2*1xJHzuB$lLF zB^RXvDF!10Lla#C6J0~|5JO`tV`D2*GhG97D+7aeN2h2M4Y~O#nQ4`{HGGr#^&F^y N!PC{xWt~$(699wr%vAsY literal 301 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpUtFP<)rAr-gY-rUP|*no%S!MVDl ze6qW~$THV%UUVzLAmjq~PKD^VyirCj-yQ36ekP@@^k!gW`H_0y?LUpJ+oG=bzxH{{ zb*<{#y{Fm?E%nznMXm4SVB8Y7cllSIryL7juD$N?q2cdC_gsO7d=mkc2Lb*J9Ig`{ z+A2snwta8NV3EAXyht#mg1^HJEXa6Rm_hDfTR#&6i=Z7xgP_X~4F)%Xhl?2`7!Ucg zC9rVVOE(BA{HbAZ`|;h0!PZHA-;rNE|9 z$OSTpMF0Q)zn~Z62h=QB666;Qq#1aG+LkE)S*^5Aan0{-9*fql0g5pudAqv^Rqx3G zDVXf(;uxZFerwQMzQYO}I%~u1*4+ADe{!*=)k)G;oySCs{`@|co1KI`789itzIl}KIr<=9mUe%PRFZHJ{=JC7vpTT}B zyZ;Qf(^)#296;x(mbgZgq$HN4S|t~y0x1R~149#C0~1|C^AJO0D`R6TQ!`xyb1MUb hc1NdZ6b-rgDVb@NxHWu}`SlzW0-mmZF6*2UngIQ-pEdvh literal 205 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=ffJDV{ElAr-gYUfalfKtX`np>1L6 zGLg(py3Hva=f&?U%ADkw`G~u`!JmtM;ihYTRd(5L{5ho#67I$kyRM z=a<<5|D|8?FH-JH`kAV-zwar((9g*_@kcp54(Q0Y);#-k?Askzp!*m+UHx3vIVCg! E0H9e+EC2ui diff --git a/mobile/android/base/resources/drawable-xhdpi/close_edit_mode.png b/mobile/android/base/resources/drawable-xhdpi/close_edit_mode.png index 4b6f1f34fd46470288a7a999b0479f55ce51871c..8fd7a3d1d00f3a61c1bf29396fc19be4759ab8e8 100644 GIT binary patch literal 679 zcmeAS@N?(olHy`uVBq!ia0vp^#vshW3=*k7AOWOU(j9#r85lP9bN@+X1@aY=J%W50 z7^>757#dm_7=8hT8eT9klo~KFyh>nTu$sZZAYL$MSD+10A~wJ$#1%-#C8ftFXZQz& z`38hk)V3s~WY#uyDk-amMa9J?riO&a0AX&(X_fwGKA-tI1PMO+HnK(?W$i(`n#@wd}%Gc_sjv}LM=&C@(9 z{QmzeO-ClCSL<%8e!lbP6u9rT9PnDdt=h>X?Z{CV9?uoSi{rb)Yk>WY7R~TKUDKWihS(3;aaWY!* z*0kqeHIGkwdHN9-`>M3rCoS$zyRglSyGnaOC6JM z+d7W1SnK#LvlX+Q+_m;8kEh3{;%iOuf^2E-`lYnu| zpjzS@QIe8al4_M)lnSI6j0_A-bPY^&4b4LgjjfE0txU~y4a}_!4B8!?qER&D=BH$) XRpQq0P3G5gP)vHd`njxgN@xNA&DjT~ literal 370 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7T#lEV6^mfaSW-r_4c-5(IE!`m%zLO zXLm3)3f~VF3@_UB?m#G?8pCz>+l}=XR)+mu#gJLPW6joor7Qvt42(dc;rY(`nz+fz zI~!T&uXQZ;?t5~IG3}@Orb+833l#jEUmbn&acIl_Y4PexdshFE;t+W7WABTV9DDwp zX=HrHB)pKN;ax7%7r|}Q<}=i`tbMBPAfK51lk~zc^Od zu)k1V@JVJtf5WL_nBW2%<`qgGfP!5IP8T<5F=^Q|GB|KHPJhl2$`Ut^xkRv{lJA21 zjHj#~e>ha?IMx2~sM&F-+HtAx<5Atmr=HiLlGmx4*QJ)%tuEK2BG>y=O0G{$u3w$c yL#6M83ZJK?+VcfV7H{J7w$^(uuLk$|%>2U~$xb_eg>VDIlEKr}&t;ucLK6VOFpa(d diff --git a/mobile/android/base/resources/layout/browser_toolbar.xml b/mobile/android/base/resources/layout/browser_toolbar.xml index 8df7416111d..f07972e9866 100644 --- a/mobile/android/base/resources/layout/browser_toolbar.xml +++ b/mobile/android/base/resources/layout/browser_toolbar.xml @@ -22,12 +22,11 @@ + + android:visibility="invisible"/> focusOrder; - private final View editCancel; + private final ImageView editCancel; private boolean shouldShrinkURLBar = false; @@ -218,7 +220,7 @@ public class BrowserToolbar extends ThemedRelativeLayout actionItemBar = (LinearLayout) findViewById(R.id.menu_items); hasSoftMenuButton = !HardwareUtils.hasMenuButton(); - editCancel = findViewById(R.id.edit_cancel); + editCancel = (ImageView) findViewById(R.id.edit_cancel); // We use different layouts on phones and tablets, so adjust the focus // order appropriately. @@ -603,10 +605,9 @@ public class BrowserToolbar extends ThemedRelativeLayout return 0; } - // We would ideally use the right-most point of the edit layout instead of the - // edit separator and its margin, but it is not inflated when this code initially runs. - final LayoutParams lp = (LayoutParams) editCancel.getLayoutParams(); - return editCancel.getLeft() - lp.leftMargin - urlBarEntry.getRight(); + // Subtract the right margin because it's negative. + final LayoutParams lp = (LayoutParams) urlEditLayout.getLayoutParams(); + return urlEditLayout.getRight() - lp.rightMargin - urlBarEntry.getRight(); } private int getUrlBarCurveTranslation() { @@ -1102,6 +1103,10 @@ public class BrowserToolbar extends ThemedRelativeLayout updateProgressVisibility(); + // The animation looks cleaner if the text in the URL bar is + // not selected so clear the selection by clearing focus. + urlEditLayout.clearFocus(); + if (Build.VERSION.SDK_INT < 11) { stopEditingWithoutAnimation(); } else if (HardwareUtils.isTablet()) { From 5d0d41bc299450ab35f42060d002620b7c4d8271 Mon Sep 17 00:00:00 2001 From: Michael Comella Date: Wed, 30 Apr 2014 10:25:58 -0700 Subject: [PATCH 10/11] Bug 1000149 - Part 4: Correct url bar shrinking documentation. r=lucasr --- mobile/android/base/resources/layout/browser_toolbar.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mobile/android/base/resources/layout/browser_toolbar.xml b/mobile/android/base/resources/layout/browser_toolbar.xml index f07972e9866..8df64115237 100644 --- a/mobile/android/base/resources/layout/browser_toolbar.xml +++ b/mobile/android/base/resources/layout/browser_toolbar.xml @@ -15,10 +15,10 @@ + Note 2: On devices where the editing mode cancel button is + wider than the tabs counter and nearby buttons, the url bar will + shrink, in which case the LayoutParams of this View are + changed dynamically. --> Date: Wed, 30 Apr 2014 10:26:25 -0700 Subject: [PATCH 11/11] Bug 1000149 - Part 5: Change edit/display layout visibility patterns on editing mode transitions. r=lucasr --- .../android/base/toolbar/BrowserToolbar.java | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/mobile/android/base/toolbar/BrowserToolbar.java b/mobile/android/base/toolbar/BrowserToolbar.java index 94261b536e7..bcb22def781 100644 --- a/mobile/android/base/toolbar/BrowserToolbar.java +++ b/mobile/android/base/toolbar/BrowserToolbar.java @@ -853,10 +853,10 @@ public class BrowserToolbar extends ThemedRelativeLayout urlEditLayout.prepareShowAnimation(animator); } - final View viewToShow = (showEditLayout ? urlEditLayout : urlDisplayLayout); - final View viewToHide = (showEditLayout ? urlDisplayLayout : urlEditLayout); - if (animator == null) { + final View viewToShow = (showEditLayout ? urlEditLayout : urlDisplayLayout); + final View viewToHide = (showEditLayout ? urlDisplayLayout : urlEditLayout); + viewToHide.setVisibility(View.GONE); viewToShow.setVisibility(View.VISIBLE); @@ -865,29 +865,23 @@ public class BrowserToolbar extends ThemedRelativeLayout return; } - ViewHelper.setAlpha(viewToShow, 0.0f); - animator.attach(viewToShow, - PropertyAnimator.Property.ALPHA, - 1.0f); - - animator.attach(viewToHide, - PropertyAnimator.Property.ALPHA, - 0.0f); - animator.addPropertyAnimationListener(new PropertyAnimationListener() { @Override public void onPropertyAnimationStart() { - viewToShow.setVisibility(View.VISIBLE); if (!showEditLayout) { + urlEditLayout.setVisibility(View.GONE); + urlDisplayLayout.setVisibility(View.VISIBLE); + setCancelVisibility(View.INVISIBLE); } } @Override public void onPropertyAnimationEnd() { - viewToHide.setVisibility(View.GONE); - ViewHelper.setAlpha(viewToHide, 1.0f); if (showEditLayout) { + urlDisplayLayout.setVisibility(View.GONE); + urlEditLayout.setVisibility(View.VISIBLE); + setCancelVisibility(View.VISIBLE); } }