Implement the selector highlighter in the new rules view
Categories
(DevTools :: Inspector: Rules, enhancement, P3)
Tracking
(firefox66 fixed)
Tracking | Status | |
---|---|---|
firefox66 | --- | fixed |
People
(Reporter: gl, Assigned: gl)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
22.50 KB,
patch
|
rcaliman
:
review+
yulia
:
review+
|
Details | Diff | Splinter Review |
Assignee | ||
Comment 1•6 years ago
|
||
Assignee | ||
Comment 2•6 years ago
|
||
Assignee | ||
Updated•6 years ago
|
Comment 3•6 years ago
|
||
Assignee | ||
Comment 4•6 years ago
|
||
Assignee | ||
Comment 5•6 years ago
|
||
(In reply to Razvan Caliman [:rcaliman] from comment #3)
Comment on attachment 9036822 [details] [diff] [review]
1520389.patch [1.0]Review of attachment 9036822 [details] [diff] [review]:
::: devtools/client/inspector/rules/components/SelectorHighlighter.js
@@ +24,5 @@
- constructor(props) {
- super(props);
- this.state = {
// An unique selector to the current Rule. This is used to check if the
s/An/A
@@ +25,5 @@
- super(props);
- this.state = {
// An unique selector to the current Rule. This is used to check if the
// selector highlighter matches the highlighted selector and should be highlighted.
This comment is a bit of a tongue twister :)
Suggestion: A unique selector to the current Rule. This is checked against
the value of any existing highlighted selector in order mark the toggled
state of the component.::: devtools/client/inspector/rules/models/rule.js
@@ +189,5 @@
- async getUniqueSelector() {
- let selector = "";
- if (this.domRule.selectors) {
// This is a "normal" rule with a selector.
s/"normal"/style
@@ +197,5 @@
// selector from the node which rule this is inherited from.
selector = await this.inherited.getUniqueSelector();
- } else {
// This is an inline style from the current node.
selector = this.elementStyle.ruleView.inspector.selectionCssSelector;
This is making a reference to the old (current) Rule view. It will break
when we remove it.
We should be ok since we pass the reference to the new Rules view in ElementStyle. https://searchfox.org/mozilla-central/source/devtools/client/inspector/rules/new-rules.js#162.
We can still mitigate this in the future by ensuring we have a reference to the inspector in ElementStyle as well.
::: devtools/client/inspector/rules/new-rules.js
@@ +127,5 @@
- @return {HighlighterOverlay}.
- */
- get highlighters() {
- if (!this._highlighters) {
Why do we need to set
this._highlighters
?This logic is similar to what's going on in
inspector.js
:https://searchfox.org/mozilla-central/rev/
bee8cf15c901b9f4b0c074c9977da4bbebc506e3/devtools/client/inspector/inspector.
js#192-197So returning directly
this.inspector.highlighters
would go through the
process of getting it lazily from the inspector and caching into
this._highlighters
ininspector.js
@@ +151,5 @@
return this._selectorHighlighter;
- }
- try {
const front = this.inspector.inspector;
I'm not sure how to review this. Yulia did a recent refactoring in the
Changes panel with regards to accessing fronts to avoid some of the race
condition pitfalls we had:https://searchfox.org/mozilla-central/rev/
bee8cf15c901b9f4b0c074c9977da4bbebc506e3/devtools/client/inspector/changes/
ChangesView.js#51-61I will ask for her review on this particular bit of code to make sure we're
following the recommended way to access fronts.
This bit on the SelectorHighlighter was refactored by Yulia in Bug 1508660.
https://searchfox.org/mozilla-central/source/devtools/client/inspector/rules/rules.js#265-267
@@ +246,5 @@
selector,
});
this.highlighters.selectorHighlighterShown = selector;
this.emit("ruleview-selectorhighlighter-toggled", true);
This event seems to only be used by tests now. Perhaps add a comment here
and on the otheremit()
so we know that, if we refactor the tests to rely
on Redux state, this event and the emitter can be removed.
Comment 6•6 years ago
|
||
Comment 7•6 years ago
|
||
Comment 9•6 years ago
|
||
bugherder |
Description
•