[Webkit-unassigned] [Bug 25444] SelectionStart, selectionEnd properties return wrong values when the selection is in a form input

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Nov 4 10:07:39 PDT 2010


--- Comment #8 from Julie Jeongeun Kim <jiyuluna at gmail.com>  2010-11-04 10:07:39 PST ---
Thank you for your comment.
I have some questions.

(In reply to comment #7)
> > WebCore/ChangeLog:8
> > +        Only editable elements are available at RenderTextControl::indexForVisiblePosition. 
> I don't get this comment.  Could you elaborate more?
Because rootEditableElement() is checked on RenderTextControl::indexForVisiblePosition,
ReadOnly element is not editable element. So, it can't get correct selection information.
The INPUT element on this test case has read-only property.
I'll update ChangeLog as well. 

> > WebCore/rendering/RenderTextControl.cpp:264
> > +    if (node && node->isShadowNode() && (node->shadowParentNode()->hasTagName(inputTag) || node->shadowParentNode()->hasTagName(textareaTag)))
> Why do we exclude SVGInputElement here?
Please check 'http://www.w3.org/TR/html5/association-of-controls-and-forms.html#textFieldSelection'
"4.11 APIs for the text field selections
The input and textarea elements define the following members in their DOM interfaces for handling their selection:"
Do I need to add SVGInputElement?

> > WebCore/rendering/RenderTextControl.cpp:298
> > +    if (!indexPosition.node() 
> > +        || (indexPosition.node()->rootEditableElement() != m_innerText && !isSelectableElement(indexPosition.node())))
> Mn... we still do need to make sure the position is inside the form control though.  what we might want to do is to check node()->contains(pos.node()).
In order to check element type, it should check shadow node.
isSelectableElement() checks shadow node.
If you look into 'DeleteSelectionCommand::doApply',
It checks the type like 
        Node* ancestorNode = startNode ? startNode->shadowAncestorNode() : 0;
        if (ancestorNode && ancestorNode->hasTagName(inputTag)

I think I need to change the way to search shadow node on isSelectableElement() like the above.
But, do I need 'node()->contains(pos.node())'?
If I don't understand it well, please let me know.

> > LayoutTests/fast/forms/selection-start-end-readonly.html:14
> > +        test.setSelectionRange(5,7);
> > +        
> > +        if (test.selectionStart == 5 && test.selectionEnd == 7) {
> > +            con.innerText = "PASS"; 
> > +        } else {
> > +            con.innerText = "FAIL";
> We probably want more than one case.  At least, selecting all, all but the left end, all but the right end, in the middle, and collapsed caret in the middle, at the left end, and at the right end.

There is a test case for them already. Refer to 'selection-functions.html'.
I think this issue is just related to read-only case.
In spite of it, do I need to add those test cases?

I'll upload patch again, after getting answer about the above items.

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