NEW 118287
SelectAll on a page does not work if first/last element within the body is contenteditable
https://bugs.webkit.org/show_bug.cgi?id=118287
Summary SelectAll on a page does not work if first/last element within the body is co...
vanivhegde
Reported 2013-07-02 02:35:57 PDT
Created attachment 205880 [details] test.html I have attached the test html. Steps to Reproduce: Load the test html Click on SelectAll button OR do CTRL+A Expected Result: The entire page should be selected Actual Result: Page does not get selected NOTE: Please note that this happens only when the first element in body is content editable The test html source is as below: <html> <head> <script type="text/javascript">function SelectAll(){document.execCommand('selectAll', false, null);}</script> </head> <body> <div contenteditable=true>Select this text</div> <button onclick="SelectAll()">SelectAll</button> </body> </html> Had there been another div without contenteditable property set, before the contenteditable div, select all works just fine i.e. this works <body> <div>Select this text</div> <div contenteditable=true>Select this text</div> <button onclick="SelectAll()">SelectAll</button> </body>
Attachments
test.html (270 bytes, text/html)
2013-07-02 02:35 PDT, vanivhegde
no flags
Patch (4.83 KB, patch)
2013-07-02 04:49 PDT, vanivhegde
no flags
WIP Patch (4.56 KB, patch)
2013-07-02 05:11 PDT, vanivhegde
no flags
Archive of layout-test-results from webkit-ews-05 for mac-mountainlion (617.00 KB, application/zip)
2013-07-02 06:18 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-10 for mac-mountainlion-wk2 (566.41 KB, application/zip)
2013-07-02 09:10 PDT, Build Bot
no flags
Archive of layout-test-results from APPLE-EWS-1 for win-future (899.14 KB, application/zip)
2013-07-03 16:09 PDT, Build Bot
no flags
WIP Patch (6.53 KB, patch)
2013-07-08 06:21 PDT, vanivhegde
no flags
Archive of layout-test-results from webkit-ews-10 for mac-mountainlion-wk2 (490.08 KB, application/zip)
2013-07-08 08:16 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-04 for mac-mountainlion (543.40 KB, application/zip)
2013-07-08 10:04 PDT, Build Bot
no flags
Patch (15.35 KB, patch)
2013-07-09 07:38 PDT, vanivhegde
no flags
Patch (15.40 KB, patch)
2013-07-10 06:52 PDT, vanivhegde
rniwa: review-
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2 (521.36 KB, application/zip)
2013-07-10 21:02 PDT, Build Bot
no flags
Work in progress (1.62 KB, patch)
2013-09-29 01:22 PDT, Santosh Mahto
no flags
Archive of layout-test-results from webkit-ews-11 for mac-mountainlion-wk2 (473.32 KB, application/zip)
2013-09-29 02:11 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-03 for mac-mountainlion (487.91 KB, application/zip)
2013-09-29 02:31 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-05 for mac-mountainlion (487.35 KB, application/zip)
2013-09-29 03:29 PDT, Build Bot
no flags
Work in progress (2.67 KB, patch)
2013-09-29 03:36 PDT, Santosh Mahto
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-13 for mac-mountainlion-wk2 (472.58 KB, application/zip)
2013-09-29 04:49 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-01 for mac-mountainlion (490.80 KB, application/zip)
2013-09-29 05:11 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-06 for mac-mountainlion (486.70 KB, application/zip)
2013-09-29 06:08 PDT, Build Bot
no flags
vanivhegde
Comment 1 2013-07-02 04:49:06 PDT
vanivhegde
Comment 2 2013-07-02 05:11:42 PDT
Created attachment 205895 [details] WIP Patch
vanivhegde
Comment 3 2013-07-02 05:33:22 PDT
Please note that this is a WIP patch. I am looking for some inputs to arrive at the fix. Please have a look. Below are the regressions caused: Changes in VisiblePosition.cpp cause below regressions: editing/deleting/5272440.html [ Failure ] editing/execCommand/crash-indenting-list-item.html [ Failure ] editing/selection/click-outside-editable-div.html [ Failure ] Changes in VisibleSelection.cpp cause below regressions: Regressions: Unexpected image and text failures (1) editing/selection/editable-non-editable-crash.html [ Failure ] Regressions: Unexpected text-only failures (1) editing/execCommand/indent-pre-list.html [ Failure ] Changes in FrameSelection.cpp cause below regressions: editing/selection/select-all-006.html [ Failure ] editing/style/apple-style-editable-mix.html [ Failure ]
Build Bot
Comment 4 2013-07-02 06:18:35 PDT
Comment on attachment 205895 [details] WIP Patch Attachment 205895 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/1016327 New failing tests: editing/execCommand/indent-pre-list.html editing/deleting/5272440.html editing/style/apple-style-editable-mix.html editing/selection/select-all-006.html editing/execCommand/crash-indenting-list-item.html editing/selection/editable-non-editable-crash.html fast/dom/remove-body-during-body-replacement2.html editing/selection/click-outside-editable-div.html
Build Bot
Comment 5 2013-07-02 06:18:37 PDT
Created attachment 205900 [details] Archive of layout-test-results from webkit-ews-05 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-05 Port: mac-mountainlion Platform: Mac OS X 10.8.3
Build Bot
Comment 6 2013-07-02 09:10:12 PDT
Comment on attachment 205895 [details] WIP Patch Attachment 205895 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/927959 New failing tests: editing/execCommand/indent-pre-list.html editing/deleting/5272440.html editing/style/apple-style-editable-mix.html editing/selection/select-all-006.html editing/execCommand/crash-indenting-list-item.html editing/selection/editable-non-editable-crash.html fast/dom/remove-body-during-body-replacement2.html editing/selection/click-outside-editable-div.html
Build Bot
Comment 7 2013-07-02 09:10:14 PDT
Created attachment 205921 [details] Archive of layout-test-results from webkit-ews-10 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-10 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.3
Build Bot
Comment 8 2013-07-03 16:09:01 PDT
Comment on attachment 205895 [details] WIP Patch Attachment 205895 [details] did not pass win-ews (win): Output: http://webkit-queues.appspot.com/results/1024180 New failing tests: editing/execCommand/indent-pre-list.html editing/deleting/5272440.html editing/execCommand/crash-indenting-list-item.html editing/selection/editable-non-editable-crash.html fast/dom/remove-body-during-body-replacement2.html editing/selection/click-outside-editable-div.html
Build Bot
Comment 9 2013-07-03 16:09:04 PDT
Created attachment 206033 [details] Archive of layout-test-results from APPLE-EWS-1 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: APPLE-EWS-1 Port: win-future Platform: CYGWIN_NT-6.1-WOW64-1.7.20-0.266-5-3-i686-32bit
vanivhegde
Comment 10 2013-07-08 06:21:54 PDT
Created attachment 206238 [details] WIP Patch
Build Bot
Comment 11 2013-07-08 08:16:08 PDT
Comment on attachment 206238 [details] WIP Patch Attachment 206238 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/1008172 New failing tests: fullscreen/full-screen-iframe-with-max-width-height.html editing/execCommand/crash-indenting-list-item.html
Build Bot
Comment 12 2013-07-08 08:16:10 PDT
Created attachment 206246 [details] Archive of layout-test-results from webkit-ews-10 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-10 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.3
Build Bot
Comment 13 2013-07-08 10:04:36 PDT
Comment on attachment 206238 [details] WIP Patch Attachment 206238 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/1037148 New failing tests: editing/execCommand/crash-indenting-list-item.html
Build Bot
Comment 14 2013-07-08 10:04:39 PDT
Created attachment 206256 [details] Archive of layout-test-results from webkit-ews-04 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-04 Port: mac-mountainlion Platform: Mac OS X 10.8.3
vanivhegde
Comment 15 2013-07-09 07:38:36 PDT
vanivhegde
Comment 16 2013-07-10 06:52:01 PDT
Build Bot
Comment 17 2013-07-10 21:02:10 PDT
Comment on attachment 206388 [details] Patch Attachment 206388 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/881989 New failing tests: fullscreen/full-screen-iframe-with-max-width-height.html
Build Bot
Comment 18 2013-07-10 21:02:13 PDT
Created attachment 206425 [details] Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-12 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.3
vanivhegde
Comment 19 2013-07-11 04:50:43 PDT
fullscreen/full-screen-iframe-with-max-width-height.html This doesn't seems to be a failure related to editing. This is found to be flacky even in the latest revision 152561. Seems like this exists since r152434 Reference: http://build.webkit.org/TestFailures/#/Apple MountainLion Release WK2 (Tests)
Ryosuke Niwa
Comment 20 2013-07-11 21:04:43 PDT
Comment on attachment 206388 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=206388&action=review > Source/WebCore/ChangeLog:20 > + Also, executing selectAll without focusing anywhere on the page > + should not set focus on a contenteditable element if it happens to be > + the first/last element within the body. This should be fixed as a separate bug. r- because due to this unrelated change. > Source/WebCore/editing/VisiblePosition.cpp:557 > + // If the html element is non-editable and next/previous candidates have editable roots, > + // then consider them to be in same editable element > + if (!editingRoot && node && node->hasTagName(htmlTag)) { > + prevIsInSameEditableElement = prevNode && !prevNode->isRootEditableElement(); > + nextIsInSameEditableElement = nextNode && !nextNode->isRootEditableElement(); > + } else { Why? This is what comment, which is obvious from the code. We need to explain why we do this. In fact, this doesn't look right. > Source/WebCore/editing/VisibleSelection.cpp:567 > + // If selection start & end positions are first & last elements of the body respectively, > + // it means the entire page is selected. No adjustments required. Doesn't. You can make head element visible. You can also insert a random element before/after body and make it editable. r- because of this wrong assumption as well.
Santosh Mahto
Comment 21 2013-09-29 01:22:37 PDT
Created attachment 212918 [details] Work in progress
Build Bot
Comment 22 2013-09-29 02:11:31 PDT
Comment on attachment 212918 [details] Work in progress Attachment 212918 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/2740086 New failing tests: editing/execCommand/crash-indenting-list-item.html editing/selection/click-outside-editable-div.html
Build Bot
Comment 23 2013-09-29 02:11:33 PDT
Created attachment 212919 [details] Archive of layout-test-results from webkit-ews-11 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-11 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Build Bot
Comment 24 2013-09-29 02:31:32 PDT
Comment on attachment 212918 [details] Work in progress Attachment 212918 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/2691097 New failing tests: editing/execCommand/crash-indenting-list-item.html editing/selection/click-outside-editable-div.html
Build Bot
Comment 25 2013-09-29 02:31:34 PDT
Created attachment 212920 [details] Archive of layout-test-results from webkit-ews-03 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-03 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Build Bot
Comment 26 2013-09-29 03:29:36 PDT
Comment on attachment 212918 [details] Work in progress Attachment 212918 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/2716149 New failing tests: editing/execCommand/crash-indenting-list-item.html editing/selection/click-outside-editable-div.html
Build Bot
Comment 27 2013-09-29 03:29:39 PDT
Created attachment 212921 [details] Archive of layout-test-results from webkit-ews-05 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-05 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Santosh Mahto
Comment 28 2013-09-29 03:36:00 PDT
Created attachment 212922 [details] Work in progress
Build Bot
Comment 29 2013-09-29 04:49:43 PDT
Comment on attachment 212922 [details] Work in progress Attachment 212922 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/2703042 New failing tests: editing/execCommand/crash-indenting-list-item.html editing/selection/click-outside-editable-div.html
Build Bot
Comment 30 2013-09-29 04:49:45 PDT
Created attachment 212923 [details] Archive of layout-test-results from webkit-ews-13 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-13 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Build Bot
Comment 31 2013-09-29 05:11:10 PDT
Comment on attachment 212922 [details] Work in progress Attachment 212922 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/2755005 New failing tests: editing/execCommand/crash-indenting-list-item.html editing/selection/click-outside-editable-div.html
Build Bot
Comment 32 2013-09-29 05:11:13 PDT
Created attachment 212924 [details] Archive of layout-test-results from webkit-ews-01 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-01 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Build Bot
Comment 33 2013-09-29 06:08:37 PDT
Comment on attachment 212922 [details] Work in progress Attachment 212922 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/2760017 New failing tests: editing/execCommand/crash-indenting-list-item.html editing/selection/click-outside-editable-div.html
Build Bot
Comment 34 2013-09-29 06:08:42 PDT
Created attachment 212927 [details] Archive of layout-test-results from webkit-ews-06 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-06 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Ryosuke Niwa
Comment 35 2013-09-29 20:21:54 PDT
Could you please make sure the following two tests pass with your patch BEFORE uploading it here? editing/execCommand/crash-indenting-list-item.html editing/selection/click-outside-editable-div.html It has been very noisy due to these test failures.
Ahmad Saleem
Comment 36 2023-06-17 18:09:24 PDT
Changing status to 'New', I am able to reproduce this bug in Safari Technology Preview 172 using attached test case from Comment 0 and 'Select All' does not show selection across text while Chrome Canary 116 and Firefox Nightly 116 works fine.
Note You need to log in before you can comment on or make changes to this bug.