Skip to content
Permalink
Browse files
[iOS] Remove some unnecessary editing SPI after <rdar://problem/46047…
…546>

https://bugs.webkit.org/show_bug.cgi?id=193019

Reviewed by Dan Bernstein.

Remove these SPI method declarations, as well as method forwarding in WKContentView. Mail was the only adoptee
of these methods; after <rdar://problem/46047546>, they have moved to the underscore-prefixed versions, so we
we have no need for these erroneously-named SPI methods anymore. There is no change in behavior; verified this
through existing API tests (WKWebViewEditActions), as well as building iOS Mail against WebKit with these
changes to WKWebViewPrivate.h.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView canPerformAction:withSender:]):
(-[WKWebView targetForAction:withSender:]):
(-[WKWebView _setFont:sender:]):
(-[WKWebView _setFontSize:sender:]):
(-[WKWebView _setTextColor:sender:]):
(-[WKWebView setFont:sender:]): Deleted.
(-[WKWebView setTextColor:sender:]): Deleted.
(-[WKWebView setFontSize:sender:]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView canPerformActionForWebView:withSender:]):
(-[WKContentView setFontForWebView:sender:]): Deleted.
(-[WKContentView setFontSizeForWebView:sender:]): Deleted.
(-[WKContentView setTextColorForWebView:sender:]): Deleted.


Canonical link: https://commits.webkit.org/207578@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
whsieh committed Dec 24, 2018
1 parent 428acf3 commit 0d1872c9765ea23c00b949460039ef4873b780be
@@ -1,3 +1,33 @@
2018-12-23 Wenson Hsieh <wenson_hsieh@apple.com>

[iOS] Remove some unnecessary editing SPI after <rdar://problem/46047546>
https://bugs.webkit.org/show_bug.cgi?id=193019

Reviewed by Dan Bernstein.

Remove these SPI method declarations, as well as method forwarding in WKContentView. Mail was the only adoptee
of these methods; after <rdar://problem/46047546>, they have moved to the underscore-prefixed versions, so we
we have no need for these erroneously-named SPI methods anymore. There is no change in behavior; verified this
through existing API tests (WKWebViewEditActions), as well as building iOS Mail against WebKit with these
changes to WKWebViewPrivate.h.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView canPerformAction:withSender:]):
(-[WKWebView targetForAction:withSender:]):
(-[WKWebView _setFont:sender:]):
(-[WKWebView _setFontSize:sender:]):
(-[WKWebView _setTextColor:sender:]):
(-[WKWebView setFont:sender:]): Deleted.
(-[WKWebView setTextColor:sender:]): Deleted.
(-[WKWebView setFontSize:sender:]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView canPerformActionForWebView:withSender:]):
(-[WKContentView setFontForWebView:sender:]): Deleted.
(-[WKContentView setFontSizeForWebView:sender:]): Deleted.
(-[WKContentView setTextColorForWebView:sender:]): Deleted.

2018-12-23 Wenson Hsieh <wenson_hsieh@apple.com>

Fix fast/ruby/ruby-base-merge-block-children-crash-2.html after r239543
@@ -1445,9 +1445,6 @@ - (BOOL)canPerformAction:(SEL)action withSender:(id)sender

FOR_EACH_WKCONTENTVIEW_ACTION(FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW)
FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW)
FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW(setTextColor:sender)
FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW(setFontSize:sender)
FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW(setFont:sender)
FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW(_setTextColor:sender)
FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW(_setFontSize:sender)
FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW(_setFont:sender)
@@ -1465,9 +1462,6 @@ - (id)targetForAction:(SEL)action withSender:(id)sender

FOR_EACH_WKCONTENTVIEW_ACTION(FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW)
FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW)
FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW(setTextColor:sender)
FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW(setFontSize:sender)
FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW(setFont:sender)
FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW(_setTextColor:sender)
FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW(_setFontSize:sender)
FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW(_setFont:sender)
@@ -1477,21 +1471,6 @@ - (id)targetForAction:(SEL)action withSender:(id)sender
return [super targetForAction:action withSender:sender];
}

- (void)setFont:(UIFont *)font sender:(id)sender
{
[_contentView setFontForWebView:font sender:sender];
}

- (void)setTextColor:(UIColor *)color sender:(id)sender
{
[_contentView setTextColorForWebView:color sender:sender];
}

- (void)setFontSize:(CGFloat)fontSize sender:(id)sender
{
[_contentView setFontSizeForWebView:fontSize sender:sender];
}

