Title: [154643] trunk/Source/WebCore
Revision
154643
Author
[email protected]
Date
2013-08-26 14:50:32 -0700 (Mon, 26 Aug 2013)

Log Message

Editor::spellChecker() should return a reference
https://bugs.webkit.org/show_bug.cgi?id=120325

Reviewed by Anders Carlsson.

* editing/Editor.cpp:
(WebCore::Editor::Editor):
* editing/Editor.h:
(WebCore::Editor::spellChecker):
* editing/SpellChecker.cpp:
(WebCore::SpellChecker::SpellChecker):
(WebCore::SpellChecker::client):
(WebCore::SpellChecker::isAsynchronousEnabled):
(WebCore::SpellChecker::didCheck):
(WebCore::SpellChecker::didCheckSucceed):
* editing/SpellChecker.h:
* page/EditorClient.h:
* testing/Internals.cpp:
(WebCore::Internals::lastSpellCheckRequestSequence):
(WebCore::Internals::lastSpellCheckProcessedSequence):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (154642 => 154643)


--- trunk/Source/WebCore/ChangeLog	2013-08-26 21:42:33 UTC (rev 154642)
+++ trunk/Source/WebCore/ChangeLog	2013-08-26 21:50:32 UTC (rev 154643)
@@ -1,3 +1,26 @@
+2013-08-26  Sam Weinig  <[email protected]>
+
+        Editor::spellChecker() should return a reference
+        https://bugs.webkit.org/show_bug.cgi?id=120325
+
+        Reviewed by Anders Carlsson.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::Editor):
+        * editing/Editor.h:
+        (WebCore::Editor::spellChecker):
+        * editing/SpellChecker.cpp:
+        (WebCore::SpellChecker::SpellChecker):
+        (WebCore::SpellChecker::client):
+        (WebCore::SpellChecker::isAsynchronousEnabled):
+        (WebCore::SpellChecker::didCheck):
+        (WebCore::SpellChecker::didCheckSucceed):
+        * editing/SpellChecker.h:
+        * page/EditorClient.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::lastSpellCheckRequestSequence):
+        (WebCore::Internals::lastSpellCheckProcessedSequence):
+
 2013-08-26  Bem Jones-Bey  <[email protected]>
 
         Optimize FloatIntervalSearchAdapter::collectIfNeeded

Modified: trunk/Source/WebCore/editing/Editor.cpp (154642 => 154643)


--- trunk/Source/WebCore/editing/Editor.cpp	2013-08-26 21:42:33 UTC (rev 154642)
+++ trunk/Source/WebCore/editing/Editor.cpp	2013-08-26 21:50:32 UTC (rev 154643)
@@ -898,7 +898,7 @@
     // This is off by default, since most editors want this behavior (this matches IE but not FF).
     , m_shouldStyleWithCSS(false)
     , m_killRing(adoptPtr(new KillRing))
-    , m_spellChecker(adoptPtr(new SpellChecker(&frame)))
+    , m_spellChecker(adoptPtr(new SpellChecker(frame)))
     , m_alternativeTextController(adoptPtr(new AlternativeTextController(&frame)))
     , m_areMarkedTextMatchesHighlighted(false)
     , m_defaultParagraphSeparator(EditorParagraphSeparatorIsDiv)

Modified: trunk/Source/WebCore/editing/Editor.h (154642 => 154643)


--- trunk/Source/WebCore/editing/Editor.h	2013-08-26 21:42:33 UTC (rev 154642)
+++ trunk/Source/WebCore/editing/Editor.h	2013-08-26 21:50:32 UTC (rev 154643)
@@ -329,7 +329,7 @@
     VisibleSelection selectionForCommand(Event*);
 
     KillRing* killRing() const { return m_killRing.get(); }
-    SpellChecker* spellChecker() const { return m_spellChecker.get(); }
+    SpellChecker& spellChecker() const { return *m_spellChecker.get(); }
 
     EditingBehavior behavior() const;
 

Modified: trunk/Source/WebCore/editing/SpellChecker.cpp (154642 => 154643)


--- trunk/Source/WebCore/editing/SpellChecker.cpp	2013-08-26 21:42:33 UTC (rev 154642)
+++ trunk/Source/WebCore/editing/SpellChecker.cpp	2013-08-26 21:50:32 UTC (rev 154643)
@@ -106,7 +106,7 @@
     m_checker = 0;
 }
 
-SpellChecker::SpellChecker(Frame* frame)
+SpellChecker::SpellChecker(Frame& frame)
     : m_frame(frame)
     , m_lastRequestSequence(0)
     , m_lastProcessedSequence(0)
