[webkit-reviews] review granted: [Bug 214878] Text manipulation: leading and trailing spaces should be ignored when comparing content : [Attachment 406086] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 6 14:57:36 PDT 2020


Ryosuke Niwa <rniwa at webkit.org> has granted Sihui Liu <sihui_liu at apple.com>'s
request for review:
Bug 214878: Text manipulation: leading and trailing spaces should be ignored
when comparing content
https://bugs.webkit.org/show_bug.cgi?id=214878

Attachment 406086: Patch

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




--- Comment #11 from Ryosuke Niwa <rniwa at webkit.org> ---
Comment on attachment 406086
  --> https://bugs.webkit.org/attachment.cgi?id=406086
Patch

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

> Source/WebCore/editing/TextManipulationController.cpp:802
> +	       bool isContentUnchanged = (currentToken.content ==
token.content) || ((currentTokenIndex == 1 || currentTokenIndex ==
item.tokens.size()) && isContentEquivalent(currentToken.content,
token.content));
> +	       if (!content.isReplacedContent && !isContentUnchanged)

This is a really long line.
Can we split it like this:
bool isContentUnchanged = currentToken.content == token.content;
if (!UNLIKELY(isContentUnchanged)) {
    bool isFirstOrLastToken = currentTokenIndex == 1 || currentTokenIndex ==
item.tokens.size();
    isContentUnchanged = isFirstOrLastToken &&
isContentEquivalent(currentToken.content, token.content);
}

> Tools/ChangeLog:8
> +

Say that we're adding a regression test.

> Tools/TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm:3050
> +	   "  <style>"

Since you're not inserting newlines, they'd all be in a single line. We might
as well omit indentation.


More information about the webkit-reviews mailing list