Changeset 238050 in webkit


Ignore:
Timestamp:
Nov 9, 2018 12:16:32 PM (6 years ago)
Author:
Wenson Hsieh
Message:

[Cocoa] Introduce WKWebView SPI to insert nested ordered and unordered lists
https://bugs.webkit.org/show_bug.cgi?id=191410
<rdar://problem/45898610>

Reviewed by Dean Jackson.

Source/WebKit:

Prefixes a few iOS-only SPI methods declared on WKWebView in r236867 with underscores, and also exposes some
more cross-platform Cocoa editing SPI. Once the unprefixed SPI methods are no longer used by internal clients,
these will need to be removed (see followup bug: webkit.org/b/191450). See below for more details.

Covered by new and existing API tests in WKWebViewEditActions.

  • UIProcess/API/Cocoa/WKWebView.mm:

Hoist the definition (and undefinition) of FORWARD_ACTION_TO_WKCONTENTVIEW to encompass both the WKWebView
implementation and the WKWebView (WKPrivate) implementation. This allows us to use this macro when implementing
SPI methods in the WKPrivate category, as well as methods that are part of the main WKWebView implementation.

(-[WKWebView canPerformAction:withSender:]):
(-[WKWebView targetForAction:withSender:]):

Add forwarding for the new editing commands in -canPerformAction: and -targetForAction:.

(-[WKWebView _toggleStrikeThrough:]):
(-[WKWebView _increaseListLevel:]):
(-[WKWebView _decreaseListLevel:]):
(-[WKWebView _changeListType:]):
(-[WKWebView _setFont:sender:]):
(-[WKWebView _setFontSize:sender:]):
(-[WKWebView _setTextColor:sender:]):

Add definitions for the new editing methods on WKWebView, using macros (WEBCORE_PRIVATE_COMMAND on macOS and
FORWARD_ACTION_TO_WKCONTENTVIEW on iOS) to help reduce the code duplication.

(-[WKWebView _pasteAsQuotation:]): Deleted.

Remove this method definition, which is now replaced by macros on iOS and macOS.

  • UIProcess/API/Cocoa/WKWebViewPrivate.h:

Introduce the new SPI to WKWebView (WKPrivate), and add FIXMEs to remove old, unprefixed variants of the SPI.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::increaseListLevel):
(WebKit::WebPageProxy::decreaseListLevel):
(WebKit::WebPageProxy::changeListType):

Add plumbing for these list editing commands.

  • UIProcess/WebPageProxy.h:
  • UIProcess/ios/WKContentViewInteraction.h:
  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView _increaseListLevelForWebView:]):
(-[WKContentView _decreaseListLevelForWebView:]):
(-[WKContentView _changeListTypeForWebView:]):
(-[WKContentView _toggleStrikeThroughForWebView:]):
(-[WKContentView _setFontForWebView:sender:]):
(-[WKContentView _setFontSizeForWebView:sender:]):
(-[WKContentView _setTextColorForWebView:sender:]):
(-[WKContentView toggleStrikeThroughForWebView:]):
(-[WKContentView setFontForWebView:sender:]):
(-[WKContentView setFontSizeForWebView:sender:]):
(-[WKContentView setTextColorForWebView:sender:]):
(-[WKContentView canPerformActionForWebView:withSender:]):

Check for the new action selectors here, and additionally add validation for _pasteAsQuotation:. Let the
unprefixed versions of these methods simply call the prefixed versions (these method implementations will be
removed in a followup once doing so would not affect any clients of WebKit).

  • WebKit.xcodeproj/project.pbxproj:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::increaseListLevel):
(WebKit::WebPage::decreaseListLevel):
(WebKit::WebPage::changeListType):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:

Add stubs for several list editing commands that are yet to be hooked up to WebCore. These will be implemented
in a future patch.

Tools:

Move WKWebViewEditActions from iOS to WebKitCocoa, and enable the relevant WKWebViewEditActions tests on macOS.
Additionally, add new API tests to verify that -_pasteAsQuotation: and -_insertNested(Un)OrderedList: are
hooked up to their respective editing commands.

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEditActions.mm: Renamed from Tools/TestWebKitAPI/Tests/ios/WKWebViewEditActions.mm.

(-[TestWKWebView querySelectorExists:]):
(-[TestWKWebView insertString:]):

Add a helper method to insert a piece of text. This abstracts platform differences between iOS and macOS, by
invoking the WKWebView directly on macOS and calling on the content view on iOS.

(TestWebKitAPI::webViewForEditActionTesting):
(TestWebKitAPI::TEST):

