Open Bug 1270819 Opened 8 years ago Updated 10 months ago

nsIAlertsService showAlertNotification sliding alert unnecessarily big / high

Categories

(Toolkit :: Alerts Service, defect)

45 Branch
x86_64
Windows 7
defect

Tracking

()

People

(Reporter: realRaven, Unassigned)

Details

(Keywords: regression)

Attachments

(1 file)

It appears with Thunderbird 45 the sliding alert notifications are unnecessarily increased in height. IS there a change in some padding rule that might affect it? And does anybody know how to "slow this down" so I can test it with DOM inspector?

The icon I include with the message is a 32*32 pixel png.

Can the alert be overlayed with css styles? I have chosen the OS integration component as  I believe this alert is Windows specific.
This comes from http://hg.mozilla.org/releases/mozilla-esr45/file/tip/toolkit/themes/shared/alert-common.css#l56
You can easily override it. Or if want to change it in tree you have to do this in toolkit. It's up to you if you want close this bug or move it to toolkit.
Flags: needinfo?(axelg)
(In reply to Richard Marti (:Paenglab) from comment #1)
> This comes from
> http://hg.mozilla.org/releases/mozilla-esr45/file/tip/toolkit/themes/shared/
> alert-common.css#l56
> You can easily override it. Or if want to change it in tree you have to do
> this in toolkit. It's up to you if you want close this bug or move it to
> toolkit.

How do I override this specific to my Addon? Is the new height based on a default Icon / font size? I propose the 80px width/height should not apply if a (smaller) custom icon is passed in. See my code below - can I use the "name" parameter in order to affect styling selectively? This is hard to test as the dialog auto-closes after 3 seconds or so.

  slideAlert: function slideAlert(title, text, icon) {
    setTimeout(function() {
        try {
          if (!icon)
            icon = "chrome://quickfolders/skin/ico/quickfolders-Icon.png";
          Components.classes['@mozilla.org/alerts-service;1'].
                getService(Components.interfaces.nsIAlertsService).
                showAlertNotification(icon, title, text, false, '', null);
        } catch(e) { }
      } , 0);
  } ,

>> if want to change it in tree you have to do this in toolkit.

??
Flags: needinfo?(axelg)
(In reply to Axel Grude [:realRaven] from comment #2)
> (In reply to Richard Marti (:Paenglab) from comment #1)
> How do I override this specific to my Addon? Is the new height based on a
> default Icon / font size? I propose the 80px width/height should not apply
> if a (smaller) custom icon is passed in.

Let's see what they say here.

> See my code below - can I use the
> "name" parameter in order to affect styling selectively? This is hard to
> test as the dialog auto-closes after 3 seconds or so.
> 
>   slideAlert: function slideAlert(title, text, icon) {
>     setTimeout(function() {
>         try {
>           if (!icon)
>             icon = "chrome://quickfolders/skin/ico/quickfolders-Icon.png";
>           Components.classes['@mozilla.org/alerts-service;1'].
>                 getService(Components.interfaces.nsIAlertsService).
>                 showAlertNotification(icon, title, text, false, '', null);
>         } catch(e) { }
>       } , 0);
>   } ,

You're more experienced in this ;)

> >> if want to change it in tree you have to do this in toolkit.
> 
> ??

I move the bug to toolkit
Component: OS Integration → Notifications and Alerts
Product: Thunderbird → Toolkit
(In reply to Richard Marti (:Paenglab) from comment #3)
> (In reply to Axel Grude [:realRaven] from comment #2)
> > (In reply to Richard Marti (:Paenglab) from comment #1)
> > How do I override this specific to my Addon? Is the new height based on a
> > default Icon / font size? I propose the 80px width/height should not apply
> > if a (smaller) custom icon is passed in.
> 
 
> 
> You're more experienced in this ;)
> 

I have tried overlaying the rule using an overlay over alert.xul:
overlay chrome://global/content/alerts/alert.xul          chrome://quickfolders/content/quickfolders-layout.css

using the following ruleset (selector on src ending with the name of the icon for containment) :

#alertImage[src$="quickfolders-Icon.png"] {
  width: 32px;
  height: 32px;
  max-width: 32px;
  max-height: 32px;
}

I was fast enough to glance at the object in DOMi, and it looks like the text container (#alertTextBox) has a lot of unnecessary padding at the bottom.

this is the xml from DOMi:

<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="alertTextBox" class="alertTextBox">
  <label id="alertTextLabel" class="alertText plain">Compacted folder '[QuickPasswords]' :: Original size: 941,612 ::  Bytes expunged:0 :: New size: 941,612</label>
  <spacer flex="1"/>
  <box id="alertFooter">
    <label id="alertSourceLabel" class="alertSource plain"/>
    <button type="menu" id="alertSettings" tooltiptext="Settings">
      <menupopup position="after_end">
        <menuitem id="doNotDisturbMenuItem" oncommand="doNotDisturb();"/>
        <menuseparator/>
        <menuitem id="disableForOriginMenuItem" oncommand="disableForOrigin();"/>
        <menuitem id="openSettingsMenuItem" oncommand="openSettings();"/>
      </menupopup>
    </button>
  </box>
</vbox>
(In reply to Axel Grude [:realRaven] from comment #4)
> (In reply to Richard Marti (:Paenglab) from comment #3)
> > (In reply to Axel Grude [:realRaven] from comment #2)
> > > (In reply to Richard Marti (:Paenglab) from comment #1)
> > > How do I override this specific to my Addon? Is the new height based on a
> > > default Icon / font size? I propose the 80px width/height should not apply
> > > if a (smaller) custom icon is passed in.
> > 
>  
> > 
> > You're more experienced in this ;)
> > 
> 
> I have tried overlaying the rule using an overlay over alert.xul:
> overlay chrome://global/content/alerts/alert.xul         
> chrome://quickfolders/content/quickfolders-layout.css

A Pebcak:
style chrome://global/content/alerts/alert.xul chrome://quickfolders/content/quickfolders-alert.css

I also added some margin. Now that I know how to style this I might add some niceness to the title. Why the 80px? Is the default icon that big?
Another observation: The first instance of my sliding Alert in Thunderbird was on screen very long (I am not complaining as it gave me a chance to "get at it" with DOMi). 

but the original user of QuickFolders who pointed out the size problem also mentioned it so it is a little disruptive. I would love if the showAlertNotification would have a parameter to (roughly) control the amount of time that the notification is on screen; or at least to be able set a "maximum" time, to avoid being perceived as "naggy". (Counted from the alertshow event)
Severity: normal → S3
Component: Notifications and Alerts → Alerts Service
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: