Changeset 224201 in webkit


Ignore:
Timestamp:
Oct 30, 2017 2:24:37 PM (6 years ago)
Author:
Megan Gardner
Message:

Correctly determine affinity when inserting text via Keyboard Suggestions
https://bugs.webkit.org/show_bug.cgi?id=178969

Reviewed by Ryosuke Niwa.

Source/WebCore:

There has been talk about renaming these enums, but in the meantime we should at least have a comment
clarifying what they actually mean.

No new tests only adding a comment, no tests needed.

  • editing/TextAffinity.h:

Source/WebKit:

Use the logic of VisiblePosition to correctly determine cursor affinity. We were
defaulting to upstream, but that in incorrect and resulted in hitting asserts that
we should not. This should give us the correct affinity in all cases.

  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::syncApplyAutocorrection):

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r224199 r224201  
     12017-10-27  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Correctly determine affinity when inserting text via Keyboard Suggestions
     4        https://bugs.webkit.org/show_bug.cgi?id=178969
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        There has been talk about renaming these enums, but in the meantime we should at least have a comment
     9        clarifying what they actually mean.
     10
     11        No new tests only adding a comment, no tests needed.
     12
     13        * editing/TextAffinity.h:
     14
    1152017-10-27  Ryosuke Niwa  <rniwa@webkit.org>
    216
  • trunk/Source/WebCore/editing/TextAffinity.h

    r208646 r224201  
    2727
    2828namespace WebCore {
    29 
     29// UPSTREAM means before a line break DOWNSTREAM mean after a line break
    3030enum EAffinity { UPSTREAM = 0, DOWNSTREAM = 1 };
    3131
  • trunk/Source/WebKit/ChangeLog

    r224198 r224201  
     12017-10-27  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Correctly determine affinity when inserting text via Keyboard Suggestions
     4        https://bugs.webkit.org/show_bug.cgi?id=178969
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Use the logic of VisiblePosition to correctly determine cursor affinity. We were
     9        defaulting to upstream, but that in incorrect and resulted in hitting asserts that
     10        we should not. This should give us the correct affinity in all cases.
     11
     12        * WebProcess/WebPage/ios/WebPageIOS.mm:
     13        (WebKit::WebPage::syncApplyAutocorrection):
     14
    1152017-10-30  Commit Queue  <commit-queue@webkit.org>
    216
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r224077 r224201  
    18581858    }
    18591859   
    1860     frame.selection().setSelectedRange(range.get(), UPSTREAM, true);
     1860    // Correctly determine affinity, using logic currently only present in VisiblePosition
     1861    EAffinity affinity = DOWNSTREAM;
     1862    if (range && range->collapsed())
     1863        affinity = VisiblePosition(range->startPosition(), UPSTREAM).affinity();
     1864   
     1865    frame.selection().setSelectedRange(range.get(), affinity, true);
    18611866    if (correction.length())
    18621867        frame.editor().insertText(correction, 0, originalText.isEmpty() ? TextEventInputKeyboard : TextEventInputAutocompletion);
Note: See TracChangeset for help on using the changeset viewer.