Commit 35ba0bb9 authored by weinig@apple.com's avatar weinig@apple.com

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):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154643 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e8a3063f
2013-08-26 Sam Weinig <sam@webkit.org>
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 <bjonesbe@adobe.com>
Optimize FloatIntervalSearchAdapter::collectIfNeeded
......@@ -898,7 +898,7 @@ Editor::Editor(Frame& frame)
// 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)
......
......@@ -329,7 +329,7 @@ public:
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;
......
......@@ -106,7 +106,7 @@ void SpellCheckRequest::requesterDestroyed()
m_checker = 0;
}
SpellChecker::SpellChecker(Frame* frame)
SpellChecker::SpellChecker(Frame& frame)
: m_frame(frame)
, m_lastRequestSequence(0)
, m_lastProcessedSequence(0)
......@@ -124,7 +124,7 @@ SpellChecker::~SpellChecker()
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 @@ void SpellChecker::timerFiredToProcessQueuedRequest(Timer<SpellChecker>*)
bool SpellChecker::isAsynchronousEnabled() const
{
return m_frame->settings().asynchronousSpellCheckingEnabled();
return m_frame.settings().asynchronousSpellCheckingEnabled();
}
bool SpellChecker::canCheckAsynchronously(Range* range) const
......@@ -212,7 +212,7 @@ void SpellChecker::didCheck(int sequence, const Vector<TextCheckingResult>& resu
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 @@ void SpellChecker::didCheckSucceed(int sequence, const Vector<TextCheckingResult
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);
}
......
......@@ -75,7 +75,7 @@ class SpellChecker {
public:
friend class SpellCheckRequest;
explicit SpellChecker(Frame*);
explicit SpellChecker(Frame&);
~SpellChecker();
bool isAsynchronousEnabled() const;
......@@ -105,7 +105,7 @@ private:
void didCheckCancel(int sequence);
void didCheck(int sequence, const Vector<TextCheckingResult>&);
Frame* m_frame;
Frame& m_frame;
int m_lastRequestSequence;
int m_lastProcessedSequence;
......
......@@ -53,7 +53,6 @@ class KeyboardEvent;
class Node;
class Range;
class SharedBuffer;
class SpellChecker;
class StylePropertySet;
class TextCheckerClient;
class VisibleSelection;
......
......@@ -229,14 +229,6 @@ static bool markerTypesFrom(const String& markerType, DocumentMarker::MarkerType
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 @@ PassRefPtr<ClientRect> Internals::bestZoomableAreaForTouchPoint(long x, long y,
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment