Changeset 68243 in webkit


Ignore:
Timestamp:
Sep 24, 2010 1:44:24 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-09-24 Jia Pu <jpu@apple.com>

Reviewed by Shinichiro Hamaji.

Need to remove autocorrection underlines in current line when newline is entered.
https://bugs.webkit.org/show_bug.cgi?id=45709
<rdar://problem/8335576>

This change affects only Mac OSX build.

  • dom/DocumentMarker.h: Added "CorrectionIndicator" to indicate the words on which we need to draw autocorrection underline. We cannot use existing "Replacement" for this purpose, since it is not meant to be removed once it is added. But we need to remove all autocorrection underlines when a line break or paragraph separator is inserted, which is the behavior in NSTextView. Hence we need a separate marker value for drawing autocorrection underline.
  • editing/Editor.cpp: (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Add "CorrectionIndicator" when autocorrection takes place. (WebCore::Editor::changeSelectionAfterCommand): Remove "CorrectionIndicator" markers if the command results in inserting paragraph separator.
  • rendering/InlineTextBox.cpp: (WebCore::textCheckingLineStyleForMarkerType): Use "CorrectionIndicator" marker instead of "Replacement" to draw autocorrection underline. (WebCore::InlineTextBox::paintDocumentMarkers): Ditto.
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r68242 r68243  
     12010-09-24  Jia Pu  <jpu@apple.com>
     2
     3        Reviewed by Shinichiro Hamaji.
     4
     5        Need to remove autocorrection underlines in current line when newline is entered.
     6        https://bugs.webkit.org/show_bug.cgi?id=45709
     7        <rdar://problem/8335576>
     8
     9        This change affects only Mac OSX build.
     10
     11        * dom/DocumentMarker.h: Added "CorrectionIndicator" to indicate the words on which we need
     12          to draw autocorrection underline. We cannot use existing "Replacement" for this purpose,
     13          since it is not meant to be removed once it is added. But we need to remove all autocorrection
     14          underlines when a line break or paragraph separator is inserted, which is the behavior in
     15          NSTextView. Hence we need a separate marker value for drawing autocorrection underline.
     16
     17        * editing/Editor.cpp:
     18        (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Add "CorrectionIndicator" when
     19          autocorrection takes place.
     20        (WebCore::Editor::changeSelectionAfterCommand): Remove "CorrectionIndicator" markers if the
     21          command results in inserting paragraph separator.
     22
     23        * rendering/InlineTextBox.cpp:
     24        (WebCore::textCheckingLineStyleForMarkerType): Use "CorrectionIndicator" marker instead of
     25          "Replacement" to draw autocorrection underline.
     26        (WebCore::InlineTextBox::paintDocumentMarkers): Ditto.
     27
    1282010-09-24  Eric Uhrhane  <ericu@chromium.org>
    229
  • trunk/WebCore/dom/DocumentMarker.h

    r66643 r68243  
    4141        TextMatch,
    4242        Replacement,
     43        CorrectionIndicator,
    4344        RejectedCorrection
    4445    };
  • trunk/WebCore/editing/Editor.cpp

    r68103 r68243  
    27422742                            RefPtr<Range> replacedRange = TextIterator::subrange(paragraphRange.get(), resultLocation, replacementLength);
    27432743                            replacedRange->startContainer()->document()->markers()->addMarker(replacedRange.get(), DocumentMarker::Replacement, replacedString);
     2744                            replacedRange->startContainer()->document()->markers()->addMarker(replacedRange.get(), DocumentMarker::CorrectionIndicator);
    27442745                        }
    27452746                    }
     
    31223123    if (newSelection.start().isOrphan() || newSelection.end().isOrphan())
    31233124        return;
     3125
     3126#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     3127    // Check to see if the command introduced paragraph separator. If it did, we remove existing autocorrection underlines.
     3128    // This is in consistency with the behavior in AppKit
     3129    if (!inSameParagraph(m_frame->selection()->selection().visibleStart(), newSelection.visibleEnd()))
     3130        m_frame->document()->markers()->removeMarkers(DocumentMarker::CorrectionIndicator);
     3131#endif
    31243132
    31253133    // If there is no selection change, don't bother sending shouldChangeSelection, but still call setSelection,
  • trunk/WebCore/rendering/InlineTextBox.cpp

    r68177 r68243  
    776776    case DocumentMarker::Grammar:
    777777        return GraphicsContext::TextCheckingGrammarLineStyle;
    778     case DocumentMarker::Replacement:
     778    case DocumentMarker::CorrectionIndicator:
    779779        return GraphicsContext::TextCheckingReplacementLineStyle;
    780780    default:
     
    914914            case DocumentMarker::Spelling:
    915915            case DocumentMarker::Replacement:
     916            case DocumentMarker::CorrectionIndicator:
    916917            case DocumentMarker::RejectedCorrection:
    917918                if (background)
     
    947948                paintTextMatchMarker(pt, tx, ty, marker, style, font);
    948949                break;
    949             case DocumentMarker::Replacement:
     950            case DocumentMarker::CorrectionIndicator:
    950951                computeRectForReplacementMarker(tx, ty, marker, style, font);
    951952                paintSpellingOrGrammarMarker(pt, tx, ty, marker, style, font, false);
    952953                break;
     954            case DocumentMarker::Replacement:
    953955            case DocumentMarker::RejectedCorrection:
    954956                break;
Note: See TracChangeset for help on using the changeset viewer.