Changeset 68312 in webkit


Ignore:
Timestamp:
Sep 24, 2010 4:22:02 PM (14 years ago)
Author:
rniwa@webkit.org
Message:

2010-09-24 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Tony Chang.

[chromium] Implement TextInputController::firstRectForCharacterRange
https://bugs.webkit.org/show_bug.cgi?id=38100

The following test now passes on chromium DumpRenderTree:
platform/mac/editing/input/caret-primary-bidi.html
platform/mac/editing/input/firstrectforcharacterrange-plain.html
platform/mac/editing/input/range-for-empty-document.html
editing/inserting/caret-position.html

  • platform/chromium/test_expectations.txt:

2010-09-24 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Tony Chang.

[chromium] Implement TextInputController::firstRectForCharacterRange
https://bugs.webkit.org/show_bug.cgi?id=38100

Implemented TextInputController::firstRectForCharacterRange for chromium platform.
Because the function needs to return an array of integers, added makeIntArray to WebBindings.
makeIntArray does not take Vector because WebBindings.h is included in plugin glue code
where it cannot find wtf/Vector.h.

No new tests are added since we need to implement the same feature in chromium side
in order to enable any tests that uses this function.

  • public/WebBindings.h:
  • public/WebFrame.h:
  • src/WebBindings.cpp: (WebKit::makeIntArrayImpl): Added. (WebKit::WebBindings::makeIntArray): Added.
  • src/WebFrameImpl.cpp: (WebKit::WebFrameImpl::firstRectForCharacterRange): Added.
  • src/WebFrameImpl.h:

2010-09-24 Ryosuke Niwa <rniwa@webkit.org>

Reviewed by Tony Chang.

[chromium] Implement TextInputController::firstRectForCharacterRange
https://bugs.webkit.org/show_bug.cgi?id=38100

