Repository: servo/servo
File: components/servo/webview_delegate.rs (Rust)

Code before:
    /// Return the current string value of the input field.
    pub fn text(&self) -> String {
        self.text.clone()
    }

    /// The current zero-based insertion point / cursor position if it is within the field or `None`
    /// if it is not.
    pub fn insertion_point(&self) -> Option<u32> {
        self.insertion_point
    }

    /// Get the area occupied by the `<input>` element that triggered the input method.
    ///
    /// The embedder should use this value to position the input method interface that is
    /// shown to the user.
    pub fn position(&self) -> DeviceIntRect {
        self.position
    }

    /// Whether or not this field is a multiline field.
    pub fn multiline(&self) -> bool {
        self.multiline
    }

    /// Whether the UAs allows virtual keyboard to be shown, we currently allow keyboard to be shown
    /// onlu if user has interacted with the document.
    pub fn allow_virtual_keyboard(&self) -> bool {
        self.allow_virtual_keyboard
    }
}

/// [Simple dialogs](https://html.spec.whatwg.org/multipage/#simple-dialogs) are synchronous dialogs
/// that can be opened by web content. Since their messages are controlled by web content, they
/// should be presented to the user in a way that makes them impossible to mistake for browser UI.
pub enum SimpleDialog {
    Alert(AlertDialog),
    Confirm(ConfirmDialog),
    Prompt(PromptDialog),
}

impl SimpleDialog {
    pub fn message(&self) -> &str {
        match self {
            SimpleDialog::Alert(alert_dialog) => alert_dialog.message(),
            SimpleDialog::Confirm(confirm_dialog) => confirm_dialog.message(),
            SimpleDialog::Prompt(prompt_dialog) => prompt_dialog.message(),
        }
    }

    pub fn confirm(self) {
        match self {

Review comment (suggestion):
```suggestion
    /// only if user has interacted with the document to cause this input method event.
```

Code after:
    /// Return the current string value of the input field.
    pub fn text(&self) -> String {
        self.text.clone()
    }

    /// The current zero-based insertion point / cursor position if it is within the field or `None`
    /// if it is not.
    pub fn insertion_point(&self) -> Option<u32> {
        self.insertion_point
    }

    /// Get the area occupied by the `<input>` element that triggered the input method.
    ///
    /// The embedder should use this value to position the input method interface that is
    /// shown to the user.
    pub fn position(&self) -> DeviceIntRect {
        self.position
    }

    /// Whether or not this field is a multiline field.
    pub fn multiline(&self) -> bool {
        self.multiline
    }

    /// Whether the virtual keyboard should be shown for this input method event.
    /// This is currently true for input method events that happen after the user has
    /// interacted with page contents via an input event.
    pub fn allow_virtual_keyboard(&self) -> bool {
        self.allow_virtual_keyboard
    }
}

/// [Simple dialogs](https://html.spec.whatwg.org/multipage/#simple-dialogs) are synchronous dialogs
/// that can be opened by web content. Since their messages are controlled by web content, they
/// should be presented to the user in a way that makes them impossible to mistake for browser UI.
pub enum SimpleDialog {
    Alert(AlertDialog),
    Confirm(ConfirmDialog),
    Prompt(PromptDialog),
}

impl SimpleDialog {
    pub fn message(&self) -> &str {
        match self {
            SimpleDialog::Alert(alert_dialog) => alert_dialog.message(),
            SimpleDialog::Confirm(confirm_dialog) => confirm_dialog.message(),
            SimpleDialog::Prompt(prompt_dialog) => prompt_dialog.message(),
        }
    }

    pub fn confirm(self) {