[webkit-reviews] review granted: [Bug 230205] [macOS] -toggleAutomaticSpellingCorrection: menu item validation shouldn't require post-layout editor state : [Attachment 437995] Fix iOS build

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 13 13:28:12 PDT 2021


Darin Adler <darin at apple.com> has granted Wenson Hsieh
<wenson_hsieh at apple.com>'s request for review:
Bug 230205: [macOS] -toggleAutomaticSpellingCorrection: menu item validation
shouldn't require post-layout editor state
https://bugs.webkit.org/show_bug.cgi?id=230205

Attachment 437995: Fix iOS build

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




--- Comment #3 from Darin Adler <darin at apple.com> ---
Comment on attachment 437995
  --> https://bugs.webkit.org/attachment.cgi?id=437995
Fix iOS build

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

> Source/WebCore/editing/AlternativeTextController.cpp:348
> +    } else if (RefPtr editableRoot = position.rootEditableElement()) {
> +	   if (is<HTMLElement>(editableRoot) &&
!downcast<HTMLElement>(*editableRoot).shouldAutocorrect())
> +	       return false;
>      }

This is null checking twice. The old code was doing that too. There are a
couple different ways to avoid that. Here’s one:

    } else if (RefPtr editableRoot = position.rootEditableElement();
is<HTMLElement>(editableRoot)) {

Here’s another:

    } else if (RefPtr editableRoot = position.rootEditableElement()) {
	if (is<HTMLElement>(*editableRoot) &&
!downcast<HTMLElement>(*editableRoot).shouldAutocorrect())
	    return false;
    }


More information about the webkit-reviews mailing list