WebKit Bugzilla
Attachment 362166 Details for
Bug 194724
: Web Inspector: Move CSS completion logic from SpreadsheetTextField to SpreadsheetStyleProperty
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
patch.txt (text/plain), 6.25 KB, created by
Nikita Vasilyev
on 2019-02-15 15:21:31 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Nikita Vasilyev
Created:
2019-02-15 15:21:31 PST
Size:
6.25 KB
patch
obsolete
>diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index 880666f9cb3..fdb2d0e770c 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,26 @@ >+2019-02-15 Nikita Vasilyev <nvasilyev@apple.com> >+ >+ Web Inspector: Move CSS completion logic from SpreadsheetTextField to SpreadsheetStyleProperty >+ https://bugs.webkit.org/show_bug.cgi?id=194724 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Move CSS value completion logic from SpreadsheetTextField, a generic text field, >+ to SpreadsheetStyleProperty. >+ >+ * UserInterface/Views/SpreadsheetStyleProperty.js: >+ (WI.SpreadsheetStyleProperty.prototype._nameCompletionDataProvider): >+ (WI.SpreadsheetStyleProperty.prototype._valueCompletionDataProvider): >+ >+ * UserInterface/Views/SpreadsheetTextField.js: >+ (WI.SpreadsheetTextField): >+ (WI.SpreadsheetTextField.prototype.discardCompletion): >+ (WI.SpreadsheetTextField.prototype.completionSuggestionsSelectedCompletion): >+ (WI.SpreadsheetTextField.prototype.completionSuggestionsClickedCompletion): >+ (WI.SpreadsheetTextField.prototype._updateCompletions): >+ (WI.SpreadsheetTextField.prototype._showSuggestionsView): >+ (WI.SpreadsheetTextField.prototype._getCompletionPrefix): Deleted. >+ > 2019-02-15 Devin Rousso <drousso@apple.com> > > Web Inspector: Canvas: all actions after an offscreen path modification are marked as offscreen path errors >diff --git a/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js b/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js >index af6c0699d00..0229afe2f5f 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js >+++ b/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js >@@ -711,7 +711,10 @@ WI.SpreadsheetStyleProperty = class SpreadsheetStyleProperty extends WI.Object > > _nameCompletionDataProvider(prefix) > { >- return WI.CSSCompletions.cssNameCompletions.startsWith(prefix); >+ return { >+ completionPrefix: prefix, >+ completions: WI.CSSCompletions.cssNameCompletions.startsWith(prefix) >+ }; > } > > _handleValueBeforeInput(event) >@@ -747,8 +750,15 @@ WI.SpreadsheetStyleProperty = class SpreadsheetStyleProperty extends WI.Object > > _valueCompletionDataProvider(prefix) > { >+ // For "border: 1px so|", we want to suggest "solid" based on "so" prefix. >+ let match = prefix.match(/[a-z0-9()-]+$/i); >+ if (!match) >+ return {completions: [], completionPrefix: ""}; >+ >+ let completionPrefix = match[0]; > let propertyName = this._nameElement.textContent.trim(); >- return WI.CSSKeywordCompletions.forProperty(propertyName).startsWith(prefix); >+ let completions = WI.CSSKeywordCompletions.forProperty(propertyName).startsWith(completionPrefix); >+ return {completionPrefix, completions}; > } > > _setupJumpToSymbol(element) >diff --git a/Source/WebInspectorUI/UserInterface/Views/SpreadsheetTextField.js b/Source/WebInspectorUI/UserInterface/Views/SpreadsheetTextField.js >index 974264e5223..2f32ba2d857 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/SpreadsheetTextField.js >+++ b/Source/WebInspectorUI/UserInterface/Views/SpreadsheetTextField.js >@@ -48,6 +48,7 @@ WI.SpreadsheetTextField = class SpreadsheetTextField > > this._editing = false; > this._valueBeforeEditing = ""; >+ this._completionPrefix = ""; > } > > // Public >@@ -121,6 +122,7 @@ WI.SpreadsheetTextField = class SpreadsheetTextField > return; > > this._suggestionsView.hide(); >+ this._completionPrefix = ""; > > let hadSuggestionHint = !!this.suggestionHint; > this.suggestionHint = ""; >@@ -138,10 +140,7 @@ WI.SpreadsheetTextField = class SpreadsheetTextField > > completionSuggestionsSelectedCompletion(suggestionsView, selectedText = "") > { >- let prefix = this.valueWithoutSuggestion(); >- let completionPrefix = this._getCompletionPrefix(prefix); >- >- this.suggestionHint = selectedText.slice(completionPrefix.length); >+ this.suggestionHint = selectedText.slice(this._completionPrefix.length); > > this._reAttachSuggestionHint(); > >@@ -164,8 +163,7 @@ WI.SpreadsheetTextField = class SpreadsheetTextField > // newPrefix: 1px solid > // selectedText: rosybrown > let prefix = this.valueWithoutSuggestion(); >- let completionPrefix = this._getCompletionPrefix(prefix); >- let newPrefix = prefix.slice(0, -completionPrefix.length); >+ let newPrefix = prefix.slice(0, -this._completionPrefix.length); > > this._element.textContent = newPrefix + selectedText; > >@@ -367,8 +365,8 @@ WI.SpreadsheetTextField = class SpreadsheetTextField > return; > > let prefix = this.valueWithoutSuggestion(); >- let completionPrefix = this._getCompletionPrefix(prefix); >- let completions = this._completionProvider(completionPrefix); >+ let {completions, completionPrefix} = this._completionProvider(prefix); >+ this._completionPrefix = completionPrefix; > > if (!completions.length) { > this.discardCompletion(); >@@ -406,8 +404,7 @@ WI.SpreadsheetTextField = class SpreadsheetTextField > _showSuggestionsView() > { > let prefix = this.valueWithoutSuggestion(); >- let completionPrefix = this._getCompletionPrefix(prefix); >- let startOffset = prefix.length - completionPrefix.length; >+ let startOffset = prefix.length - this._completionPrefix.length; > let caretRect = this._getCaretRect(startOffset); > > // Hide completion popover when the anchor element is removed from the DOM. >@@ -447,16 +444,6 @@ WI.SpreadsheetTextField = class SpreadsheetTextField > return new WI.Rect(clientRect.left + leftPadding, clientRect.top, clientRect.width, clientRect.height); > } > >- _getCompletionPrefix(prefix) >- { >- // For "border: 1px so|", we want to suggest "solid" based on "so" prefix. >- let match = prefix.match(/[a-z0-9()-]+$/i); >- if (match) >- return match[0]; >- >- return prefix; >- } >- > _applyCompletionHint() > { > if (!this._completionProvider || !this.suggestionHint)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194724
:
362166
|
362224
|
362259