Changeset 288498 in webkit
- Timestamp:
- Jan 24, 2022, 5:54:51 PM (5 years ago)
- Location:
- branches/safari-613-branch
- Files:
-
- 6 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/inspector/unit-tests/css-keyword-completions-expected.txt (modified) (1 diff)
-
LayoutTests/inspector/unit-tests/css-keyword-completions.html (modified) (3 diffs)
-
Source/WebInspectorUI/ChangeLog (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Views/SpreadsheetTextField.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-613-branch/LayoutTests/ChangeLog
r288497 r288498 1 2022-01-24 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r287934. rdar://problem/86578732 4 5 Web Inspector: Unhandled exception when moving cursor mid-token after receiving CSS property name completions 6 https://bugs.webkit.org/show_bug.cgi?id=234393 7 <rdar://problem/86578732> 8 9 Reviewed by Patrick Angle. 10 11 Source/WebInspectorUI: 12 13 A faulty check for mid-token completions in `WI.CSSKeywordCompletions.forPartialPropertyName()`, which are still 14 unsupported, prevented an early return and completions were provided unexpectedly. This had knock-on effects in 15 `WI.SpreadsheetTextField` which is not set up to handle cases where the caret is placed within the completion query. 16 Calculating the adjusted caret position could return a negative index and throw an unhandled exception. 17 18 Web Inspector does not currently explicitly support mid-token completions. See https://webkit.org/b/227157 19 20 The implementation of fuzzy matching for CSS completions in https://webkit.org/b/234092 21 means that, unhindered, the completion provider for CSS property names _can_ return mid-token completions. 22 Typing a query like `margin`, then moving the caret to the beginning and correcting to `s|margin` will return 23 completions like `[s]croll-[margin]`. Accepting the completion results in a malformed `SpreadsheetTextField.value` 24 by concatenation within the prefix itself. As the user types mid-token, the prefix becomes ambiguous. 25 26 Fixing the condition in `WI.CSSKeywordCompletions.forPartialPropertyName()` now inhibits unintentional 27 mid-token completions when fuzzy matching is enabled. 28 29 * UserInterface/Models/CSSKeywordCompletions.js: 30 (WI.CSSKeywordCompletions.forPartialPropertyName): 31 * UserInterface/Views/SpreadsheetTextField.js: 32 (WI.SpreadsheetTextField.prototype._showSuggestionsView): 33 34 LayoutTests: 35 36 * inspector/unit-tests/css-keyword-completions-expected.txt: 37 * inspector/unit-tests/css-keyword-completions.html: 38 39 40 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287934 268f45cc-cd09-0410-ab3c-d52691b4dbfc 41 42 2022-01-12 Razvan Caliman <rcaliman@apple.com> 43 44 Web Inspector: Unhandled exception when moving cursor mid-token after receiving CSS property name completions 45 https://bugs.webkit.org/show_bug.cgi?id=234393 46 <rdar://problem/86578732> 47 48 Reviewed by Patrick Angle. 49 50 * inspector/unit-tests/css-keyword-completions-expected.txt: 51 * inspector/unit-tests/css-keyword-completions.html: 52 1 53 2022-01-24 Alan Coon <alancoon@apple.com> 2 54 -
branches/safari-613-branch/LayoutTests/inspector/unit-tests/css-keyword-completions-expected.txt
r286611 r288498 14 14 15 15 -- Running test case: WI.CSSKeywordCompletions.forPartialPropertyName.multipleCharacterMatches 16 PASS: All expected completions were present. 17 18 -- Running test case: WI.CSSKeywordCompletions.forPartialPropertyName.midTokenNoCompletions 19 PASS: Expected exactly 0 completion results. 16 20 PASS: All expected completions were present. 17 21 -
branches/safari-613-branch/LayoutTests/inspector/unit-tests/css-keyword-completions.html
r286611 r288498 8 8 let suite = InspectorTest.createSyncSuite("WI.CSSKeywordCompletions"); 9 9 10 function addTestForPartialPropertyName({name, description, text, allowEmptyPrefix, expectedCompletions, expectedCompletionCount}) {10 function addTestForPartialPropertyName({name, description, text, caretPosition, allowEmptyPrefix, expectedCompletions, expectedCompletionCount}) { 11 11 suite.addTestCase({ 12 12 name, … … 18 18 19 19 // FIXME: <webkit.org/b/227157> Styles: Support completions mid-token. 20 let caretPosition= text.length;20 caretPosition ??= text.length; 21 21 let completionResults = WI.CSSKeywordCompletions.forPartialPropertyName(text, {caretPosition, allowEmptyPrefix}); 22 22 … … 67 67 }); 68 68 69 // FIXME: This test will fail after addressing <webkit.org/b/227157> Styles: Support completions mid-token. 70 addTestForPartialPropertyName({ 71 name: "WI.CSSKeywordCompletions.forPartialPropertyName.midTokenNoCompletions", 72 description: "Test that completions are not provided when the caret is positioned within the token.", 73 text: "margin", 74 caretPosition: 1, 75 expectedCompletionCount: 0, 76 }); 77 69 78 function addTestForPartialPropertyValue({name, description, propertyName, text, caretPosition, expectedPrefix, expectedCompletions, expectedCompletionCount, additionalFunctionValueCompletionsProvider}) { 70 79 suite.addTestCase({ -
branches/safari-613-branch/Source/WebInspectorUI/ChangeLog
r288495 r288498 1 2022-01-24 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r287934. rdar://problem/86578732 4 5 Web Inspector: Unhandled exception when moving cursor mid-token after receiving CSS property name completions 6 https://bugs.webkit.org/show_bug.cgi?id=234393 7 <rdar://problem/86578732> 8 9 Reviewed by Patrick Angle. 10 11 Source/WebInspectorUI: 12 13 A faulty check for mid-token completions in `WI.CSSKeywordCompletions.forPartialPropertyName()`, which are still 14 unsupported, prevented an early return and completions were provided unexpectedly. This had knock-on effects in 15 `WI.SpreadsheetTextField` which is not set up to handle cases where the caret is placed within the completion query. 16 Calculating the adjusted caret position could return a negative index and throw an unhandled exception. 17 18 Web Inspector does not currently explicitly support mid-token completions. See https://webkit.org/b/227157 19 20 The implementation of fuzzy matching for CSS completions in https://webkit.org/b/234092 21 means that, unhindered, the completion provider for CSS property names _can_ return mid-token completions. 22 Typing a query like `margin`, then moving the caret to the beginning and correcting to `s|margin` will return 23 completions like `[s]croll-[margin]`. Accepting the completion results in a malformed `SpreadsheetTextField.value` 24 by concatenation within the prefix itself. As the user types mid-token, the prefix becomes ambiguous. 25 26 Fixing the condition in `WI.CSSKeywordCompletions.forPartialPropertyName()` now inhibits unintentional 27 mid-token completions when fuzzy matching is enabled. 28 29 * UserInterface/Models/CSSKeywordCompletions.js: 30 (WI.CSSKeywordCompletions.forPartialPropertyName): 31 * UserInterface/Views/SpreadsheetTextField.js: 32 (WI.SpreadsheetTextField.prototype._showSuggestionsView): 33 34 LayoutTests: 35 36 * inspector/unit-tests/css-keyword-completions-expected.txt: 37 * inspector/unit-tests/css-keyword-completions.html: 38 39 40 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287934 268f45cc-cd09-0410-ab3c-d52691b4dbfc 41 42 2022-01-12 Razvan Caliman <rcaliman@apple.com> 43 44 Web Inspector: Unhandled exception when moving cursor mid-token after receiving CSS property name completions 45 https://bugs.webkit.org/show_bug.cgi?id=234393 46 <rdar://problem/86578732> 47 48 Reviewed by Patrick Angle. 49 50 A faulty check for mid-token completions in `WI.CSSKeywordCompletions.forPartialPropertyName()`, which are still 51 unsupported, prevented an early return and completions were provided unexpectedly. This had knock-on effects in 52 `WI.SpreadsheetTextField` which is not set up to handle cases where the caret is placed within the completion query. 53 Calculating the adjusted caret position could return a negative index and throw an unhandled exception. 54 55 Web Inspector does not currently explicitly support mid-token completions. See https://webkit.org/b/227157 56 57 The implementation of fuzzy matching for CSS completions in https://webkit.org/b/234092 58 means that, unhindered, the completion provider for CSS property names _can_ return mid-token completions. 59 Typing a query like `margin`, then moving the caret to the beginning and correcting to `s|margin` will return 60 completions like `[s]croll-[margin]`. Accepting the completion results in a malformed `SpreadsheetTextField.value` 61 by concatenation within the prefix itself. As the user types mid-token, the prefix becomes ambiguous. 62 63 Fixing the condition in `WI.CSSKeywordCompletions.forPartialPropertyName()` now inhibits unintentional 64 mid-token completions when fuzzy matching is enabled. 65 66 * UserInterface/Models/CSSKeywordCompletions.js: 67 (WI.CSSKeywordCompletions.forPartialPropertyName): 68 * UserInterface/Views/SpreadsheetTextField.js: 69 (WI.SpreadsheetTextField.prototype._showSuggestionsView): 70 1 71 2022-01-24 Alan Coon <alancoon@apple.com> 2 72 -
branches/safari-613-branch/Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js
r287712 r288498 34 34 WI.CSSKeywordCompletions.forPartialPropertyName = function(text, {caretPosition, allowEmptyPrefix, useFuzzyMatching} = {}) 35 35 { 36 caretPosition ??= text.length;37 36 allowEmptyPrefix ??= false; 38 37 39 38 // FIXME: <webkit.org/b/227157> Styles: Support completions mid-token. 40 if (caretPosition !== caretPosition)41 return {prefix: text, completions: []};39 if (caretPosition !== text.length) 40 return {prefix: "", completions: []}; 42 41 43 42 if (!text.length && allowEmptyPrefix) -
branches/safari-613-branch/Source/WebInspectorUI/UserInterface/Views/SpreadsheetTextField.js
r286611 r288498 479 479 // rosybrown 480 480 // royalblue 481 // 482 // FIXME: Account for the caret being within the token when fixing <webkit.org/b/227157> Styles: Support completions mid-token. 481 483 let adjustedCaretPosition = this._getCaretPosition() - this._completionPrefix.length; 482 484 let caretRect = this._getCaretRect(adjustedCaretPosition);
Note:
See TracChangeset
for help on using the changeset viewer.