Unfortunately we can't do that right now... See the experiment results here: https://codereview.chromium.org/2623103003 Also see your notes in computeSelectionType(): https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/editing/VisibleSelection.cpp?rcl=0&l=81
http://crrev.com/1958093002, On-demand selection canonicalization should solve this.
Issue 679680 has been merged into this issue.
Thanks for taking it. There are some other cases unrelated to selection update, which should be easier to handle. I'll try handling them.
Other than FrameSelection, the followings also call the two functions with dirty layout: CompositeEditCommand::positionAvoidingSpecialElementBoundary InsertListCommand::listifyParagraph InsertParagraphSeparatorCommand::doApply
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/9438f509f344dd4ded216be3c38505c09f35922d commit 9438f509f344dd4ded216be3c38505c09f35922d Author: xiaochengh <xiaochengh@chromium.org> Date: Thu Jan 12 11:07:22 2017 Update layout for mostForward/BackwardCaretPosition in editing/commands mostForward/BackwardCaretPosition should be, but are currently not, called with clean layout. This patch ensures that they are called with clean layout at several places in editing/commands BUG= 679991 Review-Url: https://codereview.chromium.org/2628693003 Cr-Commit-Position: refs/heads/master@{#443206} [modify] https://crrev.com/9438f509f344dd4ded216be3c38505c09f35922d/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp [modify] https://crrev.com/9438f509f344dd4ded216be3c38505c09f35922d/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp [modify] https://crrev.com/9438f509f344dd4ded216be3c38505c09f35922d/third_party/WebKit/Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/157413286770a7ac5a24c446a30c08f749738276 commit 157413286770a7ac5a24c446a30c08f749738276 Author: yosin <yosin@chromium.org> Date: Mon Feb 13 10:55:13 2017 Make FrameSelection to hold non-canonicalized DOM positions This patch makes |FrameSelection| to hold non-canonicalized DOM positions in |SelectionEditor| to align Selection API specification[1] for improving interoperatbility[2]. Before this patch we holds selection as |VisibleSelection| as canonicalized DOM positions. This behavior is not align with Selection API specification[1] then the most complained issue of Blink from editing-tf@w3c. The heart of this patch is holding selection as |SelectionInDOMTree| and compute |VisibleSelection| on-demand with cache of computed |VisibleSelection|. |VisibleSelection| cache is invalidate each DOM tree change and style change since canonicalization referes CSS style properties, e.g display, visibility, -webkit-user-modify, etc, and layout dimension. |SelectionEditor| utilizes |SynchronousMutationObserver| to relocate |m_selectionInDOMTree| instead of |FrameSelection|. Before this patch |FrameSelection| relocates |VisibleSelection| with dirty layout tree then sets |FrameSelection::setSelection()|. To void cyclic reference between |FrameSelection| and |SelectionEditor|, we could not move relocation part to |SelectionEditor|. This patch also updates |FrameSelection::updatePostionAfterAdoptingTextNodesMerged()| to handle |PositonAnchorType|. # Highlight of changes ## FrameCaret - Compute caret position after "layout clean" rather than each selection change to align rendering pipeline. ## CharacterData Changes timing of notifying character data update for ease of relocation of positions. ## FrameSelection - Move |m_isHandleVisible| to |SelectionInDOMTree| as follow-up of [5]. - Move selection relocation to |SelectionEditor|; following patch will move implementations to "SelectionEditor.cpp" ## SelecitonEdtior - Make it to hold |SelectionInDOMTree| with relocation at DOM mutation. - Caching |VisibleSelection| # Brief description of test expectation changes: ## ImeTest.java: This patch gets rid of redundant selection change event from - |testImePaste|, - |testContentEditableEvents_DeleteSurroundingText| - |testInputTextEvents_DeleteSurroundingText| ## LayoutTests Before this patch, Blink uses |VisibleSelection| when it sets even if style and layout changed. This is wrong and unexpected behavior since positions in |VisibleSelection| can no longer be canonicalized positions. This patch changes this behavior to return "sane" canonicalized positions with clean style and layout tree. This patch is the result of many attempts. Previous changes can be found in [3][4]. [1] https://www.w3.org/TR/selection-api/ W3C Selection API [2] https://goo.gl/9v1zOK Improving Interoperatbility of Selection [3] http://crrev.com/1958093002 [4] http://crrev.com/2637013002 [5] http://crrev.com/2651803007 Added isHandleVisible to |SelectionTemplate| BUG= 139552 , 603684 , 605499 , 606499 , 625533 , 644648 , 679991 TEST=See changes in this patch CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Review-Url: https://codereview.chromium.org/2680943004 Cr-Commit-Position: refs/heads/master@{#449928} [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/TestExpectations [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/editing/execCommand/crash-indenting-list-item.html [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/editing/execCommand/crash-inserting-list.html [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/editing/execCommand/format-block-multiple-paragraphs-in-pre.html [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/editing/execCommand/remove_format_and_extract_contents.html [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/editing/selection/character-data-mutation.html [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/editing/selection/document-mutation.html [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/editing/selection/select_all/select_all_details_crash.html [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/editing/selection/select_all/select_all_iframe_crash.html [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/editing/selection/selection_remove_children.html [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/editing/style/justify-left-crash.html [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/editing/undo/redo-selection-modify-crash.html [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/fast/dom/delete-contents.html [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/fast/dom/shadow/selection-in-nested-shadow.html [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/fast/dynamic/move-node-with-selection.html [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/fast/events/drag_and_drop_into_removed_on_focus.html [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/images/element-gcd-while-generating-alt-content-expected.txt [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/platform/mac/fast/css/first-letter-rtc-crash-expected.txt [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/platform/win/fast/css/first-letter-rtc-crash-expected.txt [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/LayoutTests/svg/foreignObject/viewport-foreignobject-crash-expected.html [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/Source/core/editing/FrameCaret.cpp [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/Source/core/editing/FrameCaret.h [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/Source/core/editing/FrameSelection.cpp [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/Source/core/editing/FrameSelection.h [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/Source/core/editing/SelectionEditor.cpp [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/Source/core/editing/SelectionEditor.h [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/Source/core/editing/VisibleSelection.cpp [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/Source/core/frame/FrameView.cpp [modify] https://crrev.com/157413286770a7ac5a24c446a30c08f749738276/third_party/WebKit/Source/core/page/FocusController.cpp
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/47591962f15392d4af5eb1f69f3b79a8e2990947 commit 47591962f15392d4af5eb1f69f3b79a8e2990947 Author: gcasto <gcasto@chromium.org> Date: Mon Feb 13 18:25:57 2017 Revert of Make FrameSelection to hold non-canonicalized positions (patchset #9 id:180001 of https://codereview.chromium.org/2680943004/ ) Reason for revert: This patch looks like it is causing failures in editing/execCommand/move-up-down-should-skip-hidden-elements.html on Windows 7 (https://uberchromegw.corp.google.com/i/chromium.webkit/builders/WebKit%20Win7%20%28dbg%29). Original issue's description: > Make FrameSelection to hold non-canonicalized DOM positions > > This patch makes |FrameSelection| to hold non-canonicalized DOM positions in > |SelectionEditor| to align Selection API specification[1] for improving > interoperatbility[2]. > > Before this patch we holds selection as |VisibleSelection| as canonicalized > DOM positions. This behavior is not align with Selection API specification[1] > then the most complained issue of Blink from editing-tf@w3c. > > The heart of this patch is holding selection as |SelectionInDOMTree| and > compute |VisibleSelection| on-demand with cache of computed |VisibleSelection|. > > |VisibleSelection| cache is invalidate each DOM tree change and style change > since canonicalization referes CSS style properties, e.g display, visibility, > -webkit-user-modify, etc, and layout dimension. > > |SelectionEditor| utilizes |SynchronousMutationObserver| to relocate > |m_selectionInDOMTree| instead of |FrameSelection|. Before this patch > |FrameSelection| relocates |VisibleSelection| with dirty layout tree then > sets |FrameSelection::setSelection()|. To void cyclic reference between > |FrameSelection| and |SelectionEditor|, we could not move relocation part to > |SelectionEditor|. > > This patch also updates > |FrameSelection::updatePostionAfterAdoptingTextNodesMerged()| to handle > |PositonAnchorType|. > > # Highlight of changes > ## FrameCaret > - Compute caret position after "layout clean" rather than each selection change > to align rendering pipeline. > > ## CharacterData > Changes timing of notifying character data update for ease of relocation of > positions. > > ## FrameSelection > - Move |m_isHandleVisible| to |SelectionInDOMTree| as follow-up of [5]. > - Move selection relocation to |SelectionEditor|; following patch will move > implementations to "SelectionEditor.cpp" > > ## SelecitonEdtior > - Make it to hold |SelectionInDOMTree| with relocation at DOM mutation. > - Caching |VisibleSelection| > > # Brief description of test expectation changes: > ## ImeTest.java: > This patch gets rid of redundant selection change event from > - |testImePaste|, > - |testContentEditableEvents_DeleteSurroundingText| > - |testInputTextEvents_DeleteSurroundingText| > > ## LayoutTests > Before this patch, Blink uses |VisibleSelection| when it sets even if style and > layout changed. This is wrong and unexpected behavior since positions in > |VisibleSelection| can no longer be canonicalized positions. This patch changes > this behavior to return "sane" canonicalized positions with clean style and > layout tree. > > This patch is the result of many attempts. Previous changes can be found in > [3][4]. > > [1] https://www.w3.org/TR/selection-api/ W3C Selection API > [2] https://goo.gl/9v1zOK Improving Interoperatbility of Selection > [3] http://crrev.com/1958093002 > [4] http://crrev.com/2637013002 > [5] http://crrev.com/2651803007 Added isHandleVisible to |SelectionTemplate| > > BUG= 139552 , 603684 , 605499 , 606499 , 625533 , 644648 , 679991 > TEST=See changes in this patch > CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 > > Review-Url: https://codereview.chromium.org/2680943004 > Cr-Commit-Position: refs/heads/master@{#449928} > Committed: https://chromium.googlesource.com/chromium/src/+/157413286770a7ac5a24c446a30c08f749738276 TBR=tkent@chromium.org,changwan@chromium.org,xiaochengh@chromium.org,yoichio@chromium.org,yosin@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG= 139552 , 603684 , 605499 , 606499 , 625533 , 644648 , 679991 Review-Url: https://codereview.chromium.org/2694823002 Cr-Commit-Position: refs/heads/master@{#450018} [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/editing/execCommand/crash-indenting-list-item.html [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/editing/execCommand/crash-inserting-list.html [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/editing/execCommand/format-block-multiple-paragraphs-in-pre.html [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/editing/execCommand/remove_format_and_extract_contents.html [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/editing/selection/character-data-mutation.html [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/editing/selection/document-mutation.html [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/editing/selection/select_all/select_all_details_crash.html [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/editing/selection/select_all/select_all_iframe_crash.html [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/editing/selection/selection_remove_children.html [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/editing/style/justify-left-crash.html [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/editing/undo/redo-selection-modify-crash.html [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/fast/dom/delete-contents.html [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/fast/dom/shadow/selection-in-nested-shadow.html [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/fast/dynamic/move-node-with-selection.html [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/fast/events/drag_and_drop_into_removed_on_focus.html [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/images/element-gcd-while-generating-alt-content-expected.txt [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/platform/mac/fast/css/first-letter-rtc-crash-expected.txt [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/platform/win/fast/css/first-letter-rtc-crash-expected.txt [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/LayoutTests/svg/foreignObject/viewport-foreignobject-crash-expected.html [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/Source/core/editing/FrameCaret.cpp [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/Source/core/editing/FrameCaret.h [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/Source/core/editing/FrameSelection.cpp [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/Source/core/editing/FrameSelection.h [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/Source/core/editing/SelectionEditor.cpp [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/Source/core/editing/SelectionEditor.h [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/Source/core/editing/VisibleSelection.cpp [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/Source/core/frame/FrameView.cpp [modify] https://crrev.com/47591962f15392d4af5eb1f69f3b79a8e2990947/third_party/WebKit/Source/core/page/FocusController.cpp
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/17c84b2b6519c821dc319e79f2a7a4508508e20f commit 17c84b2b6519c821dc319e79f2a7a4508508e20f Author: yosin <yosin@chromium.org> Date: Tue Feb 14 06:34:37 2017 Make FrameSelection to hold non-canonicalized DOM positions This patch makes |FrameSelection| to hold non-canonicalized DOM positions in |SelectionEditor| to align Selection API specification[1] for improving interoperatbility[2]. Before this patch we holds selection as |VisibleSelection| as canonicalized DOM positions. This behavior is not align with Selection API specification[1] then the most complained issue of Blink from editing-tf@w3c. The heart of this patch is holding selection as |SelectionInDOMTree| and compute |VisibleSelection| on-demand with cache of computed |VisibleSelection|. |VisibleSelection| cache is invalidate each DOM tree change and style change since canonicalization referes CSS style properties, e.g display, visibility, -webkit-user-modify, etc, and layout dimension. |SelectionEditor| utilizes |SynchronousMutationObserver| to relocate |m_selectionInDOMTree| instead of |FrameSelection|. Before this patch |FrameSelection| relocates |VisibleSelection| with dirty layout tree then sets |FrameSelection::setSelection()|. To void cyclic reference between |FrameSelection| and |SelectionEditor|, we could not move relocation part to |SelectionEditor|. This patch also updates |FrameSelection::updatePostionAfterAdoptingTextNodesMerged()| to handle |PositonAnchorType|. # Highlight of changes ## FrameCaret - Compute caret position after "layout clean" rather than each selection change to align rendering pipeline. ## CharacterData Changes timing of notifying character data update for ease of relocation of positions. ## FrameSelection - Move |m_isHandleVisible| to |SelectionInDOMTree| as follow-up of [5]. - Move selection relocation to |SelectionEditor|; following patch will move implementations to "SelectionEditor.cpp" ## SelecitonEdtior - Make it to hold |SelectionInDOMTree| with relocation at DOM mutation. - Caching |VisibleSelection| # Brief description of test expectation changes: ## ImeTest.java: This patch gets rid of redundant selection change event from - |testImePaste|, - |testContentEditableEvents_DeleteSurroundingText| - |testInputTextEvents_DeleteSurroundingText| ## LayoutTests Before this patch, Blink uses |VisibleSelection| when it sets even if style and layout changed. This is wrong and unexpected behavior since positions in |VisibleSelection| can no longer be canonicalized positions. This patch changes this behavior to return "sane" canonicalized positions with clean style and layout tree. This patch is the result of many attempts. Previous changes can be found in [3][4]. [1] https://www.w3.org/TR/selection-api/ W3C Selection API [2] https://goo.gl/9v1zOK Improving Interoperatbility of Selection [3] http://crrev.com/1958093002 [4] http://crrev.com/2637013002 [5] http://crrev.com/2651803007 Added isHandleVisible to |SelectionTemplate| BUG= 139552 , 603684 , 605499 , 606499 , 625533 , 644648 , 679991 TEST=See changes in this patch CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Review-Url: https://codereview.chromium.org/2680943004 Cr-Original-Commit-Position: refs/heads/master@{#449928} Committed: https://chromium.googlesource.com/chromium/src/+/157413286770a7ac5a24c446a30c08f749738276 Review-Url: https://codereview.chromium.org/2680943004 Cr-Commit-Position: refs/heads/master@{#450280} [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/TestExpectations [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/editing/execCommand/crash-indenting-list-item.html [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/editing/execCommand/crash-inserting-list.html [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/editing/execCommand/format-block-multiple-paragraphs-in-pre.html [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/editing/execCommand/remove_format_and_extract_contents.html [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/editing/selection/character-data-mutation.html [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/editing/selection/document-mutation.html [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/editing/selection/select_all/select_all_details_crash.html [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/editing/selection/select_all/select_all_iframe_crash.html [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/editing/selection/selection_remove_children.html [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/editing/style/justify-left-crash.html [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/editing/undo/redo-selection-modify-crash.html [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/fast/dom/delete-contents.html [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/fast/dom/shadow/selection-in-nested-shadow.html [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/fast/dynamic/move-node-with-selection.html [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/fast/events/drag_and_drop_into_removed_on_focus.html [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/images/element-gcd-while-generating-alt-content-expected.txt [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/platform/mac/fast/css/first-letter-rtc-crash-expected.txt [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/platform/win/fast/css/first-letter-rtc-crash-expected.txt [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/LayoutTests/svg/foreignObject/viewport-foreignobject-crash-expected.html [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/Source/core/editing/FrameCaret.cpp [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/Source/core/editing/FrameCaret.h [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/Source/core/editing/FrameSelection.cpp [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/Source/core/editing/FrameSelection.h [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/Source/core/editing/SelectionEditor.cpp [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/Source/core/editing/SelectionEditor.h [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/Source/core/editing/VisibleSelection.cpp [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/Source/core/frame/FrameView.cpp [modify] https://crrev.com/17c84b2b6519c821dc319e79f2a7a4508508e20f/third_party/WebKit/Source/core/page/FocusController.cpp
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/8f2a1baf12aa71d59d72e24583983b8a6b78340a commit 8f2a1baf12aa71d59d72e24583983b8a6b78340a Author: tyoshino <tyoshino@chromium.org> Date: Tue Feb 14 08:18:39 2017 Revert of Make FrameSelection to hold non-canonicalized positions (patchset #9 id:180001 of https://codereview.chromium.org/2680943004/ ) Reason for revert: See https://codereview.chromium.org/2680943004/#msg70 Original issue's description: > Make FrameSelection to hold non-canonicalized DOM positions > > This patch makes |FrameSelection| to hold non-canonicalized DOM positions in > |SelectionEditor| to align Selection API specification[1] for improving > interoperatbility[2]. > > Before this patch we holds selection as |VisibleSelection| as canonicalized > DOM positions. This behavior is not align with Selection API specification[1] > then the most complained issue of Blink from editing-tf@w3c. > > The heart of this patch is holding selection as |SelectionInDOMTree| and > compute |VisibleSelection| on-demand with cache of computed |VisibleSelection|. > > |VisibleSelection| cache is invalidate each DOM tree change and style change > since canonicalization referes CSS style properties, e.g display, visibility, > -webkit-user-modify, etc, and layout dimension. > > |SelectionEditor| utilizes |SynchronousMutationObserver| to relocate > |m_selectionInDOMTree| instead of |FrameSelection|. Before this patch > |FrameSelection| relocates |VisibleSelection| with dirty layout tree then > sets |FrameSelection::setSelection()|. To void cyclic reference between > |FrameSelection| and |SelectionEditor|, we could not move relocation part to > |SelectionEditor|. > > This patch also updates > |FrameSelection::updatePostionAfterAdoptingTextNodesMerged()| to handle > |PositonAnchorType|. > > # Highlight of changes > ## FrameCaret > - Compute caret position after "layout clean" rather than each selection change > to align rendering pipeline. > > ## CharacterData > Changes timing of notifying character data update for ease of relocation of > positions. > > ## FrameSelection > - Move |m_isHandleVisible| to |SelectionInDOMTree| as follow-up of [5]. > - Move selection relocation to |SelectionEditor|; following patch will move > implementations to "SelectionEditor.cpp" > > ## SelecitonEdtior > - Make it to hold |SelectionInDOMTree| with relocation at DOM mutation. > - Caching |VisibleSelection| > > # Brief description of test expectation changes: > ## ImeTest.java: > This patch gets rid of redundant selection change event from > - |testImePaste|, > - |testContentEditableEvents_DeleteSurroundingText| > - |testInputTextEvents_DeleteSurroundingText| > > ## LayoutTests > Before this patch, Blink uses |VisibleSelection| when it sets even if style and > layout changed. This is wrong and unexpected behavior since positions in > |VisibleSelection| can no longer be canonicalized positions. This patch changes > this behavior to return "sane" canonicalized positions with clean style and > layout tree. > > This patch is the result of many attempts. Previous changes can be found in > [3][4]. > > [1] https://www.w3.org/TR/selection-api/ W3C Selection API > [2] https://goo.gl/9v1zOK Improving Interoperatbility of Selection > [3] http://crrev.com/1958093002 > [4] http://crrev.com/2637013002 > [5] http://crrev.com/2651803007 Added isHandleVisible to |SelectionTemplate| > > BUG= 139552 , 603684 , 605499 , 606499 , 625533 , 644648 , 679991 > TEST=See changes in this patch > CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 > > Review-Url: https://codereview.chromium.org/2680943004 > Cr-Original-Commit-Position: refs/heads/master@{#449928} > Committed: https://chromium.googlesource.com/chromium/src/+/157413286770a7ac5a24c446a30c08f749738276 > Review-Url: https://codereview.chromium.org/2680943004 > Cr-Commit-Position: refs/heads/master@{#450280} > Committed: https://chromium.googlesource.com/chromium/src/+/17c84b2b6519c821dc319e79f2a7a4508508e20f TBR=changwan@chromium.org,tkent@chromium.org,xiaochengh@chromium.org,yoichio@chromium.org,yosin@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG= 139552 , 603684 , 605499 , 606499 , 625533 , 644648 , 679991 Review-Url: https://codereview.chromium.org/2691243002 Cr-Commit-Position: refs/heads/master@{#450291} [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/TestExpectations [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/editing/execCommand/crash-indenting-list-item.html [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/editing/execCommand/crash-inserting-list.html [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/editing/execCommand/format-block-multiple-paragraphs-in-pre.html [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/editing/execCommand/remove_format_and_extract_contents.html [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/editing/selection/character-data-mutation.html [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/editing/selection/document-mutation.html [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/editing/selection/select_all/select_all_details_crash.html [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/editing/selection/select_all/select_all_iframe_crash.html [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/editing/selection/selection_remove_children.html [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/editing/style/justify-left-crash.html [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/editing/undo/redo-selection-modify-crash.html [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/fast/dom/delete-contents.html [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/fast/dom/shadow/selection-in-nested-shadow.html [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/fast/dynamic/move-node-with-selection.html [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/fast/events/drag_and_drop_into_removed_on_focus.html [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/images/element-gcd-while-generating-alt-content-expected.txt [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/platform/mac/fast/css/first-letter-rtc-crash-expected.txt [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/platform/win/fast/css/first-letter-rtc-crash-expected.txt [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/LayoutTests/svg/foreignObject/viewport-foreignobject-crash-expected.html [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/Source/core/editing/FrameCaret.cpp [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/Source/core/editing/FrameCaret.h [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/Source/core/editing/FrameSelection.cpp [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/Source/core/editing/FrameSelection.h [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/Source/core/editing/SelectionEditor.cpp [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/Source/core/editing/SelectionEditor.h [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/Source/core/editing/VisibleSelection.cpp [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/Source/core/frame/FrameView.cpp [modify] https://crrev.com/8f2a1baf12aa71d59d72e24583983b8a6b78340a/third_party/WebKit/Source/core/page/FocusController.cpp
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/d892f9592860691ae9a782c12260c94ed6bd1a63 commit d892f9592860691ae9a782c12260c94ed6bd1a63 Author: yosin <yosin@chromium.org> Date: Tue Feb 14 15:56:00 2017 Make FrameSelection to hold non-canonicalized DOM positions This patch makes |FrameSelection| to hold non-canonicalized DOM positions in |SelectionEditor| to align Selection API specification[1] for improving interoperatbility[2]. Before this patch we holds selection as |VisibleSelection| as canonicalized DOM positions. This behavior is not align with Selection API specification[1] then the most complained issue of Blink from editing-tf@w3c. The heart of this patch is holding selection as |SelectionInDOMTree| and compute |VisibleSelection| on-demand with cache of computed |VisibleSelection|. |VisibleSelection| cache is invalidate each DOM tree change and style change since canonicalization referes CSS style properties, e.g display, visibility, -webkit-user-modify, etc, and layout dimension. |SelectionEditor| utilizes |SynchronousMutationObserver| to relocate |m_selectionInDOMTree| instead of |FrameSelection|. Before this patch |FrameSelection| relocates |VisibleSelection| with dirty layout tree then sets |FrameSelection::setSelection()|. To void cyclic reference between |FrameSelection| and |SelectionEditor|, we could not move relocation part to |SelectionEditor|. This patch also updates |FrameSelection::updatePostionAfterAdoptingTextNodesMerged()| to handle |PositonAnchorType|. # Highlight of changes ## FrameCaret - Compute caret position after "layout clean" rather than each selection change to align rendering pipeline. ## CharacterData Changes timing of notifying character data update for ease of relocation of positions. ## FrameSelection - Move |m_isHandleVisible| to |SelectionInDOMTree| as follow-up of [5]. - Move selection relocation to |SelectionEditor|; following patch will move implementations to "SelectionEditor.cpp" ## SelecitonEdtior - Make it to hold |SelectionInDOMTree| with relocation at DOM mutation. - Caching |VisibleSelection| # Brief description of test expectation changes: ## ImeTest.java: This patch gets rid of redundant selection change event from - |testImePaste|, - |testContentEditableEvents_DeleteSurroundingText| - |testInputTextEvents_DeleteSurroundingText| ## LayoutTests Before this patch, Blink uses |VisibleSelection| when it sets even if style and layout changed. This is wrong and unexpected behavior since positions in |VisibleSelection| can no longer be canonicalized positions. This patch changes this behavior to return "sane" canonicalized positions with clean style and layout tree. This patch is the result of many attempts. Previous changes can be found in [3][4]. [1] https://www.w3.org/TR/selection-api/ W3C Selection API [2] https://goo.gl/9v1zOK Improving Interoperatbility of Selection [3] http://crrev.com/1958093002 [4] http://crrev.com/2637013002 [5] http://crrev.com/2651803007 Added isHandleVisible to |SelectionTemplate| BUG= 139552 , 603684 , 605499 , 606499 , 625533 , 644648 , 679991 TEST=See changes in this patch CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Review-Url: https://codereview.chromium.org/2680943004 Cr-Original-Original-Commit-Position: refs/heads/master@{#449928} Committed: https://chromium.googlesource.com/chromium/src/+/157413286770a7ac5a24c446a30c08f749738276 Review-Url: https://codereview.chromium.org/2680943004 Cr-Original-Commit-Position: refs/heads/master@{#450280} Committed: https://chromium.googlesource.com/chromium/src/+/17c84b2b6519c821dc319e79f2a7a4508508e20f Review-Url: https://codereview.chromium.org/2680943004 Cr-Commit-Position: refs/heads/master@{#450370} [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/TestExpectations [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/editing/deleting/delete-br-001-expected.txt [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/editing/deleting/delete-br-001.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/editing/deleting/delete-character-003-expected.txt [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/editing/deleting/delete-character-003.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/editing/execCommand/crash-indenting-list-item.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/editing/execCommand/crash-inserting-list.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/editing/execCommand/format-block-multiple-paragraphs-in-pre.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/editing/execCommand/remove_format_and_extract_contents.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/editing/selection/character-data-mutation.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/editing/selection/document-mutation.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/editing/selection/select_all/select_all_details_crash.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/editing/selection/select_all/select_all_iframe_crash.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/editing/selection/selection_remove_children.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/editing/style/justify-left-crash.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/editing/undo/redo-selection-modify-crash.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/external/wpt/selection/collapse-00-expected.txt [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/external/wpt/selection/collapse-30-expected.txt [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/external/wpt/selection/collapseToStartEnd-expected.txt [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/fast/dom/delete-contents.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/fast/dom/shadow/selection-in-nested-shadow.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/fast/dynamic/move-node-with-selection.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/fast/events/drag_and_drop_into_removed_on_focus.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/images/element-gcd-while-generating-alt-content-expected.txt [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/platform/mac/fast/css/first-letter-rtc-crash-expected.txt [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/platform/win/fast/css/first-letter-rtc-crash-expected.txt [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/LayoutTests/svg/foreignObject/viewport-foreignobject-crash-expected.html [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/Source/core/editing/FrameCaret.cpp [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/Source/core/editing/FrameCaret.h [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/Source/core/editing/FrameSelection.cpp [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/Source/core/editing/FrameSelection.h [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/Source/core/editing/SelectionEditor.cpp [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/Source/core/editing/SelectionEditor.h [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/Source/core/editing/VisibleSelection.cpp [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/Source/core/frame/FrameView.cpp [modify] https://crrev.com/d892f9592860691ae9a782c12260c94ed6bd1a63/third_party/WebKit/Source/core/page/FocusController.cpp
Oops, I filed another bug 694413 . :-<
Comment 1 by yosin@chromium.org
, Jan 11 2017Owner: yosin@chromium.org
Status: Started (was: Available)