Bug 1487048 - Use a <xul:checkbox> control to draw the icon and label of the checkboxes in the Content Blocking section; r=johannh,flod

Differential Revision: https://phabricator.services.mozilla.com/D4818
This commit is contained in:
Ehsan Akhgari 2018-09-01 01:56:48 -04:00
Родитель 67b0f1d4fb
Коммит 08f05bd051
5 изменённых файлов: 98 добавлений и 131 удалений

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

@ -640,8 +640,6 @@ var gPrivacyPane = {
let dependentControls = [
"#content-blocking-categories-label",
".content-blocking-checkbox",
".content-blocking-icon",
".content-blocking-category-name",
"#changeBlockListLink",
"#contentBlockingChangeCookieSettings",
"#blockCookiesCB, #blockCookiesCB > radio",
@ -1163,8 +1161,6 @@ var gPrivacyPane = {
let dependentControls = [
".reject-trackers-ui .content-blocking-checkbox",
".reject-trackers-ui .content-blocking-icon",
".reject-trackers-ui .content-blocking-category-name",
"#blockCookiesCB, #blockCookiesCB > radio",
"#blockCookiesCBDeck",
];
@ -1187,8 +1183,6 @@ var gPrivacyPane = {
let dependentControls = [
".reject-trackers-ui .content-blocking-checkbox",
".reject-trackers-ui .content-blocking-icon",
".reject-trackers-ui .content-blocking-category-name",
"#blockCookiesCB, #blockCookiesCB > radio",
"#blockCookiesCBDeck",
];

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

@ -332,106 +332,97 @@
<vbox id="contentBlockingCategories">
<label id="content-blocking-categories-label" data-l10n-id="content-blocking-category-label"/>
<hbox class="content-blocking-category fast-block-ui">
<vbox class="content-blocking-category-checkbox">
<vbox>
<checkbox id="contentBlockingFastBlockCheckbox"
class="content-blocking-checkbox"
preference="browser.fastblock.enabled" />
</vbox>
<vbox class="content-blocking-category-icon">
<image class="fastblock-icon content-blocking-icon"/>
</vbox>
<vbox class="content-blocking-category-labels" flex="1">
<label data-l10n-id="content-blocking-fastblock-slow-loading-label"
class="content-blocking-category-name"
control="contentBlockingFastBlockCheckbox"/>
<description data-l10n-id="content-blocking-fastblock-new-description" class="content-blocking-category-description"/>
class="content-blocking-checkbox" flex="1"
src="chrome://browser/skin/controlcenter/slowtrackers.svg"
preference="browser.fastblock.enabled"
data-l10n-id="content-blocking-fastblock-slow-loading-trackers-label"/>
<vbox class="content-blocking-category-labels" flex="1">
<description data-l10n-id="content-blocking-fastblock-new-description" class="content-blocking-category-description"/>
</vbox>
</vbox>
</hbox>
<vbox>
<hbox class="content-blocking-category tracking-protection-ui">
<vbox class="content-blocking-category-checkbox">
<checkbox id="contentBlockingTrackingProtectionCheckbox" class="content-blocking-checkbox" />
</vbox>
<vbox class="content-blocking-category-icon">
<image class="tracking-protection-icon content-blocking-icon" />
</vbox>
<vbox class="content-blocking-category-labels" flex="1">
<label data-l10n-id="content-blocking-tracking-protection-all-label"
class="content-blocking-category-name"
control="contentBlockingTrackingProtectionCheckbox"/>
<hbox id="contentBlockingTrackingProtectionExtensionContentLabel"
align="center" hidden="true" class="extension-controlled">
<description control="contentBlockingDisableTrackingProtectionExtension" flex="1"/>
<button id="contentBlockingDisableTrackingProtectionExtension"
class="extension-controlled-button accessory-button"
data-l10n-id="disable-extension" hidden="true"/>
</hbox>
<description data-l10n-id="content-blocking-tracking-protection-new-description"
class="content-blocking-category-description"
id="trackingProtectionMenuDesc"/>
<radiogroup id="trackingProtectionMenu"
aria-labelledby="trackingProtectionMenuDesc">
<radio value="private"
data-l10n-id="content-blocking-tracking-protection-option-private"
flex="1" />
<radio value="always"
data-l10n-id="content-blocking-tracking-protection-option-always"
flex="1" />
</radiogroup>
<label id="changeBlockListLink"
data-l10n-id="content-blocking-tracking-protection-change-block-list"
class="text-link"
search-l10n-ids="blocklist-window.title, blocklist-desc, blocklist-button-cancel.label, blocklist-button-ok.label"/>
<vbox>
<checkbox id="contentBlockingTrackingProtectionCheckbox"
class="content-blocking-checkbox" flex="1"
src="chrome://browser/skin/controlcenter/trackers.svg"
data-l10n-id="content-blocking-tracking-protection-all-detected-trackers-label"/>
<vbox class="content-blocking-category-labels" flex="1">
<hbox id="contentBlockingTrackingProtectionExtensionContentLabel"
align="center" hidden="true" class="extension-controlled">
<description control="contentBlockingDisableTrackingProtectionExtension" flex="1"/>
<button id="contentBlockingDisableTrackingProtectionExtension"
class="extension-controlled-button accessory-button"
data-l10n-id="disable-extension" hidden="true"/>
</hbox>
<description data-l10n-id="content-blocking-tracking-protection-new-description"
class="content-blocking-category-description"
id="trackingProtectionMenuDesc"/>
<radiogroup id="trackingProtectionMenu"
aria-labelledby="trackingProtectionMenuDesc">
<radio value="private"
data-l10n-id="content-blocking-tracking-protection-option-private"
flex="1" />
<radio value="always"
data-l10n-id="content-blocking-tracking-protection-option-always"
flex="1" />
</radiogroup>
<label id="changeBlockListLink" data-l10n-id="content-blocking-tracking-protection-change-block-list" class="text-link"/>
<label id="changeBlockListLink"
data-l10n-id="content-blocking-tracking-protection-change-block-list"
class="text-link"
search-l10n-ids="blocklist-window.title, blocklist-desc, blocklist-button-cancel.label, blocklist-button-ok.label"/>
</vbox>
</vbox>
</hbox>
</vbox>
<hbox class="content-blocking-category reject-trackers-ui">
<hbox flex="1">
<vbox class="content-blocking-category-checkbox">
<checkbox id="contentBlockingBlockCookiesCheckbox" class="content-blocking-checkbox" />
</vbox>
<vbox class="content-blocking-category-icon">
<image class="reject-trackers-icon content-blocking-icon"/>
</vbox>
<vbox class="content-blocking-category-labels" flex="1">
<hbox>
<vbox flex="1">
<label data-l10n-id="content-blocking-reject-trackers-label"
class="content-blocking-category-name"
control="contentBlockingBlockCookiesCheckbox"/>
<deck id="blockCookiesCBDeck">
<description id="blockCookiesCBDesc"
data-l10n-id="content-blocking-reject-trackers-description"
class="content-blocking-category-description"/>
<description data-l10n-id="content-blocking-reject-trackers-warning-your-settings-prevent-changes"
class="content-blocking-category-description description-with-side-element reject-trackers-warning-icon"/>
<description data-l10n-id="content-blocking-reject-trackers-warning-your-settings-prevent-changes"
class="content-blocking-category-description description-with-side-element reject-trackers-warning-icon"/>
</deck>
</vbox>
<hbox align="center" pack="end">
<vbox align="center">
<button id="contentBlockingChangeCookieSettings"
class="accessory-button"
flex="1"
hidden="true"
data-l10n-id="content-blocking-change-cookie-settings"/>
<checkbox id="contentBlockingBlockCookiesCheckbox"
class="content-blocking-checkbox" flex="1"
src="chrome://browser/skin/controlcenter/3rdpartycookies.svg"
data-l10n-id="content-blocking-third-party-cookies-label"/>
<vbox class="content-blocking-category-labels" flex="1">
<hbox>
<vbox flex="1">
<deck id="blockCookiesCBDeck">
<description id="blockCookiesCBDesc"
data-l10n-id="content-blocking-reject-trackers-description"
class="content-blocking-category-description"/>
<description data-l10n-id="content-blocking-reject-trackers-warning-your-settings-prevent-changes"
class="content-blocking-category-description description-with-side-element reject-trackers-warning-icon"/>
<description data-l10n-id="content-blocking-reject-trackers-warning-your-settings-prevent-changes"
class="content-blocking-category-description description-with-side-element reject-trackers-warning-icon"/>
</deck>
</vbox>
<hbox align="center" pack="end">
<vbox align="center">
<button id="contentBlockingChangeCookieSettings"
class="accessory-button"
flex="1"
hidden="true"
data-l10n-id="content-blocking-change-cookie-settings"/>
</vbox>
</hbox>
</hbox>
</hbox>
<radiogroup id="blockCookiesCB"
aria-labelledby="blockCookiesCBDesc"
preference="network.cookie.cookieBehavior"
onsyncfrompreference="return gPrivacyPane.readBlockCookiesCB();"
onsynctopreference="return gPrivacyPane.writeBlockCookiesCB();">
<radio value="trackers"
id="blockCookiesFromTrackersCB"
data-l10n-id="content-blocking-reject-trackers-block-trackers-option"
flex="1" />
<radio value="all-third-parties"
data-l10n-id="content-blocking-reject-trackers-all-third-parties-option"
flex="1" />
</radiogroup>
<radiogroup id="blockCookiesCB"
aria-labelledby="blockCookiesCBDesc"
preference="network.cookie.cookieBehavior"
onsyncfrompreference="return gPrivacyPane.readBlockCookiesCB();"
onsynctopreference="return gPrivacyPane.writeBlockCookiesCB();">
<radio value="trackers"
id="blockCookiesFromTrackersCB"
data-l10n-id="content-blocking-reject-trackers-block-trackers-option"
flex="1" />
<radio value="all-third-parties"
data-l10n-id="content-blocking-reject-trackers-all-third-parties-option"
flex="1" />
</radiogroup>
</vbox>
</vbox>
</hbox>
</hbox>

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

@ -202,11 +202,9 @@ add_task(async function testContentBlockingRestoreDefaultsSkipExtensionControlle
await TestUtils.waitForCondition(() => Services.prefs.prefHasUserValue(TP_PREF));
let dependentControls = [
"#content-blocking-categories-label",
".fast-block-ui .content-blocking-checkbox",
".reject-trackers-ui .content-blocking-checkbox",
".content-blocking-icon",
".content-blocking-category-name",
"#content-blocking-categories-label",
"#changeBlockListLink",
"#contentBlockingChangeCookieSettings",
"#blockCookiesCB, #blockCookiesCB > radio",
@ -310,10 +308,8 @@ add_task(async function testContentBlockingDependentControls() {
]});
let dependentControls = [
"#content-blocking-categories-label",
".content-blocking-checkbox",
".content-blocking-icon",
".content-blocking-category-name",
"#content-blocking-categories-label",
"#changeBlockListLink",
"#contentBlockingChangeCookieSettings",
];
@ -334,10 +330,8 @@ add_task(async function testContentBlockingDependentControls() {
]});
dependentControls = [
"#content-blocking-categories-label",
".content-blocking-checkbox",
".content-blocking-icon",
".content-blocking-category-name",
"#content-blocking-categories-label",
"#changeBlockListLink",
"#contentBlockingChangeCookieSettings",
"#blockCookiesCB, #blockCookiesCB > radio",
@ -404,8 +398,6 @@ add_task(async function testContentBlockingDependentControlsOnSiteDataUI() {
"#contentBlockingChangeCookieSettings",
];
let alwaysDisabledControls = [
".reject-trackers-checkbox",
".reject-trackers-icon",
"[control=blockCookiesCB]",
"#blockCookiesCBDeck",
"#blockCookiesCB, #blockCookiesCB > radio",
@ -431,8 +423,6 @@ add_task(async function testContentBlockingDependentControlsOnSiteDataUI() {
let dependentControls = [
"#content-blocking-categories-label",
".content-blocking-checkbox",
".content-blocking-icon",
".content-blocking-category-name",
"#trackingProtectionMenu",
"[control=trackingProtectionMenu]",
"#changeBlockListLink",
@ -464,8 +454,6 @@ add_task(async function testContentBlockingDependentControlsOnSiteDataUI() {
let dependentControls = [
"#content-blocking-categories-label",
".content-blocking-checkbox",
".content-blocking-icon",
".content-blocking-category-name",
"#trackingProtectionMenu",
"[control=trackingProtectionMenu]",
"#changeBlockListLink",

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

@ -835,10 +835,12 @@ content-blocking-category-label = Choose what to block
# "Slow" in this instance means "slow to load on the network".
# FastBlock is a feature that blocks requests to tracking sites if they
# have not finished loading after a certain threshold of seconds.
content-blocking-fastblock-slow-loading-label = Slow-Loading Trackers
content-blocking-fastblock-slow-loading-trackers-label =
.label = Slow-Loading Trackers
.accesskey = S
content-blocking-fastblock-new-description = Block just the trackers that keep pages from loading quickly.
content-blocking-tracking-protection-all-label = All Detected Trackers
content-blocking-tracking-protection-all-detected-trackers-label =
.label = All Detected Trackers
.accesskey = T
content-blocking-tracking-protection-new-description = Block all known trackers. (May prevent some pages from loading.)
content-blocking-tracking-protection-option-always =
@ -849,7 +851,8 @@ content-blocking-tracking-protection-option-private =
.accesskey = p
content-blocking-tracking-protection-change-block-list = Change block list
content-blocking-reject-trackers-label = Third-Party Cookies
content-blocking-third-party-cookies-label =
.label = Third-Party Cookies
.accesskey = C
content-blocking-reject-trackers-description = Block all third-party cookies or just those set by trackers.
# This is a warning message shown next to a yellow warning icon when the Third-Party Cookies subsection

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

@ -12,6 +12,12 @@
vertical-align: middle;
}
.content-blocking-checkbox .checkbox-icon {
margin-inline-end: 8px;
margin-inline-start: 4px;
width: 16px;
}
.content-blocking-icon,
.permission-icon {
-moz-context-properties: fill;
@ -116,16 +122,9 @@
margin: 16px 0;
}
.content-blocking-category-checkbox {
padding: 4px;
}
.content-blocking-category-icon {
padding: 4px;
}
.content-blocking-category-labels {
padding-inline-start: 4px;
margin-inline-start: 25px !important;
}
#trackingProtectionMenu,
@ -133,6 +132,10 @@
margin-top: 0.75em;
}
#blockCookiesCBDeck {
max-width: 444px;
}
#changeBlockListLink {
font-size: 90%;
/* In order to override the margins set in preferences.inc.css, we have to use !important. */
@ -144,18 +147,6 @@
opacity: 0.6;
}
.fastblock-icon {
list-style-image: url(chrome://browser/skin/controlcenter/slowtrackers.svg);
}
.tracking-protection-icon {
list-style-image: url(chrome://browser/skin/controlcenter/trackers.svg);
}
.reject-trackers-icon {
list-style-image: url(chrome://browser/skin/controlcenter/3rdpartycookies.svg);
}
.reject-trackers-warning-icon {
background: url(chrome://browser/skin/controlcenter/warning.svg) no-repeat 0 5px;
-moz-context-properties: fill, stroke;