Changeset 118594 in webkit


Ignore:
Timestamp:
May 25, 2012 6:02:19 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Source/WebKit/win: Added methods needed to implement backend for DRT's TextInputController on windows, https://bugs.webkit.org/show_bug.cgi?id=32021

Patch by Lynn Neir <lynn.neir@skype.net> on 2012-05-25
Reviewed by Eric Seidel.

  • Interfaces/IWebViewPrivate.idl:
  • WebView.cpp:

(WebView::setCompositionForTesting):
(WebView::hasCompositionForTesting):
(WebView::confirmCompositionForTesting):
(WebView::compositionRangeForTesting):
(WebView::firstRectForCharacterRangeForTesting):
(WebView::selectedRangeForTesting):

  • WebView.h:

(WebView):

Tools: Added windows implementation in DRT for TextInputController, https://bugs.webkit.org/show_bug.cgi?id=32021

Patch by Lynn Neir <lynn.neir@skype.net> on 2012-05-25
Reviewed by Eric Seidel.

  • DumpRenderTree/win/DumpRenderTree.vcproj:
  • DumpRenderTree/win/FrameLoadDelegate.cpp:

(FrameLoadDelegate::FrameLoadDelegate):
(FrameLoadDelegate::didClearWindowObjectForFrameInStandardWorld):

  • DumpRenderTree/win/FrameLoadDelegate.h:

(FrameLoadDelegate):

  • DumpRenderTree/win/TextInputController.cpp: Added.

(setMarkedTextCallback):
(hasMarkedTextCallback):
(unmarkTextCallback):
(markedRangeCallback):
(insertTextCallback):
(firstRectForCharacterRangeCallback):
(selectedRangeCallback):
(TextInputController::makeWindowObject):
(TextInputController::getJSClass):
(TextInputController::staticValues):
(TextInputController::staticFunctions):

  • DumpRenderTree/win/TextInputController.h: Added.

(TextInputController):

  • DumpRenderTree/win/TextInputControllerWin.cpp: Added.

(TextInputController::setMarkedText):
(TextInputController::hasMarkedText):
(TextInputController::unmarkText):
(TextInputController::markedRange):
(TextInputController::insertText):
(TextInputController::firstRectForCharacterRange):
(TextInputController::selectedRange):

LayoutTests: Updated tests as a result of implementing TextInputController in DRT for windows, https://bugs.webkit.org/show_bug.cgi?id=32021

Patch by Lynn Neir <lynn.neir@skype.net> on 2012-05-25
Reviewed by Eric Seidel.

  • platform/win/Skipped:
  • platform/win/editing/selection/5825350-1-expected.txt: Added.
  • platform/win/editing/selection/5825350-2-expected.txt: Added.
  • platform/win/editing/selection/mixed-editability-10-expected.txt:
  • platform/win/editing/selection/move-left-right-expected.txt: Added.
  • platform/win/fast/events/ime-composition-events-001-expected.txt:
  • platform/win/fast/forms/input-maxlength-ime-completed-expected.txt: Removed.
  • platform/win/fast/forms/input-maxlength-ime-preedit-expected.txt: Removed.
  • platform/win/svg/text/caret-in-svg-text-expected.txt: Added.
