Changeset 116475 in webkit


Ignore:
Timestamp:
May 8, 2012 6:32:43 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[EFL][DRT] Implement TextInputController.
https://bugs.webkit.org/show_bug.cgi?id=78559

Patch by Kangil Han <kangil.han@samsung.com> on 2012-05-08
Reviewed by Martin Robinson.

TextInputController has been created for an input emulation purpose in DRT.
However, not like other ports, EFL doesn't have it.
Therefore, this patch will enable EFL port to have an input emulation in DRT.

Source/WebKit/efl:

  • WebCoreSupport/DumpRenderTreeSupportEfl.cpp:

(DumpRenderTreeSupportEfl::setComposition):
(DumpRenderTreeSupportEfl::hasComposition):
(DumpRenderTreeSupportEfl::compositionRange):
(DumpRenderTreeSupportEfl::confirmComposition):
(DumpRenderTreeSupportEfl::firstRectForCharacterRange):
(DumpRenderTreeSupportEfl::selectedRange):

  • WebCoreSupport/DumpRenderTreeSupportEfl.h:

Tools:

  • DumpRenderTree/efl/CMakeLists.txt:
  • DumpRenderTree/efl/DumpRenderTreeChrome.cpp:

(DumpRenderTreeChrome::onWindowObjectCleared):

  • DumpRenderTree/efl/TextInputController.cpp: Added.

(setMarkedTextCallback):
(hasMarkedTextCallback):
(markedRangeCallback):
(insertTextCallback):
(unmarkTextCallback):
(firstRectForCharacterRangeCallback):
(selectedRangeCallback):
(makeTextInputController):

  • DumpRenderTree/efl/TextInputController.h: Added.

