Changeset 77917 in webkit


Ignore:
Timestamp:
Feb 8, 2011 2:20:51 AM (13 years ago)
Author:
Carlos Garcia Campos
Message:

2011-02-08 Carlos Garcia Campos <cgarcia@igalia.com>

Reviewed by Martin Robinson.

[GTK] DRT's TextInputController is unimplemented on GTK
https://bugs.webkit.org/show_bug.cgi?id=52997

  • platform/gtk/Skipped: Unskip several tests that pass now that we have TextInputController.

2011-02-08 Carlos Garcia Campos <cgarcia@igalia.com>

Reviewed by Martin Robinson.

[GTK] DRT's TextInputController is unimplemented on GTK
https://bugs.webkit.org/show_bug.cgi?id=52997

  • WebCoreSupport/DumpRenderTreeSupportGtk.cpp: (DumpRenderTreeSupportGtk::setComposition): (DumpRenderTreeSupportGtk::confirmComposition): (DumpRenderTreeSupportGtk::firstRectForCharacterRange): (DumpRenderTreeSupportGtk::selectedRange): New methods needed by TextInputController.
  • WebCoreSupport/DumpRenderTreeSupportGtk.h:

2011-02-08 Carlos Garcia Campos <cgarcia@igalia.com>

Reviewed by Martin Robinson.

[GTK] DRT's TextInputController is unimplemented on GTK
https://bugs.webkit.org/show_bug.cgi?id=52997