Location:
trunk
Files:
7 added
2 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r118593 r118594  
     12012-05-25  Lynn Neir  <lynn.neir@skype.net>
     2
     3        Updated tests as a result of implementing TextInputController in DRT for windows, https://bugs.webkit.org/show_bug.cgi?id=32021
     4
     5        Reviewed by Eric Seidel.
     6
     7        * platform/win/Skipped:
     8        * platform/win/editing/selection/5825350-1-expected.txt: Added.
     9        * platform/win/editing/selection/5825350-2-expected.txt: Added.
     10        * platform/win/editing/selection/mixed-editability-10-expected.txt:
     11        * platform/win/editing/selection/move-left-right-expected.txt: Added.
     12        * platform/win/fast/events/ime-composition-events-001-expected.txt:
     13        * platform/win/fast/forms/input-maxlength-ime-completed-expected.txt: Removed.
     14        * platform/win/fast/forms/input-maxlength-ime-preedit-expected.txt: Removed.
     15        * platform/win/svg/text/caret-in-svg-text-expected.txt: Added.
     16
    1172012-05-25  Jessie Berlin  <jberlin@apple.com>
    218
  • trunk/LayoutTests/platform/win/Skipped

    r118593 r118594  
    10651065# https://bugs.webkit.org/show_bug.cgi?id=62597
    10661066editing/pasteboard/copy-standalone-image-crash.html
    1067 
    1068 # https://webkit.org/b/32021 - DRT's textInputController is unimplemented on Windows
    1069 editing/input/ime-composition-clearpreedit.html
    1070 editing/input/password-echo-passnode2.html
    1071 editing/input/password-echo-passnode3.html
    1072 editing/input/password-echo-passnode.html
    1073 editing/input/password-echo-textnode.html
    1074 editing/input/setting-input-value-cancel-ime-composition.html
    1075 editing/inserting/insert-composition-whitespace.html
    1076 editing/selection/5825350-1.html
    1077 editing/selection/5825350-2.html
    1078 fast/text/international/thai-cursor-position.html
    1079 fast/dom/tab-in-right-alignment.html
    1080 svg/text/caret-in-svg-text.xhtml
    10811067
    10821068# textInputController.hasGrammarMarkers() is not implemented.
  • trunk/LayoutTests/platform/win/editing/selection/mixed-editability-10-expected.txt

    r94615 r118594  
    1616
    1717Hello: 
    18 Anchor ([object HTMLDivElement], 0 caret[0,0] refpos=40) is incorrect.
    19 Anchor ([object HTMLDivElement], 3 caret[0,0] refpos=76) is incorrect.
    20 Anchor ([object HTMLDivElement], 1 caret[0,0] refpos=43) is incorrect.
    21 Anchor ([object HTMLDivElement], 0 caret[0,0] refpos=8) is incorrect.
    22 Anchor ([object HTMLDivElement], 0 caret[0,0] refpos=73) is incorrect.
    23 Anchor ([object HTMLDivElement], 3 caret[0,0] refpos=47) is incorrect.
    24 Anchor ([object HTMLDivElement], 0 caret[0,0] refpos=58) is incorrect.
     18Anchor ([object HTMLDivElement], 0 caret[40,42] refpos=40) is correct.
     19Anchor ([object HTMLDivElement], 3 caret[75,42] refpos=76) is incorrect.
     20Anchor ([object HTMLDivElement], 1 caret[43,110] refpos=43) is correct.
     21Anchor ([object HTMLDivElement], 0 caret[8,110] refpos=8) is correct.
     22Anchor ([object HTMLDivElement], 0 caret[73,178] refpos=73) is correct.
     23Anchor ([object HTMLDivElement], 3 caret[47,246] refpos=47) is correct.
     24Anchor ([object HTMLDivElement], 0 caret[58,314] refpos=58) is correct.
    2525Anchor ([object HTMLSpanElement], 0 caret[0,0] refpos=0) is correct.
  • trunk/LayoutTests/platform/win/fast/events/ime-composition-events-001-expected.txt

    r51543 r118594  
    1 CONSOLE MESSAGE: line 40: ReferenceError: Can't find variable: textInputController
    21This tests that calling input-method functions sends Composition Events and Text Events introduced in DOM Level 3.
    32
     
    54
    65
    7 
     6SUCCESS: INPUT - compositionstart - "1"
     7SUCCESS: INPUT - compositionupdate - "1"
     8SUCCESS: INPUT - compositionupdate - "2"
     9SUCCESS: INPUT - compositionupdate - "3"
     10SUCCESS: INPUT - compositionend - "4"
     11SUCCESS: INPUT - textInput - "4"
     12SUCCESS: INPUT - compositionstart - "5"
     13SUCCESS: INPUT - compositionupdate - "5"
     14SUCCESS: INPUT - compositionupdate - "6"
     15SUCCESS: INPUT - compositionupdate - "7"
     16SUCCESS: INPUT - compositionend - ""
     17SUCCESS: INPUT - compositionend - "8"
     18SUCCESS: INPUT - textInput - "8"
     19SUCCESS: INPUT - compositionstart - "9"
     20SUCCESS: INPUT - compositionupdate - "9"
     21SUCCESS: INPUT - compositionend - "9"
     22SUCCESS: INPUT - textInput - "9"
     23SUCCESS: INPUT - compositionend - ""
     24SUCCESS: INPUT - textInput - ""
  • trunk/Source/WebKit/win/ChangeLog

    r117771 r118594  
     12012-05-25  Lynn Neir  <lynn.neir@skype.net>
     2
     3        Added methods needed to implement backend for DRT's TextInputController on windows, https://bugs.webkit.org/show_bug.cgi?id=32021
     4
     5        Reviewed by Eric Seidel.
     6
     7        * Interfaces/IWebViewPrivate.idl:
     8        * WebView.cpp:
     9        (WebView::setCompositionForTesting):
     10        (WebView::hasCompositionForTesting):
     11        (WebView::confirmCompositionForTesting):
     12        (WebView::compositionRangeForTesting):
     13        (WebView::firstRectForCharacterRangeForTesting):
     14        (WebView::selectedRangeForTesting):
     15        * WebView.h:
     16        (WebView):
     17
    1182012-05-21  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
    219
  • trunk/Source/WebKit/win/Interfaces/IWebViewPrivate.idl

    r117460 r118594  
    278278    HRESULT registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing([in] BSTR scheme);
    279279    HRESULT registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsing([in] BSTR scheme);
     280    // Used by TextInputController in DumpRenderTree
     281
     282    HRESULT setCompositionForTesting([in] BSTR composition,[in] UINT from,[in] UINT length);
     283
     284    HRESULT hasCompositionForTesting([out, retval] BOOL* result);
     285
     286    HRESULT confirmCompositionForTesting([in] BSTR composition);
     287
     288    HRESULT compositionRangeForTesting([out] UINT* startPosition, [out] UINT* length);
     289
     290    HRESULT firstRectForCharacterRangeForTesting([in] UINT location, [in] UINT length, [out, retval] RECT* resultRect);
     291
     292    HRESULT selectedRangeForTesting([out] UINT* location, [out] UINT* length);
    280293}
  • trunk/Source/WebKit/win/WebView.cpp

    r117771 r118594  
    3434#include "MarshallingHelpers.h"
    3535#include "SoftLinking.h"
     36#include "TextIterator.h"
    3637#include "WebBackForwardList.h"
    3738#include "WebChromeClient.h"
     
    68846885
    68856886#endif
     6887// Used by TextInputController in DumpRenderTree
     6888
     6889HRESULT STDMETHODCALLTYPE WebView::setCompositionForTesting(
     6890    /* [in] */ BSTR composition,
     6891    /* [in] */ UINT from,
     6892    /* [in] */ UINT length)
     6893{
     6894    if (!m_page)
     6895        return E_FAIL;
     6896
     6897    Frame* frame = m_page->focusController()->focusedOrMainFrame();
     6898    if (!frame || !frame->editor()->canEdit())
     6899        return E_FAIL;
     6900
     6901    String compositionStr(composition, SysStringLen(composition));
     6902
     6903    Vector<CompositionUnderline> underlines;
     6904    underlines.append(CompositionUnderline(0, compositionStr.length(), Color(Color::black), false));
     6905    frame->editor()->setComposition(compositionStr, underlines, from, from + length);
     6906
     6907    return S_OK;
     6908}
     6909
     6910HRESULT STDMETHODCALLTYPE WebView::hasCompositionForTesting(/* [out, retval] */ BOOL* result)
     6911{
     6912    if (!m_page)
     6913        return E_FAIL;
     6914
     6915    Frame* frame = m_page->focusController()->focusedOrMainFrame();
     6916     if (!frame)
     6917        return E_FAIL;
     6918
     6919    *result = frame && frame->editor()->hasComposition();
     6920
     6921    return S_OK;
     6922}
     6923
     6924HRESULT STDMETHODCALLTYPE WebView::confirmCompositionForTesting(/* [in] */ BSTR composition)
     6925{
     6926    if (!m_page)
     6927        return E_FAIL;
     6928
     6929    Frame* frame = m_page->focusController()->focusedOrMainFrame();
     6930    if (!frame || !frame->editor()->canEdit())
     6931        return E_FAIL;
     6932
     6933    String compositionStr(composition, SysStringLen(composition));
     6934
     6935    if (compositionStr.isNull())
     6936        frame->editor()->confirmComposition();
     6937
     6938    frame->editor()->confirmComposition(compositionStr);
     6939
     6940    return S_OK;
     6941}
     6942
     6943HRESULT STDMETHODCALLTYPE WebView::compositionRangeForTesting(/* [out] */ UINT* startPosition, /* [out] */ UINT* length)
     6944{
     6945    if (!m_page)
     6946        return E_FAIL;
     6947
     6948    Frame* frame = m_page->focusController()->focusedOrMainFrame();
     6949    if (!frame || !frame->editor()->canEdit())
     6950        return E_FAIL;
     6951
     6952    RefPtr<Range> range = frame->editor()->compositionRange();
     6953
     6954    if (!range)
     6955        return E_FAIL;
     6956
     6957    *startPosition = range->startOffset();
     6958    *length = range->startOffset() + range->endOffset();
     6959
     6960    return S_OK;
     6961}
     6962
     6963
     6964HRESULT STDMETHODCALLTYPE WebView::firstRectForCharacterRangeForTesting(
     6965    /* [in] */ UINT location,
     6966    /* [in] */ UINT length,
     6967    /* [out, retval] */ RECT* resultRect)
     6968{
     6969    if (!m_page)
     6970        return E_FAIL;
     6971
     6972    Frame* frame = m_page->focusController()->focusedOrMainFrame();
     6973    if (!frame)
     6974        return E_FAIL;
     6975
     6976    IntRect resultIntRect;
     6977    resultIntRect.setLocation(IntPoint(0, 0));
     6978    resultIntRect.setSize(IntSize(0, 0));
     6979   
     6980    if (location > INT_MAX)
     6981        return E_FAIL;
     6982    if (length > INT_MAX || location + length > INT_MAX)
     6983        length = INT_MAX - location;
     6984       
     6985    RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(frame->selection()->rootEditableElementOrDocumentElement(), location, length);
     6986
     6987    if (!range)
     6988        return E_FAIL;
     6989   
     6990    ASSERT(range->startContainer());
     6991    ASSERT(range->endContainer());
     6992     
     6993    IntRect rect = frame->editor()->firstRectForRange(range.get());
     6994    resultIntRect = frame->view()->contentsToWindow(rect);
     6995
     6996    resultRect->left = resultIntRect.x();
     6997    resultRect->top = resultIntRect.y();
     6998    resultRect->right = resultIntRect.x() + resultIntRect.width();
     6999    resultRect->bottom = resultIntRect.y() + resultIntRect.height();
     7000
     7001    return S_OK;
     7002}
     7003
     7004HRESULT STDMETHODCALLTYPE WebView::selectedRangeForTesting(/* [out] */ UINT* location, /* [out] */ UINT* length)
     7005{
     7006    if (!m_page)
     7007        return E_FAIL;
     7008
     7009    Frame* frame = m_page->focusController()->focusedOrMainFrame();
     7010    if (!frame)
     7011        return E_FAIL;
     7012
     7013    RefPtr<Range> range = frame->editor()->selectedRange();
     7014
     7015    size_t locationSize;
     7016    size_t lengthSize;
     7017    if (range && TextIterator::getLocationAndLengthFromRange(frame->selection()->rootEditableElementOrDocumentElement(), range.get(), locationSize, lengthSize)) {
     7018        *location = static_cast<UINT>(locationSize);
     7019        *length = static_cast<UINT>(lengthSize);
     7020    }
     7021
     7022    return S_OK;
     7023}
  • trunk/Source/WebKit/win/WebView.h

    r117460 r118594  
    963963#endif
    964964
     965    // Used by TextInputController in DumpRenderTree
     966
     967    HRESULT STDMETHODCALLTYPE setCompositionForTesting(
     968        /* [in] */ BSTR composition,
     969        /* [in] */ UINT from,
     970        /* [in] */ UINT length);
     971
     972    HRESULT STDMETHODCALLTYPE hasCompositionForTesting(/* [out, retval] */ BOOL* result);
     973
     974    HRESULT STDMETHODCALLTYPE confirmCompositionForTesting(/* [in] */ BSTR composition);
     975
     976    HRESULT STDMETHODCALLTYPE compositionRangeForTesting(/* [out] */ UINT* startPosition, /* [out] */ UINT* length);
     977
     978    HRESULT STDMETHODCALLTYPE firstRectForCharacterRangeForTesting(
     979    /* [in] */ UINT location,
     980    /* [in] */ UINT length,
     981    /* [out, retval] */ RECT* resultRect);
     982
     983    HRESULT STDMETHODCALLTYPE selectedRangeForTesting(/* [out] */ UINT* location, /* [out] */ UINT* length);
    965984private:
    966985    void setZoomMultiplier(float multiplier, bool isTextOnly);
  • trunk/Tools/ChangeLog

    r118557 r118594  
     12012-05-25  Lynn Neir  <lynn.neir@skype.net>
     2
     3        Added windows implementation in DRT for TextInputController, https://bugs.webkit.org/show_bug.cgi?id=32021
     4
     5        Reviewed by Eric Seidel.
     6
     7        * DumpRenderTree/win/DumpRenderTree.vcproj:
     8        * DumpRenderTree/win/FrameLoadDelegate.cpp:
     9        (FrameLoadDelegate::FrameLoadDelegate):
     10        (FrameLoadDelegate::didClearWindowObjectForFrameInStandardWorld):
     11        * DumpRenderTree/win/FrameLoadDelegate.h:
     12        (FrameLoadDelegate):
     13        * DumpRenderTree/win/TextInputController.cpp: Added.
     14        (setMarkedTextCallback):
     15        (hasMarkedTextCallback):
     16        (unmarkTextCallback):
     17        (markedRangeCallback):
     18        (insertTextCallback):
     19        (firstRectForCharacterRangeCallback):
     20        (selectedRangeCallback):
     21        (TextInputController::makeWindowObject):
     22        (TextInputController::getJSClass):
     23        (TextInputController::staticValues):
     24        (TextInputController::staticFunctions):
     25        * DumpRenderTree/win/TextInputController.h: Added.
     26        (TextInputController):
     27        * DumpRenderTree/win/TextInputControllerWin.cpp: Added.
     28        (TextInputController::setMarkedText):
     29        (TextInputController::hasMarkedText):
     30        (TextInputController::unmarkText):
     31        (TextInputController::markedRange):
     32        (TextInputController::insertText):
     33        (TextInputController::firstRectForCharacterRange):
     34        (TextInputController::selectedRange):
     35
    1362012-05-25  Dirk Pranke  <dpranke@chromium.org>
    237
  • trunk/Tools/DumpRenderTree/win/DumpRenderTree.vcproj

    r104187 r118594  
    434434                                >
    435435                        </File>
     436                        <File
     437                                RelativePath=".\TextInputController.cpp"
     438                                >
     439                        </File>
     440                        <File
     441                                RelativePath=".\TextInputController.h"
     442                                >
     443                        </File>
     444                        <File
     445                                RelativePath=".\TextInputControllerWin.cpp"
     446                                >
     447                        </File>
    436448                </Filter>
    437449                <Filter
  • trunk/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp

    r110523 r118594  
    3636#include "GCController.h"
    3737#include "LayoutTestController.h"
     38#include "TextInputController.h"
    3839#include "WebCoreTestSupport.h"
    3940#include "WorkQueueItem.h"
     
    7778    , m_gcController(adoptPtr(new GCController))
    7879    , m_accessibilityController(adoptPtr(new AccessibilityController))
     80    , m_textInputController(adoptPtr(new TextInputController))
    7981{
    8082}
     
    366368
    367369    m_accessibilityController->makeWindowObject(context, windowObject, &exception);
     370    ASSERT(!exception);
     371
     372    m_textInputController->makeWindowObject(context, windowObject, &exception);
    368373    ASSERT(!exception);
    369374
  • trunk/Tools/DumpRenderTree/win/FrameLoadDelegate.h

    r58111 r118594  
    3434
    3535class AccessibilityController;
     36class TextInputController;
    3637class GCController;
    3738
     
    171172    OwnPtr<GCController> m_gcController;
    172173    OwnPtr<AccessibilityController> m_accessibilityController;
     174    OwnPtr<TextInputController> m_textInputController;
    173175};
    174176
Note: See TracChangeset for help on using the changeset viewer.