Skip to content

Commit

Permalink
Add additional release asserts to ensure we not not calling SPI when …
Browse files Browse the repository at this point in the history
…using the Async input delegate.

https://bugs.webkit.org/show_bug.cgi?id=265604
rdar://119001813

Reviewed by Wenson Hsieh.

* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView webSelectionRects]):
(-[WKContentView clearSelection]):
(-[WKContentView _allowAnimatedUpdateSelectionRectViews]):
(-[WKContentView selectionRange]):
(-[WKContentView replaceRangeWithTextWithoutClosingTyping:replacementText:]):
(-[WKContentView handleKeyWebEvent:]):
(-[WKContentView setBottomBufferHeight:]):
(-[WKContentView automaticallySelectedOverlay]):
(-[WKContentView metadataDictionariesForDictationResults]):
(-[WKContentView hasContent]):
(-[WKContentView selectAll]):
(-[WKContentView hasSelection]):
(-[WKContentView takeTraitsFrom:]):

Canonical link: https://commits.webkit.org/271417@main
  • Loading branch information
megangardner committed Dec 2, 2023
1 parent b738ab3 commit 237465e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3554,6 +3554,8 @@ - (NSArray *)webSelectionRectsForSelectionGeometries:(const Vector<WebCore::Sele

- (NSArray *)webSelectionRects
{
RELEASE_ASSERT_ASYNC_TEXT_INTERACTIONS_DISABLED();

if (!_page->editorState().hasPostLayoutAndVisualData() || _page->editorState().selectionIsNone)
return nil;
const auto& selectionGeometries = _page->editorState().visualData->selectionGeometries;
Expand Down Expand Up @@ -3835,6 +3837,8 @@ - (void)pasteWithCompletionHandler:(void (^)(void))completionHandler

- (void)clearSelection
{
RELEASE_ASSERT_ASYNC_TEXT_INTERACTIONS_DISABLED();

[self _elementDidBlur];
_page->clearSelection();
}
Expand Down Expand Up @@ -5929,6 +5933,8 @@ - (void)_updateAccessory

- (BOOL)_allowAnimatedUpdateSelectionRectViews
{
RELEASE_ASSERT_ASYNC_TEXT_INTERACTIONS_DISABLED();

return NO;
}

Expand Down Expand Up @@ -6858,6 +6864,8 @@ - (UITextInteractionAssistant *)interactionAssistant
// (i.e. selectionRange) has shipped as API.
- (NSRange)selectionRange
{
RELEASE_ASSERT_ASYNC_TEXT_INTERACTIONS_DISABLED();

return NSMakeRange(NSNotFound, 0);
}

Expand All @@ -6884,6 +6892,7 @@ - (void)setSelectedDOMRange:(DOMRange *)range affinityDownstream:(BOOL)affinityD
// Modify text without starting a new undo grouping.
- (void)replaceRangeWithTextWithoutClosingTyping:(UITextRange *)range replacementText:(NSString *)text
{
RELEASE_ASSERT_ASYNC_TEXT_INTERACTIONS_DISABLED();
}

// Caret rect support. Shouldn't be necessary, but firstRectForRange doesn't offer precisely
Expand Down Expand Up @@ -7091,6 +7100,8 @@ - (void)generateSyntheticEditingCommand:(WebKit::SyntheticEditingCommandType)com

- (void)handleKeyWebEvent:(::WebEvent *)theEvent
{
RELEASE_ASSERT_ASYNC_TEXT_INTERACTIONS_DISABLED();

_page->handleKeyboardEvent(WebKit::NativeWebKeyboardEvent(theEvent, WebKit::NativeWebKeyboardEvent::HandledByInputMethod::No));
}

Expand Down Expand Up @@ -7470,10 +7481,13 @@ - (UITextInputArrowKeyHistory *)_moveToEndOfDocument:(BOOL)extending withHistory
// Sets a buffer to make room for autocorrection views
- (void)setBottomBufferHeight:(CGFloat)bottomBuffer
{
RELEASE_ASSERT_ASYNC_TEXT_INTERACTIONS_DISABLED();
}

- (UIView *)automaticallySelectedOverlay
{
RELEASE_ASSERT_ASYNC_TEXT_INTERACTIONS_DISABLED();

return [self unscaledView];
}

Expand All @@ -7486,6 +7500,8 @@ - (UITextGranularity)selectionGranularity
// alternative selection counts using the keys defined at the top of this header.
- (NSArray *)metadataDictionariesForDictationResults
{
RELEASE_ASSERT_ASYNC_TEXT_INTERACTIONS_DISABLED();

return nil;
}

Expand Down Expand Up @@ -7519,12 +7535,15 @@ - (void)setMarkedText:(NSString *)text

- (BOOL)hasContent
{
RELEASE_ASSERT_ASYNC_TEXT_INTERACTIONS_DISABLED();

auto& editorState = _page->editorState();
return !editorState.selectionIsNone && editorState.postLayoutData && editorState.postLayoutData->hasContent;
}

- (void)selectAll
{
RELEASE_ASSERT_ASYNC_TEXT_INTERACTIONS_DISABLED();
}

- (UIColor *)textColorForCaretSelection
Expand All @@ -7541,6 +7560,8 @@ - (UIFont *)fontForCaretSelection

- (BOOL)hasSelection
{
RELEASE_ASSERT_ASYNC_TEXT_INTERACTIONS_DISABLED();

return NO;
}

Expand Down Expand Up @@ -7577,6 +7598,8 @@ - (UITextRange *)rangeEnclosingPosition:(UITextPosition *)position withGranulari

- (void)takeTraitsFrom:(UITextInputTraits *)traits
{
RELEASE_ASSERT_ASYNC_TEXT_INTERACTIONS_DISABLED();

[[self textInputTraits] takeTraitsFrom:traits];
}

Expand Down

0 comments on commit 237465e

Please sign in to comment.