author | Evan Tseng <evan@tseng.io> |
Thu, 20 Jul 2017 16:15:04 +0800 | |
changeset 614091 | 3cf9acd42d0ee2e4ffab10a001edf0262775d739 |
parent 614015 | 5928d905c0bc0b28f5488b236444c7d7991cf8d4 |
child 638776 | afc4343d8ff3031c9b9256bbe4d205bc7d4cc6f7 |
push id | 69913 |
push user | bmo:evan@tseng.io |
push date | Mon, 24 Jul 2017 03:57:51 +0000 |
bugs | 1377163 |
milestone | 56.0a1 |
--- a/browser/components/preferences/in-content-new/findInPage.js +++ b/browser/components/preferences/in-content-new/findInPage.js @@ -2,26 +2,24 @@ * 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/. */ /* import-globals-from preferences.js */ var gSearchResultsPane = { listSearchTooltips: new Set(), listSearchMenuitemIndicators: new Set(), - searchResultsCategory: null, searchInput: null, inited: false, init() { if (this.inited) { return; } this.inited = true; - this.searchResultsCategory = document.getElementById("category-search-results"); this.searchInput = document.getElementById("searchInput"); this.searchInput.hidden = !Services.prefs.getBoolPref("browser.preferences.search"); if (!this.searchInput.hidden) { this.searchInput.addEventListener("command", this); window.addEventListener("load", () => { this.searchInput.focus(); this.initializeCategories(); }); @@ -228,18 +226,16 @@ var gSearchResultsPane = { this.removeAllSearchMenuitemIndicators(); let srHeader = document.getElementById("header-searchResults"); if (this.query) { // Showing the Search Results Tag gotoPref("paneSearchResults"); - this.searchResultsCategory.hidden = false; - let resultsFound = false; // Building the range for highlighted areas let rootPreferencesChildren = document .querySelectorAll("#mainPrefPane > *:not([data-hidden-from-search])"); // Showing all the children to bind JS, Access Keys, etc for (let i = 0; i < rootPreferencesChildren.length; i++) { @@ -274,17 +270,16 @@ var gSearchResultsPane = { // eslint-disable-next-line no-unsanitized/property document.getElementById("need-help").innerHTML = strings.getFormattedString("searchResults.needHelp2", [helpUrl, brandName]); } else { // Creating tooltips for all the instances found this.listSearchTooltips.forEach((anchorNode) => this.createSearchTooltip(anchorNode, this.query)); } } else { - this.searchResultsCategory.hidden = true; document.getElementById("sorry-message").textContent = ""; // Going back to General when cleared gotoPref("paneGeneral"); } }, /** * Finding leaf nodes and checking their content for words to search,
--- a/browser/components/preferences/in-content-new/preferences.js +++ b/browser/components/preferences/in-content-new/preferences.js @@ -157,53 +157,60 @@ function gotoPref(aCategory) { // until proper search support is enabled (bug 1353954). let subcategory = breakIndex != -1 && category.substring(breakIndex + 1); if (subcategory) { category = category.substring(0, breakIndex); } category = friendlyPrefCategoryNameToInternalName(category); if (category != "paneSearchResults") { gSearchResultsPane.searchInput.value = ""; - gSearchResultsPane.searchResultsCategory.hidden = true; gSearchResultsPane.getFindSelection(window).removeAllRanges(); gSearchResultsPane.removeAllSearchTooltips(); gSearchResultsPane.removeAllSearchMenuitemIndicators(); } else if (!gSearchResultsPane.searchInput.value) { // Something tried to send us to the search results pane without // a query string. Default to the General pane instead. category = kDefaultCategoryInternalName; document.location.hash = kDefaultCategory; gSearchResultsPane.query = null; } // Updating the hash (below) or changing the selected category // will re-enter gotoPref. if (gLastHash == category && !subcategory) return; - let item = categories.querySelector(".category[value=" + category + "]"); - if (!item) { - category = kDefaultCategoryInternalName; + + let item; + if (category != "paneSearchResults") { item = categories.querySelector(".category[value=" + category + "]"); + if (!item) { + category = kDefaultCategoryInternalName; + item = categories.querySelector(".category[value=" + category + "]"); + } } try { init_category_if_required(category); } catch (ex) { Cu.reportError("Error initializing preference category " + category + ": " + ex); throw ex; } let friendlyName = internalPrefCategoryNameToFriendlyName(category); if (gLastHash || category != kDefaultCategoryInternalName || subcategory) { document.location.hash = friendlyName; } // Need to set the gLastHash before setting categories.selectedItem since // the categories 'select' event will re-enter the gotoPref codepath. gLastHash = category; - categories.selectedItem = item; + if (item) { + categories.selectedItem = item; + } else { + categories.clearSelection(); + } window.history.replaceState(category, document.title); search(category, "data-category", subcategory, "data-subcategory"); let mainContent = document.querySelector(".main-content"); mainContent.scrollTop = 0; Services.telemetry .getHistogramById("FX_PREFERENCES_CATEGORY_OPENED_V2")
--- a/browser/components/preferences/in-content-new/preferences.xul +++ b/browser/components/preferences/in-content-new/preferences.xul @@ -118,27 +118,16 @@ src="chrome://browser/locale/preferences/applicationManager.properties"/> </stringbundleset> <stack flex="1"> <hbox flex="1"> <!-- category list --> <richlistbox id="categories"> - <richlistitem id="category-search-results" - class="category" - value="paneSearchResults" - helpTopic="prefs-main" - tooltiptext="&paneSearchResults.title;" - align="center" - hidden="true"> - <image class="category-icon"/> - <label class="category-name" flex="1">&paneSearchResults.title;</label> - </richlistitem> - <richlistitem id="category-general" class="category" value="paneGeneral" helpTopic="prefs-main" tooltiptext="&paneGeneral.title;" align="center"> <image class="category-icon"/> <label class="category-name" flex="1">&paneGeneral.title;</label>
--- a/browser/components/preferences/in-content-new/tests/browser_search_within_preferences_1.js +++ b/browser/components/preferences/in-content-new/tests/browser_search_within_preferences_1.js @@ -51,21 +51,17 @@ add_task(async function() { searchInput.value = "password"; searchInput.doCommand(); let categoriesList = gBrowser.contentDocument.getElementById("categories"); for (let i = 0; i < categoriesList.childElementCount; i++) { let child = categoriesList.children[i] - if (child.id == "category-search-results") { - is(child.selected, true, "Search results panel should be selected"); - } else if (child.id) { - is(child.selected, false, "No other panel should be selected"); - } + is(child.selected, false, "No other panel should be selected"); } // Takes search off searchInput.value = ""; searchInput.doCommand(); // Checks if back to generalPane for (let i = 0; i < categoriesList.childElementCount; i++) { let child = categoriesList.children[i] @@ -237,29 +233,25 @@ add_task(async function() { }); /** * Test for if we go to another tab after searching */ add_task(async function() { await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true}); let searchInput = gBrowser.contentDocument.getElementById("searchInput"); - let searchResultsCategory = gBrowser.contentDocument.getElementById("category-search-results"); is(searchInput, gBrowser.contentDocument.activeElement.closest("#searchInput"), "Search input should be focused when visiting preferences"); searchInput.value = "password"; searchInput.doCommand(); - is(searchResultsCategory.hidden, false, "search results category should be shown"); - is(searchResultsCategory.selected, true, "search results category should be selected"); let privacyCategory = gBrowser.contentDocument.getElementById("category-privacy"); privacyCategory.click(); - is(searchResultsCategory.hidden, true, "search results category should not be shown"); is(searchInput.value, "", "search input should be empty"); let categoriesList = gBrowser.contentDocument.getElementById("categories"); for (let i = 0; i < categoriesList.childElementCount; i++) { let child = categoriesList.children[i] if (child.id == "category-privacy") { is(child.selected, true, "Privacy panel should be selected"); } else if (child.id) { is(child.selected, false, "No other panel should be selected");
--- a/browser/themes/shared/incontentprefs/icons.svg +++ b/browser/themes/shared/incontentprefs/icons.svg @@ -16,63 +16,32 @@ fill: ThreeDHighlight; } </style> <defs> <g id="general-shape"> <path d="M18.97,3H5.03C3.914,3,3,3.914,3,5.03v13.94C3,20.086,3.914,21,5.03,21H18.97c1.117,0,2.03-0.914,2.03-2.03 V5.03C21,3.914,20.086,3,18.97,3z M5.35,19.326c-0.404,0-0.731-0.327-0.731-0.731c0-0.404,0.327-0.731,0.731-0.731 c0.404,0,0.731,0.327,0.731,0.731C6.081,19,5.754,19.326,5.35,19.326z M5.35,6.168c-0.403,0-0.731-0.328-0.731-0.731 c0-0.404,0.328-0.731,0.731-0.731c0.403,0,0.731,0.327,0.731,0.731C6.081,5.84,5.753,6.168,5.35,6.168z M15.243,14.035 c0,0.229-0.186,0.416-0.414,0.416c-0.229,0-0.415,0.186-0.415,0.414v3.347c0,0.228-0.185,0.384-0.414,0.384l-4.141,0.03 c-0.227,0-0.414-0.186-0.414-0.414v-3.347c0-0.228-0.185-0.414-0.414-0.414c-0.227,0-0.414-0.187-0.414-0.416V6.582 c0-0.229,0.187-0.414,0.414-0.414h5.798c0.228,0,0.414,0.185,0.414,0.414V14.035z M18.509,19.326c-0.404,0-0.731-0.327-0.731-0.731 c0-0.404,0.327-0.731,0.731-0.731c0.404,0,0.731,0.327,0.731,0.731C19.24,19,18.913,19.326,18.509,19.326z M18.509,6.168 c-0.404,0-0.731-0.328-0.731-0.731c0-0.404,0.327-0.731,0.731-0.731c0.404,0,0.731,0.327,0.731,0.731 C19.24,5.84,18.913,6.168,18.509,6.168z"/> <path d="M12.757,7.824h-1.657c-0.456,0-0.828,0.373-0.828,0.828v8.282c0,0.456,0.373,0.828,0.828,0.828h1.657 c0.456,0,0.828-0.373,0.828-0.828V8.652C13.586,8.196,13.213,7.824,12.757,7.824z"/> </g> - <g id="content-shape"> - <path d="M16.286,2H5.571C4.388,2,3.429,2.96,3.429,4.143v15.714 C3.429,21.04,4.388,22,5.571,22h12.857c1.185,0,2.143-0.96,2.143-2.143V6.286L16.286,2z M18.945,19.223c0,0.22-0.18,0.4-0.4,0.4 h-13.2c-0.22,0-0.4-0.18-0.4-0.4v-0.846c0-0.22,0.18-0.4,0.4-0.4h13.2c0.22,0,0.4,0.18,0.4,0.4V19.223z M18.945,15.223 c0,0.22-0.18,0.4-0.4,0.4h-13.2c-0.22,0-0.4-0.18-0.4-0.4v-0.846c0-0.22,0.18-0.4,0.4-0.4h13.2c0.22,0,0.4,0.18,0.4,0.4V15.223z M18.945,11.229c0,0.22-0.18,0.4-0.4,0.4h-13.2c-0.22,0-0.4-0.18-0.4-0.4v-0.846c0-0.22,0.18-0.4,0.4-0.4h13.2 c0.22,0,0.4,0.18,0.4,0.4V11.229z M14.833,7.707v-4.65l4.65,4.65H14.833z"/> - </g> <g id="security-shape"> <path d="M18.909,9.783h-0.863V8.086C18.046,4.725,15.339,2,12,2 C8.661,2,5.954,4.725,5.954,8.086v1.697H5.091c-0.955,0-1.728,0.779-1.728,1.739v8.738c0,0.961,0.773,1.74,1.728,1.74h13.818 c0.954,0,1.728-0.779,1.728-1.74v-8.738C20.637,10.562,19.863,9.783,18.909,9.783z M8.545,8.086c0-1.92,1.547-3.478,3.455-3.478 c1.908,0,3.455,1.557,3.455,3.478v1.697h-6.91V8.086z M5.181,16.092l-0.909-1.2v-2.284l2.728,3.483H5.181z M8.818,16.092 l-2.773-3.657h1.727l2.864,3.657H8.818z M12,16.092l-2.773-3.657h1.727l2.864,3.657H12z M15.637,16.092l-2.773-3.657h1.727 l2.864,3.657H15.637z M19.728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.6-0.3,0.8c-0.1,0.2-0.2,0.5-0.3,0.7C21.1,15.1,21.2,15.2,21.3,15.6L21.3,15.6z"/> - </g> - <g id="searchResults-shape"> + <g id="search-shape"> <path d="M20.6,19.6l-4.4-4.5c2.4-2.9,2.4-7.1,0.2-10c-2.3-3-6.3-3.9-9.6-2.3c-3.3,1.6-5.1,5.3-4.3,9 c0.8,3.7,4,6.3,7.7,6.3c1.5,0,3-0.4,4.3-1.3l4.5,4.6c0.3,0.3,0.8,0.4,1.2,0.3c0.4-0.1,0.7-0.4,0.9-0.9S20.9,19.9,20.6,19.6z M10.1,16c-3.3,0-6-2.7-6-6.1c0-3.4,2.7-6.1,6-6.1c3.3,0,6,2.7,6,6.1C16.1,13.3,13.4,16,10.1,16z"/> <path d="M10.1,5.3c-2.5,0-4.6,2.1-4.6,4.7c0,1.2,0.5,2.4,1.4,3.3c0.9,0.9,2,1.4,3.3,1.4c2.5,0,4.6-2.1,4.6-4.7 C14.7,7.4,12.7,5.3,10.1,5.3z M10,7.9c-1,0-1.8,0.8-1.8,1.8c0,0.4-0.3,0.8-0.8,0.8s-0.8-0.4-0.8-0.8c0-1.9,1.5-3.4,3.3-3.4h0 c0.4,0,0.8,0.4,0.8,0.8S10.4,7.9,10,7.9z"/> </g> </defs> <use id="general" href="#general-shape"/> <use id="general-native" href="#general-shape"/> - <use id="content" href="#content-shape"/> - <use id="content-native" href="#content-shape"/> <use id="security" href="#security-shape"/> <use id="security-native" href="#security-shape"/> <use id="sync" href="#sync-shape"/> <use id="sync-native" href="#sync-shape"/> - <use id="advanced" href="#advanced-shape"/> - <use id="advanced-native" href="#advanced-shape"/> - <use id="searchResults" href="#searchResults-shape"/> - <use id="searchResults-native" href="#searchResults-shape"/> + <use id="search" href="#search-shape"/> + <use id="search-native" href="#search-shape"/> </svg>
--- a/browser/themes/shared/incontentprefs/preferences.inc.css +++ b/browser/themes/shared/incontentprefs/preferences.inc.css @@ -104,39 +104,27 @@ html|option { visibility: collapse; } #category-general > .category-icon { list-style-image: url("chrome://browser/skin/preferences/in-content-new/icons.svg#general"); } #category-search > .category-icon { - list-style-image: url("chrome://browser/skin/preferences/in-content-new/icons.svg#searchResults"); -} - -#category-application > .category-icon { - list-style-image: url("chrome://browser/skin/preferences/in-content-new/icons.svg#content"); + list-style-image: url("chrome://browser/skin/preferences/in-content-new/icons.svg#search"); } #category-privacy > .category-icon { list-style-image: url("chrome://browser/skin/preferences/in-content-new/icons.svg#security"); } #category-sync > .category-icon { list-style-image: url("chrome://browser/skin/preferences/in-content-new/icons.svg#sync"); } -#category-advanced > .category-icon { - list-style-image: url("chrome://browser/skin/preferences/in-content-new/icons.svg#advanced"); -} - -#category-search-results > .category-icon { - list-style-image: url("chrome://browser/skin/preferences/in-content-new/icons.svg#searchResults"); -} - @media (max-width: 800px) { .category-name { display: none; } .help-button { font-size: 0 !important; } }