Skip to content

Commit 07e57e1

Browse files
committed
Bug 1984040 — fix ip protection status card top border and ring alignment. r=ip-protection-reviewers,fchasen
Differential Revision: https://phabricator.services.mozilla.com/D262877
1 parent c254ec4 commit 07e57e1

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

browser/components/ipprotection/content/ipprotection-content.css

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ hr {
4545
--box-icon-fill: var(--connection-shield-color);
4646
--box-icon-stroke: var(--shield-bgcolor);
4747
-moz-context-properties: fill, stroke;
48+
/**
49+
* moz-box-group changes the border of items based on its position in the group.
50+
* Undo it to preserve the border radius even though the animation rings are
51+
* loaded first in the group.
52+
*/
53+
--box-border-radius-start: initial;
4854
fill: var(--connection-shield-color);
4955
stroke: var(--shield-bgcolor);
5056

@@ -67,14 +73,21 @@ hr {
6773
width: 100%;
6874
height: 100%;
6975
contain: strict;
70-
background-position-x: -66px;
71-
background-position-y: -70px;
76+
/**
77+
* A hacky attempt at centering the rings with the globe icon.
78+
* It makes some assumptions about the icon size and padding pixels used in moz-box-item.
79+
* The rings are 200px in height and width, so they have a radius of 100px.
80+
* Additional px gap is merely for alignment and not tied to any element.
81+
* TODO: (Bug 1981251) See if we can better calculate the center coords.
82+
*/
83+
background-position-x: calc(-100px + var(--icon-size-xlarge) + var(--space-large) - 15px);
84+
background-position-y: calc(-100px + var(--icon-size-xlarge) + var(--space-large) - 13px);
7285
background-image: url("chrome://browser/content/ipprotection/assets/rings.svg");
7386
background-repeat: no-repeat;
7487

7588
&:dir(rtl) {
76-
background-position-x: calc(100% + 66px);
77-
background-position-y: calc(100% + 11px);
89+
/* Shift by approximately 100% of the element's width to move the rings to the opposite side. */
90+
background-position-x: calc(100% + var(--icon-size-xlarge) + var(--space-large) + 28px);
7891
}
7992

8093
@media (prefers-reduced-motion: reduce) {

browser/components/ipprotection/content/ipprotection-content.mjs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,12 @@ export default class IPProtectionContentElement extends MozLitElement {
295295
: null;
296296
}
297297

298+
animationRingsTemplate() {
299+
return html` <div id="status-card-animation">
300+
<div id="animation-rings"></div>
301+
</div>`;
302+
}
303+
298304
statusCardTemplate() {
299305
let protectionEnabled = this.state.isProtectionEnabled;
300306
const statusCardL10nId = protectionEnabled
@@ -311,12 +317,8 @@ export default class IPProtectionContentElement extends MozLitElement {
311317
let time =
312318
this.canShowConnectionTime && this._timeString ? this._timeString : "";
313319

314-
return html`<moz-box-group class="vpn-status-group">
315-
${this.showAnimation
316-
? html` <div id="status-card-animation">
317-
<div id="animation-rings"></div>
318-
</div>`
319-
: null}
320+
return html` <moz-box-group class="vpn-status-group">
321+
${this.showAnimation ? this.animationRingsTemplate() : null}
320322
<moz-box-item
321323
id="status-card"
322324
class=${classMap({

0 commit comments

Comments
 (0)