WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
178489
Web Inspector: Styles Redesign: Editing selector should not hide the rule
https://bugs.webkit.org/show_bug.cgi?id=178489
Summary
Web Inspector: Styles Redesign: Editing selector should not hide the rule
Nikita Vasilyev
Reported
2017-10-18 15:37:36 PDT
When selector is modified and no longer matches the selected element, it should stay on screen until the new element is selected. This is a new enhancement; we don't do it in the old styles sidebar.
Attachments
Patch
(15.80 KB, patch)
2017-12-15 00:01 PST
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(12.23 KB, patch)
2018-03-13 22:24 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews205 for win-future
(12.02 MB, application/zip)
2018-03-14 00:16 PDT
,
EWS Watchlist
no flags
Details
Patch
(11.65 KB, patch)
2018-05-17 13:55 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews206 for win-future
(12.75 MB, application/zip)
2018-05-17 22:00 PDT
,
EWS Watchlist
no flags
Details
Patch
(43.23 KB, patch)
2018-12-06 13:43 PST
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(20.75 KB, patch)
2018-12-21 15:54 PST
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
[Video] Bug (attachment 357995)
(4.66 MB, video/quicktime)
2018-12-21 16:30 PST
,
Nikita Vasilyev
no flags
Details
Patch
(20.95 KB, patch)
2018-12-21 17:01 PST
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(46.85 KB, patch)
2019-02-01 15:43 PST
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(53.90 KB, patch)
2019-03-20 15:38 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(54.81 KB, patch)
2019-03-20 16:40 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(54.81 KB, patch)
2019-03-20 16:47 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Show Obsolete
(12)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2017-10-18 15:37:46 PDT
<
rdar://problem/35062434
>
Devin Rousso
Comment 2
2017-12-15 00:01:43 PST
Created
attachment 329468
[details]
Patch
Joseph Pecoraro
Comment 3
2018-01-17 11:21:43 PST
Comment on
attachment 329468
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=329468&action=review
> Source/WebInspectorUI/ChangeLog:14 > + Drive-by fix: fix tabbing so that it will wrap to the first/last rule.
I recommend splitting this into its own change.
> Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:217 > - _renderSelector() > + _renderSelector(selectors)
Should this be renamed "_renderSelectors" plural?
> Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:237 > - break; > + index = this._sections.length - 1;
What is up here? Seems like we could get into an infinite loop if all sections are not editable.
> Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:284 > + _focusedSectionDoesNotMatch()
This reads poorly. Does not match what?
Devin Rousso
Comment 4
2018-01-17 22:30:39 PST
Comment on
attachment 329468
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=329468&action=review
>> Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:237 >> + index = this._sections.length - 1; > > What is up here? Seems like we could get into an infinite loop if all sections are not editable.
This could get into an infinite loop, but I don't think it's possible since if every section is not editable then none of the section switching code would ever be reachable. We only call these functions when the section's selector or property editor is selected, meaning that if it's not editable then we don't have any keydown listeners.
>> Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:284 >> + _focusedSectionDoesNotMatch() > > This reads poorly. Does not match what?
The idea is to return false if the section would not re-appear if we were to regenerate the list of sections based on the DOMNodeStyles. I had a hard time naming this :P
Nikita Vasilyev
Comment 5
2018-03-10 16:52:32 PST
Devin, could you rebaseline the patch? It no longer applies to WebKit ToT. I'd like to get this landed soon.
Devin Rousso
Comment 6
2018-03-13 22:24:22 PDT
Created
attachment 335759
[details]
Patch
EWS Watchlist
Comment 7
2018-03-14 00:16:25 PDT
Comment hidden (obsolete)
Comment on
attachment 335759
[details]
Patch
Attachment 335759
[details]
did not pass win-ews (win): Output:
http://webkit-queues.webkit.org/results/6947382
New failing tests: http/tests/preload/download_resources.html
EWS Watchlist
Comment 8
2018-03-14 00:16:37 PDT
Comment hidden (obsolete)
Created
attachment 335764
[details]
Archive of layout-test-results from ews205 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews205 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Matt Baker
Comment 9
2018-05-04 15:59:51 PDT
Comment on
attachment 335759
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=335759&action=review
Overall this looks good. r- only because of the following issue encountered when testing: Changes to the selector are lost when committing with Tab or Enter. Steps to Reproduce: 1. Inspect: <style> p { color: blue; } </style> <p>Some text.</p> 2. Elements tab > select the <p> DOM node 3. Styles sidebar > click on the "p" selector, change to "p.foo". 4. Hit enter or tab. Expected: => Selector shows "p.foo", first property name becomes selected. Actual: => Selector reverts back to "p". Note: Repeating the steps a second time works. The selector shows "p.foo" and is grayed out.
> Source/WebInspectorUI/ChangeLog:10 > + (SpreadsheetRulesStyleDetailsPanel) who keeps track of the focused section. When a refresh
who -> which
> Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:105 > + this.element.addEventListener("click", this._handleClick.bind(this));
This line doesn't need to move, it just causes unnecessary code churn.
> Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:269 > + var usingCustomSelectors = selectors !== this._style.ownerRule.selectors;
This should move into the `if (selectors.length) { ... }` block below, this that is the only place it's used.
> Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:427 > +
Remove extra newline.
> Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:71 > + let uniqueOrderedStyles = (styles) => {
Is there a good reason for renaming this? Seems like unnecessary churn for no benefit.
Matt Baker
Comment 10
2018-05-04 16:05:11 PDT
Comment on
attachment 329468
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=329468&action=review
>> Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:217 >> + _renderSelector(selectors) > > Should this be renamed "_renderSelectors" plural?
We're just rendering a single selector, but it is a little confusing because of the argument's name.
Devin Rousso
Comment 11
2018-05-17 13:55:33 PDT
Created
attachment 340634
[details]
Patch This doesn\'t quite work yet, but it's close. There seems to be an issue with how `significantChange` is calculated, since `WI.DOMNodeStyles` seems to think that the changing of the selector warrants that, even though it probably shouldn\'t.
EWS Watchlist
Comment 12
2018-05-17 22:00:09 PDT
Comment hidden (obsolete)
Comment on
attachment 340634
[details]
Patch
Attachment 340634
[details]
did not pass win-ews (win): Output:
http://webkit-queues.webkit.org/results/7718582
New failing tests: http/tests/security/canvas-remote-read-remote-video-redirect.html
EWS Watchlist
Comment 13
2018-05-17 22:00:20 PDT
Comment hidden (obsolete)
Created
attachment 340679
[details]
Archive of layout-test-results from ews206 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews206 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Devin Rousso
Comment 14
2018-12-06 13:43:37 PST
Created
attachment 356749
[details]
Patch Trying a different approach. The patch could probably be cleaned up a bit, but I wanted to get everyone's opinion on this approach before really committing to it.
Matt Baker
Comment 15
2018-12-21 15:36:25 PST
Comment on
attachment 356749
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=356749&action=review
Seems to work, but It's hard to tell which changes are essential to fixing the problem. Could you drop the unnecessary refactoring and add a change log comment or two? Doesn't have to be long, just a sentence or two explaining the approach you took.
> Source/WebInspectorUI/UserInterface/Models/CSSRule.js:59 > + update(sourceCodeLocation, selectorText, selectors, matchedSelectorIndices, style, mediaList)
Why was the flag dropped?
Devin Rousso
Comment 16
2018-12-21 15:42:43 PST
Comment on
attachment 356749
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=356749&action=review
>> Source/WebInspectorUI/UserInterface/Models/CSSRule.js:59 >> + update(sourceCodeLocation, selectorText, selectors, matchedSelectorIndices, style, mediaList) > > Why was the flag dropped?
It's no longer needed, as the only use of it was to prevent `WI.CSSRule.Event.Changed` from being fired. There were no listeners for that event, so it felt fine to remove.
Devin Rousso
Comment 17
2018-12-21 15:54:33 PST
Created
attachment 357995
[details]
Patch
Matt Baker
Comment 18
2018-12-21 15:55:28 PST
(In reply to Devin Rousso from
comment #16
)
> Comment on
attachment 356749
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=356749&action=review
> > >> Source/WebInspectorUI/UserInterface/Models/CSSRule.js:59 > >> + update(sourceCodeLocation, selectorText, selectors, matchedSelectorIndices, style, mediaList) > > > > Why was the flag dropped? > > It's no longer needed, as the only use of it was to prevent > `WI.CSSRule.Event.Changed` from being fired. There were no listeners for > that event, so it felt fine to remove.
Okay! That kind of thing is pretty hard to determine in a code review.
Matt Baker
Comment 19
2018-12-21 16:09:24 PST
Comment on
attachment 357995
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=357995&action=review
Looks good! I'd feel better if Nikita looked over this too since he works on this code a lot.
> Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js:54 > + static parseSelectorListPayload(selectorList)
Why was this made static? It is only used within DOMNodeStyles. Is it going to be reused, or is it purely because it wasn't referencing `this`?
> Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js:73 > + static createSourceCodeLocation(sourceURL, {line, column, documentNode} = {})
Why was this made static? Is it going to be used outside this class? Unlike the other method, making this static required changing the signature. Both these changes feel like unnecessary churn for no benefit.
> Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:213 > +
Style: I'd drop this empty line, and add one...
> Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:222 > + });
...here! IMO it makes this section easier to read.
Devin Rousso
Comment 20
2018-12-21 16:28:11 PST
Comment on
attachment 357995
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=357995&action=review
>> Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js:54 >> + static parseSelectorListPayload(selectorList) > > Why was this made static? It is only used within DOMNodeStyles. Is it going to be reused, or is it purely because it wasn't referencing `this`?
This is also used by `WI.CSSRule.prototype._selectorResolved`.
>> Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js:73 >> + static createSourceCodeLocation(sourceURL, {line, column, documentNode} = {}) > > Why was this made static? Is it going to be used outside this class? Unlike the other method, making this static required changing the signature. Both these changes feel like unnecessary churn for no benefit.
It's used by `WI.CSSRule.prototype._selectorResolved`.
Devin Rousso
Comment 21
2018-12-21 16:28:12 PST
Comment on
attachment 357995
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=357995&action=review
>> Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js:54 >> + static parseSelectorListPayload(selectorList) > > Why was this made static? It is only used within DOMNodeStyles. Is it going to be reused, or is it purely because it wasn't referencing `this`?
This is also used by `WI.CSSRule.prototype._selectorResolved`.
>> Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js:73 >> + static createSourceCodeLocation(sourceURL, {line, column, documentNode} = {}) > > Why was this made static? Is it going to be used outside this class? Unlike the other method, making this static required changing the signature. Both these changes feel like unnecessary churn for no benefit.
It's used by `WI.CSSRule.prototype._selectorResolved`.
Nikita Vasilyev
Comment 22
2018-12-21 16:30:43 PST
Created
attachment 358002
[details]
[Video] Bug (
attachment 357995
[details]
) r- because it creates section duplicates.
Devin Rousso
Comment 23
2018-12-21 17:01:35 PST
Created
attachment 358003
[details]
Patch When a selector is changed back to something that applies to the current node, `WI.DOMNodeStyles` will create a new `WI.CSSStyleDeclaration` for that style, but the id will remain the same as the old style. Don\'t add any sections if there already exists a section that has the same id.
Matt Baker
Comment 24
2018-12-21 17:11:58 PST
(In reply to Devin Rousso from
comment #23
)
> Created
attachment 358003
[details]
> Patch > > When a selector is changed back to something that applies to the current > node, `WI.DOMNodeStyles` will create a new `WI.CSSStyleDeclaration` for that > style, but the id will remain the same as the old style. Don\'t add any > sections if there already exists a section that has the same id.
It makes sense that the selector applies to the current node, and so a declaration is created. I don't follow why there is another section though.
Devin Rousso
Comment 25
2018-12-21 17:53:23 PST
(In reply to Matt Baker from
comment #24
)
> It makes sense that the selector applies to the current node, and so a declaration is created. I don't follow why there is another section though.
Two sections appear because we’ve saved them inside `preservedSections`. One of them comes from the newly created section for the newly created store after the refresh, and the other comes from the section we’ve kept around in the preserved list.
Matt Baker
Comment 26
2018-12-21 19:30:26 PST
(In reply to Devin Rousso from
comment #25
)
> (In reply to Matt Baker from
comment #24
) > > It makes sense that the selector applies to the current node, and so a declaration is created. I don't follow why there is another section though. > Two sections appear because we’ve saved them inside `preservedSections`. > One of them comes from the newly created section for the newly created store > after the refresh, and the other comes from the section we’ve kept around in > the preserved list.
I understand there is a technical rationale for the behavior, but it is unexpected and feels like a bug.
Devin Rousso
Comment 27
2019-02-01 15:43:30 PST
Created
attachment 360915
[details]
Patch
Timothy Hatcher
Comment 28
2019-03-20 09:31:26 PDT
Comment on
attachment 360915
[details]
Patch Does this latest patch fix the duplicate section issue?
Devin Rousso
Comment 29
2019-03-20 15:38:56 PDT
Created
attachment 365415
[details]
Patch The previous patch fixed the "double section" issue. This update fixes an issue with pseudo-element styles using the same key in the maps on each `WI.DOMNodeStyles`.
Timothy Hatcher
Comment 30
2019-03-20 16:12:02 PDT
Comment on
attachment 365415
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=365415&action=review
> Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js:80 > + // Try to use the node to find the frame which has the correct resource first.
Bad indentation.
> Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js:89 > + // If that didn't find the resource, then search all frames.
Ditto.
> Source/WebInspectorUI/UserInterface/Views/SpreadsheetRulesStyleDetailsPanel.js:366 > + section.__showingForNode = this.nodeStyles.node; > + section.__index = this._sections.indexOf(section);
Should change these to symbols so they are only visible in this file.
Devin Rousso
Comment 31
2019-03-20 16:40:51 PDT
Created
attachment 365434
[details]
Patch
WebKit Commit Bot
Comment 32
2019-03-20 16:42:59 PDT
Comment hidden (obsolete)
Comment on
attachment 365434
[details]
Patch Rejecting
attachment 365434
[details]
from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-02', 'validate-changelog', '--check-oops', '--non-interactive', 365434, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit ChangeLog entry in LayoutTests/ChangeLog contains OOPS!. Full output:
https://webkit-queues.webkit.org/results/11587525
Devin Rousso
Comment 33
2019-03-20 16:47:25 PDT
Created
attachment 365436
[details]
Patch
WebKit Commit Bot
Comment 34
2019-03-20 17:22:12 PDT
Comment on
attachment 365436
[details]
Patch Clearing flags on attachment: 365436 Committed
r243264
: <
https://trac.webkit.org/changeset/243264
>
WebKit Commit Bot
Comment 35
2019-03-20 17:22:14 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug