⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 179792 in webkit


Ignore:
Timestamp:
Feb 7, 2015, 6:43:40 PM (12 years ago)
Author:
timothy_horton@apple.com
Message:

Add some dictionary lookup tests
https://bugs.webkit.org/show_bug.cgi?id=141355

Reviewed by Darin Adler.

Tests: platform/mac/editing/dictionary-lookup/dictionary-lookup-input.html

platform/mac/editing/dictionary-lookup/dictionary-lookup-inside-selection.html
platform/mac/editing/dictionary-lookup/dictionary-lookup-outside-selection.html
platform/mac/editing/dictionary-lookup/dictionary-lookup-rtl.html
platform/mac/editing/dictionary-lookup/dictionary-lookup.html

  • WebCore.exp.in:

Remove an unneeded export.

  • editing/mac/DictionaryLookup.h:

Use OBJC_CLASS instead of @class so that this can be included in pure-C++ files.

  • testing/Internals.cpp:

(WebCore::Internals::rangeForDictionaryLookupAtLocation):

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

Expose rangeForDictionaryLookupAtHitTestResult fairly directly to JavaScript.

  • platform/mac/editing/dictionary-lookup/dictionary-lookup-expected.txt: Added.
  • platform/mac/editing/dictionary-lookup/dictionary-lookup-input-expected.txt: Added.
  • platform/mac/editing/dictionary-lookup/dictionary-lookup-input.html: Added.
  • platform/mac/editing/dictionary-lookup/dictionary-lookup-inside-selection-expected.txt: Added.
  • platform/mac/editing/dictionary-lookup/dictionary-lookup-inside-selection.html: Added.
  • platform/mac/editing/dictionary-lookup/dictionary-lookup-outside-selection-expected.txt: Added.
  • platform/mac/editing/dictionary-lookup/dictionary-lookup-outside-selection.html: Added.
  • platform/mac/editing/dictionary-lookup/dictionary-lookup-rtl-expected.txt: Added.
  • platform/mac/editing/dictionary-lookup/dictionary-lookup-rtl.html: Added.
  • platform/mac/editing/dictionary-lookup/dictionary-lookup.html: Added.
  • platform/mac/editing/dictionary-lookup/lookup-test.js: Added.

(runTest):
Add tests for various cases that we've had trouble with in the past.

Location:
trunk
Files:
12 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r179790 r179792  
     12015-02-07  Tim Horton  <timothy_horton@apple.com>
     2
     3        Add some dictionary lookup tests
     4        https://bugs.webkit.org/show_bug.cgi?id=141355
     5
     6        Reviewed by Darin Adler.
     7
     8        * platform/mac/editing/dictionary-lookup/dictionary-lookup-expected.txt: Added.
     9        * platform/mac/editing/dictionary-lookup/dictionary-lookup-input-expected.txt: Added.
     10        * platform/mac/editing/dictionary-lookup/dictionary-lookup-input.html: Added.
     11        * platform/mac/editing/dictionary-lookup/dictionary-lookup-inside-selection-expected.txt: Added.
     12        * platform/mac/editing/dictionary-lookup/dictionary-lookup-inside-selection.html: Added.
     13        * platform/mac/editing/dictionary-lookup/dictionary-lookup-outside-selection-expected.txt: Added.
     14        * platform/mac/editing/dictionary-lookup/dictionary-lookup-outside-selection.html: Added.
     15        * platform/mac/editing/dictionary-lookup/dictionary-lookup-rtl-expected.txt: Added.
     16        * platform/mac/editing/dictionary-lookup/dictionary-lookup-rtl.html: Added.
     17        * platform/mac/editing/dictionary-lookup/dictionary-lookup.html: Added.
     18        * platform/mac/editing/dictionary-lookup/lookup-test.js: Added.
     19        (runTest):
     20        Add tests for various cases that we've had trouble with in the past.
     21
    1222015-02-07  Zalan Bujtas  <zalan@apple.com>
    223
  • trunk/Source/WebCore/ChangeLog

    r179791 r179792  
     12015-02-07  Tim Horton  <timothy_horton@apple.com>
     2
     3        Add some dictionary lookup tests
     4        https://bugs.webkit.org/show_bug.cgi?id=141355
     5
     6        Reviewed by Darin Adler.
     7
     8        Tests: platform/mac/editing/dictionary-lookup/dictionary-lookup-input.html
     9               platform/mac/editing/dictionary-lookup/dictionary-lookup-inside-selection.html
     10               platform/mac/editing/dictionary-lookup/dictionary-lookup-outside-selection.html
     11               platform/mac/editing/dictionary-lookup/dictionary-lookup-rtl.html
     12               platform/mac/editing/dictionary-lookup/dictionary-lookup.html
     13
     14        * WebCore.exp.in:
     15        Remove an unneeded export.
     16
     17        * editing/mac/DictionaryLookup.h:
     18        Use OBJC_CLASS instead of @class so that this can be included in pure-C++ files.
     19
     20        * testing/Internals.cpp:
     21        (WebCore::Internals::rangeForDictionaryLookupAtLocation):
     22        * testing/Internals.h:
     23        * testing/Internals.idl:
     24        Expose rangeForDictionaryLookupAtHitTestResult fairly directly to JavaScript.
     25
    1262015-02-07  Chris Dumez  <cdumez@apple.com>
    227
  • trunk/Source/WebCore/WebCore.exp.in

    r179702 r179792  
    24552455__ZN7WebCore37contextMenuItemTagTransformationsMenuEv
    24562456__ZN7WebCore38contextMenuItemTagWritingDirectionMenuEv
    2457 __ZN7WebCore39rangeExpandedAroundPositionByCharactersERKNS_15VisiblePositionEi
    24582457__ZN7WebCore39rangeForDictionaryLookupAtHitTestResultERKNS_13HitTestResultEPP12NSDictionary
    24592458__ZN7WebCore42contextMenuItemTagCheckGrammarWithSpellingEv
  • trunk/Source/WebCore/editing/mac/DictionaryLookup.h

    r177739 r179792  
    3131#include <wtf/PassRefPtr.h>
    3232
    33 @class NSDictionary;
     33OBJC_CLASS NSDictionary;
    3434
    3535namespace WebCore {
  • trunk/Source/WebCore/testing/Internals.cpp

    r179702 r179792  
    167167#endif
    168168
     169#if PLATFORM(MAC)
     170#include "DictionaryLookup.h"
     171#endif
     172
    169173using JSC::CodeBlock;
    170174using JSC::FunctionExecutable;
     
    10851089
    10861090    return TextIterator::subrange(range, rangeLocation, rangeLength);
     1091}
     1092
     1093RefPtr<Range> Internals::rangeForDictionaryLookupAtLocation(int x, int y, ExceptionCode& ec)
     1094{
     1095#if PLATFORM(MAC)
     1096    Document* document = contextDocument();
     1097    if (!document || !document->frame()) {
     1098        ec = INVALID_ACCESS_ERR;
     1099        return nullptr;
     1100    }
     1101
     1102    document->updateLayoutIgnorePendingStylesheets();
     1103   
     1104    HitTestResult result = document->frame()->mainFrame().eventHandler().hitTestResultAtPoint(IntPoint(x, y));
     1105    NSDictionary *options = nullptr;
     1106    return rangeForDictionaryLookupAtHitTestResult(result, &options);
     1107#else
     1108    UNUSED_PARAM(x);
     1109    UNUSED_PARAM(y);
     1110    ec = INVALID_ACCESS_ERR;
     1111    return nullptr;
     1112#endif
    10871113}
    10881114
  • trunk/Source/WebCore/testing/Internals.h

    r179702 r179792  
    163163    String rangeAsText(const Range*, ExceptionCode&);
    164164    PassRefPtr<Range> subrange(Range* range, int rangeLocation, int rangeLength, ExceptionCode&);
     165    RefPtr<Range> rangeForDictionaryLookupAtLocation(int x, int y, ExceptionCode&);
    165166
    166167    void setDelegatesScrolling(bool enabled, ExceptionCode&);
  • trunk/Source/WebCore/testing/Internals.idl

    r179702 r179792  
    125125    [RaisesException] DOMString rangeAsText(Range range);
    126126    [RaisesException] Range subrange(Range range, long rangeLocation, long rangeLength);
     127    [RaisesException] Range rangeForDictionaryLookupAtLocation(long x, long y);
    127128
    128129    [RaisesException] void setDelegatesScrolling(boolean enabled);
Note: See TracChangeset for help on using the changeset viewer.