[webkit-reviews] review granted: [Bug 212548] TextManipulationController should put one Node in only one paragraph : [Attachment 400742] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 1 13:49:49 PDT 2020


Wenson Hsieh <wenson_hsieh at apple.com> has granted Sihui Liu
<sihui_liu at apple.com>'s request for review:
Bug 212548: TextManipulationController should put one Node in only one
paragraph
https://bugs.webkit.org/show_bug.cgi?id=212548

Attachment 400742: Patch

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




--- Comment #4 from Wenson Hsieh <wenson_hsieh at apple.com> ---
Comment on attachment 400742
  --> https://bugs.webkit.org/attachment.cgi?id=400742
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.


More information about the webkit-reviews mailing list