Steps: 1. Open https://webkit.org 2. Inspect <body> 3. Add `font-family: "Helv` CSS property to the Style Attribute rule. 4. Press Tab or Enter. Actual: font-family: "Helvetica}" Expected: font-family: "Helvetica" Notes: This is similar to https://bugs.webkit.org/show_bug.cgi?id=199090. Weirdly, for this case "}" gets added by WI.tokenizeCSSValue when it encounters unbalanced quotes.
<rdar://problem/52023534>
Created attachment 372690 [details] Patch
Comment on attachment 372690 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=372690&action=review r=me, even though I have questions, the logic looks fine to me. Please address my questions before landing. > Source/WebInspectorUI/ChangeLog:9 > + `}` gets added by WI.tokenizeCSSValue (CodeMirror CSS tokenizer) when it encounters unbalanced quotes. It's worth mentioning that `WI.tokenizeCSSValue` is called by `_renderValue`, not in `spreadsheetTextFieldDidCommit`. That initially confused me. > Source/WebInspectorUI/ChangeLog:10 > + Fix unbalanced quotes by rendering the value from the model, not the view. Why does the model have the "correct" value, but the view doesn't? Every time you edit the view, it updates the model with the corresponding text, so the model and view should be in sync. Are you saying that they're not? If so, why? If not, what is actually changed/fixed by using the model?
(In reply to Devin Rousso from comment #3) > Comment on attachment 372690 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=372690&action=review > > r=me, even though I have questions, the logic looks fine to me. Please > address my questions before landing. > > > Source/WebInspectorUI/ChangeLog:9 > > + `}` gets added by WI.tokenizeCSSValue (CodeMirror CSS tokenizer) when it encounters unbalanced quotes. > > It's worth mentioning that `WI.tokenizeCSSValue` is called by > `_renderValue`, not in `spreadsheetTextFieldDidCommit`. That initially > confused me. > > > Source/WebInspectorUI/ChangeLog:10 > > + Fix unbalanced quotes by rendering the value from the model, not the view. > > Why does the model have the "correct" value, but the view doesn't? Every > time you edit the view, it updates the model with the corresponding text, so > the model and view should be in sync. Are you saying that they're not? If > so, why? If not, what is actually changed/fixed by using the model? When I said the view, I really meant the DOM. After entering CSS value `"Helvetica` this is what happens: _handleValueChange() { this._property.rawValue = this._valueElement.textContent.trim(); } this._valueElement.textContent is "Helvetica. this._property.rawValue setter fixes unbalanced quotes, so the value becomes "Helvetica": set rawValue(value) { ... let suffix = WI.CSSCompletions.completeUnbalancedValue(value); if (suffix) value += suffix;
Created attachment 373589 [details] Patch
Comment on attachment 373589 [details] Patch Clearing flags on attachment: 373589 Committed r247196: <https://trac.webkit.org/changeset/247196>
All reviewed patches have been landed. Closing bug.