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

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 5 09:39:08 PDT 2010


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

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

--- Comment #5 from Tony Chang (Google) <tony at chromium.org>  2010-08-05 09:39:08 PST ---
(From update of attachment 63551)
This looks great!  Just some small changes left.

> diff --git a/WebCore/dom/TextEvent.h b/WebCore/dom/TextEvent.h
> +        static PassRefPtr<TextEvent> createForPlainTextPaste(PassRefPtr<AbstractView> view, const String& data, bool shouldSmartReplace)
> +        {
> +            RefPtr<TextEvent> event = adoptRef(new TextEvent(view, data));

Can you move this body into the .cpp file?

> +            event->setIsPaste(true);
> +            event->setShouldSmartReplace(shouldSmartReplace);

Can the member variables change after the TextEvent is created?  If not, maybe we should use constructor arguments and not have set methods.

> +        static PassRefPtr<TextEvent> createForFragmentPaste(PassRefPtr<AbstractView> view, PassRefPtr<DocumentFragment> data, bool shouldSmartReplace, bool shouldMatchStyle)
> +        {
> +            RefPtr<TextEvent> event = adoptRef(new TextEvent(view, ""));

Same as above.

> diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp
> +bool Editor::handleTextEvent(TextEvent* event)
> +{
> +    if (event->isPaste()) {

This refactoring looks much nicer!

> diff --git a/LayoutTests/editing/pasteboard/paste-text-events.html b/LayoutTests/editing/pasteboard/paste-text-events.html

One other testing suggestion: Should we add a test to make sure that canceling keydown prevents textInput from firing?  This is mentioned here: http://www.w3.org/TR/DOM-Level-3-Events/#keyset-cancelable_keys

It would be fine to add that in a follow up change too.

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