Bug 213536 - Cannot delete last line of Mail Message
Summary: Cannot delete last line of Mail Message
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Megan Gardner
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-06-23 16:07 PDT by Megan Gardner
Modified: 2020-06-25 13:58 PDT (History)
6 users (show)

See Also:


Attachments
Patch (7.99 KB, patch)
2020-06-23 16:16 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (7.96 KB, patch)
2020-06-23 18:00 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (7.96 KB, patch)
2020-06-23 19:01 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (7.51 KB, patch)
2020-06-23 22:29 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (11.14 KB, patch)
2020-06-24 11:59 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (11.21 KB, patch)
2020-06-24 12:00 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (11.43 KB, patch)
2020-06-24 12:16 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (11.36 KB, patch)
2020-06-24 14:33 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (11.06 KB, patch)
2020-06-24 15:33 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (11.14 KB, patch)
2020-06-24 16:20 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (11.07 KB, patch)
2020-06-24 17:14 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Megan Gardner 2020-06-23 16:07:08 PDT
Cannot delete last line of Mail Message
Comment 1 Megan Gardner 2020-06-23 16:16:50 PDT
Created attachment 402604 [details]
Patch
Comment 2 Megan Gardner 2020-06-23 16:18:22 PDT
<rdar://problem/63420928>
Comment 3 Darin Adler 2020-06-23 16:47:02 PDT
Comment on attachment 402604 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=402604&action=review

> Source/WebCore/editing/DeleteSelectionCommand.cpp:211
> +            position = endOfParagraphBeforeStart.deepEquivalent();

This line doesn’t seem like it needs to be in the if statement.
Comment 4 Wenson Hsieh 2020-06-23 16:48:19 PDT
Comment on attachment 402604 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=402604&action=review

Looks reasonable, but you might need to tweak the test or add different baselines for some of the other platforms.

> Source/WebCore/editing/DeleteSelectionCommand.cpp:215
> +        VisiblePosition endOfParagraphBeforeStart;
> +        Position position;
> +        if (previousPositionIsStartOfContent) {
> +            endOfParagraphBeforeStart = endOfParagraph(VisiblePosition { m_upstreamStart }.previous());
> +            position = endOfParagraphBeforeStart.deepEquivalent();
> +        } else {
> +            endOfParagraphBeforeStart = endOfParagraph(VisiblePosition { m_upstreamStart }.previous().previous());
> +            position = endOfParagraphBeforeStart.deepEquivalent();
> +        }

Nit - I think this could be written a little more succinctly as:

    …
    VisiblePosition positionBeforeUpstreamStart { m_upstreamStart }.previous();
    if (!previousPositionIsStartOfContent)
        positionBeforeUpstreamStart = positionBeforeUpstreamStart.previous();
    auto position = endOfParagraph(positionBeforeUpstreamStart).deepEquivalent();
    …

...or perhaps

    …
    auto positionBeforeUpstreamStart = previousPositionIsStartOfContent ? VisiblePosition { m_upstreamStart }.previous() : VisiblePosition { m_upstreamStart }.previous().previous();
    auto position = endOfParagraph(positionBeforeUpstreamStart).deepEquivalent();
    …

At least, the last line (position = endOfParagraphBeforeStart.deepEquivalent();) could be moved out of the if/else.

> LayoutTests/ChangeLog:8
> +        * editing/deleting/smart-delete-paragraph-001.html:

Nit - this ChangeLog entry looks out of date.

> LayoutTests/editing/deleting/smart-delete-paragraph-005.html:28
> +Test must exist at the top of the file in order to correclty test the original bug.

Nit - correclty => correctly
Comment 5 Megan Gardner 2020-06-23 18:00:53 PDT
Created attachment 402613 [details]
Patch
Comment 6 Megan Gardner 2020-06-23 19:01:06 PDT
Created attachment 402615 [details]
Patch
Comment 7 Megan Gardner 2020-06-23 22:29:26 PDT
Created attachment 402622 [details]
Patch
Comment 8 Megan Gardner 2020-06-24 11:59:15 PDT
Created attachment 402667 [details]
Patch
Comment 9 Megan Gardner 2020-06-24 12:00:08 PDT
Created attachment 402668 [details]
Patch
Comment 10 Darin Adler 2020-06-24 12:05:31 PDT
Comment on attachment 402668 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=402668&action=review

Not that you need to wait for me specifically, but I am planning to review once there’s a patch that passes all EWS.

> Source/WebCore/editing/DeleteSelectionCommand.cpp:191
>      bool endPositonIsBlankParagraph = isBlankParagraph(visibleEnd);

Hey, look at that: "positon"
Comment 11 Megan Gardner 2020-06-24 12:16:13 PDT
Created attachment 402672 [details]
Patch
Comment 12 Megan Gardner 2020-06-24 14:33:03 PDT
Created attachment 402686 [details]
Patch
Comment 13 Megan Gardner 2020-06-24 15:33:39 PDT
Created attachment 402691 [details]
Patch
Comment 14 Megan Gardner 2020-06-24 16:20:06 PDT
Created attachment 402695 [details]
Patch
Comment 15 Megan Gardner 2020-06-24 17:14:58 PDT
Created attachment 402697 [details]
Patch
Comment 16 Darin Adler 2020-06-24 17:15:41 PDT
(My take: we’ll grep for "ositon" separately and fix all those typos. No need to mix it up in this patch.)
Comment 17 Megan Gardner 2020-06-25 10:56:36 PDT
I agree, I'll fix it in a different patch.
Comment 18 EWS 2020-06-25 13:58:03 PDT
Committed r263528: <https://trac.webkit.org/changeset/263528>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 402697 [details].