[Webkit-unassigned] [Bug 42958] Pasting should fire textInput event

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Aug 4 14:08:19 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=42958


Tony Chang (Google) <tony at chromium.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #63440|review?                     |review-
               Flag|                            |




--- Comment #2 from Tony Chang (Google) <tony at chromium.org>  2010-08-04 14:08:19 PST ---
(From update of attachment 63440)
> diff --git a/LayoutTests/editing/pasteboard/script-tests/paste-text-events.js b/LayoutTests/editing/pasteboard/script-tests/paste-text-events.js
> +function pastingTextInputHandler(evt)
> +{
> +    shouldBe("event.data", toStringLiteral(expectedTextEventData));
> +    textInputCount++;
> +    if (willCancelTextInput)
> +	evt.preventDefault();

Nit: Looks like a tab character got in here.

> +willCancelTextInput = false;
> +for (var i = 0; i < proceedingTestCases.length; ++i)
> +    runSingleTest(proceedingTestCases[i]);
> +shouldBe("textInputCount", "proceedingTestCases.length");
> +
> +textInputCount = 0;
> +willCancelTextInput = true;
> +for (var i = 0; i < cancelingTestCases.length; ++i)
> +    runSingleTest(cancelingTestCases[i]);
> +shouldBe("textInputCount", "cancelingTestCases.length");

These tests look great!  Does this event fire for ontextinput declared in the HTML?  If so, it'd be nice to add some tests for that too.

> diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp
> +void Editor::pasteAsPlainText(const String& pastingText, bool smartReplace)
> +void Editor::pasteAsFragment(PassRefPtr<DocumentFragment> pastingFragment, bool smartReplace, bool matchStyle)

These methods seem to have only one caller.  Since they're pretty short, maybe we should just inline them?  I think it's confusing to have pasteAsPlainText and pasteAsPlainTextWithPasteboard.


> +class FragmentPasteTextEvent : public TextEvent {
> +public:
> +    static PassRefPtr<FragmentPasteTextEvent> create(PassRefPtr<AbstractView> view, PassRefPtr<DocumentFragment> pastingData, bool smartReplace, bool matchStyle);

Subclassing seems like overkill just to keep track of the type of event.  Can we just add an argument to the TextEvent constructor that keeps track of the event type?  The spec mentions an inputMode parameter to initTextEvent, but that should probably happen in a different patch.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list