Rule view does not update when window is resized

RESOLVED FIXED in Firefox 15



Developer Tools: Inspector
6 years ago
5 years ago


(Reporter: Kevin Dangoor, Assigned: dcamp)


Firefox 15
Mac OS X

Firefox Tracking Flags

(Not tracked)



(1 attachment, 3 obsolete attachments)



6 years ago

1. Open this test case:
2. open the page inspector
3. make sure the content area is fairly narrow (so that the media query kicks in)
4. lock on the red box and look at the rule view values
5. expand the window
6. the red box expands, but the rule view still says "width: 200px" and lists the media query

expected result: the rule view updates to reflect the new styles

(note that the property view is quite possibly doing the same thing, I just didn't look at this time)


5 years ago
Assignee: nobody → dcamp
Depends on: 757253

Comment 1

5 years ago
Created attachment 628457 [details] [diff] [review]

Doesn't have a good test yet, and I want to revisit one or two of the choices.

Comment 2

5 years ago
Created attachment 629391 [details] [diff] [review]

I'm not a huge fan of this patch, but it makes the responsive design view much more useful.
Attachment #628457 - Attachment is obsolete: true
Attachment #629391 - Flags: review?(paul)

Comment 3

5 years ago
Comment on attachment 629391 [details] [diff] [review]

Review of attachment 629391 [details] [diff] [review]:

So the inspector listens to the "resize" event of the page, then, emit a "resize" event. The ruleview listen to this event, and call a specific function (onResize).
I am not against this path, but this feels a lot "resize" specific.

What about that:
The inspector emits an event: "page_layout_update" on resize. Then the ruleview call scheduleRefresh when it gets this event.
In the future, we would use this event when we detect a layout update (on DOM updates, or if the JS code plays with the CSSOM).
And we could use this event in the layoutview as well.

(basically, just rename the event, and remove the onResize function).

Some other ideas:
Maybe it's better to listen the the MozAfterPaint events instead of "resize" (this is what I do for the layoutview).
And maybe it's better to do the "delaying" (250ms timer) on the inspector side.

What do you think?

::: browser/devtools/styleinspector/StyleInspector.jsm
@@ +119,5 @@
>    this.inspector.on("change", this._onChange);
> +  this.inspector.on("sidebaractivated-ruleview", this._onChange);
> +
> +  this._onResize = this.onResize.bind(this);

Attachment #629391 - Flags: review?(paul)

Comment 4

5 years ago
Created attachment 629497 [details] [diff] [review]

This version moves the timeout management into Inspector.  It uses a change event with a 'layout' detail.

As discussed on irc, for now we're only responding to resize events.
Attachment #629391 - Attachment is obsolete: true
Attachment #629497 - Flags: review?

Comment 5

5 years ago


5 years ago
Attachment #629497 - Flags: review? → review?(paul)
Comment on attachment 629497 [details] [diff] [review]

+  _scheduleLayoutChange: function Inspector_scheduleLayoutChange()
+  {
+    if (this._timer) {
+      return null;
+    }
+    this._timer = Cc[";1"].createInstance(Ci.nsITimer);
+    this._timer.init(
+      function() {
+        this.change("layout");
+      }.bind(this),
+  },

Is this any different than just using setTimeout, other than looking cool?

13:25 < robcee> also, I'm not sure if we've gotten away from using isFunctionName for testing 
                functions that return booleans or not in inspector code
13:26 < robcee> panelVisible vs. isPanelVisible?

13:27 < robcee> yeah, I think we do
13:28 < robcee> isInspectorOpen, isDirty

13:30 < robcee> extra indents in your _thaw: function
13:31 < robcee> in _emit, there's a for each in loop you can switch to for .. of since you're in 
13:31 <@dcamp> oh right

(in CssRuleView)

+  get editing() {
+    return this.element.querySelectorAll(".styleinspector-propertyeditor").length > 0;
+  },


r+ with those.
Attachment #629497 - Flags: review?(paul) → review+

Comment 7

5 years ago
Created attachment 629518 [details] [diff] [review]

Fixed everything mentioned above, and added a few method comments because I want to be popular.
Attachment #629497 - Attachment is obsolete: true

Comment 8

5 years ago
Last Resolved: 5 years ago
Priority: -- → P2
Resolution: --- → FIXED
Target Milestone: --- → Firefox 15
You need to log in before you can comment on or make changes to this bug.