Closed Bug 1100443 Opened 10 years ago Closed 9 years ago

DevTools Themes: Make infobar arrow smaller

Categories

(DevTools :: Inspector, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 38

People

(Reporter: me, Assigned: me, Mentored)

Details

Attachments

(5 files, 2 obsolete files)

From Bug 1059376 Comment 4:
> since the infobar font-size has been made smaller. It makes sense to me to make the arrow size smaller as well.

Do we have any spec or mockup or should I just try different sizes and decide which one looks better?
I would try different sizes first. It'd be nice to use em units btw, so the arrow size will be proportional to the font-size for all cases.
Attached image arrow-size.png
Here are some examples, from 0.6em to 1.0em. Which one do you like most?
Flags: needinfo?(ntim007)
(In reply to Albert Juhé from comment #2)
> Created attachment 8550972 [details]
> arrow-size.png
> 
> Here are some examples, from 0.6em to 1.0em. Which one do you like most?

0.7em looks good to me.
Flags: needinfo?(ntim007)
I saw there is a problem using em instead of px. On /toolkit/devtools/server/actors/highlighter.js the arrow size is used to correctly position the infobar:
http://lxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/highlighter.js#30
http://lxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/highlighter.js#1283

Any advice in how to solve that?
Flags: needinfo?(ntim007)
(In reply to Albert Juhé from comment #4)
> I saw there is a problem using em instead of px. On
> /toolkit/devtools/server/actors/highlighter.js the arrow size is used to
> correctly position the infobar:
> http://lxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/
> highlighter.js#30
> http://lxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/
> highlighter.js#1283
> 
> Any advice in how to solve that?

getComputedStyle ? Patrick will now better than me for this.
Flags: needinfo?(ntim007) → needinfo?(pbrosset)
The size of the arrow is defined in this CSS rule: http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/highlighter.css?force=1#97

If you want to change it to .7em, you'll have to change these 2 properties:
left: calc(50% - 14px);
and
border: 14px solid hsl(214,13%,24%);
change 14px by .7em

Now, the NODE_INFOBAR_ARROW_SIZE const in highlighter.js here: http://lxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/highlighter.js#30 is used to make sure the height of the arrow doesn't cover up the node.

The bad news is there isn't a good way now to calculate this height dynamically because the highlighter DOM lives in a native anonymous node in one of the document root frames, and there's any way to access it from chrome JS.

So that means whatever height we choose in the CSS, we must have the corresponding height as a const in the JS.
In that case, why choose ems at all? The font-size of the nodeinfobar isn't supposed to change anyway, right? Why not settle for something like 8px (which looks good to me) and put that in both places.

Also, adding a comment above |const NODE_INFOBAR_ARROW_SIZE = 8; // px| explaining why this height has to be hard-coded here would help.
Flags: needinfo?(pbrosset)
Attached patch bug1100443.patch (obsolete) — Splinter Review
Done! If I'm not missing anything, this patch should work. I used a sentence from Patrick Brosset's explanation as a comment on highlighter.js.
Attachment #8551410 - Flags: review?(bgrinstead)
Attached image with-patch-applied.png
With the patch applied, I'm seeing a gap between the arrow and the node
Comment on attachment 8551410 [details] [diff] [review]
bug1100443.patch

Review of attachment 8551410 [details] [diff] [review]:
-----------------------------------------------------------------

::: toolkit/devtools/server/actors/highlighter.css
@@ -94,1 @@
>  

There is a line up here:


:-moz-native-anonymous .box-model-nodeinfobar-container[hide-arrow] > .box-model-nodeinfobar {
  margin: 7px 0;
}

I have a hunch (but haven't tested) that this needs to be updated to 4px 0 to get rid of the space seen in Comment 8
Attachment #8551410 - Flags: review?(bgrinstead)
(In reply to Brian Grinstead [:bgrins] from comment #10)
> I have a hunch (but haven't tested) that this needs to be updated to 4px 0
> to get rid of the space seen in Comment 8

Or even 0.35em 0, if that's possible.
(In reply to Tim Nguyen [:ntim] from comment #11)
> (In reply to Brian Grinstead [:bgrins] from comment #10)
> > I have a hunch (but haven't tested) that this needs to be updated to 4px 0
> > to get rid of the space seen in Comment 8
> 
> Or even 0.35em 0, if that's possible.

I think everything is being switched to px as per Comment 6.  I don't see a reason not to do that.
(In reply to Brian Grinstead [:bgrins] from comment #12)
> (In reply to Tim Nguyen [:ntim] from comment #11)
> > (In reply to Brian Grinstead [:bgrins] from comment #10)
> > > I have a hunch (but haven't tested) that this needs to be updated to 4px 0
> > > to get rid of the space seen in Comment 8
> > 
> > Or even 0.35em 0, if that's possible.
> 
> I think everything is being switched to px as per Comment 6.  I don't see a
> reason not to do that.

Oh ok, didn't read the end of the comment.
Attached patch bug1100443b.patch (obsolete) — Splinter Review
Wow, I didn't see the gap. Actually the problem was that I didn't update the NODE_INFOBAR_HEIGHT variable too (I didn't know the arrow size had to be included). This patch fixes that.
Attachment #8551410 - Attachment is obsolete: true
Attachment #8552667 - Flags: review?(bgrinstead)
Attached image margin.png
By the way, the margin you said:

> :-moz-native-anonymous .box-model-nodeinfobar-container[hide-arrow] > .box-model-nodeinfobar {
>   margin: 7px 0;
> }

Is used when no arrow is displayed. I'm not sure if it must have some correlation with the arrow size. I didn't modify it because I was not sure.
(sorry for the multiple emails)

I saw that originally there was a small 1px gap between the arrow and the element, I added it back in this patch. In the previous patch there were also some wrong values.
Attachment #8552667 - Attachment is obsolete: true
Attachment #8552667 - Flags: review?(bgrinstead)
Attachment #8552674 - Flags: review?(bgrinstead)
Comment on attachment 8552674 [details] [diff] [review]
bug1100443c.patch

Review of attachment 8552674 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me - pushed to try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=baebbb3db62b
Attachment #8552674 - Flags: review?(bgrinstead) → review+
https://hg.mozilla.org/mozilla-central/rev/cfd8a15f50b2
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 38
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: