<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>168779</bug_id>
          
          <creation_ts>2017-02-23 08:12:31 -0800</creation_ts>
          <short_desc>Spell check not updated if moving with caret by modifying the selection</short_desc>
          <delta_ts>2018-10-23 05:44:58 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>HTML Editing</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>153291</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Tomas Popela">tpopela</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>cgarcia</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>mcrha</cc>
    
    <cc>rniwa</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1280279</commentid>
    <comment_count>0</comment_count>
      <attachid>302512</attachid>
    <who name="Tomas Popela">tpopela</who>
    <bug_when>2017-02-23 08:12:31 -0800</bug_when>
    <thetext>Created attachment 302512
test case

To describe the problem imagine that you are creating an advanced WYSIWYG editor based on contenteditable. You are modifying the DOM directly (as some of the document&apos;s execCommand methods are not sufficient for you) and at some point the spell check for the element is lost. The suggested method (until https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/forceSpellCheck is ready and implemented in WebKit) is to move the caret to the beginning of the element and then by modifying the selection, moving the caret to the end of the element (that&apos;s what the attached test case is doing) forces the spell check to be renewed. To speak precisely it forced as after the bug 129024 the spell checking is now done async. Now, if we are moving the caret in a loop then the spell check is scheduled inside Editor::respondToChangedSelection() and we move the caret to the next work, but inside Editor::respondToChangedSelection() the spell check for the current word under caret is skipped as there is an active timer - https://trac.webkit.org/browser/trunk/Source/WebCore/editing/Editor.cpp?rev=212884#L3303.

The question is how is the application supposed to refresh the spell check? In Chromium the test case works as expected. In Firefox they are renewing the spell check automatically (if spellcheck=&quot;true&quot; is presented). The test case works in WebKit if I add a call to Editor::updateEditorUINowIfScheduled() if the timer is active, but that&apos;s not a solution as that&apos;s basically reverting the bug 129024. It also works if I&apos;m moving the caret after 1 ms (set through setTimeout()), but that&apos;s not a solution as well.

Ryosuke do you have any idea (as you are the one who introduced that change)?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1471547</commentid>
    <comment_count>1</comment_count>
    <who name="Milan Crha">mcrha</who>
    <bug_when>2018-10-23 05:44:58 -0700</bug_when>
    <thetext>A better option would be to fix bug #48411, because it would avoid the busy-loop which worked in WebKit1.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>302512</attachid>
            <date>2017-02-23 08:12:31 -0800</date>
            <delta_ts>2017-02-23 08:12:31 -0800</delta_ts>
            <desc>test case</desc>
            <filename>test_spell_check.html</filename>
            <type>text/html</type>
            <size>1502</size>
            <attacher name="Tomas Popela">tpopela</attacher>
            
              <data encoding="base64">PGh0bWw+CiAgPGhlYWQ+CiAgPHNjcmlwdD4KICAgIGZ1bmN0aW9uIHBlcmZvcm1TcGVsbENoZWNr
KCkgewogICAgICBzZWxlY3Rpb24gPSB3aW5kb3cuZ2V0U2VsZWN0aW9uKCk7CgogICAgICBlbmRO
b2RlID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgic3BhbiIpOwogICAgICBlbmROb2RlLmlubmVy
SFRNTCA9ICImIz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