Closed Bug 740543 Opened 13 years ago Closed 13 years ago

Rule view does not update when window is resized

Categories

(DevTools :: Inspector, defect, P2)

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 15

People

(Reporter: dangoor, Assigned: dcamp)

References

Details

Attachments

(1 file, 3 obsolete files)

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: nobody → dcamp
Depends on: 757253
Attached patch WIP (obsolete) — Splinter Review
Doesn't have a good test yet, and I want to revisit one or two of the choices.
Attached patch v1 (obsolete) — Splinter 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 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)
Attached patch v2 (obsolete) — Splinter 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?
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+
Attached patch v3Splinter Review
Fixed everything mentioned above, and added a few method comments because I want to be popular.
Attachment #629497 - Attachment is obsolete: true
Status: NEW → RESOLVED
Closed: 13 years ago
Priority: -- → P2
Resolution: --- → FIXED
Target Milestone: --- → Firefox 15
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: