⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 176701 in webkit


Ignore:
Timestamp:
Dec 2, 2014, 4:59:06 PM (12 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/18441138> [iOS] Text selection in WKWebView with WKSelectionGranularityCharacter only works in the most recent WKWebView to load
https://bugs.webkit.org/show_bug.cgi?id=139211

Reviewed by Anders Carlsson.

  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView becomeFirstResponder]): Override to activate the text selection for when
becoming first resopnder.
(-[WKContentView resignFirstResponder]): Deactiavte the text selection when resigning first
responder. This ensures that if another WKWebView becomes first responder, and it uses
block selection, we don’t end up with two active selection views.
(-[WKContentView useSelectionAssistantWithMode:]): Only activate the text selection if this
is the first responder. This ensures that loading content into a non-first-responder
WKWebView doesn‘t deactivate the text selection in the current first responder.

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r176698 r176701  
     12014-12-02  Dan Bernstein  <mitz@apple.com>
     2
     3        <rdar://problem/18441138> [iOS] Text selection in WKWebView with WKSelectionGranularityCharacter only works in the most recent WKWebView to load
     4        https://bugs.webkit.org/show_bug.cgi?id=139211
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * UIProcess/ios/WKContentViewInteraction.mm:
     9        (-[WKContentView becomeFirstResponder]): Override to activate the text selection for when
     10        becoming first resopnder.
     11        (-[WKContentView resignFirstResponder]): Deactiavte the text selection when resigning first
     12        responder. This ensures that if another WKWebView becomes first responder, and it uses
     13        block selection, we don’t end up with two active selection views.
     14        (-[WKContentView useSelectionAssistantWithMode:]): Only activate the text selection if this
     15        is the first responder. This ensures that loading content into a non-first-responder
     16        WKWebView doesn‘t deactivate the text selection in the current first responder.
     17
    1182014-12-02  Alexey Proskuryakov  <ap@apple.com>
    219
  • trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

    r176411 r176701  
    451451}
    452452
     453- (BOOL)becomeFirstResponder
     454{
     455    BOOL didBecomeFirstResponder = [super becomeFirstResponder];
     456    if (didBecomeFirstResponder)
     457        [_textSelectionAssistant activateSelection];
     458
     459    return didBecomeFirstResponder;
     460}
     461
    453462- (BOOL)resignFirstResponder
    454463{
     
    460469    [self _cancelInteraction];
    461470    [_webSelectionAssistant resignedFirstResponder];
     471    [_textSelectionAssistant deactivateSelection];
    462472
    463473    return [super resignFirstResponder];
     
    10871097        }
    10881098
    1089         [_textSelectionAssistant activateSelection];
     1099        if (self.isFirstResponder)
     1100            [_textSelectionAssistant activateSelection];
    10901101    }
    10911102}
Note: See TracChangeset for help on using the changeset viewer.