Closed
Bug 1186138
Opened 9 years ago
Closed 9 years ago
[Rule View] Editing a disabled property and escaping re-enables the property
Categories
(DevTools :: Inspector, defect)
DevTools
Inspector
Tracking
(firefox42 fixed)
RESOLVED
FIXED
Firefox 42
Tracking | Status | |
---|---|---|
firefox42 | --- | fixed |
People
(Reporter: gl, Assigned: gl)
References
Details
(Whiteboard: [rule-view-correctness])
Attachments
(3 files, 13 obsolete files)
2.49 KB,
patch
|
gl
:
review+
|
Details | Diff | Splinter Review |
3.89 KB,
patch
|
gl
:
review+
|
Details | Diff | Splinter Review |
4.82 KB,
patch
|
bgrins
:
review+
|
Details | Diff | Splinter Review |
When we escape editing a disabled property, the property is re-enabled even though the property is crossed out.
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → gabriel.luong
Status: NEW → ASSIGNED
OS: Unspecified → All
Hardware: Unspecified → All
Assignee | ||
Comment 1•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Attachment #8636751 -
Attachment description: Part 1: [Rule View] Refactor this.prop.rule to this.rule → Part 1: [Rule View] Refactor this.prop.rule to this.rule [1.0]
Assignee | ||
Comment 2•9 years ago
|
||
Attachment #8636751 -
Attachment is obsolete: true
Assignee | ||
Comment 3•9 years ago
|
||
Attachment #8636785 -
Attachment is obsolete: true
Assignee | ||
Comment 4•9 years ago
|
||
Assignee | ||
Comment 5•9 years ago
|
||
Attachment #8637387 -
Flags: review?(bgrinstead)
Assignee | ||
Updated•9 years ago
|
Attachment #8637387 -
Attachment description: Part 3: Add unit test → Part 3: Add unit test [1.0]
Assignee | ||
Updated•9 years ago
|
Attachment #8636849 -
Flags: review?(bgrinstead)
Assignee | ||
Updated•9 years ago
|
Attachment #8636848 -
Flags: review?(bgrinstead)
Assignee | ||
Comment 6•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=4c3ea5027845
Assignee | ||
Comment 7•9 years ago
|
||
Attachment #8636848 -
Attachment is obsolete: true
Attachment #8636848 -
Flags: review?(bgrinstead)
Attachment #8637391 -
Flags: review?(bgrinstead)
Assignee | ||
Comment 8•9 years ago
|
||
Comment on attachment 8636849 [details] [diff] [review] Part 2: Ensure the property remains disabled after ESC editing a disabled property [1.0] Review of attachment 8636849 [details] [diff] [review]: ----------------------------------------------------------------- ::: browser/devtools/styleinspector/rule-view.js @@ +3339,5 @@ > if (this.removeOnRevert) { > this.remove(); > } else { > + // Disable the property if the property was originally disabled. > + this.rule.setPropertyEnabled(this.prop, this.prop.enabled); We could remove this.update here because this.update will be called after this._onValueDone from inplace-editor.js. this.rule.setPropertyEnabled() will essentially perform previewPropertyValue()
Comment 9•9 years ago
|
||
Comment on attachment 8637391 [details] [diff] [review] Part 1: Refactor this.prop.rule to this.rule in rule-view.js [4.0] Review of attachment 8637391 [details] [diff] [review]: ----------------------------------------------------------------- The place where prop is getting reassigned in _updateTextProperty makes me a little suspicious of hardcoding `this.rule = this.prop.rule` in the constructor. Seems like it may be safer to add a getter on the TPE object to return this.prop.rule
Attachment #8637391 -
Flags: review?(bgrinstead)
Comment 10•9 years ago
|
||
(In reply to Brian Grinstead [:bgrins] from comment #9) > Comment on attachment 8637391 [details] [diff] [review] > Part 1: Refactor this.prop.rule to this.rule in rule-view.js [4.0] > > Review of attachment 8637391 [details] [diff] [review]: > ----------------------------------------------------------------- > > The place where prop is getting reassigned in _updateTextProperty makes me a > little suspicious of hardcoding `this.rule = this.prop.rule` in the > constructor. Seems like it may be safer to add a getter on the TPE object > to return this.prop.rule But this was just at a glance, I haven't tracked down exactly what that code is doing so maybe it'd be fine after all
Assignee | ||
Comment 11•9 years ago
|
||
I agree using a getter might be safer here.
Attachment #8637391 -
Attachment is obsolete: true
Attachment #8637415 -
Flags: review?(bgrinstead)
Updated•9 years ago
|
Attachment #8637415 -
Flags: review?(bgrinstead) → review+
Assignee | ||
Comment 12•9 years ago
|
||
Attachment #8636849 -
Attachment is obsolete: true
Attachment #8636849 -
Flags: review?(bgrinstead)
Attachment #8637491 -
Flags: review?(bgrinstead)
Assignee | ||
Comment 13•9 years ago
|
||
Attachment #8637387 -
Attachment is obsolete: true
Attachment #8637387 -
Flags: review?(bgrinstead)
Attachment #8637569 -
Flags: review?(bgrinstead)
Assignee | ||
Comment 14•9 years ago
|
||
Attachment #8637491 -
Attachment is obsolete: true
Attachment #8637491 -
Flags: review?(bgrinstead)
Attachment #8638201 -
Flags: review?(bgrinstead)
Assignee | ||
Updated•9 years ago
|
Attachment #8638201 -
Flags: review?(bgrinstead)
Assignee | ||
Updated•9 years ago
|
Attachment #8637569 -
Flags: review?(bgrinstead)
Assignee | ||
Comment 15•9 years ago
|
||
Attachment #8638201 -
Attachment is obsolete: true
Attachment #8638400 -
Flags: review?(bgrinstead)
Assignee | ||
Updated•9 years ago
|
Attachment #8637569 -
Flags: review?(bgrinstead)
Assignee | ||
Comment 16•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=75eea33e58e8
Comment 17•9 years ago
|
||
Comment on attachment 8638400 [details] [diff] [review] Part 2: Ensure the property remains disabled after ESC editing a disabled property [4.0] Review of attachment 8638400 [details] [diff] [review]: ----------------------------------------------------------------- ::: browser/devtools/styleinspector/rule-view.js @@ +3295,5 @@ > + // Unlike the value editor, if a name is empty the entire property > + // should always be removed. > + if (aValue.trim() === "") { > + this.remove(); > + } else { Nit: could early return here also to reduce nesting @@ +3348,5 @@ > + val = parseSingleValue(parsedProperties.firstValue); > + } > + > + if ((!aCommit && !this.ruleEditor.isEditing) || > + (val && this.committed.value == val.value && What if there is multiple values but the value of this property hasn't changed? It looks like in that case it would ignore the new values. For example, old val: "100%", new val (pasted in): "100%; background: red;" I think we'll need to split up the idea of re-disabling the property and removing the property if esc was pressed and removeOnRevert. @@ -3335,5 @@ > // A new property should be removed when escape is pressed. > if (this.removeOnRevert) { > this.remove(); > } else { > - // update the editor back to committed value I'm not even sure how pressing ESC is actually reverting anything right now with these lines gone but it seems to do so with the patch applied.
Comment 18•9 years ago
|
||
Comment on attachment 8637569 [details] [diff] [review] Part 3: Add unit test [2.0] Review of attachment 8637569 [details] [diff] [review]: ----------------------------------------------------------------- As discussed, I'm not sure if previewing disabled properties is even that useful of a thing, but given the context of Bug 1184628 where we will re-enable when starting an edit having test coverage for this is a step in the right direction
Attachment #8637569 -
Flags: review?(bgrinstead) → review+
Assignee | ||
Comment 19•9 years ago
|
||
Attachment #8638400 -
Attachment is obsolete: true
Attachment #8638400 -
Flags: review?(bgrinstead)
Attachment #8638832 -
Flags: review?(bgrinstead)
Assignee | ||
Comment 20•9 years ago
|
||
Attachment #8637415 -
Attachment is obsolete: true
Attachment #8639085 -
Flags: review+
Assignee | ||
Comment 21•9 years ago
|
||
Attachment #8638832 -
Attachment is obsolete: true
Attachment #8638832 -
Flags: review?(bgrinstead)
Attachment #8639086 -
Flags: review?(bgrinstead)
Assignee | ||
Comment 22•9 years ago
|
||
Attachment #8637569 -
Attachment is obsolete: true
Attachment #8639087 -
Flags: review+
Updated•9 years ago
|
Whiteboard: [rule-view-correctness]
Comment 23•9 years ago
|
||
Comment on attachment 8639086 [details] [diff] [review] Part 2: Ensure the property remains disabled after ESC editing a disabled property [6.0] Review of attachment 8639086 [details] [diff] [review]: ----------------------------------------------------------------- ::: browser/devtools/styleinspector/rule-view.js @@ +3361,5 @@ > */ > _onValueDone: function(aValue, aCommit) { > + let parsedProperties, val; > + > + if (aValue !== undefined) { In what case would aValue be undefined here? I thought it would always pass a string in.. @@ +3367,5 @@ > + val = parseSingleValue(parsedProperties.firstValue); > + } > + > + if ((!aCommit && !this.ruleEditor.isEditing) || > + (val && !parsedProperties.propertiesToAdd.length && Can you store this part of the OR into a separate variable with a descriptive name?
Assignee | ||
Comment 24•9 years ago
|
||
Attachment #8639086 -
Attachment is obsolete: true
Attachment #8639086 -
Flags: review?(bgrinstead)
Attachment #8639584 -
Flags: review?(bgrinstead)
Comment 25•9 years ago
|
||
Comment on attachment 8639584 [details] [diff] [review] Part 2: Ensure the property remains disabled after ESC editing a disabled property [7.0] Review of attachment 8639584 [details] [diff] [review]: ----------------------------------------------------------------- r=me with a green try push
Attachment #8639584 -
Flags: review?(bgrinstead) → review+
Assignee | ||
Comment 26•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=cde088c9b84c
Assignee | ||
Comment 27•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=363847b0bf42
Comment 28•9 years ago
|
||
https://hg.mozilla.org/integration/fx-team/rev/49a2e0844098 https://hg.mozilla.org/integration/fx-team/rev/36ea982d46ab https://hg.mozilla.org/integration/fx-team/rev/72b6857ff784
Comment 29•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/49a2e0844098 https://hg.mozilla.org/mozilla-central/rev/36ea982d46ab https://hg.mozilla.org/mozilla-central/rev/72b6857ff784
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox42:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 42
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•