Closed Bug 952724 Opened 11 years ago Closed 11 years ago

[InputMethid API] InputContext#replaceSurroundingText doesn't match spec

Categories

(Core :: DOM: Device Interfaces, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla29

People

(Reporter: xyuan, Assigned: xyuan)

References

()

Details

Attachments

(2 files, 3 obsolete files)

The spec: Promise<void> replaceSurroundingText(DOMString text, optional long offset, optional long length); The webidl is the same with the spec: http://mxr.mozilla.org/mozilla-central/source/dom/webidl/InputMethod.webidl#124 Promise replaceSurroundingText(DOMString text, optional long offset, optional long length); The last two parameters give the offset from the cursor position where replacing starts and the length of text to replace. But we made a mistake with the implementation: Promise<void> replaceSurroundingText(DOMString text, optional long beforeLength, optional long afterLength); The last two parameters give the text lengths before and after the cursor to replace.
Attached patch gecko part v1 (obsolete) — Splinter Review
Attachment #8350871 - Attachment is obsolete: true
Attachment #8350871 - Flags: review?(janjongboom)
Attachment #8350873 - Flags: review?(janjongboom)
Attached patch gecko part v2Splinter Review
Sorry, I uploaded the wrong patch. This is the right one ;-)
Attachment #8350873 - Attachment is obsolete: true
Attachment #8350873 - Flags: review?(janjongboom)
Attachment #8350874 - Flags: review?(janjongboom)
Attached file gaia part (obsolete) —
Attachment #8350879 - Flags: review?(dflanagan)
So what I don't like here is that we're making a breaking change in the API as of v1.4 with this patch. Is there any way we can deprecate the old call and make a new function that behaves correct (via an overload or something). I guess there will be people writing keyboards for 1.2 and up and there is no way to know which version of replaceSurroundingText they'll be dealing with...
Flags: needinfo?(xyuan)
The fix should be uplifted to v1.2 as well. We'll use the same API for v1.2 and above. Our implementation doesn't follow all our public wiki, webidl and documents. It'll make keyboard developer confusing. Since v1.2 hasn't support 3rd party keyboard yet, and we mainly use the keyboard API for the built-in keyboard, I think we don't need to be compatible with the old call ;-)
Flags: needinfo?(xyuan)
Since when was 3rd party keyboard scrapped from 1.2? If this will be the only version people will ever see I'm fine with it :p
Flags: needinfo?(xyuan)
Comment on attachment 8350874 [details] [diff] [review] gecko part v2 r=janjongboom. Unrelated; why is INFO TEST-KNOWN-FAIL | /tests/dom/inputmethod/mochitest/test_basic.html | The input context type should match. - got text, expected input failing?
Attachment #8350874 - Flags: review?(janjongboom) → review+
Comment on attachment 8350879 [details] [review] gaia part Looks good to me. Note, though, that I have not compiled the gecko patch and tested myself. Thanks for patching the test_apps/demo-keyboard too!
Attachment #8350879 - Flags: review?(dflanagan) → review+
(In reply to Jan Jongboom [:janjongboom] from comment #7) > Since when was 3rd party keyboard scrapped from 1.2? If this will be the > only version people will ever see I'm fine with it :p 3rd party keyboards didn't make 1.3 either, they'll start in 1.4. No need to backport anywhere please.
Flags: needinfo?(xyuan)
Keywords: checkin-needed
(In reply to Jan Jongboom [:janjongboom] from comment #8) > Comment on attachment 8350874 [details] [diff] [review] > gecko part v2 > > r=janjongboom. > > Unrelated; why is INFO TEST-KNOWN-FAIL | > /tests/dom/inputmethod/mochitest/test_basic.html | The input context type > should match. - got text, expected input failing? From the webild, InputContext#type should be "input", "textarea", or "contenteditable", but we get "text".
https://hg.mozilla.org/integration/b2g-inbound/rev/eccb5de0533a The Gaia PR needs updating before it can be merged.
Flags: in-testsuite+
Keywords: checkin-needed
Attached file gaia part v2
Attachment #8350879 - Attachment is obsolete: true
Attachment #8355564 - Flags: review+
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
Jan & Ryan, thanks for the help :)
Depends on: 978918
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: