[Webkit-unassigned] [Bug 54443] Textarea maxlength doesn't account for newlines

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 14 01:19:56 PDT 2011


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


Ryosuke Niwa <rniwa at webkit.org> changed:

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




--- Comment #12 from Ryosuke Niwa <rniwa at webkit.org>  2011-03-14 01:19:56 PST ---
(From update of attachment 85609)
View in context: https://bugs.webkit.org/attachment.cgi?id=85609&action=review

> LayoutTests/fast/forms/script-tests/textarea-maxlength.js:96
> +document.execCommand('insertLineBreak'); // This linebreak should be ignored because limitation up to 3 characters.

You didn't realize about the bug I spotted below because your previous 3 calls have instantiated an open TypingCommand.

> Source/WebCore/editing/TypingCommand.cpp:227
> +            // Check if we can insert new line break with \n(line feed) string.
> +            ExceptionCode ec = 0;
> +            RefPtr<BeforeTextInsertedEvent> evt = BeforeTextInsertedEvent::create(String("\n"));
> +            root->dispatchEvent(evt, ec);
> +
> +            if (evt->text().length()) {
> +                lastTypingCommand->setShouldRetainAutocorrectionIndicator(options & RetainAutocorrectionIndicator);
> +                lastTypingCommand->insertLineBreak();
> +            }

I don't think this is the right place to put this code.  I don't see any reason this fix should be restricted to the line breaks inserted after the user had typed something else (i.e. there is an open typing command).  r- because of this.

-- 
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