Implemented TextInputController::firstRectForCharacterRange for chromium platform.
No new tests are added since we need to implement the same feature in chromium side
in order to enable any tests that uses this function.

  • DumpRenderTree/chromium/TextInputController.cpp: (TextInputController::firstRectForCharacterRange): Added.
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r68311 r68312  
     12010-09-24  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Tony Chang.
     4
     5        [chromium] Implement TextInputController::firstRectForCharacterRange
     6        https://bugs.webkit.org/show_bug.cgi?id=38100
     7
     8        The following test now passes on chromium DumpRenderTree:
     9        platform/mac/editing/input/caret-primary-bidi.html
     10        platform/mac/editing/input/firstrectforcharacterrange-plain.html
     11        platform/mac/editing/input/range-for-empty-document.html
     12        editing/inserting/caret-position.html
     13
     14        * platform/chromium/test_expectations.txt:
     15
    1162010-09-24  Tony Chang  <tony@chromium.org>
    217
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r68311 r68312  
    965965// Issue 3273: TextInputController::firstRectForCharacterRange not implemented.
    966966BUG3273 : editing/selection/move-left-right.html = FAIL
    967 BUG3273 MAC : platform/mac/editing/input/caret-primary-bidi.html = FAIL
    968 BUG3273 MAC : platform/mac/editing/input/firstrectforcharacterrange-plain.html = FAIL
    969 BUG3273 MAC : platform/mac/editing/input/range-for-empty-document.html = FAIL
     967BUG3273 MAC : platform/mac/editing/input/caret-primary-bidi.html = FAIL PASS
     968BUG3273 MAC : platform/mac/editing/input/firstrectforcharacterrange-plain.html = FAIL PASS
     969BUG3273 MAC : platform/mac/editing/input/range-for-empty-document.html = FAIL PASS
     970BUGWK38100 : editing/inserting/caret-position.html = TEXT PASS
     971
    970972// WebKit 50358:50395
    971973BUG3273 : fast/text/international/thai-cursor-position.html = TEXT
     
    24562458BUGWK38038 WIN LINUX MAC : fast/url/file-http-base.html = TEXT
    24572459
    2458 // Started failing at r58191
    2459 BUGWK38100 WIN LINUX MAC : editing/inserting/caret-position.html = TEXT
    2460 
    24612460// New test, may be safe to just rebaseline.
    24622461
  • trunk/WebKit/chromium/ChangeLog

    r68279 r68312  
     12010-09-24  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Tony Chang.
     4
     5        [chromium] Implement TextInputController::firstRectForCharacterRange
     6        https://bugs.webkit.org/show_bug.cgi?id=38100
     7
     8        Implemented TextInputController::firstRectForCharacterRange for chromium platform.
     9        Because the function needs to return an array of integers, added makeIntArray to WebBindings.
     10        makeIntArray does not take Vector because WebBindings.h is included in plugin glue code
     11        where it cannot find wtf/Vector.h.
     12
     13        No new tests are added since we need to implement the same feature in chromium side
     14        in order to enable any tests that uses this function.
     15
     16        * public/WebBindings.h:
     17        * public/WebFrame.h:
     18        * src/WebBindings.cpp:
     19        (WebKit::makeIntArrayImpl): Added.
     20        (WebKit::WebBindings::makeIntArray): Added.
     21        * src/WebFrameImpl.cpp:
     22        (WebKit::WebFrameImpl::firstRectForCharacterRange): Added.
     23        * src/WebFrameImpl.h:
     24
    1252010-09-24  Tony Chang  <tony@chromium.org>
    226
  • trunk/WebKit/chromium/public/WebBindings.h

    r66176 r68312  
    3333
    3434#include "WebCommon.h"
     35#include "WebVector.h"
    3536#include <bindings/npruntime.h>
    3637
     
    145146    WEBKIT_API static bool getElement(NPObject* element, WebElement*);
    146147
     148    WEBKIT_API static NPObject* makeIntArray(const WebVector<int>&);
     149
    147150    // Exceptions -------------------------------------------------------------
    148151
  • trunk/WebKit/chromium/public/WebFrame.h

    r68216 r68312  
    356356    virtual WebRange markedRange() const = 0;
    357357
     358    virtual bool firstRectForCharacterRange(unsigned location, unsigned length, WebRect&) const = 0;
     359
    358360    // Supports commands like Undo, Redo, Cut, Copy, Paste, SelectAll,
    359361    // Unselect, etc. See EditorCommand.cpp for the full list of supported
  • trunk/WebKit/chromium/src/WebBindings.cpp

    r66176 r68312  
    313313}
    314314
     315static NPObject* makeIntArrayImpl(const WebVector<int>& data)
     316{
     317    v8::HandleScope handleScope;
     318    v8::Handle<v8::Array> result = v8::Array::New(data.size());
     319    for (size_t i = 0; i < data.size(); i++)
     320        result->Set(i, v8::Number::New(data[i]));
     321
     322    WebCore::DOMWindow* window = WebCore::V8Proxy::retrieveWindow(WebCore::V8Proxy::currentContext());
     323    return npCreateV8ScriptObject(0, result, window);
     324}
     325
    315326#endif
    316327
     
    351362}
    352363
     364NPObject* WebBindings::makeIntArray(const WebVector<int> & data)
     365{
     366#if USE(V8)
     367    return makeIntArrayImpl(data);
     368#else
     369    // Not supported on other ports (JSC, etc.).
     370    return 0;
     371#endif
     372}
     373
    353374void WebBindings::pushExceptionHandler(ExceptionHandler handler, void* data)
    354375{
  • trunk/WebKit/chromium/src/WebFrameImpl.cpp

    r68279 r68312  
    10831083}
    10841084
     1085bool WebFrameImpl::firstRectForCharacterRange(unsigned location, unsigned length, WebRect& rect) const
     1086{
     1087    if ((location + length < location) && (location + length))
     1088        length = 0;
     1089
     1090    Element* selectionRoot = frame()->selection()->rootEditableElement();
     1091    Element* scope = selectionRoot ? selectionRoot : frame()->document()->documentElement();
     1092    RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(scope, location, length);
     1093    if (!range)
     1094        return false;
     1095    IntRect intRect = frame()->editor()->firstRectForRange(range.get());
     1096    rect = WebRect(intRect.x(), intRect.y(), intRect.width(), intRect.height());
     1097
     1098    return true;
     1099}
     1100
    10851101bool WebFrameImpl::executeCommand(const WebString& name)
    10861102{
  • trunk/WebKit/chromium/src/WebFrameImpl.h

    r68216 r68312  
    138138    virtual bool hasMarkedText() const;
    139139    virtual WebRange markedRange() const;
     140    virtual bool firstRectForCharacterRange(unsigned location, unsigned length, WebRect&) const;
    140141    virtual bool executeCommand(const WebString&);
    141142    virtual bool executeCommand(const WebString&, const WebString& value);
  • trunk/WebKitTools/ChangeLog

    r68308 r68312  
     12010-09-24  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Reviewed by Tony Chang.
     4
     5        [chromium] Implement TextInputController::firstRectForCharacterRange
     6        https://bugs.webkit.org/show_bug.cgi?id=38100
     7
     8        Implemented TextInputController::firstRectForCharacterRange for chromium platform.
     9        No new tests are added since we need to implement the same feature in chromium side
     10        in order to enable any tests that uses this function.
     11
     12        * DumpRenderTree/chromium/TextInputController.cpp:
     13        (TextInputController::firstRectForCharacterRange): Added.
     14
    1152010-09-24  Adam Barth  <abarth@webkit.org>
    216
  • trunk/WebKitTools/DumpRenderTree/chromium/TextInputController.cpp

    r67585 r68312  
    3333
    3434#include "TestShell.h"
     35#include "public/WebBindings.h"
    3536#include "public/WebFrame.h"
    3637#include "public/WebRange.h"
     
    187188}
    188189
    189 void TextInputController::firstRectForCharacterRange(const CppArgumentList&, CppVariant* result)
    190 {
    191     // FIXME: Implement this.
    192     result->setNull();
     190void TextInputController::firstRectForCharacterRange(const CppArgumentList& arguments, CppVariant* result)
     191{
     192    result->setNull();
     193
     194    WebFrame* mainFrame = getMainFrame();
     195    if (!mainFrame)
     196        return;
     197
     198    if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber())
     199        return;
     200
     201    WebRect rect;
     202    if (!mainFrame->firstRectForCharacterRange(arguments[0].toInt32(), arguments[1].toInt32(), rect))
     203        return;
     204
     205    Vector<int> intArray(4);
     206    intArray[0] = rect.x;
     207    intArray[1] = rect.y;
     208    intArray[2] = rect.width;
     209    intArray[3] = rect.height;
     210    result->set(WebBindings::makeIntArray(intArray));
    193211}
    194212
Note: See TracChangeset for help on using the changeset viewer.