[webkit-reviews] review granted: [Bug 224941] Crash in BreakBlockquoteCommand::doApply() : [Attachment 426932] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Apr 23 13:04:13 PDT 2021


Darin Adler <darin at apple.com> has granted Julian Gonzalez
<julian_a_gonzalez at apple.com>'s request for review:
Bug 224941: Crash in BreakBlockquoteCommand::doApply()
https://bugs.webkit.org/show_bug.cgi?id=224941

Attachment 426932: Patch

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




--- Comment #5 from Darin Adler <darin at apple.com> ---
Comment on attachment 426932
  --> https://bugs.webkit.org/attachment.cgi?id=426932
Patch

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

> Source/WebCore/editing/BreakBlockquoteCommand.cpp:114
> +	       Node* nextNode = NodeTraversal::next(*startNode);
> +	       if (nextNode)
> +		   startNode = nextNode;

Should be scoped:

    if (auto nextNode = NodeTraversal::next(*startNode))
	startNode = nextNode;

> Source/WebCore/editing/BreakBlockquoteCommand.cpp:120
> +	   Node* nextNode = NodeTraversal::next(*startNode);
> +	   startNode = childAtOffset ? childAtOffset : (nextNode ? nextNode :
startNode);

Ideally would like to avoid doing node traversal if childAtOffset is non-null.
I’d write this:

    if (auto child =
startNode->traverseToChildAt(pos.deprecatedEditingOffset()))
	startNode = child;
    else if (auto next = NodeTraversal::next(*startNode))
	startNode = next;


More information about the webkit-reviews mailing list