static inline CGFloat floorToDevicePixel(CGFloat input, float deviceScaleFactor)
{
return CGFloor(input * deviceScaleFactor) / deviceScaleFactor;
@@ -4432,19 +4411,19 @@ - (void)_changeListType:(id)sender
- (void)_setFont:(UIFont *)font sender:(id)sender
{
if (self.usesStandardContentView)
[_contentView setFontForWebView:font sender:sender];
[_contentView _setFontForWebView:font sender:sender];
}

- (void)_setFontSize:(CGFloat)fontSize sender:(id)sender
{
if (self.usesStandardContentView)
[_contentView setFontSizeForWebView:fontSize sender:sender];
[_contentView _setFontSizeForWebView:fontSize sender:sender];
}

- (void)_setTextColor:(UIColor *)color sender:(id)sender
{
if (self.usesStandardContentView)
[_contentView setTextColorForWebView:color sender:sender];
[_contentView _setTextColorForWebView:color sender:sender];
}

#endif // PLATFORM(IOS_FAMILY)
@@ -406,19 +406,6 @@ typedef NS_OPTIONS(NSUInteger, _WKRectEdge) {
#if TARGET_OS_IPHONE

@interface WKWebView () <UIResponderStandardEditActions>
// FIXME: Remove these once internal clients have moved to the underscore-prefixed versions.
- (void)alignCenter:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
- (void)alignJustified:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
- (void)alignLeft:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
- (void)alignRight:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
- (void)indent:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
- (void)insertOrderedList:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
- (void)insertUnorderedList:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
- (void)outdent:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
- (void)toggleStrikeThrough:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
- (void)setFont:(UIFont *)font sender:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
- (void)setFontSize:(CGFloat)fontSize sender:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
- (void)setTextColor:(UIColor *)color sender:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
@end

#else
@@ -129,15 +129,6 @@ typedef std::pair<WebKit::InteractionInformationRequest, InteractionInformationC
M(toggleUnderline) \
M(increaseSize) \
M(decreaseSize) \
M(toggleStrikeThrough) \
M(insertUnorderedList) \
M(insertOrderedList) \
M(indent) \
M(outdent) \
M(alignLeft) \
M(alignRight) \
M(alignCenter) \
M(alignJustified) \
M(pasteAndMatchStyle) \
M(makeTextWritingDirectionNatural)

@@ -380,9 +371,9 @@ FOR_EACH_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW)
FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW)
#undef DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW

- (void)setFontForWebView:(UIFont *)fontFamily sender:(id)sender;
- (void)setFontSizeForWebView:(CGFloat)fontSize sender:(id)sender;
- (void)setTextColorForWebView:(UIColor *)color sender:(id)sender;
- (void)_setFontForWebView:(UIFont *)fontFamily sender:(id)sender;
- (void)_setFontSizeForWebView:(CGFloat)fontSize sender:(id)sender;
- (void)_setTextColorForWebView:(UIColor *)color sender:(id)sender;

#if ENABLE(TOUCH_EVENTS)
- (void)_webTouchEvent:(const WebKit::NativeWebTouchEvent&)touchEvent preventsNativeGestures:(BOOL)preventsDefault;
@@ -2453,21 +2453,6 @@ - (void)toggleStrikeThroughForWebView:(id)sender
[self _toggleStrikeThroughForWebView:sender];
}

- (void)setFontForWebView:(UIFont *)font sender:(id)sender
{
[self _setFontForWebView:font sender:sender];
}

- (void)setFontSizeForWebView:(CGFloat)fontSize sender:(id)sender
{
[self _setFontSizeForWebView:fontSize sender:sender];
}

- (void)setTextColorForWebView:(UIColor *)color sender:(id)sender
{
[self _setTextColorForWebView:color sender:sender];
}

- (NSDictionary *)textStylingAtPosition:(UITextPosition *)position inDirection:(UITextStorageDirection)direction
{
if (!position || !_page->editorState().isContentRichlyEditable)
@@ -2561,11 +2546,7 @@ - (BOOL)canPerformActionForWebView:(SEL)action withSender:(id)sender
|| action == @selector(_setTextColor:sender:) || action == @selector(_setFont:sender:) || action == @selector(_setFontSize:sender:)
|| action == @selector(_insertOrderedList:) || action == @selector(_insertUnorderedList:) || action == @selector(_insertNestedOrderedList:) || action == @selector(_insertNestedUnorderedList:)
|| action == @selector(_increaseListLevel:) || action == @selector(_decreaseListLevel:) || action == @selector(_changeListType:) || action == @selector(_indent:) || action == @selector(_outdent:)
|| action == @selector(increaseSize:) || action == @selector(decreaseSize:)
|| action == @selector(toggleStrikeThrough:) || action == @selector(insertOrderedList:) || action == @selector(insertUnorderedList:) || action == @selector(indent:) || action == @selector(outdent:)
|| action == @selector(alignLeft:) || action == @selector(alignRight:) || action == @selector(alignCenter:) || action == @selector(alignJustified:)
|| action == @selector(setTextColor:sender:) || action == @selector(setFont:sender:) || action == @selector(setFontSize:sender:)
|| action == @selector(makeTextWritingDirectionNatural:)) {
|| action == @selector(increaseSize:) || action == @selector(decreaseSize:) || action == @selector(makeTextWritingDirectionNatural:)) {
// FIXME: This should be more nuanced in the future, rather than returning YES for all richly editable areas. For instance, outdent: should be disabled when the selection is already
// at the outermost indentation level.
return editorState.isContentRichlyEditable;

0 comments on commit 0d1872c

Please sign in to comment.