Bug 120006

Summary: <br> does not get deleted when inlined after some non-textual content.
Product: WebKit Reporter: Arpita Bahuguna <arpitabahuguna>
Component: HTML EditingAssignee: Arpita Bahuguna <a.bah>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, darin, enrica, rniwa, simon.fraser
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Test page
none
Patch
none
Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2
none
Patch
none
Archive of layout-test-results from webkit-ews-10 for mac-mountainlion-wk2
none
Patch
rniwa: review+, buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-06 for mac-mountainlion
none
Archive of layout-test-results from webkit-ews-08 for mac-mountainlion
none
Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2 none

Arpita Bahuguna
Reported 2013-08-19 03:44:07 PDT
Created attachment 209076 [details] Test page Fetch the attached testpage and place the cursor at the start of the second line, right before "text2". Now press backspace (delete backward) so that the two lines merge. Notice that the lines do not merge and the back-delete does not have any effect.
Attachments
Test page (189 bytes, text/html)
2013-08-19 03:44 PDT, Arpita Bahuguna
no flags
Patch (26.61 KB, patch)
2013-08-19 05:03 PDT, Arpita Bahuguna
no flags
Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2 (777.55 KB, application/zip)
2013-08-19 10:31 PDT, Build Bot
no flags
Patch (6.70 KB, patch)
2013-08-22 03:51 PDT, Arpita Bahuguna
no flags
Archive of layout-test-results from webkit-ews-10 for mac-mountainlion-wk2 (633.91 KB, application/zip)
2013-08-22 05:19 PDT, Build Bot
no flags
Patch (12.65 KB, patch)
2013-08-22 06:15 PDT, Arpita Bahuguna
rniwa: review+
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-06 for mac-mountainlion (529.00 KB, application/zip)
2013-08-22 07:23 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-08 for mac-mountainlion (533.17 KB, application/zip)
2013-08-22 08:23 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-12 for mac-mountainlion-wk2 (630.64 KB, application/zip)
2013-08-22 13:59 PDT, Build Bot
no flags
Arpita Bahuguna
Comment 1 2013-08-19 05:03:35 PDT
Build Bot
Comment 2 2013-08-19 10:31:43 PDT
Comment on attachment 209078 [details] Patch Attachment 209078 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/1478937 New failing tests: editing/deleting/delete-inline-br.html
Build Bot
Comment 3 2013-08-19 10:31:44 PDT
Created attachment 209101 [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.4
Andy Estes
Comment 4 2013-08-19 11:09:18 PDT
Comment on attachment 209078 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=209078&action=review > Source/WebCore/editing/DeleteSelectionCommand.cpp:323 > - if (upstreamStartIsBR && downstreamStartIsBR && !(isStartOfBlock(positionBeforeNode(nodeAfterUpstreamStart)) && isEndOfBlock(positionAfterNode(nodeAfterUpstreamStart)))) { > + if (upstreamStartIsBR && downstreamStartIsBR && !(isStartOfBlock(positionBeforeNode(nodeAfterUpstreamStart)) && isEndOfBlock(positionAfterNode(nodeAfterDownstreamStart))) && (!nodeAfterUpstreamEnd || !(nodeAfterUpstreamEnd->previousSibling() == nodeAfterUpstreamStart))) { Just a drive-by comment: I think !(nodeAfterUpstreamEnd->previousSibling() == nodeAfterUpstreamStart) should be nodeAfterUpstreamEnd->previousSibling() != nodeAfterUpstreamStart instead.
Ryosuke Niwa
Comment 5 2013-08-19 12:39:02 PDT
Comment on attachment 209078 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=209078&action=review > Source/WebCore/ChangeLog:24 > + Added a check to verify that the inline <br> is not on an empty line if > + the end node's previous sibling is the <br> element. I don't understand this comment. If end node is a br and its previous sibling is a br, then it IS an empty line. >> Source/WebCore/editing/DeleteSelectionCommand.cpp:323 >> + if (upstreamStartIsBR && downstreamStartIsBR && !(isStartOfBlock(positionBeforeNode(nodeAfterUpstreamStart)) && isEndOfBlock(positionAfterNode(nodeAfterDownstreamStart))) && (!nodeAfterUpstreamEnd || !(nodeAfterUpstreamEnd->previousSibling() == nodeAfterUpstreamStart))) { > > Just a drive-by comment: I think !(nodeAfterUpstreamEnd->previousSibling() == nodeAfterUpstreamStart) should be nodeAfterUpstreamEnd->previousSibling() != nodeAfterUpstreamStart instead. I don't think this fix is correct. What we want to detect here is if the entire line consists of br or not.
Ryosuke Niwa
Comment 6 2013-08-19 12:40:23 PDT
Comment on attachment 209078 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=209078&action=review > LayoutTests/editing/deleting/delete-inline-br.html:15 > +function editingTest() { > + for (i = 0; i < 7; i++) { > + moveSelectionForwardByCharacterCommand(); > + } > + deleteCommand(); > +} > +</script> This should be a dump-as-markup test. There is no need for this to be a pixel test. r- because of this. > LayoutTests/platform/efl/TestExpectations:1782 > +# Needs to be rebaselined after landing patch for 120006 > +# https://bugs.webkit.org/show_bug.cgi?id=120006 > +webkit.org/b/120006 editing/deleting/delete-br-004.html [ Failure ] > +webkit.org/b/120006 editing/deleting/delete-br-005.html [ Failure ] > +webkit.org/b/120006 editing/deleting/delete-br-006.html [ Failure ] Please don't add these test expectations. Instead, land this patch and rebaseline them after the fact.
Arpita Bahuguna
Comment 7 2013-08-22 03:51:23 PDT
Arpita Bahuguna
Comment 8 2013-08-22 04:28:02 PDT
Comment on attachment 209078 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=209078&action=review >> Source/WebCore/ChangeLog:24 >> + the end node's previous sibling is the <br> element. > > I don't understand this comment. If end node is a br and its previous sibling is a br, then it IS an empty line. The end node is not a <br> is this case. Have now added an explicit check for the same. >>> Source/WebCore/editing/DeleteSelectionCommand.cpp:323 >>> + if (upstreamStartIsBR && downstreamStartIsBR && !(isStartOfBlock(positionBeforeNode(nodeAfterUpstreamStart)) && isEndOfBlock(positionAfterNode(nodeAfterDownstreamStart))) && (!nodeAfterUpstreamEnd || !(nodeAfterUpstreamEnd->previousSibling() == nodeAfterUpstreamStart))) { >> >> Just a drive-by comment: I think !(nodeAfterUpstreamEnd->previousSibling() == nodeAfterUpstreamStart) should be nodeAfterUpstreamEnd->previousSibling() != nodeAfterUpstreamStart instead. > > I don't think this fix is correct. What we want to detect here is if the entire line consists of br or not. Yes, so if the end node's previous sibling is the <br> element and we know that the <br> is inline and the end node is not another <br> element (check added now) then we can assume that the <br> is not on an empty line. (?) A similar check is done in the code before this where: bool isBROnLineByItself = upstreamStartIsBR && downstreamStartIsBR && ((nodeAfterDownstreamStart == nodeAfterUpstreamEnd) || (nodeAfterUpstreamEnd && nodeAfterUpstreamEnd->hasTagName(brTag) && nodeAfterUpstreamStart->nextSibling() == nodeAfterUpstreamEnd)); This particularly checks for the condition if we have a <br> following another <br> (<br><br>) and has the check nodeAfterUpstreamStart->nextSibling() == nodeAfterUpstreamEnd. Even for a case like: <div contenteditable="true"> <span>text1<input type="text"/><br></span>text2 </div> In this case both upstreamStart and downstreamStart will point to the <br> element and upstreamEnd will be NULL. So it will set m_startsAtEmptyLine (since my condition checks for !nodeAfterUpstreamEnd). >> LayoutTests/editing/deleting/delete-inline-br.html:15 >> +</script> > > This should be a dump-as-markup test. There is no need for this to be a pixel test. r- because of this. Have changed the layout testcase. >> LayoutTests/platform/efl/TestExpectations:1782 >> +webkit.org/b/120006 editing/deleting/delete-br-006.html [ Failure ] > > Please don't add these test expectations. Instead, land this patch and rebaseline them after the fact. Removed these from the next patch. Shall rebaseline the same after landing the patch.
Arpita Bahuguna
Comment 9 2013-08-22 04:30:25 PDT
(In reply to comment #6) > (From update of attachment 209078 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=209078&action=review > Thanks for the review Ryosuke. Have uploaded another patch as per the review comments. > > LayoutTests/editing/deleting/delete-inline-br.html:15 > > +function editingTest() { > > + for (i = 0; i < 7; i++) { > > + moveSelectionForwardByCharacterCommand(); > > + } > > + deleteCommand(); > > +} > > +</script> > > This should be a dump-as-markup test. There is no need for this to be a pixel test. r- because of this. > > > LayoutTests/platform/efl/TestExpectations:1782 > > +# Needs to be rebaselined after landing patch for 120006 > > +# https://bugs.webkit.org/show_bug.cgi?id=120006 > > +webkit.org/b/120006 editing/deleting/delete-br-004.html [ Failure ] > > +webkit.org/b/120006 editing/deleting/delete-br-005.html [ Failure ] > > +webkit.org/b/120006 editing/deleting/delete-br-006.html [ Failure ] > > Please don't add these test expectations. Instead, land this patch and rebaseline them after the fact.
Arpita Bahuguna
Comment 10 2013-08-22 04:31:11 PDT
Comment on attachment 209340 [details] Patch Expected failures: editing/deleting/delete-br-004.html editing/deleting/delete-br-005.html editing/deleting/delete-br-006.html
Arpita Bahuguna
Comment 11 2013-08-22 04:32:19 PDT
(In reply to comment #4) > (From update of attachment 209078 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=209078&action=review > Thanks for the comment Andy. Have made the suggested change. > > Source/WebCore/editing/DeleteSelectionCommand.cpp:323 > > - if (upstreamStartIsBR && downstreamStartIsBR && !(isStartOfBlock(positionBeforeNode(nodeAfterUpstreamStart)) && isEndOfBlock(positionAfterNode(nodeAfterUpstreamStart)))) { > > + if (upstreamStartIsBR && downstreamStartIsBR && !(isStartOfBlock(positionBeforeNode(nodeAfterUpstreamStart)) && isEndOfBlock(positionAfterNode(nodeAfterDownstreamStart))) && (!nodeAfterUpstreamEnd || !(nodeAfterUpstreamEnd->previousSibling() == nodeAfterUpstreamStart))) { > > Just a drive-by comment: I think !(nodeAfterUpstreamEnd->previousSibling() == nodeAfterUpstreamStart) should be nodeAfterUpstreamEnd->previousSibling() != nodeAfterUpstreamStart instead.
Build Bot
Comment 12 2013-08-22 05:19:33 PDT
Comment on attachment 209340 [details] Patch Attachment 209340 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/1426065 New failing tests: editing/deleting/delete-br-005.html editing/deleting/delete-br-006.html editing/deleting/delete-br-004.html
Build Bot
Comment 13 2013-08-22 05:19:35 PDT
Created attachment 209351 [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.4
Arpita Bahuguna
Comment 14 2013-08-22 06:15:09 PDT
Arpita Bahuguna
Comment 15 2013-08-22 06:15:37 PDT
Comment on attachment 209357 [details] Patch Patch with rebaselines for the qt port.
Build Bot
Comment 16 2013-08-22 07:23:09 PDT
Comment on attachment 209357 [details] Patch Attachment 209357 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/1545133 New failing tests: editing/deleting/delete-br-005.html editing/deleting/delete-br-006.html editing/deleting/delete-br-004.html
Build Bot
Comment 17 2013-08-22 07:23:12 PDT
Created attachment 209364 [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.4
Build Bot
Comment 18 2013-08-22 08:23:02 PDT
Comment on attachment 209357 [details] Patch Attachment 209357 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/1380576 New failing tests: editing/deleting/delete-br-005.html editing/deleting/delete-br-006.html editing/deleting/delete-br-004.html
Build Bot
Comment 19 2013-08-22 08:23:05 PDT
Created attachment 209370 [details] Archive of layout-test-results from webkit-ews-08 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-08 Port: mac-mountainlion Platform: Mac OS X 10.8.4
Build Bot
Comment 20 2013-08-22 13:59:25 PDT
Comment on attachment 209357 [details] Patch Attachment 209357 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/1528339 New failing tests: editing/deleting/delete-br-005.html editing/deleting/delete-br-006.html editing/deleting/delete-br-004.html
Build Bot
Comment 21 2013-08-22 13:59:27 PDT
Created attachment 209393 [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.4
Arpita Bahuguna
Comment 22 2013-08-26 05:41:49 PDT
Note You need to log in before you can comment on or make changes to this bug.