Bug 43814 - selectionStart clobbered if textarea isn't focused
Summary: selectionStart clobbered if textarea isn't focused
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-10 14:58 PDT by Ojan Vafai
Modified: 2010-08-17 15:34 PDT (History)
0 users

See Also:


Attachments
test case (400 bytes, text/html)
2010-08-10 14:58 PDT, Ojan Vafai
no flags Details
Patch (4.23 KB, patch)
2010-08-17 12:33 PDT, Ojan Vafai
tony: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ojan Vafai 2010-08-10 14:58:51 PDT
Created attachment 64049 [details]
test case

See test case.  IE/Gecko/Opera don't clobber.
Comment 1 Ojan Vafai 2010-08-10 15:01:19 PDT
Also, if you call editArea.focus() before setting selectionEnd in the test case, then selectionStart doesn't get clobbered.
Comment 2 Ojan Vafai 2010-08-17 12:33:07 PDT
Created attachment 64619 [details]
Patch
Comment 3 Tony Chang 2010-08-17 13:32:10 PDT
Comment on attachment 64619 [details]
Patch

> diff --git a/LayoutTests/fast/forms/text-control-select-blurred.html b/LayoutTests/fast/forms/text-control-select-blurred.html

Nit: Can you add some text explaining what this is testing?


> diff --git a/WebCore/rendering/RenderTextControl.cpp b/WebCore/rendering/RenderTextControl.cpp
>  void RenderTextControl::setSelectionStart(int start)
>  {
> -    setSelectionRange(start, max(start, selectionEnd()));
> +    HTMLTextFormControlElement* element = static_cast<HTMLTextFormControlElement*> (node());

Nit: kill the space between > and (?  I don't see any other static_casts with this space.
Comment 4 Ojan Vafai 2010-08-17 15:34:10 PDT
Committed r65564: <http://trac.webkit.org/changeset/65564>