LayoutTests:

  • platform/efl/Skipped:
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r116473 r116475  
     12012-05-08  Kangil Han  <kangil.han@samsung.com>
     2
     3        [EFL][DRT] Implement TextInputController.
     4        https://bugs.webkit.org/show_bug.cgi?id=78559
     5
     6        Reviewed by Martin Robinson.
     7
     8        TextInputController has been created for an input emulation purpose in DRT.
     9        However, not like other ports, EFL doesn't have it.
     10        Therefore, this patch will enable EFL port to have an input emulation in DRT.
     11
     12        * platform/efl/Skipped:
     13
    1142012-05-08  Jon Lee  <jonlee@apple.com>
    215
  • trunk/LayoutTests/platform/efl/Skipped

    r116464 r116475  
    210210editing/text-iterator/basic-iteration.html
    211211
    212 # EFL's DRT needs a TextInputController
    213 editing/input/ime-composition-clearpreedit.html
     212# EFL's DRT key down bug
     213# https://bugs.webkit.org/show_bug.cgi?id=84710
    214214editing/input/password-echo-passnode.html
    215215editing/input/password-echo-passnode2.html
    216 editing/input/password-echo-passnode3.html
    217 editing/input/password-echo-textnode.html
     216
     217# EFL's editor doesn't cancel composition as change of value
     218# https://bugs.webkit.org/show_bug.cgi?id=85122
    218219editing/input/setting-input-value-cancel-ime-composition.html
    219 editing/inserting/caret-position.html
    220 editing/inserting/insert-composition-whitespace.html
    221 editing/selection/5825350-1.html
    222 editing/selection/5825350-2.html
    223 editing/selection/mixed-editability-10.html
    224 editing/selection/move-left-right.html
    225 fast/dom/tab-in-right-alignment.html
    226 fast/events/ime-composition-events-001.html
     220
     221# EFL's textarea and textfield doesn't handle whitespace style
     222# https://bugs.webkit.org/show_bug.cgi?id=85123
    227223fast/forms/cursor-at-editable-content-boundary.html
    228 fast/forms/input-maxlength-ime-completed.html
    229 fast/forms/input-maxlength-ime-preedit.html
    230 fast/text/international/thai-cursor-position.html
    231 svg/text/caret-in-svg-text.xhtml
    232224
    233225# EFL's LayoutTestController does not implement setMediaType
     
    17951787transitions/svg-text-shadow-transition.html
    17961788transitions/svg-transitions.html
     1789fast/dom/Window/window-properties.html
     1790fast/dom/prototype-inheritance-2.html
    17971791
    17981792# EFL DRT doesn't fully support http tests yet. These tests make timeout error.
  • trunk/Source/WebKit/efl/ChangeLog

    r116470 r116475  
     12012-05-08  Kangil Han  <kangil.han@samsung.com>
     2
     3        [EFL][DRT] Implement TextInputController.
     4        https://bugs.webkit.org/show_bug.cgi?id=78559
     5
     6        Reviewed by Martin Robinson.
     7
     8        TextInputController has been created for an input emulation purpose in DRT.
     9        However, not like other ports, EFL doesn't have it.
     10        Therefore, this patch will enable EFL port to have an input emulation in DRT.
     11
     12        * WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
     13        (DumpRenderTreeSupportEfl::setComposition):
     14        (DumpRenderTreeSupportEfl::hasComposition):
     15        (DumpRenderTreeSupportEfl::compositionRange):
     16        (DumpRenderTreeSupportEfl::confirmComposition):
     17        (DumpRenderTreeSupportEfl::firstRectForCharacterRange):
     18        (DumpRenderTreeSupportEfl::selectedRange):
     19        * WebCoreSupport/DumpRenderTreeSupportEfl.h:
     20
    1212012-04-23  Raphael Kubo da Costa  <rakuco@webkit.org>
    222
  • trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp

    r116470 r116475  
    4444#include <RenderTreeAsText.h>
    4545#include <Settings.h>
     46#include <TextIterator.h>
    4647#include <WebKitMutationObserver.h>
    4748#include <bindings/js/GCController.h>
     
    616617    corePage->settings()->setAuthorAndUserStylesEnabled(enabled);
    617618}
     619
     620void DumpRenderTreeSupportEfl::setComposition(Evas_Object* ewkView, const char* text, int start, int length)
     621{
     622    WebCore::Page* page = EWKPrivate::corePage(ewkView);
     623    if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame())
     624        return;
     625
     626    WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
     627    if (!editor || (!editor->canEdit() && !editor->hasComposition()))
     628        return;
     629
     630    const String compositionString = String::fromUTF8(text);
     631    Vector<WebCore::CompositionUnderline> underlines;
     632    underlines.append(WebCore::CompositionUnderline(0, compositionString.length(), WebCore::Color(0, 0, 0), false));
     633    editor->setComposition(compositionString, underlines, start, start + length);
     634}
     635
     636bool DumpRenderTreeSupportEfl::hasComposition(const Evas_Object* ewkView)
     637{
     638    const WebCore::Page* page = EWKPrivate::corePage(ewkView);
     639    if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame())
     640        return false;
     641
     642    const WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
     643    if (!editor)
     644        return false;
     645
     646    return editor->hasComposition();
     647}
     648
     649bool DumpRenderTreeSupportEfl::compositionRange(Evas_Object* ewkView, int* start, int* length)
     650{
     651    *start = *length = 0;
     652
     653    WebCore::Page* page = EWKPrivate::corePage(ewkView);
     654    if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame())
     655        return false;
     656
     657    WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
     658    if (!editor || !editor->hasComposition())
     659        return false;
     660
     661    *start = editor->compositionStart();
     662    *length = editor->compositionEnd() - *start;
     663    return true;
     664}
     665
     666void DumpRenderTreeSupportEfl::confirmComposition(Evas_Object* ewkView, const char* text)
     667{
     668    WebCore::Page* page = EWKPrivate::corePage(ewkView);
     669    if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame())
     670        return;
     671
     672    WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor();
     673    if (!editor)
     674        return;
     675
     676    if (!editor->hasComposition()) {
     677        editor->insertText(String::fromUTF8(text), 0);
     678        return;
     679    }
     680
     681    if (text) {
     682        editor->confirmComposition(String::fromUTF8(text));
     683        return;
     684    }
     685    editor->confirmComposition();
     686}
     687
     688WebCore::IntRect DumpRenderTreeSupportEfl::firstRectForCharacterRange(Evas_Object* ewkView, int location, int length)
     689{
     690    WebCore::Page* page = EWKPrivate::corePage(ewkView);
     691    if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame() || !page->focusController()->focusedOrMainFrame()->editor())
     692        return WebCore::IntRect();
     693
     694    if ((location + length < location) && (location + length))
     695        length = 0;
     696
     697    WebCore::Frame* frame = page->focusController()->focusedOrMainFrame();
     698    WebCore::Editor* editor = frame->editor();
     699
     700    RefPtr<WebCore::Range> range = WebCore::TextIterator::rangeFromLocationAndLength(frame->selection()->rootEditableElementOrDocumentElement(), location, length);
     701    if (!range)
     702        return WebCore::IntRect();
     703
     704    return editor->firstRectForRange(range.get());
     705}
     706
     707bool DumpRenderTreeSupportEfl::selectedRange(Evas_Object* ewkView, int* start, int* length)
     708{
     709    if (!(start && length))
     710        return false;
     711
     712    WebCore::Page* page = EWKPrivate::corePage(ewkView);
     713    if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame())
     714        return false;
     715
     716    WebCore::Frame* frame = page->focusController()->focusedOrMainFrame();
     717    RefPtr<WebCore::Range> range = frame->selection()->toNormalizedRange().get();
     718    if (!range)
     719        return false;
     720
     721    WebCore::Element* selectionRoot = frame->selection()->rootEditableElement();
     722    WebCore::Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement();
     723
     724    RefPtr<WebCore::Range> testRange = WebCore::Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset());
     725    *start = WebCore::TextIterator::rangeLength(testRange.get());
     726
     727    WebCore::ExceptionCode ec;
     728    testRange->setEnd(range->endContainer(), range->endOffset(), ec);
     729    *length = WebCore::TextIterator::rangeLength(testRange.get());
     730
     731    return true;
     732}
  • trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h

    r116470 r116475  
    9999    static JSValueRef computedStyleIncludingVisitedInfo(JSContextRef, JSValueRef);
    100100    static void setAuthorAndUserStylesEnabled(Evas_Object* ewkView, bool);
     101
     102    // TextInputController
     103    static void setComposition(Evas_Object*, const char*, int, int);
     104    static bool hasComposition(const Evas_Object*);
     105    static bool compositionRange(Evas_Object*, int*, int*);
     106    static void confirmComposition(Evas_Object*, const char*);
     107    static WebCore::IntRect firstRectForCharacterRange(Evas_Object*, int, int);
     108    static bool selectedRange(Evas_Object*, int*, int*);
    101109};
    102110
  • trunk/Tools/ChangeLog

    r116470 r116475  
     12012-05-08  Kangil Han  <kangil.han@samsung.com>
     2
     3        [EFL][DRT] Implement TextInputController.
     4        https://bugs.webkit.org/show_bug.cgi?id=78559
     5
     6        Reviewed by Martin Robinson.
     7
     8        TextInputController has been created for an input emulation purpose in DRT.
     9        However, not like other ports, EFL doesn't have it.
     10        Therefore, this patch will enable EFL port to have an input emulation in DRT.
     11
     12        * DumpRenderTree/efl/CMakeLists.txt:
     13        * DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
     14        (DumpRenderTreeChrome::onWindowObjectCleared):
     15        * DumpRenderTree/efl/TextInputController.cpp: Added.
     16        (setMarkedTextCallback):
     17        (hasMarkedTextCallback):
     18        (markedRangeCallback):
     19        (insertTextCallback):
     20        (unmarkTextCallback):
     21        (firstRectForCharacterRangeCallback):
     22        (selectedRangeCallback):
     23        (makeTextInputController):
     24        * DumpRenderTree/efl/TextInputController.h: Added.
     25
    1262012-04-23  Raphael Kubo da Costa  <rakuco@webkit.org>
    227
  • trunk/Tools/DumpRenderTree/efl/CMakeLists.txt

    r116049 r116475  
    1616    ${TOOLS_DIR}/DumpRenderTree/efl/LayoutTestControllerEfl.cpp
    1717    ${TOOLS_DIR}/DumpRenderTree/efl/PixelDumpSupportEfl.cpp
     18    ${TOOLS_DIR}/DumpRenderTree/efl/TextInputController.cpp
    1819    ${TOOLS_DIR}/DumpRenderTree/efl/WorkQueueItemEfl.cpp
    1920)
  • trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp

    r116416 r116475  
    3434#include "LayoutTestController.h"
    3535#include "NotImplemented.h"
     36#include "TextInputController.h"
    3637#include "WebCoreSupport/DumpRenderTreeSupportEfl.h"
    3738#include "WebCoreTestSupport.h"
     
    369370                        kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, 0);
    370371
     372    JSRetainPtr<JSStringRef> textInputControllerName(JSStringCreateWithUTF8CString("textInputController"));
     373    JSObjectSetProperty(objectClearedInfo->context, objectClearedInfo->windowObject,
     374                        textInputControllerName.get(),
     375                        makeTextInputController(objectClearedInfo->context),
     376                        kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, 0);
     377
    371378    WebCoreTestSupport::injectInternalsObject(objectClearedInfo->context);
    372379}
Note: See TracChangeset for help on using the changeset viewer.