Bug 212548 - TextManipulationController should put one Node in only one paragraph
Summary: TextManipulationController should put one Node in only one paragraph
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sihui Liu
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-05-29 14:44 PDT by Sihui Liu
Modified: 2020-06-01 16:55 PDT (History)
4 users (show)

See Also:


Attachments
Patch (46.36 KB, patch)
2020-05-29 14:51 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch (48.00 KB, patch)
2020-05-31 20:45 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch (46.76 KB, patch)
2020-06-01 11:31 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff
Patch for landing (47.16 KB, patch)
2020-06-01 16:28 PDT, Sihui Liu
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sihui Liu 2020-05-29 14:44:40 PDT
...
Comment 1 Sihui Liu 2020-05-29 14:51:24 PDT
Created attachment 400622 [details]
Patch
Comment 2 Sihui Liu 2020-05-31 20:45:56 PDT
Created attachment 400717 [details]
Patch
Comment 3 Sihui Liu 2020-06-01 11:31:18 PDT
Created attachment 400742 [details]
Patch
Comment 4 Wenson Hsieh 2020-06-01 13:49:49 PDT
Comment on attachment 400742 [details]
Patch

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

> Source/WebCore/ChangeLog:11
> +        When TextManipulationController manipulates the the first paragraph, it removes all the Nodes in its range and 

Nit - “the the”

> Source/WebCore/ChangeLog:13
> +        and fails to replace. Also, TextManipulationController does not reserve line breaks in text, which can be an

Nit - do you mean “does not preserve”?

> Source/WebCore/editing/TextManipulationController.cpp:208
> +        while (!m_iterator.atEnd() && m_iteratorNode == m_node) {

I think you can factor out this (!m_iterator.atEnd() && m_iteratorNode == m_node) check into a private helper method (maybe something like shouldAdvanceIteratorPastCurrentNode), and then use it both here and in the advance() function by early returning !shouldAdvanceIteratorPastCurrentNode().

> Source/WebCore/editing/TextManipulationController.h:158
> +        bool containsOnlyHTMLSpace;
> +        bool containsLineBreak;
> +        bool firstTokenContainsLineBreak;
> +        bool lastTokenContainsLineBreak;

Nit - probably a good idea to give these an initial value.
Comment 5 Sihui Liu 2020-06-01 16:28:03 PDT
Created attachment 400767 [details]
Patch for landing
Comment 6 EWS 2020-06-01 16:54:38 PDT
Committed r262398: <https://trac.webkit.org/changeset/262398>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 400767 [details].
Comment 7 Radar WebKit Bug Importer 2020-06-01 16:55:16 PDT
<rdar://problem/63850127>