Initial implementation of TextInputController for GTK port.

  • DumpRenderTree/gtk/DumpRenderTree.cpp: (webViewWindowObjectCleared):
  • DumpRenderTree/gtk/TextInputController.cpp: Added. (setMarkedTextCallback): (insertTextCallback): (unmarkTextCallback): (firstRectForCharacterRangeCallback): (selectedRangeCallback): (getClass): (makeTextInputController):
  • DumpRenderTree/gtk/TextInputController.h: Added.
  • GNUmakefile.am:
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r77914 r77917  
     12011-02-08  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [GTK] DRT's TextInputController is unimplemented on GTK
     6        https://bugs.webkit.org/show_bug.cgi?id=52997
     7
     8        * platform/gtk/Skipped: Unskip several tests that pass now that we
     9        have TextInputController.
     10
    1112011-02-07  Cris Neckar  <cdn@chromium.org>
    212
  • trunk/LayoutTests/platform/gtk/Skipped

    r77885 r77917  
    37733773fast/loader/opaque-base-url.html
    37743774
    3775 # No TextInputController support
    3776 # https://bugs.webkit.org/show_bug.cgi?id=52997
    3777 fast/forms/input-maxlength-ime-completed.html
    3778 fast/forms/input-maxlength-ime-preedit.html
    3779 fast/text/international/thai-cursor-position.html
    3780 fast/events/ime-composition-events-001.html
    3781 fast/dom/tab-in-right-alignment.html
    3782 editing/input/ime-composition-clearpreedit.html
     3775# https://bugs.webkit.org/show_bug.cgi?id=53986
    37833776svg/text/caret-in-svg-text.xhtml
    3784 editing/inserting/insert-composition-whitespace.html
    37853777
    37863778# No User Scripts
  • trunk/Source/WebKit/gtk/ChangeLog

    r77870 r77917  
     12011-02-08  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [GTK] DRT's TextInputController is unimplemented on GTK
     6        https://bugs.webkit.org/show_bug.cgi?id=52997
     7
     8        * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
     9        (DumpRenderTreeSupportGtk::setComposition):
     10        (DumpRenderTreeSupportGtk::confirmComposition):
     11        (DumpRenderTreeSupportGtk::firstRectForCharacterRange):
     12        (DumpRenderTreeSupportGtk::selectedRange): New methods needed by
     13        TextInputController.
     14        * WebCoreSupport/DumpRenderTreeSupportGtk.h:
     15
    1162011-02-07  Enrica Casucci  <enrica@apple.com>
    217
  • trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp

    r77868 r77917  
    33 *  Copyright (C) 2010 Joone Hur <joone@kldp.org>
    44 *  Copyright (C) 2009 Google Inc. All rights reserved.
     5 *  Copyright (C) 2011 Igalia S.L.
    56 *
    67 *  This library is free software; you can redistribute it and/or
     
    4849#include "RenderView.h"
    4950#include "SecurityOrigin.h"
     51#include "TextIterator.h"
    5052#include "WorkerThread.h"
    5153#include "webkitwebframe.h"
     
    467469}
    468470
     471void DumpRenderTreeSupportGtk::setComposition(WebKitWebView* webView, const char* text, int start, int end)
     472{
     473    g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
     474    g_return_if_fail(text);
     475
     476    Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
     477    if (!frame)
     478        return;
     479
     480    Editor* editor = frame->editor();
     481    if (!editor)
     482        return;
     483    if (!editor->canEdit() && !editor->hasComposition())
     484        return;
     485
     486    String compositionString = String::fromUTF8(text);
     487    Vector<CompositionUnderline> underlines;
     488    underlines.append(CompositionUnderline(0, compositionString.length(), Color(0, 0, 0), false));
     489    editor->setComposition(compositionString, underlines, start, end);
     490}
     491
     492void DumpRenderTreeSupportGtk::confirmComposition(WebKitWebView* webView, const char* text)
     493{
     494    g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
     495
     496    Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
     497    if (!frame)
     498        return;
     499
     500    Editor* editor = frame->editor();
     501    if (!editor || (!editor->hasComposition() && !text))
     502        return;
     503
     504    if (editor->hasComposition()) {
     505        if (text)
     506            editor->confirmComposition(String::fromUTF8(text));
     507        else
     508            editor->confirmComposition();
     509    } else
     510        editor->insertText(String::fromUTF8(text), 0);
     511}
     512
     513bool DumpRenderTreeSupportGtk::firstRectForCharacterRange(WebKitWebView* webView, int location, int length, GdkRectangle* rect)
     514{
     515    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), false);
     516    g_return_val_if_fail(rect, false);
     517
     518    if ((location + length < location) && (location + length))
     519        length = 0;
     520
     521    Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
     522    if (!frame)
     523        return false;
     524
     525    Editor* editor = frame->editor();
     526    if (!editor)
     527        return false;
     528
     529    Element* selectionRoot = frame->selection()->rootEditableElement();
     530    Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement();
     531    RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(scope, location, length);
     532    if (!range)
     533        return false;
     534
     535    *rect = editor->firstRectForRange(range.get());
     536
     537    return true;
     538}
     539
     540bool DumpRenderTreeSupportGtk::selectedRange(WebKitWebView* webView, int* start, int* end)
     541{
     542    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), false);
     543    g_return_val_if_fail(start, false);
     544    g_return_val_if_fail(end, false);
     545
     546    Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
     547    if (!frame)
     548        return false;
     549
     550    RefPtr<Range> range = frame->selection()->toNormalizedRange().get();
     551
     552    Element* selectionRoot = frame->selection()->rootEditableElement();
     553    Element* scope = selectionRoot ? selectionRoot : frame->document()->documentElement();
     554
     555    RefPtr<Range> testRange = Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset());
     556    ASSERT(testRange->startContainer() == scope);
     557    *start = TextIterator::rangeLength(testRange.get());
     558
     559    ExceptionCode ec;
     560    testRange->setEnd(range->endContainer(), range->endOffset(), ec);
     561    ASSERT(testRange->startContainer() == scope);
     562    *end = TextIterator::rangeLength(testRange.get());
     563
     564    return true;
     565}
     566
    469567void DumpRenderTreeSupportGtk::whiteListAccessFromOrigin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains)
    470568{
  • trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h

    r77868 r77917  
    8585    static bool isCommandEnabled(WebKitWebView*, const gchar* name);
    8686    static bool findString(WebKitWebView*, const gchar*, WebKitFindOptions);
     87    static void setComposition(WebKitWebView*, const char* text, int start, int end);
     88    static void confirmComposition(WebKitWebView*, const char* text);
     89    static bool firstRectForCharacterRange(WebKitWebView*, int location, int length, GdkRectangle*);
     90    static bool selectedRange(WebKitWebView*, int* start, int* end);
    8791
    8892    // GC
  • trunk/Tools/ChangeLog

    r77913 r77917  
     12011-02-08  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [GTK] DRT's TextInputController is unimplemented on GTK
     6        https://bugs.webkit.org/show_bug.cgi?id=52997
     7
     8        Initial implementation of TextInputController for GTK port.
     9
     10        * DumpRenderTree/gtk/DumpRenderTree.cpp:
     11        (webViewWindowObjectCleared):
     12        * DumpRenderTree/gtk/TextInputController.cpp: Added.
     13        (setMarkedTextCallback):
     14        (insertTextCallback):
     15        (unmarkTextCallback):
     16        (firstRectForCharacterRangeCallback):
     17        (selectedRangeCallback):
     18        (getClass):
     19        (makeTextInputController):
     20        * DumpRenderTree/gtk/TextInputController.h: Added.
     21        * GNUmakefile.am:
     22
    1232011-02-07  Tony Chang  <tony@chromium.org>
    224
  • trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp

    r77710 r77917  
    4040#include "LayoutTestController.h"
    4141#include "PixelDumpSupport.h"
     42#include "TextInputController.h"
    4243#include "WebCoreSupport/DumpRenderTreeSupportGtk.h"
    4344#include "WorkQueue.h"
     
    781782    JSObjectSetProperty(context, windowObject, eventSenderStr, eventSender, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, 0);
    782783    JSStringRelease(eventSenderStr);
     784
     785    JSStringRef textInputControllerStr = JSStringCreateWithUTF8CString("textInputController");
     786    JSValueRef textInputController = makeTextInputController(context);
     787    JSObjectSetProperty(context, windowObject, textInputControllerStr, textInputController, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, 0);
     788    JSStringRelease(textInputControllerStr);
    783789}
    784790
  • trunk/Tools/GNUmakefile.am

    r75911 r77917  
    8181        Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp \
    8282        Tools/DumpRenderTree/gtk/PixelDumpSupportGtk.cpp \
     83        Tools/DumpRenderTree/gtk/TextInputController.h \
     84        Tools/DumpRenderTree/gtk/TextInputController.cpp \
    8385        Tools/DumpRenderTree/gtk/WorkQueueItemGtk.cpp \
    8486        Source/WebCore/platform/gtk/GtkVersioning.c
Note: See TracChangeset for help on using the changeset viewer.