RESOLVED INVALID70664
positionAvoidingFirstPositionInTable seems unnecessary
https://bugs.webkit.org/show_bug.cgi?id=70664
Summary positionAvoidingFirstPositionInTable seems unnecessary
Ryosuke Niwa
Reported 2011-10-21 18:55:38 PDT
It appears that positionAvoidingFirstPositionInTable doesn't do anything. All editing tests pass without calling this function, and the bug it claimed to fix (http://trac.webkit.org/changeset/25586) doesn't reproduce without calling this function. We've probably fixed the same problem elsewhere, not realizing this has become a dead code.
Attachments
Removes the function (3.35 KB, patch)
2011-10-21 19:15 PDT, Ryosuke Niwa
no flags
Ryosuke Niwa
Comment 1 2011-10-21 19:15:31 PDT
Created attachment 112058 [details] Removes the function
Antonio Gomes
Comment 2 2011-10-22 07:24:32 PDT
Comment on attachment 112058 [details] Removes the function View in context: https://bugs.webkit.org/attachment.cgi?id=112058&action=review > Source/WebCore/editing/visible_units.cpp:-326 > - // return table offset 0 instead of the first VisiblePosition inside the table > - VisiblePosition previous = c.previous(); > - if (isLastPositionBeforeTable(previous) && isEditablePosition(previous.deepEquivalent())) > - return previous; rniwa, could you explain that this block is dead code in the changelog?
Ryosuke Niwa
Comment 3 2011-10-22 09:20:07 PDT
(In reply to comment #2) > (From update of attachment 112058 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=112058&action=review > > > Source/WebCore/editing/visible_units.cpp:-326 > > - // return table offset 0 instead of the first VisiblePosition inside the table > > - VisiblePosition previous = c.previous(); > > - if (isLastPositionBeforeTable(previous) && isEditablePosition(previous.deepEquivalent())) > > - return previous; > > rniwa, could you explain that this block is dead code in the changelog? Will do.
Ryosuke Niwa
Comment 4 2011-10-22 09:21:23 PDT
Comment on attachment 112058 [details] Removes the function View in context: https://bugs.webkit.org/attachment.cgi?id=112058&action=review >>> Source/WebCore/editing/visible_units.cpp:-326 >>> - return previous; >> >> rniwa, could you explain that this block is dead code in the changelog? > > Will do. Wait... I've already said "Remove positionAvoidingFirstPositionInTable *because it appears to be dead code*." What do you want me to add?
Kent Tamura
Comment 5 2011-10-23 18:15:40 PDT
Comment on attachment 112058 [details] Removes the function View in context: https://bugs.webkit.org/attachment.cgi?id=112058&action=review >>>> Source/WebCore/editing/visible_units.cpp:-326 >>>> - return previous; >>> >>> rniwa, could you explain that this block is dead code in the changelog? >> >> Will do. > > Wait... I've already said "Remove positionAvoidingFirstPositionInTable *because it appears to be dead code*." > > What do you want me to add? You think this function always returns 'c', don't you? So, you had better explain why this function doesn't return 'previous'.
Darin Adler
Comment 6 2011-10-23 20:45:32 PDT
Comment on attachment 112058 [details] Removes the function View in context: https://bugs.webkit.org/attachment.cgi?id=112058&action=review >>>>> Source/WebCore/editing/visible_units.cpp:-326 >>>>> - return previous; >>>> >>>> rniwa, could you explain that this block is dead code in the changelog? >>> >>> Will do. >> >> Wait... I've already said "Remove positionAvoidingFirstPositionInTable *because it appears to be dead code*." >> >> What do you want me to add? > > You think this function always returns 'c', don't you? So, you had better explain why this function doesn't return 'previous'. I believe Ryosuke’s argument is that something preserves the high level semantics of editing. I do not think he is saying that the functions here in visible_units.cpp still all behave the same. If we had unit tests for them, we probably would have to change those tests.
Antonio Gomes
Comment 7 2011-10-23 21:23:28 PDT
(In reply to comment #6) > (From update of attachment 112058 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=112058&action=review > > >>>>> Source/WebCore/editing/visible_units.cpp:-326 > >>>>> - return previous; > >>>> > >>>> rniwa, could you explain that this block is dead code in the changelog? > >>> > >>> Will do. > >> > >> Wait... I've already said "Remove positionAvoidingFirstPositionInTable *because it appears to be dead code*." > >> > >> What do you want me to add? > > > > You think this function always returns 'c', don't you? So, you had better explain why this function doesn't return 'previous'. > > I believe Ryosuke’s argument is that something preserves the high level semantics of editing. I do not think he is saying that the functions here in visible_units.cpp still all behave the same. If we had unit tests for them, we probably would have to change those tests. This is exactly what I would say could get clarified in the changelog.
Ryosuke Niwa
Comment 8 2011-10-24 11:58:28 PDT
Comment on attachment 112058 [details] Removes the function It turned out that this function IS needed. It's just that there are no tests and endOfLine has a bug this function fixes for startOfLine.
Ryosuke Niwa
Comment 9 2011-10-24 13:50:15 PDT
It turned out that this function is not necessary, it's causing a bug. Filed https://bugs.webkit.org/show_bug.cgi?id=70757 to fix it.
Note You need to log in before you can comment on or make changes to this bug.