Closed Bug 1026921 Opened 10 years ago Closed 10 years ago

Only one background image is shown in popup on style rules that have multiple backgrounds

Categories

(DevTools :: Inspector, defect)

32 Branch
x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 33

People

(Reporter: tw2113, Assigned: sjakthol)

Details

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:32.0) Gecko/20100101 Firefox/32.0 (Beta/Release)
Build ID: 20140615004003

Steps to reproduce:

have a DOM element that has multiple backgrounds assigned to it. Hover over both in the Inspector tab and the rules panel on the right.


Actual results:

Only the first background image is ever shown in the displayed popup to show the image in real time. Hovering over second image showed the first image.


Expected results:

Currently hovered image should change and be displayed in the popup.
Component: Untriaged → Developer Tools: Inspector
The URL for tooltip image is parsed from the property value which always returns the first url() declaration. Here's a patch that uses the href of the hovered link instead.
Assignee: nobody → sjakthol
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #8447619 - Flags: review?(pbrosset)
Comment on attachment 8447619 [details] [diff] [review]
styleinspector-multiple-background-images.patch

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

Thanks! Looks good to me.
Just a couple more cleanups while we're at it.

::: browser/devtools/styleinspector/rule-view.js
@@ +1235,5 @@
>        type = overlays.VIEW_NODE_IMAGE_URL_TYPE;
>        value = {
>          property: getPropertyNameAndValue(node).name,
>          value: node.parentNode.textContent,
> +        url: node.href,

Indeed, much better since href is already resolved to the absolute URL.

::: browser/devtools/styleinspector/style-inspector-overlays.js
@@ +337,5 @@
>  
>      if (type === TOOLTIP_IMAGE_TYPE) {
>        let dim = Services.prefs.getIntPref(PREF_IMAGE_TOOLTIP_SIZE);
> +      // nodeInfo contains an absolute uri
> +      let uri = nodeInfo.value.url;

Thanks for simplifying this!

Looks like getBackgroundImageUriFromProperty had been introduced only for this and since it's not needed anymore, we might as well use this patch to remove getBackgroundImageUriFromProperty from css-logic.js.

Searching the codebase for occurrences of getBackgroundImageUriFromProperty reveals it being used in style-inspector-overlays.js in the _getTooltipType method, but that can easily be removed too:
let dim = ...
let uri = ...
are both unused in this method and should be removed.
Attachment #8447619 - Flags: review?(pbrosset) → review+
Thanks for the review. Here's an improved version with getBackgroundImageUriFromProperty completely removed.
Attachment #8447619 - Attachment is obsolete: true
Attachment #8447873 - Flags: review?(pbrosset)
Comment on attachment 8447873 [details] [diff] [review]
styleinspector-multiple-background-images-v2.patch

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

Perfect!
Attachment #8447873 - Flags: review?(pbrosset) → review+
Try succeeded except for one unrelated, already known failure (bug 1016310).
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/2a523e4ae004
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 33
Confirmed fixed from my end as well in the July 1st nightly build.
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: