New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 725890 link

Starred by 2 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 3
Type: Bug-Regression



Sign in to add a comment

selectionchange event not firing after backspace

Reported by e...@iseulde.com, May 24 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.1 Safari/603.1.30

Steps to reproduce the problem:
1. https://codepen.io/iseulde/pen/LyqXMx
2. Focus the contentEditable area.
3. Press backspace.
3. selectionChange does not fire. (No green checkmark.)

What is the expected behavior?
The selectionChange even should fire, as the selection changed.

What went wrong?
No event fired.

Did this work before? Yes 57

Does this work in other browsers? Yes

Chrome version: 58.0.3029.110 (Official Build) (64-bit)  Channel: stable
OS Version: OS X 10.12.4
Flash Version: 25.0.0.171
 
Labels: Needs-Bisect Needs-Triage-M58

Comment 2 by yosin@chromium.org, May 25 2017

Components: -Blink>Editing Blink>Editing>Selection
Labels: OS-Linux OS-Windows
Status: Available (was: Unconfirmed)
Confirmed with 58.0.3029.110 (Official Build) (64-bit) on Win

FrameSelection::DidSetSelectionDeprecated() dispatches "selectionchange" at end
of function by:
  frame_->DomWindow()->EnqueueDocumentEvent(
      Event::Create(EventTypeNames::selectionchange));

Comment 3 by yosin@chromium.org, May 25 2017

The root cause is Blink relocates selection by CharacterData::deleteData() during
processing backspace.

It seems we need to know whether selection is relocated or not.
Then dispatching "selectionchange" in Editor::ChangeSelectionAfterCommand().


# Relocation of Selection
blink::SelectionEditor::DidFinishTextChange(const blink::PositionTemplate<blink::EditingAlgorithm<blink::NodeTraversal> > & new_base, const blink::PositionTemplate<blink::EditingAlgorithm<blink::NodeTraversal> > & new_extent) Line 142
blink::SelectionEditor::DidUpdateCharacterData(blink::CharacterData * node, unsigned int offset, unsigned int old_length, unsigned int new_length) Line 276
blink::SynchronousMutationNotifier::NotifyUpdateCharacterData(blink::CharacterData * character_data, unsigned int offset, unsigned int old_length, unsigned int new_length) Line 48
blink::CharacterData::SetDataAndUpdate(const WTF::String & new_data, unsigned int offset_of_replaced_data, unsigned int old_length, unsigned int new_length, blink::CharacterData::UpdateSource source) Line 194
blink::CharacterData::deleteData(unsigned int offset, unsigned int count, blink::ExceptionState & exception_state) Line 138
blink::DeleteFromTextNodeCommand::DoApply(blink::EditingState * __formal) Line 59
blink::CompositeEditCommand::ApplyCommandToComposite(blink::EditCommand * command, blink::EditingState * editing_state) Line 191
blink::CompositeEditCommand::DeleteTextFromNode(blink::Text * node, unsigned int offset, unsigned int count) Line 535
blink::DeleteSelectionCommand::DeleteTextFromNode(blink::Text * node, unsigned int offset, unsigned int count) Line 561
blink::DeleteSelectionCommand::HandleGeneralDelete(blink::EditingState * editing_state) Line 634
blink::DeleteSelectionCommand::DoApply(blink::EditingState * editing_state) Line 1138
blink::CompositeEditCommand::ApplyCommandToComposite(blink::EditCommand * command, blink::EditingState * editing_state) Line 191
blink::TypingCommand::DeleteSelectionIfRange(const blink::VisibleSelectionTemplate<blink::EditingAlgorithm<blink::NodeTraversal> > & selection, blink::EditingState * editing_state, bool smart_delete, bool merge_blocks_after_delete, bool expand_for_special_elements, bool sanitize_markup) Line 192
blink::TypingCommand::DeleteKeyPressed(blink::TextGranularity granularity, bool kill_ring, blink::EditingState * editing_state) Line 848
blink::TypingCommand::DeleteKeyPressed(blink::Document & document, unsigned int options, blink::TextGranularity granularity) Line 212
blink::Editor::DeleteWithDirection(blink::DeleteDirection direction, blink::TextGranularity granularity, bool kill_ring, bool is_typing_action) Line 435
blink::ExecuteDeleteBackward(blink::LocalFrame & frame, blink::Event * __formal, blink::EditorCommandSource __formal, const WTF::String & __formal) Line 741
blink::Editor::Command::Execute(const WTF::String & parameter, blink::Event * triggering_event) Line 2956
blink::Editor::Command::Execute(blink::Event * triggering_event) Line 2959
blink::Editor::HandleEditingKeyboardEvent(blink::KeyboardEvent * evt) Line 54
blink::Editor::HandleKeyboardEvent(blink::KeyboardEvent * evt) Line 84


# SetSelection after character changed
FrameSelection::SetSelectionDeprecated(const blink::SelectionTemplate<blink::EditingAlgorithm<blink::NodeTraversal> > & passed_selection, unsigned int options, blink::TextGranularity granularity) Line 221
FrameSelection::SetSelection(const blink::SelectionTemplate<blink::EditingAlgorithm<blink::NodeTraversal> > & passed_selection, unsigned int options, blink::CursorAlignOnScroll align, blink::TextGranularity granularity) Line 188
Editor::ChangeSelectionAfterCommand(const blink::SelectionTemplate<blink::EditingAlgorithm<blink::NodeTraversal> > & new_selection, unsigned int options) Line 1514
Editor::AppliedEditing(blink::CompositeEditCommand * cmd) Line 956
TypingCommand::TypingAddedToOpenCommand(blink::TypingCommand::ETypingCommand command_type_for_added_typing) Line 537
TypingCommand::DeleteKeyPressed(blink::TextGranularity granularity, bool kill_ring, blink::EditingState * editing_state) Line 852
TypingCommand::DoApply(blink::EditingState * editing_state) Line 474
CompositeEditCommand::Apply() Line 143
TypingCommand::DeleteKeyPressed(blink::Document & document, unsigned int options, blink::TextGranularity granularity) Line 217
Editor::DeleteWithDirection(blink::DeleteDirection direction, blink::TextGranularity granularity, bool kill_ring, bool is_typing_action) Line 435
ExecuteDeleteBackward(blink::LocalFrame & frame, blink::Event * __formal, blink::EditorCommandSource __formal, const WTF::String & __formal) Line 741
Editor::Command::Execute(const WTF::String & parameter, blink::Event * triggering_event) Line 2956
Editor::Command::Execute(blink::Event * triggering_event) Line 2959
Editor::HandleEditingKeyboardEvent(blink::KeyboardEvent * evt) Line 54

Comment 4 by hdodda@chromium.org, May 25 2017

Cc: hdodda@chromium.org
Labels: -Needs-Bisect hasbisect-per-revision M-60
Owner: yosin@chromium.org
Status: Assigned (was: Available)
Tested the issue on windows 7 , Mac os 10.12.4 and ubutu 14.04 using chrome M58 #58.0.3029.110 and chrome canary M60 #60.0.3110.0 and issue is reproduced.

Issue is regression issue broken in M58 .

Using the per-revision bisect providing the bisect results,
Good build: 58.0.3012.0(Revision: 450199).
Bad build: 58.0.3013.0 (Revision: 450530).

You are probably looking for a change made after 450369 (known good), but no later than 450370 (first known bad).

CHANGELOG URL:

The script might not always return single CL as suspectas some perf builds might get missing due to failure.

 https://chromium.googlesource.com/chromium/src/+log/18375370aff250f59f5ef624ecf686d860377ece..d892f9592860691ae9a782c12260c94ed6bd1a63

From the CL above, assigning the issue to the concern owner 

@yosin- Could you please check whether this is caused with respect to your change, if not please help us in assigning it to the right owner.

Review-Url: https://codereview.chromium.org/2680943004

Thanks!

Comment 5 by yosin@chromium.org, May 26 2017

Owner: ----
Status: Available (was: Assigned)

Comment 6 by yosin@chromium.org, Jan 10 2018

Labels: Pri-3
Project Member

Comment 7 by sheriffbot@chromium.org, Jan 10

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Sign in to add a comment