Closed Bug 1164327 Opened 9 years ago Closed 9 years ago

Resizing performance tool doesn't not maintain selection accurately

Categories

(DevTools :: Performance Tools (Profiler/Timeline), defect)

41 Branch
defect
Not set
normal

Tracking

(firefox41 fixed)

RESOLVED FIXED
Firefox 41
Tracking Status
firefox41 --- fixed

People

(Reporter: jsantell, Assigned: bgrins)

References

Details

Attachments

(1 file, 3 obsolete files)

If I have a selection in the overview graph, say 500px selection, somewhere in the middle of a 1000px graph of a 1000ms recording, 250px from the left, so I have the 250ms-750ms selected, right?

Stretch out the window so it's 2000px now. My selection should have the some proportions, and still have 250ms-750ms selected. Instead, it's still a 500px selection, 250px from the left.
Another weird thing is that once the window is stretched out, the timeline size never shrinks even if the window size is restored.  So if you make window really big and then small again, it seems like the timeline is being clipped
Yeah, bug 1122662. I'm having a hard time understanding what the heck is going on. I suspect it's because of the canvases inside the iframes not being able to shrink down, but some quick css massaging didn't help.
See Also: → 1122662
(In reply to Victor Porof [:vporof][:vp] from comment #2)
> Yeah, bug 1122662. I'm having a hard time understanding what the heck is
> going on. I suspect it's because of the canvases inside the iframes not
> being able to shrink down, but some quick css massaging didn't help.

I can take a look at this bug, let me know if you want me to look into that one also
Assignee: nobody → bgrinstead
Status: NEW → ASSIGNED
Feel free to take a glance at bug 1122662 if you want to. I've haven't been very successful with it.
Attached patch selection-resize.patch (obsolete) — Splinter Review
I think this does the trick.  Still needs test
Attached patch canvas-redraw-WIP.patch (obsolete) — Splinter Review
some ideas on how to improve perceived perf on canvas redraws

1) Use deferredtask so it gets redrawn while resizing (up to once per N ms)
2) Don't reset the canvas width until the redraw actually happens to get rid of white flicker
3) Set the canvas's CSS width from code instead of relying on 100% from CSS - this gets rid of the font zooming thing that happens during resizing
Comment on attachment 8609080 [details] [diff] [review]
canvas-redraw-WIP.patch

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

::: browser/devtools/shared/widgets/Graphs.jsm
@@ +29,5 @@
>  const L10N = new ViewHelpers.L10N();
>  
>  // Generic constants.
>  
> +const GRAPH_RESIZE_EVENTS_DRAIN = 10; // ms

Is this change necessary? For heavy heavy graphs this might result in choppy resizes.

@@ +780,5 @@
> +    let bounds = this.bounds;
> +    this._iframe.setAttribute("width", bounds.width);
> +    this._iframe.setAttribute("height", bounds.height);
> +    this._canvas.style.width = bounds.width + "px";
> +    this._canvas.style.height =  bounds.height + "px";

I'd like us to avoid doing this when not necessary or when sizes didn't change. Currently this can be called whenever hovering, for example, or moving the mouse. Sounds a bit extreme to me.

Why not keep this in `refresh`? It will cause the widget to redraw anyway, by setting `_shouldRedraw` to true.
(In reply to Victor Porof [:vporof][:vp] from comment #7)
> @@ +780,5 @@
> > +    let bounds = this.bounds;
> > +    this._iframe.setAttribute("width", bounds.width);
> > +    this._iframe.setAttribute("height", bounds.height);
> > +    this._canvas.style.width = bounds.width + "px";
> > +    this._canvas.style.height =  bounds.height + "px";
> 
> I'd like us to avoid doing this when not necessary or when sizes didn't
> change. Currently this can be called whenever hovering, for example, or
> moving the mouse. Sounds a bit extreme to me.
> 
> Why not keep this in `refresh`? It will cause the widget to redraw anyway,
> by setting `_shouldRedraw` to true.

Yeah, I'm not even sure if I will request review on that patch, just stashing some work there.  I moved it there to avoid the 'flicker' that's caused if we allow refreshing during resize (the delay between clearing the canvas by setting width and when the redraw happens.  Likewise, for the CSS width on the frame and canvas if we have a delay between setting it and redrawing then the canvas will sort of zoom itself and cause some weirdness with the text sizing.

I'll have to do some measurements and see if it's even worth proceeding with that.
Attached patch selection-resize.patch (obsolete) — Splinter Review
This seems to do the trick.  What do you think?

https://treeherder.mozilla.org/#/jobs?repo=try&revision=23bfd1e9a95c
Attachment #8609477 - Flags: review?(vporof)
Attachment #8609056 - Attachment is obsolete: true
Attachment #8609080 - Attachment is obsolete: true
Comment on attachment 8609477 [details] [diff] [review]
selection-resize.patch

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

Nice and simple
Attachment #8609477 - Flags: review?(vporof) → review+
Ah, need some rounding on the test for Windows: TEST-UNEXPECTED-FAIL | browser/devtools/shared/test/browser_graphs-10c.js | The current selection start value is correct (2). - Got 49.1869918699187, expected 50
Actually, that's further off than I thought.  Maybe it's because of the window chrome size being different and the graph width is not quite changing to 50%.  Checking on a local build
Had to do a bit of math in the test to account for different a different window size in Windows.
Attachment #8609477 - Attachment is obsolete: true
Attachment #8609915 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/08eb0e8fcbbc
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 41
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: