• 1 Post
  • 55 Comments
Joined 1 year ago
cake
Cake day: June 13th, 2023

help-circle



  • You’ll be styling another element, that’s really all it is.

    Normally Firefox applies various styling rules to the element with id urlbar-background - so it makes sense to also apply your custom style rules and overrides to it. If you apply your background-color or border or other rules to some other element such as #urlbar-input-container then the original styling of #urlbar-background still applies as well.

    This would then cause issue like you would see in your first image, exactly like you guessed; the outline of #urlbar-background is seen behind the background-color of #urlbar-input-container because the two boxes don’t have exactly the same shape and thus you are not fully covering the urlbar-background.







  • I’m not sure about how the svg would work here (though it might work fine), but you can do that with just CSS as well:

    @keyframes tab-gradient-anim{
      from{ background-position-x: 0% }
      to{ background-position-x: 200% }
    }
    .tab-content[selected]{
      background-image: linear-gradient(
            90deg,
            rgb(255, 0, 0) 0%,
            rgb(255, 154, 0) 12%,
            rgb(208, 222, 33) 24%,
            rgb(79, 220, 74) 35%,
            rgb(63, 218, 216) 44%,
            rgb(47, 201, 226) 50%,
            rgb(28, 127, 238) 60%,
            rgb(95, 21, 242) 70%,
            rgb(186, 12, 248) 80%,
            rgb(251, 7, 217) 90%,
            rgb(255, 0, 0) 100%
        );
      background-repeat: repeat-x;
      background-size: 200% 100%;
      animation: tab-gradient-anim 2s infinite linear;
      background-clip: text;
      color: transparent;
    }
    





  • The same will also happen with filter, transform and a few other properties. The reason is that when these properties are applied then a new containing block is formed, and that will cause fixed and absolute positioned children to behave somewhat unexpectedly in they now “appear to reserve space” whereas normally they don’t. In this case the newtab options menu is fixed positioned, and thus if the body has backdrop-filter then the menu box causes the page to overflow.

    There is an exception to that mentioned containing-block formation though; if you apply the property (such as backdrop-filter here) to the document root element then no extra containing block is generated. I suppose it should be pretty simple to just apply your rule to :root instead of body.


  • Right, that makes perfect sense. The property being a variable nor it having an important tag are not meaningful to explain what’s happening here.

    What is important is simply what the address of the .css file is which sets the background-image property, because relative url resolves relative to that. The internal style sheet where this background-image property is set is chrome://activity-stream/content/css/activity-stream.css. So if the url it uses is ../newtab/wallpaper-dark.png (as by you setting the variable as such) then it will try to load an image from address chrome://activity-stream/content/newtab/wallpaper-dark.png which surely doesn’t exist.

    But if you set background-image property from within userContent.css then the relative url resolves relative to that instead.