|
|
Created:
4 years, 3 months ago by einbinder Modified:
4 years, 2 months ago Reviewers:
lushnikov CC:
apavlov+blink_chromium.org, blink-reviews, caseq+blink_chromium.org, chromium-reviews, devtools-reviews_chromium.org, kozyatinskiy+blink_chromium.org, lushnikov+blink_chromium.org, pfeldman+blink_chromium.org, pfeldman Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionDevTools: Fix flickering hint when typing in TextPrompt
The grey hint text in the TextPrompt was being removed on every keystroke, and then re-added the next frame if it was still needed for the suggestion.
BUG=none
Committed: https://crrev.com/37a665db550b7afc5175dee09596a46a8fcf6697
Cr-Commit-Position: refs/heads/master@{#426681}
Patch Set 1 #
Total comments: 2
Patch Set 2 : Refactor #
Total comments: 2
Patch Set 3 : Add test #
Total comments: 10
Patch Set 4 : Merge clearAutocomplete methods #Patch Set 5 : Merge #
Total comments: 4
Patch Set 6 : merge #Patch Set 7 : currentHintText #
Total comments: 6
Patch Set 8 : Remove _updateAutocomplete #
Total comments: 5
Patch Set 9 : Explicity measure autocomplete text length #Patch Set 10 : condition #Patch Set 11 : fix test #
Messages
Total messages: 39 (16 generated)
einbinder@chromium.org changed reviewers: + lushnikov@chromium.org
Ptal
The CQ bit was checked by einbinder@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Could you please also briefly describe in the issue description the root cause of this poor behavior? https://codereview.chromium.org/2285993002/diff/1/third_party/WebKit/Source/d... File third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js (right): https://codereview.chromium.org/2285993002/diff/1/third_party/WebKit/Source/d... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:395: clearAutoComplete: function(includeTimeout, singleCharInput, singleDeleteChar) why are these arguments a part of public interface? They feel like an implementation detail
Description was changed from ========== DevTools: Fix flickering hint when typing in TextPrompt BUG=none ========== to ========== DevTools: Fix flickering hint when typing in TextPrompt The grey hint text in the TextPrompt was being removed on every keystroke, and then re-added the next frame if it was still needed for the suggestion. BUG=none ==========
Ptal https://codereview.chromium.org/2285993002/diff/1/third_party/WebKit/Source/d... File third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js (right): https://codereview.chromium.org/2285993002/diff/1/third_party/WebKit/Source/d... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:395: clearAutoComplete: function(includeTimeout, singleCharInput, singleDeleteChar) On 2016/08/29 at 22:10:41, lushnikov wrote: > why are these arguments a part of public interface? They feel like an implementation detail Done.
Description was changed from ========== DevTools: Fix flickering hint when typing in TextPrompt The grey hint text in the TextPrompt was being removed on every keystroke, and then re-added the next frame if it was still needed for the suggestion. BUG=none ========== to ========== DevTools: Fix flickering hint when typing in TextPrompt The grey hint text in the TextPrompt was being removed on every keystroke, and then re-added the next frame if it was still needed for the suggestion. BUG=none ==========
https://codereview.chromium.org/2285993002/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js (right): https://codereview.chromium.org/2285993002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:293: if (this._autocompleteElement) { what is this._autocompleteElement? AFAIU it is never defined. How does this work altogether then?..
I added a test. ptal https://codereview.chromium.org/2285993002/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js (right): https://codereview.chromium.org/2285993002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:293: if (this._autocompleteElement) { On 2016/08/31 at 15:11:16, lushnikov wrote: > what is this._autocompleteElement? AFAIU it is never defined. > > How does this work altogether then?.. Was a typo in a refactor. Fixed it.
https://codereview.chromium.org/2285993002/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js (right): https://codereview.chromium.org/2285993002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:293: if (this.autoCompleteElement) { can we hide autoCompleteElement inside text prompt in a follow-up? It's a pity someone reaches right into it. https://codereview.chromium.org/2285993002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:295: if (this._previousText === text.substring(0, text.length - 1)) { can we generalize this to the "this.userEnteredText() is prefix of previous text"? https://codereview.chromium.org/2285993002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:299: } nit: else on the same line as "}" https://codereview.chromium.org/2285993002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:402: clearAutoComplete: function(includeTimeout) I'm confused with TextPrompt API. So there are three methods which in some way hide autocomplete: - clearAutoComplete - cleans grey text - hideSuggestBox - hides suggest box - _removeCompletionAids - does both clearAutoComplete and hideSuggestBox In which situation clients of TextPrompt need to call either clearAutoComlpete or hideSuggestBox, and not both? https://codereview.chromium.org/2285993002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:404: if (includeTimeout) why would anyone ever want to call this with includeTimeout === false?
ptal https://codereview.chromium.org/2285993002/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js (right): https://codereview.chromium.org/2285993002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:293: if (this.autoCompleteElement) { On 2016/09/01 at 21:25:33, lushnikov wrote: > can we hide autoCompleteElement inside text prompt in a follow-up? It's a pity someone reaches right into it. Yes, I am planning a TextPrompt rewrite/refactor. https://codereview.chromium.org/2285993002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:295: if (this._previousText === text.substring(0, text.length - 1)) { On 2016/09/01 at 21:25:33, lushnikov wrote: > can we generalize this to the "this.userEnteredText() is prefix of previous text"? No, it's checking that exactly one character was deleted. https://codereview.chromium.org/2285993002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:299: } On 2016/09/01 at 21:25:33, lushnikov wrote: > nit: else on the same line as "}" Done. https://codereview.chromium.org/2285993002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:402: clearAutoComplete: function(includeTimeout) On 2016/09/01 at 21:25:33, lushnikov wrote: > I'm confused with TextPrompt API. > > So there are three methods which in some way hide autocomplete: > - clearAutoComplete - cleans grey text > - hideSuggestBox - hides suggest box > - _removeCompletionAids - does both clearAutoComplete and hideSuggestBox > > In which situation clients of TextPrompt need to call either clearAutoComlpete or hideSuggestBox, and > not both? I think we can get away with always hiding SuggestBox. https://codereview.chromium.org/2285993002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:404: if (includeTimeout) On 2016/09/01 at 21:25:33, lushnikov wrote: > why would anyone ever want to call this with includeTimeout === false? I don't think there is a good reason.
there's a lot going on here; can we split this in patches?
I merged with the other patch. PTAL
https://codereview.chromium.org/2285993002/diff/80001/third_party/WebKit/Sour... File third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js (right): https://codereview.chromium.org/2285993002/diff/80001/third_party/WebKit/Sour... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:293: } else if (this._previousText.substring(0, this._previousText.length - 1) === text) { let's use .startsWith? https://codereview.chromium.org/2285993002/diff/80001/third_party/WebKit/Sour... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:301: delete this._waitingForCompletions; why would you need to delete this? The _waitingForCompletions flag also doesn't do its job properly - it is supposed to cancel the completionsReady callback, but it is not hard to model the situation when it doesn't. Let's fix in a separate patch?
Description was changed from ========== DevTools: Fix flickering hint when typing in TextPrompt The grey hint text in the TextPrompt was being removed on every keystroke, and then re-added the next frame if it was still needed for the suggestion. BUG=none ========== to ========== DevTools: Fix flickering hint when typing in TextPrompt The grey hint text in the TextPrompt was being removed on every keystroke, and then re-added the next frame if it was still needed for the suggestion. BUG=none ==========
lushnikov@chromium.org changed reviewers: - lushnikov@chromium.org
einbinder@chromium.org changed reviewers: + lushnikov@chromium.org
http://crbug.com/645665 got fixed, so we can land this. https://codereview.chromium.org/2285993002/diff/80001/third_party/WebKit/Sour... File third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js (right): https://codereview.chromium.org/2285993002/diff/80001/third_party/WebKit/Sour... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:293: } else if (this._previousText.substring(0, this._previousText.length - 1) === text) { On 2016/09/07 at 22:11:01, lushnikov wrote: > let's use .startsWith? Done. https://codereview.chromium.org/2285993002/diff/80001/third_party/WebKit/Sour... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:301: delete this._waitingForCompletions; On 2016/09/07 at 22:11:01, lushnikov wrote: > why would you need to delete this? > > The _waitingForCompletions flag also doesn't do its job properly - it is supposed to cancel the > completionsReady callback, but it is not hard to model the situation when it doesn't. > > Let's fix in a separate patch? Done.
"I'm confused why is this not updated" (Joel)
ptal
https://codereview.chromium.org/2285993002/diff/120001/third_party/WebKit/Sou... File third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js (right): https://codereview.chromium.org/2285993002/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:286: _updateAutoComplete: function(force) let's get rid of this method - it's confusing https://codereview.chromium.org/2285993002/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:289: if (this._autocompleteElement) { var hasCommonPrefix = text.startsWith(this._previousText) || this._previousText.startsWith(text); var text = this.userEnteredText(); if (this._autocompleteElement && hasCommonPrefix) this._autocompleteElement.textContent = this._currentHintText.substring(text.length); else this._clearAutocompleteElement(); this._previousText = text; this.autoCompleteSoon(force); https://codereview.chromium.org/2285993002/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:398: this._completionRequestId++; let's move this into _clearAutocompleteTimeout
ptal https://codereview.chromium.org/2285993002/diff/120001/third_party/WebKit/Sou... File third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js (right): https://codereview.chromium.org/2285993002/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:286: _updateAutoComplete: function(force) On 2016/10/19 at 23:36:47, lushnikov wrote: > let's get rid of this method - it's confusing Done. https://codereview.chromium.org/2285993002/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:289: if (this._autocompleteElement) { On 2016/10/19 at 23:36:47, lushnikov wrote: > var hasCommonPrefix = text.startsWith(this._previousText) || this._previousText.startsWith(text); > var text = this.userEnteredText(); > if (this._autocompleteElement && hasCommonPrefix) > this._autocompleteElement.textContent = this._currentHintText.substring(text.length); > else > this._clearAutocompleteElement(); > this._previousText = text; > this.autoCompleteSoon(force); Done. https://codereview.chromium.org/2285993002/diff/120001/third_party/WebKit/Sou... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:398: this._completionRequestId++; On 2016/10/19 at 23:36:47, lushnikov wrote: > let's move this into _clearAutocompleteTimeout Done. https://codereview.chromium.org/2285993002/diff/140001/third_party/WebKit/Sou... File third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js (right): https://codereview.chromium.org/2285993002/diff/140001/third_party/WebKit/Sou... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:409: this._completeTimeout = setTimeout(this.complete.bind(this, force), immediately ? 0 : this._autocompletionTimeout); I was mistaken about every autocomplete being in a promise resolve now. That was for CodeMirrorTextEditor's autocomplete. I haven't unified them yet.
https://codereview.chromium.org/2285993002/diff/140001/third_party/WebKit/Sou... File third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js (right): https://codereview.chromium.org/2285993002/diff/140001/third_party/WebKit/Sou... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:351: this._autocompleteElement.textContent = this._currentHintText.substring(text.length); we should update currentHintText in applySuggestion https://codereview.chromium.org/2285993002/diff/140001/third_party/WebKit/Sou... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:433: if (wordSuffixRange.toString().length + this.userEnteredText().length - this.text().length) Let's put the condition more explicitly, mentioning autocompleteHint
https://codereview.chromium.org/2285993002/diff/140001/third_party/WebKit/Sou... File third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js (right): https://codereview.chromium.org/2285993002/diff/140001/third_party/WebKit/Sou... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:351: this._autocompleteElement.textContent = this._currentHintText.substring(text.length); On 2016/10/20 at 20:49:27, lushnikov wrote: > we should update currentHintText in applySuggestion Currently applySuggestion doesn't update the hint. It clears it and selects text. https://codereview.chromium.org/2285993002/diff/140001/third_party/WebKit/Sou... third_party/WebKit/Source/devtools/front_end/ui/TextPrompt.js:433: if (wordSuffixRange.toString().length + this.userEnteredText().length - this.text().length) On 2016/10/20 at 20:49:27, lushnikov wrote: > Let's put the condition more explicitly, mentioning autocompleteHint Done.
lgtm
The CQ bit was checked by einbinder@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
The CQ bit was checked by einbinder@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from lushnikov@chromium.org Link to the patchset: https://codereview.chromium.org/2285993002/#ps200001 (title: "fix test")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== DevTools: Fix flickering hint when typing in TextPrompt The grey hint text in the TextPrompt was being removed on every keystroke, and then re-added the next frame if it was still needed for the suggestion. BUG=none ========== to ========== DevTools: Fix flickering hint when typing in TextPrompt The grey hint text in the TextPrompt was being removed on every keystroke, and then re-added the next frame if it was still needed for the suggestion. BUG=none ==========
Message was sent while issue was closed.
Committed patchset #11 (id:200001)
Message was sent while issue was closed.
Description was changed from ========== DevTools: Fix flickering hint when typing in TextPrompt The grey hint text in the TextPrompt was being removed on every keystroke, and then re-added the next frame if it was still needed for the suggestion. BUG=none ========== to ========== DevTools: Fix flickering hint when typing in TextPrompt The grey hint text in the TextPrompt was being removed on every keystroke, and then re-added the next frame if it was still needed for the suggestion. BUG=none Committed: https://crrev.com/37a665db550b7afc5175dee09596a46a8fcf6697 Cr-Commit-Position: refs/heads/master@{#426681} ==========
Message was sent while issue was closed.
Patchset 11 (id:??) landed as https://crrev.com/37a665db550b7afc5175dee09596a46a8fcf6697 Cr-Commit-Position: refs/heads/master@{#426681} |