TextInputHandler may dispatch keypress events after InsertText() is called if there was composition and it's committed by "current" keydown event. In that case, [NSEvent characters] may have the committing string. For example, when Opt+e of US keyboard layout started composition, Cmd+v causes committing the "`" character and pasting the clipboard text. Then, the "v" key's keydown event's |characters| is "`v". So, after InsertText() is called with "`", TextInputHandler shouldn't dispatch keypress event for "`" again. I.e., the KeyboardEvent.key value should be "v" rather than "`v".
For solving this issue, TextInputHandlerBase::AutoInsertStringClearer which is created at every InsertText() call should store the inserted string to TextInputHandlerBase::KeyEventState. However, for making the implemntation simpler, it should recode only when the inserting string is actually a part of [mKeyEvent characters]. Then, TextInputHandlerBase::KeyEventState can compute unhandled insert string at initializing WidgetKeyboardEvent.
So, finally, TextInputHandlerBase::InitKeyEvent() should be called via TextInputHandlerBase::KeyEventState::InitKeyEvent(). This ensures that all key events which may cause InsertText() calls are always initialized with unhandled string.
MozReview-Commit-ID: A9o8o9pV2XV
--HG--
extra : rebase_source : d99e9ab7633f45069d0a3940cc2b2b5ad859ea05
The autocomplete popup is displayed relatively to an anchor, but will be
shifted on the x-axis in order to be aligned with the word being completed.
To support this, the HTMLTooltip show() method now accepts x and y offsets.
MozReview-Commit-ID: 1cR3XFPdcVy
--HG--
extra : rebase_source : 0aa84be9afe977c52bffad2eb37eb35813d8a17a
The autocomplete popup defines its width by finding the longest label
to display and then applying a "width:Xch" to its content, where X is
the length of the longest label + 3.
In order to support this, the HTMLTooltip setContent() methods allows to
use width: "auto" (which also becomes the default value). In this case,
the HTMLTooltip show() method will automatically compute the preferred
width for the tooltip. It will first calculate the tooltip height, then
measure the width of the tooltip for this computed height and use it as
the preferred width.
MozReview-Commit-ID: KDxZNB3KDdR
--HG--
extra : rebase_source : 8ceedd73434551050f8d63cbf03d66870e275b03
Some test documents are using a <page> object instead of a <window> object.
When inserting the tooltip container inside of the document, the HTMLTooltip
will now insert the container in the documentElement
MozReview-Commit-ID: F57vP2lfvrg
--HG--
extra : rebase_source : 5f99c4c139fed9a9893a98a5de2c4c3e76c753da
When calling HTMLTooltip::show() consecutively, we were leaking a window object.
The timeout responsible for attaching the click event on window is now cleared
before attaching a new one.
MozReview-Commit-ID: 3ccIHM2QNlp
--HG--
extra : rebase_source : 645e761b8fa562bfa5b8e4abe3412ef52c03c62e
setContent expects 3 arguments: content, width, height. Height is already optional
but for the autocomplete migration, the width will also become optional.
Using an object argument for width and height makes this easier.
MozReview-Commit-ID: 9CiMG0BdLOR
--HG--
extra : rebase_source : 4ec54714ccc2476fa4b341aaad3773ba095cca5a