Changeset 102231 in webkit


Ignore:
Timestamp:
Dec 7, 2011 4:34:02 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Internals should have a method to reutrn the max sequence number of spellcheck reqeust.
https://bugs.webkit.org/show_bug.cgi?id=73511

Patch by Shinya Kawanaka <shinyak@google.com> on 2011-12-07
Reviewed by Hajime Morita.

Source/WebCore:

Internal state of SpellChecker should be able to be exposed for testing SpellChecker.
This patch will enable us to know asynchronous spellcheck has finished or not.

Test: editing/spelling/spellcheck-sequencenum.html

  • editing/SpellChecker.cpp:

(WebCore::SpellChecker::SpellChecker):
(WebCore::SpellChecker::createRequest):
(WebCore::SpellChecker::didCheck):

  • editing/SpellChecker.h:

(WebCore::SpellChecker::lastRequestSequence):

Interface to take SpellCheck sequence numbers.

(WebCore::SpellChecker::lastProcessedSequence): ditto.

  • testing/Internals.cpp:

(WebCore::spellchecker):
(WebCore::Internals::lastSpellCheckRequestSequence):
(WebCore::Internals::lastSpellCheckProcessedSequence):

  • testing/Internals.h:
  • testing/Internals.idl:

LayoutTests:

Added tests to check internals.lastSpellCheckRequestSequence and internals.lastSpellCheckProcessedSequence.

  • editing/spelling/spellcheck-sequencenum-expected.txt: Added.
  • editing/spelling/spellcheck-sequencenum.html: Added.
  • platform/gtk/Skipped:
  • platform/qt/Skipped:
Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r102229 r102231  
     12011-12-07  Shinya Kawanaka  <shinyak@google.com>
     2
     3        Internals should have a method to reutrn the max sequence number of spellcheck reqeust.
     4        https://bugs.webkit.org/show_bug.cgi?id=73511
     5
     6        Reviewed by Hajime Morita.
     7
     8        Added tests to check internals.lastSpellCheckRequestSequence and internals.lastSpellCheckProcessedSequence.
     9
     10        * editing/spelling/spellcheck-sequencenum-expected.txt: Added.
     11        * editing/spelling/spellcheck-sequencenum.html: Added.
     12        * platform/gtk/Skipped:
     13        * platform/qt/Skipped:
     14
    1152011-12-07  Vsevolod Vlasov  <vsevik@chromium.org>
    216
  • trunk/LayoutTests/platform/gtk/Skipped

    r102226 r102231  
    12211221editing/spelling/spellcheck-paste.html
    12221222editing/spelling/spellcheck-queue.html
     1223editing/spelling/spellcheck-sequencenum.html
    12231224
    12241225# For https://bugs.webkit.org/show_bug.cgi?id=50758
  • trunk/LayoutTests/platform/qt/Skipped

    r102226 r102231  
    10111011editing/spelling/spellcheck-paste.html
    10121012editing/spelling/spellcheck-queue.html
     1013editing/spelling/spellcheck-sequencenum.html
    10131014
    10141015# [Qt][GTK] editing/spelling/spellcheck-async.html fails
  • trunk/Source/WebCore/ChangeLog

    r102225 r102231  
     12011-12-07  Shinya Kawanaka  <shinyak@google.com>
     2
     3        Internals should have a method to reutrn the max sequence number of spellcheck reqeust.
     4        https://bugs.webkit.org/show_bug.cgi?id=73511
     5
     6        Reviewed by Hajime Morita.
     7
     8        Internal state of SpellChecker should be able to be exposed for testing SpellChecker.
     9        This patch will enable us to know asynchronous spellcheck has finished or not.
     10
     11        Test: editing/spelling/spellcheck-sequencenum.html
     12
     13        * editing/SpellChecker.cpp:
     14        (WebCore::SpellChecker::SpellChecker):
     15        (WebCore::SpellChecker::createRequest):
     16        (WebCore::SpellChecker::didCheck):
     17        * editing/SpellChecker.h:
     18        (WebCore::SpellChecker::lastRequestSequence):
     19          Interface to take SpellCheck sequence numbers.
     20        (WebCore::SpellChecker::lastProcessedSequence): ditto.
     21        * testing/Internals.cpp:
     22        (WebCore::spellchecker):
     23        (WebCore::Internals::lastSpellCheckRequestSequence):
     24        (WebCore::Internals::lastSpellCheckProcessedSequence):
     25        * testing/Internals.h:
     26        * testing/Internals.idl:
     27
    1282011-12-07  Ryosuke Niwa  <rniwa@webkit.org>
    229
  • trunk/Source/WebCore/editing/SpellChecker.cpp

    r101978 r102231  
    7373SpellChecker::SpellChecker(Frame* frame)
    7474    : m_frame(frame)
    75     , m_lastRequestedSequence(0)
     75    , m_lastRequestSequence(0)
     76    , m_lastProcessedSequence(0)
    7677    , m_timerToProcessQueuedRequest(this, &SpellChecker::timerFiredToProcessQueuedRequest)
    7778{
     
    9899        return PassRefPtr<SpellCheckRequest>();
    99100
    100     return adoptRef(new SpellCheckRequest(++m_lastRequestedSequence, range, text, mask));
     101    return adoptRef(new SpellCheckRequest(++m_lastRequestSequence, range, text, mask));
    101102}
    102103
     
    199200{
    200201    ASSERT(m_processingRequest);
    201 
    202202    ASSERT(m_processingRequest->sequence() == sequence);
    203203    if (m_processingRequest->sequence() != sequence) {
     
    235235    }
    236236
     237    if (m_lastProcessedSequence < sequence)
     238        m_lastProcessedSequence = sequence;
     239
    237240    m_processingRequest.clear();
    238241    if (!m_requestQueue.isEmpty())
  • trunk/Source/WebCore/editing/SpellChecker.h

    r101978 r102231  
    5454    void didCheck(int sequence, const Vector<TextCheckingResult>&);
    5555
     56    int lastRequestSequence() const
     57    {
     58        return m_lastRequestSequence;
     59    }
     60
     61    int lastProcessedSequence() const
     62    {
     63        return m_lastProcessedSequence;
     64    }
     65
    5666private:
    5767    class SpellCheckRequest;
     
    6676
    6777    Frame* m_frame;
    68     int m_lastRequestedSequence;
     78    int m_lastRequestSequence;
     79    int m_lastProcessedSequence;
    6980
    7081    Timer<SpellChecker> m_timerToProcessQueuedRequest;
  • trunk/Source/WebCore/testing/Internals.cpp

    r102088 r102231  
    4949#include "ShadowContentElement.h"
    5050#include "ShadowRoot.h"
     51#include "SpellChecker.h"
    5152#include "TextIterator.h"
    5253
     
    9394}
    9495
     96static SpellChecker* spellchecker(Document* document)
     97{
     98    if (!document || !document->frame() || !document->frame()->editor())
     99        return 0;
     100
     101    return document->frame()->editor()->spellChecker();
     102}
     103
    95104const char* Internals::internalsId = "internals";
    96105
     
    619628}
    620629
    621 }
     630int Internals::lastSpellCheckRequestSequence(Document* document, ExceptionCode& ec)
     631{
     632    SpellChecker* checker = spellchecker(document);
     633
     634    if (!checker) {
     635        ec = INVALID_ACCESS_ERR;
     636        return -1;
     637    }
     638
     639    return checker->lastRequestSequence();
     640}
     641
     642int Internals::lastSpellCheckProcessedSequence(Document* document, ExceptionCode& ec)
     643{
     644    SpellChecker* checker = spellchecker(document);
     645
     646    if (!checker) {
     647        ec = INVALID_ACCESS_ERR;
     648        return -1;
     649    }
     650
     651    return checker->lastProcessedSequence();
     652}
     653
     654}
  • trunk/Source/WebCore/testing/Internals.h

    r102088 r102231  
    111111    bool unifiedTextCheckingEnabled(Document*, ExceptionCode&);
    112112
     113    int lastSpellCheckRequestSequence(Document*, ExceptionCode&);
     114    int lastSpellCheckProcessedSequence(Document*, ExceptionCode&);
     115
    113116    static const char* internalsId;
    114117
  • trunk/Source/WebCore/testing/Internals.idl

    r102088 r102231  
    8282        void setUnifiedTextCheckingEnabled(in Document document, in boolean enabled) raises (DOMException);
    8383        boolean unifiedTextCheckingEnabled(in Document document) raises (DOMException);
     84
     85        long lastSpellCheckRequestSequence(in Document document) raises (DOMException);
     86        long lastSpellCheckProcessedSequence(in Document document) raises (DOMException);
    8487    };
    8588}
Note: See TracChangeset for help on using the changeset viewer.