[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 13:43:48 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b5d274e70cd5a571f6f4aa442d49b1ae3e0b0433
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Sep 24 08:44:24 2010 +0000

    2010-09-24  Jia Pu  <jpu at 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.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68243 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a3c244a..f8ba6d3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2010-09-24  Jia Pu  <jpu at 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.
+
 2010-09-24  Eric Uhrhane  <ericu at chromium.org>
 
         Reviewed by David Levin.
diff --git a/WebCore/dom/DocumentMarker.h b/WebCore/dom/DocumentMarker.h
index e6160ae..dd5e981 100644
--- a/WebCore/dom/DocumentMarker.h
+++ b/WebCore/dom/DocumentMarker.h
@@ -40,6 +40,7 @@ struct DocumentMarker {
         Grammar,
         TextMatch,
         Replacement,
+        CorrectionIndicator,
         RejectedCorrection
     };
 
diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp
index 8224281..9b2a88f 100644
--- a/WebCore/editing/Editor.cpp
+++ b/WebCore/editing/Editor.cpp
@@ -2741,6 +2741,7 @@ void Editor::markAllMisspellingsAndBadGrammarInRanges(TextCheckingOptions textCh
                             // Add a marker so that corrections can easily be undone and won't be re-corrected.
                             RefPtr<Range> replacedRange = TextIterator::subrange(paragraphRange.get(), resultLocation, replacementLength);
                             replacedRange->startContainer()->document()->markers()->addMarker(replacedRange.get(), DocumentMarker::Replacement, replacedString);
+                            replacedRange->startContainer()->document()->markers()->addMarker(replacedRange.get(), DocumentMarker::CorrectionIndicator);
                         }
                     }
                 }
@@ -3122,6 +3123,13 @@ void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection, b
     if (newSelection.start().isOrphan() || newSelection.end().isOrphan())
         return;
 
+#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+    // Check to see if the command introduced paragraph separator. If it did, we remove existing autocorrection underlines.
+    // This is in consistency with the behavior in AppKit
+    if (!inSameParagraph(m_frame->selection()->selection().visibleStart(), newSelection.visibleEnd()))
+        m_frame->document()->markers()->removeMarkers(DocumentMarker::CorrectionIndicator);
+#endif
+
     // If there is no selection change, don't bother sending shouldChangeSelection, but still call setSelection,
     // because there is work that it must do in this situation.
     // The old selection can be invalid here and calling shouldChangeSelection can produce some strange calls.
diff --git a/WebCore/rendering/InlineTextBox.cpp b/WebCore/rendering/InlineTextBox.cpp
index 5e968b6..68bff3c 100644
--- a/WebCore/rendering/InlineTextBox.cpp
+++ b/WebCore/rendering/InlineTextBox.cpp
@@ -775,7 +775,7 @@ static GraphicsContext::TextCheckingLineStyle textCheckingLineStyleForMarkerType
         return GraphicsContext::TextCheckingSpellingLineStyle;
     case DocumentMarker::Grammar:
         return GraphicsContext::TextCheckingGrammarLineStyle;
-    case DocumentMarker::Replacement:
+    case DocumentMarker::CorrectionIndicator:
         return GraphicsContext::TextCheckingReplacementLineStyle;
     default:
         ASSERT_NOT_REACHED();
@@ -913,6 +913,7 @@ void InlineTextBox::paintDocumentMarkers(GraphicsContext* pt, int tx, int ty, Re
             case DocumentMarker::Grammar:
             case DocumentMarker::Spelling:
             case DocumentMarker::Replacement:
+            case DocumentMarker::CorrectionIndicator:
             case DocumentMarker::RejectedCorrection:
                 if (background)
                     continue;
@@ -946,10 +947,11 @@ void InlineTextBox::paintDocumentMarkers(GraphicsContext* pt, int tx, int ty, Re
             case DocumentMarker::TextMatch:
                 paintTextMatchMarker(pt, tx, ty, marker, style, font);
                 break;
-            case DocumentMarker::Replacement:
+            case DocumentMarker::CorrectionIndicator:
                 computeRectForReplacementMarker(tx, ty, marker, style, font);
                 paintSpellingOrGrammarMarker(pt, tx, ty, marker, style, font, false);
                 break;
+            case DocumentMarker::Replacement:
             case DocumentMarker::RejectedCorrection:
                 break;
             default:

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list