Commit 037271df authored by jhoneycutt@apple.com's avatar jhoneycutt@apple.com
Browse files

Implement DOMHTMLInputElement::replaceCharactersInRange().

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

Reviewed by Dan Bernstein.

* DOMHTMLClasses.cpp:
(DOMHTMLInputElement::replaceCharactersInRange):
Get the text of the input field. Replace the given range with the
replacement text, and set this new string as the input element's value.
Select from index to the end of the field. This matches the
implementation in the Obj-C bindings.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51094 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ed26f53c
2009-11-12 Jon Honeycutt <jhoneycutt@apple.com>
Implement DOMHTMLInputElement::replaceCharactersInRange().
https://bugs.webkit.org/show_bug.cgi?id=31492
Reviewed by Dan Bernstein.
* DOMHTMLClasses.cpp:
(DOMHTMLInputElement::replaceCharactersInRange):
Get the text of the input field. Replace the given range with the
replacement text, and set this new string as the input element's value.
Select from index to the end of the field. This matches the
implementation in the Obj-C bindings.
2009-11-12 Jon Honeycutt <jhoneycutt@apple.com>
DOMHTMLOptionElement is missing some functionality.
......
......@@ -1306,13 +1306,25 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::rectOnScreen(
}
HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::replaceCharactersInRange(
/* [in] */ int /*startTarget*/,
/* [in] */ int /*endTarget*/,
/* [in] */ BSTR /*replacementString*/,
/* [in] */ int /*index*/)
/* [in] */ int startTarget,
/* [in] */ int endTarget,
/* [in] */ BSTR replacementString,
/* [in] */ int index)
{
ASSERT_NOT_REACHED();
return E_NOTIMPL;
if (!replacementString)
return E_POINTER;
ASSERT(m_element);
ASSERT(m_element->hasTagName(inputTag));
HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
String newValue = inputElement->value();
String webCoreReplacementString(static_cast<UChar*>(replacementString), SysStringLen(replacementString));
newValue.replace(startTarget, endTarget - startTarget, webCoreReplacementString);
inputElement->setValue(newValue);
inputElement->setSelectionRange(index, newValue.length());
return S_OK;
}
HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::selectedRange(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment