|
|
DescriptionINPUT/TEXTAREA elements: Fix incorrect selectionStart/selectionEnd values after blur.
We failed to update selectionStart/selectionEnd cache because
TextControlElement::SelectionChanged() is not called in some cases after
crrev.com/450370.
After this CL, selection values are cached in webkitEditableContentChanged event
handling code too. It is called on every DOM mutation in text control editor.
BUG=714425
Review-Url: https://codereview.chromium.org/2878613002
Cr-Commit-Position: refs/heads/master@{#471290}
Committed: https://chromium.googlesource.com/chromium/src/+/e71aa45ab3098edca75725a658d3624f5ed47108
Patch Set 1 : . #
Total comments: 2
Patch Set 2 : rename FrameSelection::NotifyLayoutObjectOfSelectionChange() #
Total comments: 6
Patch Set 3 : Cache in TextControlElement::DefaultEventHandler() #
Total comments: 4
Patch Set 4 : Improve a test #
Messages
Total messages: 44 (28 generated)
The CQ bit was checked by tkent@chromium.org to run a CQ dry run
Patchset #1 (id:1) has been deleted
Dry run: CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
tkent@chromium.org changed reviewers: + yosin@chromium.org
yosin@, would you review this please?
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
yosin@chromium.org changed reviewers: + xiaochengh@chromium.org, yoichio@chromium.org
+ xiaochengh@ and +yoichio@, for new name of NotifyLayoutObjectOfSelectionChange() https://codereview.chromium.org/2878613002/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2878613002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/FrameSelection.cpp:225: NotifyLayoutObjectOfSelectionChange( Could you rename NotifyLayoutObjectOfSelectionChange() to NotifySelectionChangeToTextControl() or another? NotifySetSelectionToTextControl() is better? Since NotifyLayoutObjectOfSelectionChange() notifies to text control instead of layout object. Also, at glance, this change is hard to understand because a comment and newly added function call doesn't match. WDYT? void FrameSelection::NotifyLayoutObjectOfSelectionChange( EUserTriggered user_triggered) { TextControlElement* text_control = EnclosingTextControl(GetSelectionInDOMTree().Base()); if (!text_control) return; text_control->SelectionChanged(user_triggered == kUserTriggered); }
https://codereview.chromium.org/2878613002/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2878613002/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/FrameSelection.cpp:225: NotifyLayoutObjectOfSelectionChange( On 2017/05/11 at 09:41:55, yosin_UTC9 wrote: > Could you rename NotifyLayoutObjectOfSelectionChange() to NotifySelectionChangeToTextControl() or another? > NotifySetSelectionToTextControl() is better? > > Since NotifyLayoutObjectOfSelectionChange() notifies to text control instead of layout object. > > Also, at glance, this change is hard to understand because a comment and newly added function call doesn't > match. > > WDYT? > > > void FrameSelection::NotifyLayoutObjectOfSelectionChange( > EUserTriggered user_triggered) { > TextControlElement* text_control = > EnclosingTextControl(GetSelectionInDOMTree().Base()); > if (!text_control) > return; > text_control->SelectionChanged(user_triggered == kUserTriggered); > } +1 for renaming.
The CQ bit was checked by tkent@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...
ok, patch set 2 renames it to NotifyTextControlOfSelectionChange().
Description was changed from ========== INPUT/TEXTAREA elements: Fix incorrect selectionStart/selectionEnd values after blur. We failed to update selectionStart/selectionEnd cache because TextControlElement::SelectionChanged() is not called in some cases after crrev.com/450370. We should cache them on blur. BUG=714425 ========== to ========== INPUT/TEXTAREA elements: Fix incorrect selectionStart/selectionEnd values after blur. We failed to update selectionStart/selectionEnd cache because TextControlElement::SelectionChanged() is not called in some cases after crrev.com/450370. BUG=714425 ==========
Description was changed from ========== INPUT/TEXTAREA elements: Fix incorrect selectionStart/selectionEnd values after blur. We failed to update selectionStart/selectionEnd cache because TextControlElement::SelectionChanged() is not called in some cases after crrev.com/450370. BUG=714425 ========== to ========== INPUT/TEXTAREA elements: Fix incorrect selectionStart/selectionEnd values after blur. We failed to update selectionStart/selectionEnd cache because TextControlElement::SelectionChanged() is not called in some cases after crrev.com/450370. This CL adds NotifyTextControlOfSelectionChange(), which is renamed from NotifyLayoutObjectOfSelectionChange(), call even if SelectionInDOMTree is not changed. BUG=714425 ==========
https://codereview.chromium.org/2878613002/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2878613002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/FrameSelection.cpp:225: NotifyTextControlOfSelectionChange( Can we update cached selection in "webkitEditableContentChanged" event handler in TextControlElement::DefaultEventHandler()? void TextControlElement::DefaultEventHandler(Event* event) { if (event->type() == EventTypeNames::webkitEditableContentChanged && GetLayoutObject() && GetLayoutObject()->IsTextControl()) { last_change_was_user_edit_ = !GetDocument().IsRunningExecCommand(); SubtreeHasChanged(); return; } ... It seems SubtreeHasChange() is the right place to sync cached selection.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_asan_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
https://codereview.chromium.org/2878613002/diff/40001/third_party/WebKit/Layo... File third_party/WebKit/LayoutTests/fast/forms/text/text-selection-after-type-change.html (right): https://codereview.chromium.org/2878613002/diff/40001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/fast/forms/text/text-selection-after-type-change.html:17: assert_equals(element.selectionStart, null); It doesn't make sense of "selectionStart/End on button element". Is that speced or interop? https://codereview.chromium.org/2878613002/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2878613002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/FrameSelection.cpp:224: // changed. Could you explain why?
The CQ bit was checked by tkent@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...
https://codereview.chromium.org/2878613002/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/FrameSelection.cpp (right): https://codereview.chromium.org/2878613002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/FrameSelection.cpp:224: // changed. On 2017/05/12 at 01:54:00, yoichio wrote: > Could you explain why? e.g. DIV id=inner-editor #text "line-1\n" #text "line-2\n" The caret is on offset=0 of the second Text node, and type Backspace will make the DOM: DIV id=inner-editor #text "line-1" #text "line-2\n" but the caret position is still offset=0 of the second Text node. Patch Set 3 has a comment on this. https://codereview.chromium.org/2878613002/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/FrameSelection.cpp:225: NotifyTextControlOfSelectionChange( On 2017/05/12 at 01:37:00, yosin_UTC9 wrote: > Can we update cached selection in "webkitEditableContentChanged" event handler in > TextControlElement::DefaultEventHandler()? > > void TextControlElement::DefaultEventHandler(Event* event) { > if (event->type() == EventTypeNames::webkitEditableContentChanged && > GetLayoutObject() && GetLayoutObject()->IsTextControl()) { > last_change_was_user_edit_ = !GetDocument().IsRunningExecCommand(); > SubtreeHasChanged(); > return; > } > ... > > It seems SubtreeHasChange() is the right place to sync cached selection. Patch Set 3 follows it. Yes, handling in TextControl is better than adding notification to the no-selection-change path.
https://codereview.chromium.org/2878613002/diff/40001/third_party/WebKit/Layo... File third_party/WebKit/LayoutTests/fast/forms/text/text-selection-after-type-change.html (right): https://codereview.chromium.org/2878613002/diff/40001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/fast/forms/text/text-selection-after-type-change.html:17: assert_equals(element.selectionStart, null); On 2017/05/12 at 01:54:00, yoichio wrote: > It doesn't make sense of "selectionStart/End on button element". > Is that speced or interop? It's a spec'ed behavior.
lgtm w/ nits Please update summary and description. It seems they describe PS#1 and PS#2 instead of PS#3 https://codereview.chromium.org/2878613002/diff/60001/third_party/WebKit/Layo... File third_party/WebKit/LayoutTests/fast/forms/text/text-selection-after-type-change.html (right): https://codereview.chromium.org/2878613002/diff/60001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/fast/forms/text/text-selection-after-type-change.html:11: var element = document.querySelector('input'); nit: Please add: |assert_exists(window, 'eventSender');| https://codereview.chromium.org/2878613002/diff/60001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/fast/forms/text/text-selection-after-type-change.html:23: setTimeout(t.step_func_done(() => { nit: How about using t.step_timeout()[1]? [1] "Timeouts in Tests" http://web-platform-tests.org/writing-tests/testharness-api.html
Description was changed from ========== INPUT/TEXTAREA elements: Fix incorrect selectionStart/selectionEnd values after blur. We failed to update selectionStart/selectionEnd cache because TextControlElement::SelectionChanged() is not called in some cases after crrev.com/450370. This CL adds NotifyTextControlOfSelectionChange(), which is renamed from NotifyLayoutObjectOfSelectionChange(), call even if SelectionInDOMTree is not changed. BUG=714425 ========== to ========== INPUT/TEXTAREA elements: Fix incorrect selectionStart/selectionEnd values after blur. We failed to update selectionStart/selectionEnd cache because TextControlElement::SelectionChanged() is not called in some cases after crrev.com/450370. After this CL, selection values are cached in webkitEditableContentChanged event handling code too. It is called on every DOM mutation in text control editor. BUG=714425 ==========
The CQ bit was checked by tkent@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: Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
> Please update summary and description. It seems they describe PS#1 and PS#2 instead of PS#3 Done. https://codereview.chromium.org/2878613002/diff/60001/third_party/WebKit/Layo... File third_party/WebKit/LayoutTests/fast/forms/text/text-selection-after-type-change.html (right): https://codereview.chromium.org/2878613002/diff/60001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/fast/forms/text/text-selection-after-type-change.html:11: var element = document.querySelector('input'); On 2017/05/12 at 04:03:52, yosin_UTC9 wrote: > nit: Please add: |assert_exists(window, 'eventSender');| Done. https://codereview.chromium.org/2878613002/diff/60001/third_party/WebKit/Layo... third_party/WebKit/LayoutTests/fast/forms/text/text-selection-after-type-change.html:23: setTimeout(t.step_func_done(() => { On 2017/05/12 at 04:03:52, yosin_UTC9 wrote: > nit: How about using t.step_timeout()[1]? > > [1] "Timeouts in Tests" http://web-platform-tests.org/writing-tests/testharness-api.html Done.
The CQ bit was checked by tkent@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from yosin@chromium.org Link to the patchset: https://codereview.chromium.org/2878613002/#ps80001 (title: "Improve a test")
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_chromeos_ozone_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 tkent@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_chromeos_ozone_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 tkent@chromium.org
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 80001, "attempt_start_ts": 1494593703980720, "parent_rev": "545f7be4401875ef9842de21144da3561281b2db", "commit_rev": "e71aa45ab3098edca75725a658d3624f5ed47108"}
Message was sent while issue was closed.
Description was changed from ========== INPUT/TEXTAREA elements: Fix incorrect selectionStart/selectionEnd values after blur. We failed to update selectionStart/selectionEnd cache because TextControlElement::SelectionChanged() is not called in some cases after crrev.com/450370. After this CL, selection values are cached in webkitEditableContentChanged event handling code too. It is called on every DOM mutation in text control editor. BUG=714425 ========== to ========== INPUT/TEXTAREA elements: Fix incorrect selectionStart/selectionEnd values after blur. We failed to update selectionStart/selectionEnd cache because TextControlElement::SelectionChanged() is not called in some cases after crrev.com/450370. After this CL, selection values are cached in webkitEditableContentChanged event handling code too. It is called on every DOM mutation in text control editor. BUG=714425 Review-Url: https://codereview.chromium.org/2878613002 Cr-Commit-Position: refs/heads/master@{#471290} Committed: https://chromium.googlesource.com/chromium/src/+/e71aa45ab3098edca75725a658d3... ==========
Message was sent while issue was closed.
Committed patchset #4 (id:80001) as https://chromium.googlesource.com/chromium/src/+/e71aa45ab3098edca75725a658d3... |