@@ -124,7 +124,7 @@
 
 TextCheckerClient* SpellChecker::client() const
 {
-    Page* page = m_frame->page();
+    Page* page = m_frame.page();
     if (!page)
         return 0;
     return page->editorClient()->textChecker();
@@ -141,7 +141,7 @@
 
 bool SpellChecker::isAsynchronousEnabled() const
 {
-    return m_frame->settings().asynchronousSpellCheckingEnabled();
+    return m_frame.settings().asynchronousSpellCheckingEnabled();
 }
 
 bool SpellChecker::canCheckAsynchronously(Range* range) const
@@ -212,7 +212,7 @@
         return;
     }
 
-    m_frame->editor().markAndReplaceFor(m_processingRequest, results);
+    m_frame.editor().markAndReplaceFor(m_processingRequest, results);
 
     if (m_lastProcessedSequence < sequence)
         m_lastProcessedSequence = sequence;
@@ -232,7 +232,7 @@
         if (requestData.mask() & TextCheckingTypeGrammar)
             markers |= DocumentMarker::Grammar;
         if (markers)
-            m_frame->document()->markers().removeMarkers(m_processingRequest->checkingRange().get(), markers);
+            m_frame.document()->markers().removeMarkers(m_processingRequest->checkingRange().get(), markers);
     }
     didCheck(sequence, results);
 }

Modified: trunk/Source/WebCore/editing/SpellChecker.h (154642 => 154643)


--- trunk/Source/WebCore/editing/SpellChecker.h	2013-08-26 21:42:33 UTC (rev 154642)
+++ trunk/Source/WebCore/editing/SpellChecker.h	2013-08-26 21:50:32 UTC (rev 154643)
@@ -75,7 +75,7 @@
 public:
     friend class SpellCheckRequest;
 
-    explicit SpellChecker(Frame*);
+    explicit SpellChecker(Frame&);
     ~SpellChecker();
 
     bool isAsynchronousEnabled() const;
@@ -105,7 +105,7 @@
     void didCheckCancel(int sequence);
     void didCheck(int sequence, const Vector<TextCheckingResult>&);
 
-    Frame* m_frame;
+    Frame& m_frame;
     int m_lastRequestSequence;
     int m_lastProcessedSequence;
 

Modified: trunk/Source/WebCore/page/EditorClient.h (154642 => 154643)


--- trunk/Source/WebCore/page/EditorClient.h	2013-08-26 21:42:33 UTC (rev 154642)
+++ trunk/Source/WebCore/page/EditorClient.h	2013-08-26 21:50:32 UTC (rev 154643)
@@ -53,7 +53,6 @@
 class Node;
 class Range;
 class SharedBuffer;
-class SpellChecker;
 class StylePropertySet;
 class TextCheckerClient;
 class VisibleSelection;

Modified: trunk/Source/WebCore/testing/Internals.cpp (154642 => 154643)


--- trunk/Source/WebCore/testing/Internals.cpp	2013-08-26 21:42:33 UTC (rev 154642)
+++ trunk/Source/WebCore/testing/Internals.cpp	2013-08-26 21:50:32 UTC (rev 154643)
@@ -229,14 +229,6 @@
     return true;
 }
 
-static SpellChecker* spellchecker(Document* document)
-{
-    if (!document || !document->frame())
-        return 0;
-
-    return document->frame()->editor().spellChecker();
-}
-
 const char* Internals::internalsId = "internals";
 
 PassRefPtr<Internals> Internals::create(Document* document)
@@ -1172,26 +1164,22 @@
 
 int Internals::lastSpellCheckRequestSequence(Document* document, ExceptionCode& ec)
 {
-    SpellChecker* checker = spellchecker(document);
-
-    if (!checker) {
+    if (!document || !document->frame()) {
         ec = INVALID_ACCESS_ERR;
         return -1;
     }
 
-    return checker->lastRequestSequence();
+    return document->frame()->editor().spellChecker().lastRequestSequence();
 }
 
 int Internals::lastSpellCheckProcessedSequence(Document* document, ExceptionCode& ec)
 {
-    SpellChecker* checker = spellchecker(document);
-
-    if (!checker) {
+    if (!document || !document->frame()) {
         ec = INVALID_ACCESS_ERR;
         return -1;
     }
 
-    return checker->lastProcessedSequence();
+    return document->frame()->editor().spellChecker().lastProcessedSequence();
 }
 
 Vector<String> Internals::userPreferredLanguages() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to