Commit cc3ace47 authored by Julien Wajsberg's avatar Julien Wajsberg
Browse files

Bug 1730893 - [devtools profiler] Properly localize buttons in the profiler...

Bug 1730893 - [devtools profiler] Properly localize buttons in the profiler popup r=jdescottes,fluent-reviewers,desktop-theme-reviewers,nbaumgardner,harry,flod

This fixes a warning when Fluent translates these buttons: previously it
was removing the content, which we don't control. The proper way is
assigning attributes instead.

This also required touching the style a bit.

Differential Revision: https://phabricator.services.mozilla.com/D127678
parent 4d736275
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -270,13 +270,13 @@
                <image class="PanelUI-profiler-info-icon" />
              </vbox>
            </hbox>
            <label data-l10n-id="profiler-popup-description-title" />
            <description data-l10n-id="profiler-popup-description" />
            <label class="PanelUI-profiler-description-title" data-l10n-id="profiler-popup-description-title" />
            <description class="PanelUI-profiler-description" data-l10n-id="profiler-popup-description" />
            <hbox>
              <button id="PanelUI-profiler-learn-more"
                      class="PanelUI-profiler-button-link"
                      tabindex="-1"
                      data-l10n-id="profiler-popup-learn-more" />
              <space flex="1" />
                      data-l10n-id="profiler-popup-learn-more-button" />
            </hbox>
          </vbox>
        </hbox>
@@ -300,9 +300,10 @@
          </menulist>
          <!-- The following description gets inserted dynamically. -->
          <description id="PanelUI-profiler-content-description" />
          <hbox id="PanelUI-profiler-content-custom">
            <button id="PanelUI-profiler-content-custom-button"
                    data-l10n-id="profiler-popup-edit-settings">
          <hbox>
            <button id="PanelUI-profiler-content-edit-settings"
                    class="PanelUI-profiler-button-link"
                    data-l10n-id="profiler-popup-edit-settings-button">
            </button>
          </hbox>
        </vbox>
+4 −2
Original line number Diff line number Diff line
@@ -147,13 +147,15 @@ profiler-popup-description-title =
profiler-popup-description =
  Collaborate on performance issues by publishing profiles to share with your team.

profiler-popup-learn-more = Learn more
profiler-popup-learn-more-button =
  .label = Learn more

profiler-popup-settings =
  .value = Settings

# This link takes the user to about:profiling, and is only visible with the Custom preset.
profiler-popup-edit-settings = Edit Settings…
profiler-popup-edit-settings-button =
  .label = Edit Settings…

profiler-popup-disabled =
  The profiler is currently disabled, most likely due to a Private Browsing window
+26 −30
Original line number Diff line number Diff line
@@ -1973,6 +1973,19 @@ panelview:not([mainview]) #PanelUI-whatsNew-title {
  min-width: 0 !important;
}

/* This utility class styles a button as a link. */
.PanelUI-profiler-button-link {
  appearance: none;
  font-size: inherit;
  cursor: pointer;
  min-width: 0;
  text-decoration: underline;
}

.PanelUI-profiler-button-link .button-text {
  margin: 0; /* Cancel out the default internal margin */
}

#PanelUI-profiler description {
  max-width: 290px;
}
@@ -2053,11 +2066,6 @@ panelview:not([mainview]) #PanelUI-whatsNew-title {
  --arrowpanel-background: #fbfbfb;
}

/* Hide the unused box that gets added here. */
#PanelUI-profiler-learn-more > hbox {
  display: none;
}

#PanelUI-profiler-content {
  position: relative;
}
@@ -2067,30 +2075,26 @@ panelview:not([mainview]) #PanelUI-whatsNew-title {
  margin-inline-end: 4px;
}

#PanelUI-profiler-info label {
.PanelUI-profiler-description-title {
  font-size: 16px;
  font-weight: bold;
  margin: 6px 15px;
}

#PanelUI-profiler-info description {
.PanelUI-profiler-description {
  margin: 4px 15px;
}

#PanelUI-profiler-info button {
  appearance: none;
  padding: 2px;
  margin: 4px 13px 13px;
#PanelUI-profiler-learn-more {
  margin: 4px 15px 13px;
  color: #fff;
  text-decoration: underline;
  cursor: pointer;
}

#PanelUI-profiler-info button:active {
#PanelUI-profiler-learn-more:active {
  color: #fffc;
}

#PanelUI-profiler-info button:focus {
#PanelUI-profiler-learn-more:focus {
  box-shadow: 0 0 0 2px #fff, 0 0 0 6px rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  text-decoration: none;
@@ -2100,31 +2104,23 @@ panelview:not([mainview]) #PanelUI-whatsNew-title {
  margin: 8px 15px;
}

#PanelUI-profiler-content-custom-button {
  appearance: none;
  margin: 0;
#PanelUI-profiler-content-edit-settings {
  margin: 0 15px;
  color: #0046A4;
  text-decoration: none;
  font-size: 12px;
  cursor: pointer;
}

:root[lwt-popup-brighttext] #PanelUI-profiler-content-custom-button {
:root[lwt-popup-brighttext] #PanelUI-profiler-content-edit-settings {
  color: #76B1FF;
}

#PanelUI-profiler-content-custom-button:hover {
#PanelUI-profiler-content-edit-settings:hover,
#PanelUI-profiler-content-edit-settings:active,
#PanelUI-profiler-content-edit-settings:focus {
  text-decoration: underline;
}

#PanelUI-profiler-content-custom-button:active,
#PanelUI-profiler-content-custom-button:focus {
  text-decoration: underline;
}

#PanelUI-profiler-content-custom {
  margin-inline: 15px;
}

.PanelUI-profiler-content-label {
  font-weight: bold;
  font-size: 13px;
+3 −4
Original line number Diff line number Diff line
@@ -72,9 +72,8 @@ function selectElementsInPanelview(panelview) {
    active: getElementById("PanelUI-profiler-active"),
    locked: getElementById("PanelUI-profiler-locked"),
    presetDescription: getElementById("PanelUI-profiler-content-description"),
    presetCustom: getElementById("PanelUI-profiler-content-custom"),
    presetsCustomButton: getElementById(
      "PanelUI-profiler-content-custom-button"
    presetsEditSettings: getElementById(
      "PanelUI-profiler-content-edit-settings"
    ),
    presetsMenuList: /** @type {MenuListElement} */ (getElementById(
      "PanelUI-profiler-presets"
@@ -359,7 +358,7 @@ function addPopupEventHandlers(state, elements, view) {
    event.preventDefault();
  });

  addHandler(elements.presetsCustomButton, "click", () => {
  addHandler(elements.presetsEditSettings, "click", () => {
    elements.window.openTrustedLinkIn("about:profiling", "tab");
    view.hidePopup();
  });