Bug 147361 - Web Inspector: Allow users to duplicate rules in the Rules sidebar panel
Summary: Web Inspector: Allow users to duplicate rules in the Rules sidebar panel
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-07-28 09:57 PDT by Devin Rousso
Modified: 2015-08-05 07:08 PDT (History)
8 users (show)

See Also:


Attachments
Patch (4.22 KB, patch)
2015-07-28 10:24 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (5.17 KB, patch)
2015-07-28 18:52 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (5.13 KB, patch)
2015-08-02 00:54 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (5.27 KB, patch)
2015-08-04 21:26 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2015-07-28 09:57:01 PDT
I often find that I want to duplicate a rule to be able to tweak the selector from that rule without messing up the applied properties.  I think that the best place to put this would be as a context menu item that inserts the duplicated (same selector but no properties) rule immediately after the copied rule.
Comment 1 Radar WebKit Bug Importer 2015-07-28 09:57:11 PDT
<rdar://problem/22031990>
Comment 2 Devin Rousso 2015-07-28 10:24:04 PDT
Created attachment 257655 [details]
Patch
Comment 3 Timothy Hatcher 2015-07-28 12:13:50 PDT
Comment on attachment 257655 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=257655&action=review

> Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js:408
> +        if (!(this._style.ownerRule && this._style.ownerRule.type === WebInspector.CSSRule.Type.UserAgent)) {

Why exclude UserAgent? (Or am I failing at boolean logic.) I think it would be useful to duplicate a rule that you can't edit directly.
Comment 4 Devin Rousso 2015-07-28 12:56:51 PDT
Comment on attachment 257655 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=257655&action=review

>> Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js:408
>> +        if (!(this._style.ownerRule && this._style.ownerRule.type === WebInspector.CSSRule.Type.UserAgent)) {
> 
> Why exclude UserAgent? (Or am I failing at boolean logic.) I think it would be useful to duplicate a rule that you can't edit directly.

That was supposed to be Inherited, not UserAgent.  Duplicated Inherited rules won't show up in the sidebar unless the node which the inherited rule comes from is selected, so its pointless to allow users to duplicate rules that are marked as inherited.
Comment 5 Devin Rousso 2015-07-28 18:52:29 PDT
Created attachment 257720 [details]
Patch
Comment 6 Devin Rousso 2015-08-02 00:54:19 PDT
Created attachment 258029 [details]
Patch
Comment 7 Timothy Hatcher 2015-08-04 14:49:23 PDT
Comment on attachment 258029 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=258029&action=review

> Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js:459
> +                if (this._delegate && typeof this._delegate.focusNextNewInspectorRule === "function")
> +                    this._delegate.focusNextNewInspectorRule();

Delegate methods should be prefixed with the class name. So cssStyleDeclarationSectionFocusNextNewInspectorRule. This is really just calling a public method as a delegate method currently.
Comment 8 Devin Rousso 2015-08-04 21:26:56 PDT
Created attachment 258264 [details]
Patch
Comment 9 WebKit Commit Bot 2015-08-05 07:08:05 PDT
Comment on attachment 258264 [details]
Patch

Clearing flags on attachment: 258264

Committed r187960: <http://trac.webkit.org/changeset/187960>
Comment 10 WebKit Commit Bot 2015-08-05 07:08:09 PDT
All reviewed patches have been landed.  Closing bug.