blob: b085b020237c9c9f6efa1c4794746fc3085734a1 [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// The goal of the EditContext is to expose the lower-level APIs provided by
// modern operating systems to facilitate various input modalities to unlock
// advanced editing scenarios. For more information please refer
// https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/master/EditContext/explainer.md
[
Exposed=Window,
ActiveScriptWrappable,
RuntimeEnabled=EditContext
] interface EditContext : EventTarget {
[CallWith=ScriptState] constructor(optional EditContextInit options = {});
void focus();
void blur();
[RaisesException] void updateSelection(unsigned long start, unsigned long end);
void updateLayout(DOMRect controlBounds, DOMRect selectionBounds);
[RaisesException] void updateText(unsigned long start, unsigned long end, DOMString newText);
attribute DOMString text;
[RaisesException=Setter] attribute unsigned long selectionStart;
[RaisesException=Setter] attribute unsigned long selectionEnd;
attribute EditContextInputMode inputMode;
attribute EditContextInputPanelPolicy inputPanelPolicy;
attribute EditContextEnterKeyHint enterKeyHint;
// Event handler attributes
attribute EventHandler ontextupdate;
attribute EventHandler ontextformatupdate;
attribute EventHandler oncompositionstart;
attribute EventHandler oncompositionend;
};