Rule view does not update when window is resized

RESOLVED FIXED in Firefox 15

Status

()

Firefox
Developer Tools: Inspector
P2
normal
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Kevin Dangoor, Assigned: dcamp)

Tracking

unspecified
Firefox 15
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 3 obsolete attachments)

(Reporter)

Description

5 years ago
STR:

1. Open this test case: https://bug722196.bugzilla.mozilla.org/attachment.cgi?id=601603
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)
(Assignee)

Updated

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

Comment 1

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

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

Comment 2

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

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]
v1

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);

_onResizeBound?
Attachment #629391 - Flags: review?(paul)
(Assignee)

Comment 4

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

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?
(Assignee)

Comment 5

5 years ago
https://tbpl.mozilla.org/?tree=Try&rev=7b7098872cdc
(Assignee)

Updated

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

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

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 
                there
13:31 <@dcamp> oh right


(in CssRuleView)

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

isEditing?

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

Comment 7

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

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

Comment 8

5 years ago
https://hg.mozilla.org/mozilla-central/rev/00704d2f3a35
Status: NEW → RESOLVED
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.