Closed
Bug 1260482
Opened 10 years ago
Closed 10 years ago
Replace device icons with SVG versions
Categories
(Firefox :: Sync, defect, P1)
Firefox
Sync
Tracking
()
RESOLVED
FIXED
Firefox 49
| Tracking | Status | |
|---|---|---|
| firefox49 | --- | fixed |
People
(Reporter: rfeeley, Assigned: eoger)
Details
Attachments
(3 files, 2 obsolete files)
Currently our device icons as used in Synced Tabs are bitmaps, but should be vector SVG.
Comment 1•10 years ago
|
||
I looked into doing this but I ran into a problem.
Instead of being styled with CSS and getting a device specific class or something; it looks like it is getting the icon from https://dxr.mozilla.org/mozilla-central/source/services/sync/modules/SyncedTabs.jsm#56
I think we should add a class name to the item-title-container div or to its container div and then reference the image with CSS. Then we can add the SVG image and any other variants (e.g. inverted icons for the selected/focused state).
Flags: needinfo?(markh)
Comment 2•10 years ago
|
||
SyncedTabs.jsm does indeed specify the names of the image files, which the SyncedTabs sidebar uses to set the backgroundImage style on the element showing the image. IIUC, the reason we tend to show images this way is for themes - if we displayed images in the "normal" way (eg, <img src=...>, themes (ie, css) would be not able to override the image shown.
However, this is a bit of a problem for svg images where we want to use CSS to change stuff inside the svg itself - you can't apply additional styling to the svg itself when it's specified in CSS rather than directly in the markup (and is the same problem bug 1228478 has - it wants to use a svg but use CSS to change one of the colors in the SVG, so would need to change to using a traditional image).
So IIUC, the tension is that if we show the svg in a theme-friendly way, we can't use CSS to style the svg. I'm inclined to say "tough luck to themes - they just can't change the image shown (but would be able to style how it is shown).
Assuming that's correct, I think the change we could make here would be something like:
<div class="device-image-container">
<img class="device-image device-image-mobile" src="chrome://browser/skin/sync-mobileIcon.svg">
<img class="device-image device-image-desktop" src="chrome://browser/skin/sync-desktopIcon.svg">
</div>
with css something like:
.device-image-container[devicetype="mobile"] .device-image-desktop {
display: none;
}
.device-image-container[devicetype="desktop"] .device-image-mobile {
display: none;
}
.device-image {
... styling we want to apply to both svgs...
}
and the JS code setting the "devicetype" attribute on the container based on the device type (duh!). Additional styling could also be applied.
Gijs, does the above all sound correct and reasonable?
Flags: needinfo?(markh) → needinfo?(gijskruitbosch+bugs)
Comment 3•10 years ago
|
||
Referencing hardcoded paths into /skin/ from /content/ is kind of frowned upon though, because then 3rd party themes have to provide files at those paths.
If we want to change the SVG colors etc., can we use the techniques from bug 1054016 to still keep them as references from CSS instead?
Flags: needinfo?(gijskruitbosch+bugs) → needinfo?(markh)
Comment 4•10 years ago
|
||
(In reply to Mark Hammond [:markh] from comment #2)
> So IIUC, the tension is that if we show the svg in a theme-friendly way, we
> can't use CSS to style the svg. I'm inclined to say "tough luck to themes -
> they just can't change the image shown (but would be able to style how it is
> shown).
I don't want to use CSS to style the SVG directly in this case. I want to be able to change the icon based on its device type AND based whether or not it has a different state.
For example on the disclosure arrow the default image we call is:
.item.client .item-twisty-container {
width: 16px;
height: 16px;
background-image: url("chrome://global/skin/tree/arrow-disclosure.svg#arrow-disclosure-expanded");
}
But when it is in a focused state we need to use the inverted version:
.item.client.selected:focus .item-twisty-container {
background-image: url("chrome://global/skin/tree/arrow-disclosure.svg#arrow-disclosure-expanded-inverted");
}
We can't do that for the device icon because there is no class differentiating between desktop and mobile.
> Assuming that's correct, I think the change we could make here would be
> something like:
>
> <div class="device-image-container">
> <img class="device-image device-image-mobile"
> src="chrome://browser/skin/sync-mobileIcon.svg">
> <img class="device-image device-image-desktop"
> src="chrome://browser/skin/sync-desktopIcon.svg">
> </div>
I think something like that would work. But I was thinking more about just adding the device-image-* class to the parent like:
<div class="item client device-image-mobile" role="option" tabindex="-1" id="item-something" title="iPhone">
<div class="item-title-container">
<div class="item-twisty-container"></div>
<div class="item-icon-container" style="background-image: url("chrome://browser/skin/sync-mobileIcon.png");"></div>
<p class="item-title">iPhone</p>
</div>
</div>
Then we could style it with CSS like:
.item.client.device-image-mobile > .item-title-container > .item-icon-container {
background-image: url("chrome://browser/skin/sync-mobileIcon.svg#icon");
}
.item.client.device-image-mobile > .item-title-container.selected:focus > .item-icon-container {
background-image: url("chrome://browser/skin/sync-mobileIcon.svg#icon-inverted");
}
Updated•10 years ago
|
Flags: needinfo?(gijskruitbosch+bugs)
Comment 5•10 years ago
|
||
The approach in comment #4 is fine by me as long as we put all the references to the images in CSS files (rather than inline style attributes), which I think should be possible? Or am I missing something?
Flags: needinfo?(gijskruitbosch+bugs)
Comment 6•10 years ago
|
||
Mark, how does the approach in comment #4 and comment #5 sound to you?
Comment 7•10 years ago
|
||
(In reply to Stephen Horlander [:shorlander] from comment #6)
> Mark, how does the approach in comment #4 and comment #5 sound to you?
SGTM! Moving to the Sync component so it appears on our backlog.
Component: General → Sync
Flags: needinfo?(markh) → firefox-backlog+
Priority: -- → P1
Comment 8•10 years ago
|
||
> (In reply to Stephen Horlander [:shorlander] from comment #6)
> SGTM! Moving to the Sync component so it appears on our backlog.
oh - it remains assigned to Stephen, so that probably wasn't necessary - Stephen, please unassign yourself if you don't intend doing the actual work.
Comment 11•10 years ago
|
||
Flags: needinfo?(shorlander)
Comment 12•10 years ago
|
||
Comment 13•10 years ago
|
||
(In reply to Edouard Oger [:eoger] from comment #10)
> Stephen do you still have the SVGs?
Attached!
Updated•10 years ago
|
Flags: needinfo?(edouard.oger)
| Assignee | ||
Comment 14•10 years ago
|
||
Are these SVGs for OSX only or for all platforms?
Flags: needinfo?(edouard.oger) → needinfo?(shorlander)
Comment 15•10 years ago
|
||
(In reply to Edouard Oger [:eoger] from comment #14)
> Are these SVGs for OSX only or for all platforms?
For all platforms for right now. I am doing some separate places icon updates for Windows. I might roll something into that.
Flags: needinfo?(shorlander)
| Assignee | ||
Comment 16•10 years ago
|
||
- I kept the svg declaration in the osx/ windows/ linux/ jar files instead of the shared one since we're gonna have platforms specific versions at some point (see comment 15)
- I didn't remove the png versions of these icons since they are still used in about:sync-tabs, we can open up a follow up bug later if needed.
| Assignee | ||
Comment 17•10 years ago
|
||
Comment 18•10 years ago
|
||
Comment on attachment 8749746 [details] [diff] [review]
bug-1260482.patch
Review of attachment 8749746 [details] [diff] [review]:
-----------------------------------------------------------------
I think you need to change the synced tabs menu at https://dxr.mozilla.org/mozilla-central/rev/e5a10bc7dac4ee2453d8319165c1f6578203eac7/browser/components/customizableui/CustomizableWidgets.jsm#483 too? Also, if it's not too painful, can we use the svgs on about:sync-tabs too?
Attachment #8749746 -
Flags: review?(markh)
| Assignee | ||
Comment 19•10 years ago
|
||
Mark the Synced Tabs Panel UI never had device icons, or maybe I didn't understand what you are saying?
I also replaced/deleted the pngs by their svg equivalent in about:sync-tabs.
Attachment #8749746 -
Attachment is obsolete: true
Attachment #8750416 -
Flags: review?(markh)
Comment 20•10 years ago
|
||
Comment on attachment 8750416 [details] [diff] [review]
bug-1260482.patch
Review of attachment 8750416 [details] [diff] [review]:
-----------------------------------------------------------------
Sorry for the confusion about the panel - I was looking at the tab, not the device. This LGTM, thanks.
Attachment #8750416 -
Flags: review?(markh) → review+
| Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 21•10 years ago
|
||
has problems to apply:
adding 1260482 to series file
renamed 1260482 -> bug-1260482.patch
applying bug-1260482.patch
patching file services/sync/modules/SyncedTabs.jsm
Hunk #2 FAILED at 77
1 out of 2 hunks FAILED -- saving rejects to file services/sync/modules/SyncedTabs.jsm.rej
could you take a look, thanks!
Flags: needinfo?(edouard.oger)
Keywords: checkin-needed
| Assignee | ||
Comment 22•10 years ago
|
||
Rebased, sorry about that
Attachment #8750416 -
Attachment is obsolete: true
Flags: needinfo?(edouard.oger)
Attachment #8750898 -
Flags: review+
| Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 23•10 years ago
|
||
Keywords: checkin-needed
Comment 24•10 years ago
|
||
| bugherder | ||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox49:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 49
You need to log in
before you can comment on or make changes to this bug.
Description
•