Changeset 102413 in webkit


Ignore:
Timestamp:
Dec 8, 2011 6:28:27 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Caret keeps blinking during forward-delete
https://bugs.webkit.org/show_bug.cgi?id=38564

Patch by Van Lam <vanlam@google.com> on 2011-12-08
Reviewed by Darin Adler.

Currently updateAppearance determines if the caret should stop blinking
based on whether or not the editing operation changed the position of
the caret; so the caret stops blinking in case of typing text and
backwards delete (which always displace the caret) but does not stop
blinking in the case of forward delete (which does not displace the
caret).

Added a boolean member function shouldStopCaretBlinking in EditCommand
which will return true if the object is a TypingCommand (my
understanding here is that all TypingCommands should stop the caret
from blinking for a cycle, currently 0.5 seconds). Then used this
function to stop the caret from blinking if the last editing command
is a TypingCommand.

  • editing/EditCommand.h:

(WebCore::EditCommand::shouldStopCaretBlinking):

  • editing/FrameSelection.cpp:

(WebCore::FrameSelection::updateAppearance):

  • editing/TypingCommand.h:

(WebCore::TypingCommand::shouldStopCaretBlinking):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r102410 r102413  
     12011-12-08  Van Lam  <vanlam@google.com>
     2
     3        Caret keeps blinking during forward-delete
     4        https://bugs.webkit.org/show_bug.cgi?id=38564
     5
     6        Reviewed by Darin Adler.
     7
     8        Currently updateAppearance determines if the caret should stop blinking
     9        based on whether or not the editing operation changed the position of
     10        the caret; so the caret stops blinking in case of typing text and
     11        backwards delete (which always displace the caret) but does not stop
     12        blinking in the case of forward delete (which does not displace the
     13        caret).
     14
     15        Added a boolean member function shouldStopCaretBlinking in EditCommand
     16        which will return true if the object is a TypingCommand (my
     17        understanding here is that all TypingCommands should stop the caret
     18        from blinking for a cycle, currently 0.5 seconds). Then used this
     19        function to stop the caret from blinking if the last editing command
     20        is a TypingCommand.
     21
     22        * editing/EditCommand.h:
     23        (WebCore::EditCommand::shouldStopCaretBlinking):
     24        * editing/FrameSelection.cpp:
     25        (WebCore::FrameSelection::updateAppearance):
     26        * editing/TypingCommand.h:
     27        (WebCore::TypingCommand::shouldStopCaretBlinking):
     28
    1292011-12-08  Adam Klein  <adamk@chromium.org>
    230
  • trunk/Source/WebCore/editing/EditCommand.h

    r102357 r102413  
    6666    virtual bool shouldRetainAutocorrectionIndicator() const;
    6767    virtual void setShouldRetainAutocorrectionIndicator(bool);
     68    virtual bool shouldStopCaretBlinking() const { return false; }
    6869
    6970protected:
  • trunk/Source/WebCore/editing/FrameSelection.cpp

    r102252 r102413  
    16571657    bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled();
    16581658    bool shouldBlink = caretIsVisible() && isCaret() && (isContentEditable() || caretBrowsing);
     1659   
     1660    EditCommand* lastEditCommand = m_frame ? m_frame->editor()->lastEditCommand() : 0;
     1661    bool shouldStopBlinkingDueToTypingCommand = lastEditCommand && lastEditCommand->shouldStopCaretBlinking();
    16591662
    16601663    // If the caret moved, stop the blink timer so we can restart with a
    16611664    // black caret in the new location.
    1662     if (caretRectChanged || !shouldBlink)
     1665    if (caretRectChanged || !shouldBlink || shouldStopBlinkingDueToTypingCommand)
    16631666        m_caretBlinkTimer.stop();
    16641667
  • trunk/Source/WebCore/editing/TypingCommand.h

    r102225 r102413  
    104104    virtual bool shouldRetainAutocorrectionIndicator() const { return m_shouldRetainAutocorrectionIndicator; }
    105105    virtual void setShouldRetainAutocorrectionIndicator(bool retain) { m_shouldRetainAutocorrectionIndicator = retain; }
     106    virtual bool shouldStopCaretBlinking() const { return true; }
    106107    void setShouldPreventSpellChecking(bool prevent) { m_shouldPreventSpellChecking = prevent; }
    107108
Note: See TracChangeset for help on using the changeset viewer.