Unduplicate the code to convert between VisiblePosition and index
https://bugs.webkit.org/show_bug.cgi?id=120506

Reviewed by Darin Adler.

Encapsulate the conversion between VisiblePosition and index into indexForVisiblePosition
and visiblePositionForIndexUsingCharacterIterator. It's unfortunate that these two functions
are different from the two other existing functions of similar names but we've at least
confined problems into a single cpp file now.

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::visiblePositionForIndex):
(WebCore::AccessibilityRenderObject::indexForVisiblePosition):
* editing/Editor.cpp:
(WebCore::findFirstMarkable):
* editing/htmlediting.cpp:
(WebCore::indexForVisiblePosition):
(WebCore::visiblePositionForIndexUsingCharacterIterator):
* editing/htmlediting.h:
* html/HTMLTextFormControlElement.cpp:
(WebCore::hasVisibleTextArea):
(WebCore::HTMLTextFormControlElement::setSelectionRange):
(WebCore::HTMLTextFormControlElement::indexForVisiblePosition):
(WebCore::HTMLTextFormControlElement::visiblePositionForIndex):
* html/HTMLTextFormControlElement.h:
* rendering/RenderTextControl.cpp:
* rendering/RenderTextControl.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154868 268f45cc-cd09-0410-ab3c-d52691b4dbfc