blob: 18bc5d027406a8fda5c3464e1b7e8ae8d9c3091e [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
[
Constructor(optional EditContextInit options),
ConstructorCallWith=ScriptState,
Exposed=Window,
ActiveScriptWrappable,
RuntimeEnabled=EditContext
] interface EditContext : EventTarget {
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;
};