WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
158272
Web Inspector: Visual Styles: "Text -> Content" section should only be visible for pseudo-element
https://bugs.webkit.org/show_bug.cgi?id=158272
Summary
Web Inspector: Visual Styles: "Text -> Content" section should only be visibl...
Nikita Vasilyev
Reported
2016-06-01 13:53:21 PDT
Currently, "Content" is the first item in the "Text" section, yet it doesn't do anything for regular (non pseudo) elements. We should only show it for pseudo elements.
Attachments
Patch
(5.82 KB, patch)
2016-08-15 15:54 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(10.58 KB, patch)
2016-08-16 00:11 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(6.45 KB, patch)
2016-08-16 17:56 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(6.46 KB, patch)
2016-08-19 10:55 PDT
,
Devin Rousso
joepeck
: review+
Details
Formatted Diff
Diff
Patch
(6.52 KB, patch)
2016-08-22 22:05 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2016-06-01 13:54:02 PDT
<
rdar://problem/26585010
>
Devin Rousso
Comment 2
2016-08-15 15:54:22 PDT
Created
attachment 286106
[details]
Patch
Joseph Pecoraro
Comment 3
2016-08-15 16:44:20 PDT
Comment on
attachment 286106
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=286106&action=review
r=me, but maybe file a follow-up on better detection.
> Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.css:-100 > -.visual-style-property-container.transition, > -.visual-style-property-container.animation { > - margin-left: 11px; > -}
Seems unrelated, but fine!
> Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.js:193 > + let isPseudoElement = currentSelector.includes(":before") || currentSelector.includes(":after") || this._nodeStyles.node.isPseudoElement();
This is tricky. Selector text of: "foo x::before bar" wouldn't want this. But "foo, x::before, bar" would. Perhaps this could be made smarter to check each of the selectors to see if one ends with :before/:after?
Devin Rousso
Comment 4
2016-08-16 00:11:44 PDT
Created
attachment 286157
[details]
Patch
Joseph Pecoraro
Comment 5
2016-08-16 12:07:09 PDT
Comment on
attachment 286157
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=286157&action=review
> Source/WebInspectorUI/UserInterface/Models/CSSRule.js:164 > + hasMatchedPseudoSelector() > + { > + if (this.nodeStyles && this.nodeStyles.node && this.nodeStyles.node.isPseudoElement()) > + return true; > + > + return this.selectors.some((selector, i) => selector.isPseudoSelector() && this.matchedSelectors.includes(i)); > + }
The intent here is PsuedoElement selectors. But there are plenty of other pseudo element selectors and the CSS content property only affects ::before/::after, so this should be hasBeforeAfterPseudoElementSelector, with a CSSSelector method isBeforeAfterPsuedoElementSelector. In reality I don't think we can do this perfectly without re-implementing a selector engine or backend support, since things like ":matches(div::before, foo)" which expands to "div::before, foo" would be missed. But what you have catches the 90% case, so I think its worth doing.
> Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.js:194 > + let isMatchedPseudoSelector = this._currentStyle.ownerRule && this._currentStyle.ownerRule.hasMatchedPseudoSelector(); > + this._groups.content.section.element.classList.toggle("inactive", !isMatchedPseudoSelector); > + this._groups.listStyle.section.element.classList.toggle("inactive", isMatchedPseudoSelector);
Variable name suggestion: let ruleMatchesBeforeAfterPseudoElement.
> Source/WebInspectorUI/UserInterface/Views/VisualStyleSelectorTreeItem.js:58 > + let iconClasses = [iconClassName]; > + if (style.ownerRule && style.ownerRule.hasMatchedPseudoSelector()) > + iconClasses.push(WebInspector.CSSStyleDeclarationSection.PseudoSelectorStyleClassName);
I see this is doing the [P] things from the other patch. Which is still being discussed. I think the top parts above regarding `content` look good to me. But these still need some discussion.
Devin Rousso
Comment 6
2016-08-16 17:56:28 PDT
Created
attachment 286240
[details]
Patch
Devin Rousso
Comment 7
2016-08-19 10:55:39 PDT
Created
attachment 286461
[details]
Patch
Joseph Pecoraro
Comment 8
2016-08-22 19:59:09 PDT
Comment on
attachment 286461
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=286461&action=review
r=me
> Source/WebInspectorUI/UserInterface/Views/VisualStyleDetailsPanel.js:668 > + properties.content = new WebInspector.VisualStyleBasicInput("content", null, WebInspector.UIString("Enter a value"));
Something feels off about this placeholder string. Safari's URL bar says "Search or enter website name" not "Search or enter a website name". Maybe drop the "a" here making this "Enter value"?
Devin Rousso
Comment 9
2016-08-22 22:05:53 PDT
Created
attachment 286672
[details]
Patch
WebKit Commit Bot
Comment 10
2016-08-22 22:36:25 PDT
Comment on
attachment 286672
[details]
Patch Clearing flags on attachment: 286672 Committed
r204757
: <
http://trac.webkit.org/changeset/204757
>
WebKit Commit Bot
Comment 11
2016-08-22 22:36:29 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