Location:
trunk
Files:
12 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r238049 r238050  
     12018-11-09  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [Cocoa] Introduce WKWebView SPI to insert nested ordered and unordered lists
     4        https://bugs.webkit.org/show_bug.cgi?id=191410
     5        <rdar://problem/45898610>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Prefixes a few iOS-only SPI methods declared on WKWebView in r236867 with underscores, and also exposes some
     10        more cross-platform Cocoa editing SPI. Once the unprefixed SPI methods are no longer used by internal clients,
     11        these will need to be removed (see followup bug: webkit.org/b/191450). See below for more details.
     12
     13        Covered by new and existing API tests in WKWebViewEditActions.
     14
     15        * UIProcess/API/Cocoa/WKWebView.mm:
     16
     17        Hoist the definition (and undefinition) of `FORWARD_ACTION_TO_WKCONTENTVIEW` to encompass both the WKWebView
     18        implementation and the WKWebView (WKPrivate) implementation. This allows us to use this macro when implementing
     19        SPI methods in the WKPrivate category, as well as methods that are part of the main WKWebView implementation.
     20
     21        (-[WKWebView canPerformAction:withSender:]):
     22        (-[WKWebView targetForAction:withSender:]):
     23
     24        Add forwarding for the new editing commands in -canPerformAction: and -targetForAction:.
     25
     26        (-[WKWebView _toggleStrikeThrough:]):
     27        (-[WKWebView _increaseListLevel:]):
     28        (-[WKWebView _decreaseListLevel:]):
     29        (-[WKWebView _changeListType:]):
     30        (-[WKWebView _setFont:sender:]):
     31        (-[WKWebView _setFontSize:sender:]):
     32        (-[WKWebView _setTextColor:sender:]):
     33
     34        Add definitions for the new editing methods on WKWebView, using macros (`WEBCORE_PRIVATE_COMMAND` on macOS and
     35        `FORWARD_ACTION_TO_WKCONTENTVIEW` on iOS) to help reduce the code duplication.
     36
     37        (-[WKWebView _pasteAsQuotation:]): Deleted.
     38
     39        Remove this method definition, which is now replaced by macros on iOS and macOS.
     40
     41        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
     42
     43        Introduce the new SPI to WKWebView (WKPrivate), and add FIXMEs to remove old, unprefixed variants of the SPI.
     44
     45        * UIProcess/WebPageProxy.cpp:
     46        (WebKit::WebPageProxy::increaseListLevel):
     47        (WebKit::WebPageProxy::decreaseListLevel):
     48        (WebKit::WebPageProxy::changeListType):
     49
     50        Add plumbing for these list editing commands.
     51
     52        * UIProcess/WebPageProxy.h:
     53        * UIProcess/ios/WKContentViewInteraction.h:
     54        * UIProcess/ios/WKContentViewInteraction.mm:
     55        (-[WKContentView _increaseListLevelForWebView:]):
     56        (-[WKContentView _decreaseListLevelForWebView:]):
     57        (-[WKContentView _changeListTypeForWebView:]):
     58        (-[WKContentView _toggleStrikeThroughForWebView:]):
     59        (-[WKContentView _setFontForWebView:sender:]):
     60        (-[WKContentView _setFontSizeForWebView:sender:]):
     61        (-[WKContentView _setTextColorForWebView:sender:]):
     62        (-[WKContentView toggleStrikeThroughForWebView:]):
     63        (-[WKContentView setFontForWebView:sender:]):
     64        (-[WKContentView setFontSizeForWebView:sender:]):
     65        (-[WKContentView setTextColorForWebView:sender:]):
     66        (-[WKContentView canPerformActionForWebView:withSender:]):
     67
     68        Check for the new action selectors here, and additionally add validation for `_pasteAsQuotation:`. Let the
     69        unprefixed versions of these methods simply call the prefixed versions (these method implementations will be
     70        removed in a followup once doing so would not affect any clients of WebKit).
     71
     72        * WebKit.xcodeproj/project.pbxproj:
     73        * WebProcess/WebPage/WebPage.cpp:
     74        (WebKit::WebPage::increaseListLevel):
     75        (WebKit::WebPage::decreaseListLevel):
     76        (WebKit::WebPage::changeListType):
     77        * WebProcess/WebPage/WebPage.h:
     78        * WebProcess/WebPage/WebPage.messages.in:
     79
     80        Add stubs for several list editing commands that are yet to be hooked up to WebCore. These will be implemented
     81        in a future patch.
     82
    1832018-11-09  Antti Koivisto  <antti@apple.com>
    284
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

    r238049 r238050  
    258258#endif
    259259
     260#define FORWARD_ACTION_TO_WKCONTENTVIEW(_action) \
     261    - (void)_action:(id)sender \
     262    { \
     263        if (self.usesStandardContentView) \
     264            [_contentView _action ## ForWebView:sender]; \
     265    }
     266
    260267@implementation WKWebView {
    261268    std::unique_ptr<WebKit::NavigationState> _navigationState;
     
    13851392}
    13861393
    1387 #define FORWARD_ACTION_TO_WKCONTENTVIEW(_action) \
    1388     - (void)_action:(id)sender \
    1389     { \
    1390         if (self.usesStandardContentView) \
    1391             [_contentView _action ## ForWebView:sender]; \
    1392     }
    1393 
    13941394FOR_EACH_WKCONTENTVIEW_ACTION(FORWARD_ACTION_TO_WKCONTENTVIEW)
    1395 
    1396 #undef FORWARD_ACTION_TO_WKCONTENTVIEW
    13971395
    13981396- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
     
    14031401
    14041402    FOR_EACH_WKCONTENTVIEW_ACTION(FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW)
    1405 
    1406     FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW(_pasteAsQuotation)
     1403    FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW)
     1404    FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW(setTextColor:sender)
     1405    FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW(setFontSize:sender)
     1406    FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW(setFont:sender)
     1407    FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW(_setTextColor:sender)
     1408    FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW(_setFontSize:sender)
     1409    FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW(_setFont:sender)
    14071410
    14081411    #undef FORWARD_CANPERFORMACTION_TO_WKCONTENTVIEW
    1409 
    1410     if (action == @selector(setTextColor:sender:) || action == @selector(setFontSize:sender:) || action == @selector(setFont:sender:))
    1411         return self.usesStandardContentView && [_contentView canPerformActionForWebView:action withSender:sender];
    14121412
    14131413    return [super canPerformAction:action withSender:sender];
     
    14211421
    14221422    FOR_EACH_WKCONTENTVIEW_ACTION(FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW)
    1423 
    1424     FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW(_pasteAsQuotation)
     1423    FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW)
     1424    FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW(setTextColor:sender)
     1425    FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW(setFontSize:sender)
     1426    FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW(setFont:sender)
     1427    FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW(_setTextColor:sender)
     1428    FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW(_setFontSize:sender)
     1429    FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW(_setFont:sender)
    14251430
    14261431    #undef FORWARD_TARGETFORACTION_TO_WKCONTENTVIEW
     
    42934298@implementation WKWebView (WKPrivate)
    42944299
     4300#if PLATFORM(MAC)
     4301
     4302#define WEBCORE_PRIVATE_COMMAND(command) - (void)_##command:(id)sender { _page->executeEditCommand(#command ## _s); }
     4303
     4304WEBCORE_PRIVATE_COMMAND(alignCenter)
     4305WEBCORE_PRIVATE_COMMAND(alignJustified)
     4306WEBCORE_PRIVATE_COMMAND(alignLeft)
     4307WEBCORE_PRIVATE_COMMAND(alignRight)
     4308WEBCORE_PRIVATE_COMMAND(insertOrderedList)
     4309WEBCORE_PRIVATE_COMMAND(insertUnorderedList)
     4310WEBCORE_PRIVATE_COMMAND(insertNestedOrderedList)
     4311WEBCORE_PRIVATE_COMMAND(insertNestedUnorderedList)
     4312WEBCORE_PRIVATE_COMMAND(indent)
     4313WEBCORE_PRIVATE_COMMAND(outdent)
     4314WEBCORE_PRIVATE_COMMAND(pasteAsQuotation);
     4315
     4316#undef WEBCORE_PRIVATE_COMMAND
     4317
     4318- (void)_toggleStrikeThrough:(id)sender
     4319{
     4320    _page->executeEditCommand("strikethrough"_s);
     4321}
     4322
     4323- (void)_increaseListLevel:(id)sender
     4324{
     4325    _page->increaseListLevel();
     4326}
     4327
     4328- (void)_decreaseListLevel:(id)sender
     4329{
     4330    _page->decreaseListLevel();
     4331}
     4332
     4333- (void)_changeListType:(id)sender
     4334{
     4335    _page->changeListType();
     4336}
     4337
     4338#endif // PLATFORM(MAC)
     4339
     4340#if PLATFORM(IOS_FAMILY)
     4341
     4342FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(FORWARD_ACTION_TO_WKCONTENTVIEW)
     4343
     4344- (void)_setFont:(UIFont *)font sender:(id)sender
     4345{
     4346    if (self.usesStandardContentView)
     4347        [_contentView setFontForWebView:font sender:sender];
     4348}
     4349
     4350- (void)_setFontSize:(CGFloat)fontSize sender:(id)sender
     4351{
     4352    if (self.usesStandardContentView)
     4353        [_contentView setFontSizeForWebView:fontSize sender:sender];
     4354}
     4355
     4356- (void)_setTextColor:(UIColor *)color sender:(id)sender
     4357{
     4358    if (self.usesStandardContentView)
     4359        [_contentView setTextColorForWebView:color sender:sender];
     4360}
     4361
     4362#endif // PLATFORM(IOS_FAMILY)
     4363
    42954364- (BOOL)_isEditable
    42964365{
     
    46374706#endif
    46384707    return nil;
    4639 }
    4640 
    4641 - (void)_pasteAsQuotation:(id)sender
    4642 {
    4643 #if PLATFORM(MAC)
    4644     _impl->executeEditCommandForSelector(_cmd);
    4645 #else
    4646     if (self.usesStandardContentView)
    4647         [_contentView _pasteAsQuotationForWebView:sender];
    4648 #endif
    46494708}
    46504709
     
    60276086@end
    60286087
     6088#undef FORWARD_ACTION_TO_WKCONTENTVIEW
    60296089
    60306090@implementation WKWebView (WKTesting)
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h

    r237885 r238050  
    187187- (_WKAttachment *)_attachmentForIdentifier:(NSString *)identifier WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
    188188
     189+ (BOOL)_handlesSafeBrowsing WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     190
     191- (IBAction)_alignCenter:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     192- (IBAction)_alignJustified:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     193- (IBAction)_alignLeft:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     194- (IBAction)_alignRight:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     195- (IBAction)_indent:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     196- (IBAction)_outdent:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     197- (IBAction)_toggleStrikeThrough:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     198- (IBAction)_insertOrderedList:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     199- (IBAction)_insertUnorderedList:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     200- (IBAction)_insertNestedOrderedList:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     201- (IBAction)_insertNestedUnorderedList:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     202- (IBAction)_increaseListLevel:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     203- (IBAction)_decreaseListLevel:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
     204- (IBAction)_changeListType:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
    189205- (IBAction)_pasteAsQuotation:(id)sender WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
    190206
    191 + (BOOL)_handlesSafeBrowsing WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
    192 
    193207#if TARGET_OS_IPHONE
     208
     209- (void)_setFont:(UIFont *)font sender:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
     210- (void)_setFontSize:(CGFloat)fontSize sender:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
     211- (void)_setTextColor:(UIColor *)color sender:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
     212
    194213// DERECATED: The setters of the three following function are deprecated, please use overrideLayoutParameters.
    195214// Define the smallest size a page take with a regular viewport.
     
    372391
    373392@interface WKWebView () <UIResponderStandardEditActions>
     393// FIXME: Remove these once internal clients have moved to the underscore-prefixed versions.
    374394- (void)alignCenter:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
    375395- (void)alignJustified:(id)sender WK_API_AVAILABLE(ios(WK_IOS_TBA));
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r238049 r238050  
    17571757}
    17581758
     1759void WebPageProxy::increaseListLevel()
     1760{
     1761    if (isValid())
     1762        m_process->send(Messages::WebPage::IncreaseListLevel(), m_pageID);
     1763}
     1764
     1765void WebPageProxy::decreaseListLevel()
     1766{
     1767    if (isValid())
     1768        m_process->send(Messages::WebPage::DecreaseListLevel(), m_pageID);
     1769}
     1770
     1771void WebPageProxy::changeListType()
     1772{
     1773    if (isValid())
     1774        m_process->send(Messages::WebPage::ChangeListType(), m_pageID);
     1775}
     1776
    17591777void WebPageProxy::updateFontAttributesAfterEditorStateChange()
    17601778{
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r238049 r238050  
    546546    bool isContentEditable() const { return m_editorState.isContentEditable; }
    547547
     548    void increaseListLevel();
     549    void decreaseListLevel();
     550    void changeListType();
     551
    548552    std::optional<WebCore::FontAttributes> cachedFontAttributesAtSelectionStart() const { return m_cachedFontAttributesAtSelectionStart; }
    549553
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r237924 r238050  
    135135    M(alignJustified)
    136136
     137#define FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(M) \
     138    M(_alignCenter) \
     139    M(_alignJustified) \
     140    M(_alignLeft) \
     141    M(_alignRight) \
     142    M(_indent) \
     143    M(_outdent) \
     144    M(_toggleStrikeThrough) \
     145    M(_insertOrderedList) \
     146    M(_insertUnorderedList) \
     147    M(_insertNestedOrderedList) \
     148    M(_insertNestedUnorderedList) \
     149    M(_increaseListLevel) \
     150    M(_decreaseListLevel) \
     151    M(_changeListType) \
     152    M(_pasteAsQuotation)
     153
    137154namespace WebKit {
    138155
     
    340357    - (void)_action ## ForWebView:(id)sender;
    341358FOR_EACH_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW)
    342 DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW(_pasteAsQuotation)
     359FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW)
    343360#undef DECLARE_WKCONTENTVIEW_ACTION_FOR_WEB_VIEW
    344361
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r238047 r238050  
    21952195
    21962196FOR_EACH_WKCONTENTVIEW_ACTION(FORWARD_ACTION_TO_WKWEBVIEW)
    2197 
    2198 FORWARD_ACTION_TO_WKWEBVIEW(_pasteAsQuotation)
     2197FOR_EACH_PRIVATE_WKCONTENTVIEW_ACTION(FORWARD_ACTION_TO_WKWEBVIEW)
    21992198
    22002199#undef FORWARD_ACTION_TO_WKWEBVIEW
     
    22862285}
    22872286
    2288 #define WEBCORE_COMMAND_FOR_WEBVIEW(command) - (void)command ## ForWebView:(id)sender { _page->executeEditCommand(#command ## _s); }
    2289 
     2287#define WEBCORE_COMMAND_FOR_WEBVIEW(command) \
     2288    - (void)_ ## command ## ForWebView:(id)sender { _page->executeEditCommand(#command ## _s); } \
     2289    - (void)command ## ForWebView:(id)sender { [self _ ## command ## ForWebView:sender]; }
    22902290WEBCORE_COMMAND_FOR_WEBVIEW(insertOrderedList);
    22912291WEBCORE_COMMAND_FOR_WEBVIEW(insertUnorderedList);
     2292WEBCORE_COMMAND_FOR_WEBVIEW(insertNestedOrderedList);
     2293WEBCORE_COMMAND_FOR_WEBVIEW(insertNestedUnorderedList);
    22922294WEBCORE_COMMAND_FOR_WEBVIEW(indent);
    22932295WEBCORE_COMMAND_FOR_WEBVIEW(outdent);
     
    22962298WEBCORE_COMMAND_FOR_WEBVIEW(alignCenter);
    22972299WEBCORE_COMMAND_FOR_WEBVIEW(alignJustified);
    2298 
    2299 - (void)toggleStrikeThroughForWebView:(id)sender
     2300#undef WEBCORE_COMMAND_FOR_WEBVIEW
     2301
     2302- (void)_increaseListLevelForWebView:(id)sender
     2303{
     2304    _page->increaseListLevel();
     2305}
     2306
     2307- (void)_decreaseListLevelForWebView:(id)sender
     2308{
     2309    _page->decreaseListLevel();
     2310}
     2311
     2312- (void)_changeListTypeForWebView:(id)sender
     2313{
     2314    _page->changeListType();
     2315}
     2316
     2317- (void)_toggleStrikeThroughForWebView:(id)sender
    23002318{
    23012319    _page->executeEditCommand("StrikeThrough"_s);
     
    23122330}
    23132331
    2314 - (void)setFontForWebView:(UIFont *)font sender:(id)sender
     2332- (void)_setFontForWebView:(UIFont *)font sender:(id)sender
    23152333{
    23162334    WebCore::FontChanges changes;
     
    23232341}
    23242342
    2325 - (void)setFontSizeForWebView:(CGFloat)fontSize sender:(id)sender
     2343- (void)_setFontSizeForWebView:(CGFloat)fontSize sender:(id)sender
    23262344{
    23272345    WebCore::FontChanges changes;
     
    23302348}
    23312349
     2350- (void)_setTextColorForWebView:(UIColor *)color sender:(id)sender
     2351{
     2352    _page->executeEditCommand("ForeColor"_s, WebCore::Color(color.CGColor).serialized());
     2353}
     2354
     2355- (void)toggleStrikeThroughForWebView:(id)sender
     2356{
     2357    [self _toggleStrikeThroughForWebView:sender];
     2358}
     2359
     2360- (void)setFontForWebView:(UIFont *)font sender:(id)sender
     2361{
     2362    [self _setFontForWebView:font sender:sender];
     2363}
     2364
     2365- (void)setFontSizeForWebView:(CGFloat)fontSize sender:(id)sender
     2366{
     2367    [self _setFontSizeForWebView:fontSize sender:sender];
     2368}
     2369
    23322370- (void)setTextColorForWebView:(UIColor *)color sender:(id)sender
    23332371{
    2334     _page->executeEditCommand("ForeColor"_s, WebCore::Color(color.CGColor).serialized());
    2335 }
    2336 
    2337 #undef WEBCORE_COMMAND_FOR_WEBVIEW
     2372    [self _setTextColorForWebView:color sender:sender];
     2373}
    23382374
    23392375- (NSDictionary *)textStylingAtPosition:(UITextPosition *)position inDirection:(UITextStorageDirection)direction
     
    23932429    if (_showingTextStyleOptions)
    23942430        return (action == @selector(toggleBoldface:) || action == @selector(toggleItalics:) || action == @selector(toggleUnderline:));
    2395     if (action == @selector(toggleBoldface:) || action == @selector(toggleItalics:) || action == @selector(toggleUnderline:) || action == @selector(toggleStrikeThrough:)
    2396         || action == @selector(insertOrderedList:) || action == @selector(insertUnorderedList:) || action == @selector(indent:) || action == @selector(outdent:)
     2431    // FIXME: Some of the following checks should be removed once internal clients move to the underscore-prefixed versions.
     2432    if (action == @selector(toggleBoldface:) || action == @selector(toggleItalics:) || action == @selector(toggleUnderline:) || action == @selector(_toggleStrikeThrough:)
     2433        || action == @selector(_alignLeft:) || action == @selector(_alignRight:) || action == @selector(_alignCenter:) || action == @selector(_alignJustified:)
     2434        || action == @selector(_setTextColor:sender:) || action == @selector(_setFont:sender:) || action == @selector(_setFontSize:sender:)
     2435        || action == @selector(_insertOrderedList:) || action == @selector(_insertUnorderedList:) || action == @selector(_insertNestedOrderedList:) || action == @selector(_insertNestedUnorderedList:)
     2436        || action == @selector(_increaseListLevel:) || action == @selector(_decreaseListLevel:) || action == @selector(_changeListType:) || action == @selector(_indent:) || action == @selector(_outdent:)
     2437        || action == @selector(increaseSize:) || action == @selector(decreaseSize:)
     2438        || action == @selector(toggleStrikeThrough:) || action == @selector(insertOrderedList:) || action == @selector(insertUnorderedList:) || action == @selector(indent:) || action == @selector(outdent:)
    23972439        || action == @selector(alignLeft:) || action == @selector(alignRight:) || action == @selector(alignCenter:) || action == @selector(alignJustified:)
    2398         || action == @selector(increaseSize:) || action == @selector(decreaseSize:) || action == @selector(setTextColor:sender:)
    2399         || action == @selector(setFont:sender:) || action == @selector(setFontSize:sender:)) {
     2440        || action == @selector(setTextColor:sender:) || action == @selector(setFont:sender:) || action == @selector(setFontSize:sender:)) {
    24002441        // 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
    24012442        // at the outermost indentation level.
     
    24052446        return !editorState.isInPasswordField && editorState.isContentEditable && editorState.selectionIsRange;
    24062447   
    2407     if (action == @selector(paste:)) {
     2448    if (action == @selector(paste:) || action == @selector(_pasteAsQuotation:)) {
    24082449        if (editorState.selectionIsNone || !editorState.isContentEditable)
    24092450            return NO;
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r238049 r238050  
    11511151}
    11521152
     1153void WebPage::increaseListLevel()
     1154{
     1155    // FIXME: Not implemented.
     1156}
     1157
     1158void WebPage::decreaseListLevel()
     1159{
     1160    // FIXME: Not implemented.
     1161}
     1162
     1163void WebPage::changeListType()
     1164{
     1165    // FIXME: Not implemented.
     1166}
     1167
    11531168bool WebPage::isEditingCommandEnabled(const String& commandName)
    11541169{
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r238049 r238050  
    11871187    void setEditable(bool);
    11881188
     1189    void increaseListLevel();
     1190    void decreaseListLevel();
     1191    void changeListType();
     1192
    11891193    void setNeedsFontAttributes(bool);
    11901194
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r238049 r238050  
    213213    ExecuteEditCommand(String name, String argument)
    214214
     215    IncreaseListLevel()
     216    DecreaseListLevel()
     217    ChangeListType()
     218
    215219    SetNeedsFontAttributes(bool needsFontAttributes)
    216220
  • trunk/Tools/ChangeLog

    r238025 r238050  
     12018-11-09  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [Cocoa] Introduce WKWebView SPI to insert nested ordered and unordered lists
     4        https://bugs.webkit.org/show_bug.cgi?id=191410
     5        <rdar://problem/45898610>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Move WKWebViewEditActions from iOS to WebKitCocoa, and enable the relevant WKWebViewEditActions tests on macOS.
     10        Additionally, add new API tests to verify that `-_pasteAsQuotation:` and `-_insertNested(Un)OrderedList:` are
     11        hooked up to their respective editing commands.
     12
     13        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     14        * TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEditActions.mm: Renamed from Tools/TestWebKitAPI/Tests/ios/WKWebViewEditActions.mm.
     15        (-[TestWKWebView querySelectorExists:]):
     16        (-[TestWKWebView insertString:]):
     17
     18        Add a helper method to insert a piece of text. This abstracts platform differences between iOS and macOS, by
     19        invoking the WKWebView directly on macOS and calling on the content view on iOS.
     20
     21        (TestWebKitAPI::webViewForEditActionTesting):
     22        (TestWebKitAPI::TEST):
     23
    1242018-11-09  Philippe Normand  <pnormand@igalia.com>
    225
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r238015 r238050  
    847847                F46A095B1ED8A6E600D4AA55 /* gif-and-file-input.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F47D30ED1ED28A6C000482E1 /* gif-and-file-input.html */; };
    848848                F47728991E4AE3C1007ABF6A /* full-page-contenteditable.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F47728981E4AE3AD007ABF6A /* full-page-contenteditable.html */; };
     849                F4811E5921940BDE00A5E0FD /* WKWebViewEditActions.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4811E5821940B4400A5E0FD /* WKWebViewEditActions.mm */; };
    849850                F4856CA31E649EA8009D7EE7 /* attachment-element.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4856CA21E6498A8009D7EE7 /* attachment-element.html */; };
    850851                F486B1D01F67952300F34BDD /* DataTransfer-setDragImage.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F486B1CF1F6794FF00F34BDD /* DataTransfer-setDragImage.html */; };
     
    879880                F4FA91811E61849B007B8C1D /* WKWebViewMacEditingTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4FA917F1E61849B007B8C1D /* WKWebViewMacEditingTests.mm */; };
    880881                F4FA91831E61857B007B8C1D /* double-click-does-not-select-trailing-space.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4FA91821E618566007B8C1D /* double-click-does-not-select-trailing-space.html */; };
    881                 F4FB682521643EFC0034607A /* WKWebViewEditActions.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4FB682421643EFC0034607A /* WKWebViewEditActions.mm */; };
    882882                F4FC077720F013B600CA043C /* significant-text-milestone.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4FC077620F0108100CA043C /* significant-text-milestone.html */; };
    883883                F660AA1115A5F631003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F660AA0F15A5F624003A1243 /* GetInjectedBundleInitializationUserDataCallback_Bundle.cpp */; };
     
    21322132                F47D30EB1ED28619000482E1 /* apple.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = apple.gif; sourceTree = "<group>"; };
    21332133                F47D30ED1ED28A6C000482E1 /* gif-and-file-input.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "gif-and-file-input.html"; sourceTree = "<group>"; };
     2134                F4811E5821940B4400A5E0FD /* WKWebViewEditActions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewEditActions.mm; sourceTree = "<group>"; };
    21342135                F4856CA21E6498A8009D7EE7 /* attachment-element.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "attachment-element.html"; sourceTree = "<group>"; };
    21352136                F486B1CF1F6794FF00F34BDD /* DataTransfer-setDragImage.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "DataTransfer-setDragImage.html"; sourceTree = "<group>"; };
     
    21672168                F4FA917F1E61849B007B8C1D /* WKWebViewMacEditingTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewMacEditingTests.mm; sourceTree = "<group>"; };
    21682169                F4FA91821E618566007B8C1D /* double-click-does-not-select-trailing-space.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = "double-click-does-not-select-trailing-space.html"; path = "Tests/WebKitCocoa/double-click-does-not-select-trailing-space.html"; sourceTree = SOURCE_ROOT; };
    2169                 F4FB682421643EFC0034607A /* WKWebViewEditActions.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewEditActions.mm; sourceTree = "<group>"; };
    21702170                F4FC077620F0108100CA043C /* significant-text-milestone.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "significant-text-milestone.html"; sourceTree = "<group>"; };
    21712171                F660AA0C15A5F061003A1243 /* GetInjectedBundleInitializationUserDataCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetInjectedBundleInitializationUserDataCallback.cpp; sourceTree = "<group>"; };
     
    25152515                                46E66A8F1F0D75590026D83C /* WKWebViewDiagnosticLogging.mm */,
    25162516                                2DB647871F4161F70051A89E /* WKWebViewDoesNotLogDuringInitialization.mm */,
     2517                                F4811E5821940B4400A5E0FD /* WKWebViewEditActions.mm */,
    25172518                                0F3B94A51A77266C00DE3272 /* WKWebViewEvaluateJavaScript.mm */,
    25182519                                D3BE5E341E4CE85E00FD563A /* WKWebViewGetContents.mm */,
     
    26332634                                F43E3BBE20DADA1E00A4E7ED /* WKScrollViewTests.mm */,
    26342635                                514958BD1F7427AC00E87BAD /* WKWebViewAutofillTests.mm */,
    2635                                 F4FB682421643EFC0034607A /* WKWebViewEditActions.mm */,
    26362636                        );
    26372637                        path = ios;
     
    41764176                                46E66A901F0D75590026D83C /* WKWebViewDiagnosticLogging.mm in Sources */,
    41774177                                2DB647881F4163D60051A89E /* WKWebViewDoesNotLogDuringInitialization.mm in Sources */,
    4178                                 F4FB682521643EFC0034607A /* WKWebViewEditActions.mm in Sources */,
     4178                                F4811E5921940BDE00A5E0FD /* WKWebViewEditActions.mm in Sources */,
    41794179                                0F3B94A71A77267400DE3272 /* WKWebViewEvaluateJavaScript.mm in Sources */,
    41804180                                D34E08761E4E42E1005FF14A /* WKWebViewGetContents.mm in Sources */,
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebViewEditActions.mm

    r238049 r238050  
    2626#import "config.h"
    2727
    28 #if PLATFORM(IOS_FAMILY) && WK_API_ENABLED
     28#if WK_API_ENABLED
    2929
    3030#import "PlatformUtilities.h"
    3131#import "TestWKWebView.h"
     32#import <WebKit/WKWebViewPrivate.h>
     33
     34#if PLATFORM(IOS_FAMILY)
    3235#import "UIKitSPI.h"
    3336#import <UIKit/UIFontDescriptor.h>
    34 #import <WebKit/WKWebViewPrivate.h>
     37#endif
    3538
    3639@interface TestWKWebView (EditActionTesting)
    3740- (BOOL)querySelectorExists:(NSString *)querySelector;
     41- (void)insertString:(NSString *)string;
    3842@end
    3943
     
    4347{
    4448    return [[self objectByEvaluatingJavaScript:[NSString stringWithFormat:@"!!document.querySelector(`%@`)", querySelector]] boolValue];
     49}
     50
     51- (void)insertString:(NSString *)string
     52{
     53#if PLATFORM(IOS_FAMILY)
     54    [[self textInputContentView] insertText:string];
     55#else
     56    [self insertText:string];
     57#endif
    4558}
    4659
     
    5871}
    5972
     73TEST(WKWebViewEditActions, NestedListInsertion)
     74{
     75    auto webView = webViewForEditActionTesting();
     76
     77    [webView _insertNestedOrderedList:nil];
     78    EXPECT_TRUE([webView querySelectorExists:@"ol"]);
     79    EXPECT_TRUE([webView querySelectorExists:@"ol > li"]);
     80
     81    [webView _insertNestedOrderedList:nil];
     82    EXPECT_TRUE([webView querySelectorExists:@"ol > ol"]);
     83    EXPECT_TRUE([webView querySelectorExists:@"ol > ol > li"]);
     84
     85    [webView _insertNestedUnorderedList:nil];
     86    EXPECT_TRUE([webView querySelectorExists:@"ol > ol > ul"]);
     87    EXPECT_TRUE([webView querySelectorExists:@"ol > ol > ul > li"]);
     88
     89    [webView _insertNestedUnorderedList:nil];
     90    EXPECT_TRUE([webView querySelectorExists:@"ol > ol > ul > ul"]);
     91    EXPECT_TRUE([webView querySelectorExists:@"ol > ol > ul > ul > li"]);
     92}
     93
    6094TEST(WKWebViewEditActions, ListInsertion)
    6195{
    6296    auto webView = webViewForEditActionTesting();
    6397
    64     [webView insertOrderedList:nil];
     98    [webView _insertOrderedList:nil];
    6599    EXPECT_TRUE([webView querySelectorExists:@"ol"]);
    66     [webView insertOrderedList:nil];
     100    [webView _insertOrderedList:nil];
    67101    EXPECT_FALSE([webView querySelectorExists:@"ol"]);
    68102
    69     [webView insertUnorderedList:nil];
     103    [webView _insertUnorderedList:nil];
    70104    EXPECT_TRUE([webView querySelectorExists:@"ul"]);
    71     [webView insertUnorderedList:nil];
     105    [webView _insertUnorderedList:nil];
    72106    EXPECT_FALSE([webView querySelectorExists:@"ul"]);
    73107}
     
    77111    auto webView = webViewForEditActionTesting();
    78112
    79     [webView indent:nil];
     113    [webView _indent:nil];
    80114    EXPECT_TRUE([webView querySelectorExists:@"blockquote"]);
    81     [webView indent:nil];
     115    [webView _indent:nil];
    82116    EXPECT_TRUE([webView querySelectorExists:@"blockquote > blockquote"]);
    83117
    84     [webView outdent:nil];
     118    [webView _outdent:nil];
    85119    EXPECT_TRUE([webView querySelectorExists:@"blockquote"]);
    86     [webView outdent:nil];
     120    [webView _outdent:nil];
    87121    EXPECT_FALSE([webView querySelectorExists:@"blockquote"]);
    88122}
     
    92126    auto webView = webViewForEditActionTesting();
    93127    auto runTest = [webView] {
    94         [webView alignCenter:nil];
     128        [webView _alignCenter:nil];
    95129        EXPECT_WK_STREQ("center", [webView stylePropertyAtSelectionStart:@"text-align"]);
    96         [webView alignLeft:nil];
     130        [webView _alignLeft:nil];
    97131        EXPECT_WK_STREQ("left", [webView stylePropertyAtSelectionStart:@"text-align"]);
    98         [webView alignRight:nil];
     132        [webView _alignRight:nil];
    99133        EXPECT_WK_STREQ("right", [webView stylePropertyAtSelectionStart:@"text-align"]);
    100         [webView alignJustified:nil];
     134        [webView _alignJustified:nil];
    101135        EXPECT_WK_STREQ("justify", [webView stylePropertyAtSelectionStart:@"text-align"]);
    102136    };
     
    113147    auto webView = webViewForEditActionTesting();
    114148    [webView selectAll:nil];
    115     [webView toggleStrikeThrough:nil];
     149    [webView _toggleStrikeThrough:nil];
    116150    EXPECT_WK_STREQ("line-through", [webView stylePropertyAtSelectionStart:@"-webkit-text-decorations-in-effect"]);
    117151    EXPECT_WK_STREQ("line-through", [webView stylePropertyAtSelectionEnd:@"-webkit-text-decorations-in-effect"]);
    118152
    119     [webView toggleStrikeThrough:nil];
     153    [webView _toggleStrikeThrough:nil];
    120154    EXPECT_WK_STREQ("none", [webView stylePropertyAtSelectionStart:@"-webkit-text-decorations-in-effect"]);
    121155    EXPECT_WK_STREQ("none", [webView stylePropertyAtSelectionEnd:@"-webkit-text-decorations-in-effect"]);
    122156
    123157    [webView collapseToEnd];
    124     [webView toggleStrikeThrough:nil];
    125     [[webView textInputContentView] insertText:@"Hello"];
     158    [webView _toggleStrikeThrough:nil];
     159    [webView insertString:@"Hello"];
    126160    EXPECT_WK_STREQ("line-through", [webView stylePropertyAtSelectionStart:@"-webkit-text-decorations-in-effect"]);
    127161
    128     [webView toggleStrikeThrough:nil];
    129     [[webView textInputContentView] insertText:@"Hello"];
     162    [webView _toggleStrikeThrough:nil];
     163    [webView insertString:@"Hello"];
    130164    EXPECT_WK_STREQ("none", [webView stylePropertyAtSelectionStart:@"-webkit-text-decorations-in-effect"]);
    131165}
     166
     167TEST(WKWebViewEditActions, PasteAsQuotation)
     168{
     169    auto webView = webViewForEditActionTesting();
     170    [webView selectAll:nil];
     171    [webView _executeEditCommand:@"cut" argument:nil completion:nil];
     172    [webView _pasteAsQuotation:nil];
     173    EXPECT_TRUE([webView querySelectorExists:@"blockquote"]);
     174}
     175
     176#if PLATFORM(IOS_FAMILY)
    132177
    133178TEST(WKWebViewEditActions, ChangeFontSize)
     
    147192    EXPECT_EQ(16, [[webView stylePropertyAtSelectionStart:@"font-size"] floatValue]);
    148193
    149     [webView setFontSize:20 sender:nil];
     194    [webView _setFontSize:20 sender:nil];
    150195    EXPECT_EQ(20, [[webView stylePropertyAtSelectionStart:@"font-size"] floatValue]);
    151196}
     
    156201    [webView selectAll:nil];
    157202
    158     [webView setTextColor:[UIColor colorWithRed:1 green:0 blue:0 alpha:1] sender:nil];
     203    [webView _setTextColor:[UIColor colorWithRed:1 green:0 blue:0 alpha:1] sender:nil];
    159204    EXPECT_WK_STREQ("rgb(255, 0, 0)", [webView stylePropertyAtSelectionStart:@"color"]);
    160205    EXPECT_TRUE([webView querySelectorExists:@"font"]);
    161206
    162     [webView setTextColor:[UIColor colorWithRed:0 green:1 blue:0 alpha:0.2] sender:nil];
     207    [webView _setTextColor:[UIColor colorWithRed:0 green:1 blue:0 alpha:0.2] sender:nil];
    163208    EXPECT_WK_STREQ("rgba(0, 255, 0, 0.2)", [webView stylePropertyAtSelectionStart:@"color"]);
    164209    EXPECT_FALSE([webView querySelectorExists:@"font"]);
     
    171216
    172217    UIFontDescriptor *fontDescriptor = [UIFontDescriptor fontDescriptorWithFontAttributes:@{ UIFontDescriptorFamilyAttribute: @"Helvetica" }];
    173     [webView setFont:[UIFont fontWithDescriptor:fontDescriptor size:24] sender:nil];
     218    [webView _setFont:[UIFont fontWithDescriptor:fontDescriptor size:24] sender:nil];
    174219    EXPECT_WK_STREQ("Helvetica", [webView stylePropertyAtSelectionStart:@"font-family"]);
    175220    EXPECT_WK_STREQ("24px", [webView stylePropertyAtSelectionStart:@"font-size"]);
     
    177222    EXPECT_WK_STREQ("normal", [webView stylePropertyAtSelectionStart:@"font-style"]);
    178223
    179     [webView setFont:[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:12] sender:nil];
     224    [webView _setFont:[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:12] sender:nil];
    180225    EXPECT_WK_STREQ("\"Times New Roman\"", [webView stylePropertyAtSelectionStart:@"font-family"]);
    181226    EXPECT_WK_STREQ("12px", [webView stylePropertyAtSelectionStart:@"font-size"]);
     
    184229
    185230    fontDescriptor = [fontDescriptor fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitItalic | UIFontDescriptorTraitBold];
    186     [webView setFont:[UIFont fontWithDescriptor:fontDescriptor size:20] sender:nil];
     231    [webView _setFont:[UIFont fontWithDescriptor:fontDescriptor size:20] sender:nil];
    187232    EXPECT_WK_STREQ("Helvetica", [webView stylePropertyAtSelectionStart:@"font-family"]);
    188233    EXPECT_WK_STREQ("20px", [webView stylePropertyAtSelectionStart:@"font-size"]);
     
    191236}
    192237
     238#endif // PLATFORM(IOS_FAMILY)
     239
    193240} // namespace TestWebKitAPI
    194241
    195 #endif // PLATFORM(IOS_FAMILY) && WK_API_ENABLED
     242#endif // WK_API_ENABLED
Note: See TracChangeset for help on using the changeset viewer.