Commit 24058f2d authored by Emilio Cobos Alvarez's avatar Emilio Cobos Alvarez
Browse files

Bug 1708735 - Make the arrowpanel code more generic. r=dao,zombie

Share the concept of a panel content with all other menupopups / panels.

This avoids importing global.css in the shadow tree, and renames the
arrowcontent part to just "content", since we want to introduce a
"content" part for other panels.

This shouldn't change behavior but makes bug 1708136 a matter of
tweaking a couple CSS rules and fixing up test failures.

Differential Revision: https://phabricator.services.mozilla.com/D113990
parent 51802327
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -241,6 +241,7 @@
    <panel is="search-autocomplete-richlistbox-popup"
           type="autocomplete-richlistbox"
           id="PopupSearchAutoComplete"
           orient="vertical"
           role="group"
           noautofocus="true"
           hidden="true" />
+12 −11
Original line number Diff line number Diff line
@@ -360,18 +360,15 @@ async function testSelectColors(selectID, itemCount, options) {
  );
  if (options.waitForComputedStyle) {
    let property = options.waitForComputedStyle.property;
    let value = options.waitForComputedStyle.value;
    let expectedValue = options.waitForComputedStyle.value;
    await TestUtils.waitForCondition(() => {
      let node = ["background-image", "background-color"].includes(property)
        ? arrowSB
        : selectPopup;
      info(
        `<${node.localName}> has ${property}: ${
          getComputedStyle(node)[property]
        }`
      );
      return getComputedStyle(node)[property] == value;
    }, `${selectID} - Waiting for <select> to have ${property}: ${value}`);
      let value = getComputedStyle(node).getPropertyValue(property);
      info(`<${node.localName}> has ${property}: ${value}`);
      return value == expectedValue;
    }, `${selectID} - Waiting for <select> to have ${property}: ${expectedValue}`);
  }

  is(selectPopup.parentNode.itemCount, itemCount, "Correct number of items");
@@ -387,7 +384,11 @@ async function testSelectColors(selectID, itemCount, options) {
  }
  if (!options.skipSelectColorTest.color) {
    is(
      getComputedStyle(selectPopup).color,
      rgbaToString(
        InspectorUtils.colorToRGBA(
          getComputedStyle(selectPopup).getPropertyValue("--panel-color")
        )
      ),
      options.selectColor,
      selectID + " popup has expected foreground color"
    );
@@ -608,7 +609,7 @@ add_task(
    let options = {
      skipSelectColorTest: true,
      waitForComputedStyle: {
        property: "color",
        property: "--panel-color",
        value: "rgb(255, 0, 0)",
      },
    };
@@ -675,7 +676,7 @@ add_task(
      selectColor: "rgb(128, 0, 128)",
      selectBgColor: kDefaultSelectStyles.backgroundColor,
      waitForComputedStyle: {
        property: "color",
        property: "--panel-color",
        value: "rgb(128, 0, 128)",
      },
      leaveOpen: true,
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@

async function testPanel(browser, standAlone, initial_background) {
  let panel = getPanelForNode(browser);
  let arrowContent = panel.shadowRoot.querySelector(".panel-arrowcontent");
  let arrowContent = panel.panelContent;
  let arrow = panel.shadowRoot.querySelector(".panel-arrow");

  let checkArrow = (background = null) => {
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ add_task(async function testPopupBorderRadius() {

  async function testPanel(browser, standAlone = true) {
    let panel = getPanelForNode(browser);
    let arrowContent = panel.shadowRoot.querySelector(".panel-arrowcontent");
    let arrowContent = panel.panelContent;

    let panelStyle = getComputedStyle(arrowContent);
    is(
+2 −2
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@
        </vbox>
        <arrowscrollbox class="menupopup-arrowscrollbox" flex="1" orient="vertical"
                        exportparts="scrollbox: arrowscrollbox-scrollbox"
                        smoothscroll="false" part="arrowscrollbox">
                        smoothscroll="false" part="arrowscrollbox content">
          <html:slot></html:slot>
        </arrowscrollbox>
      </hbox>
@@ -618,7 +618,7 @@
          </vbox>
          <arrowscrollbox class="menupopup-arrowscrollbox" flex="1"
                          orient="vertical" smoothscroll="false"
                          part="arrowscrollbox">
                          part="arrowscrollbox content">
            <html:slot/>
          </arrowscrollbox>
        </box>
Loading