summaryrefslogtreecommitdiffstats
path: root/ui/platform_window/text_input_state.cc
blob: ce6db8418578559b2e89e8a826fa992a4b864708 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2015 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.

#include "ui/platform_window/text_input_state.h"

namespace ui {

TextInputState::TextInputState()
    : type(TEXT_INPUT_TYPE_NONE),
      flags(TEXT_INPUT_FLAG_NONE),
      selection_start(0),
      selection_end(0),
      composition_start(0),
      composition_end(0),
      can_compose_inline(false) {}

TextInputState::TextInputState(TextInputType type,
                               int flags,
                               const std::string& text,
                               int selection_start,
                               int selection_end,
                               int composition_start,
                               int composition_end,
                               bool can_compose_inline)
    : type(type),
      flags(flags),
      text(text),
      selection_start(selection_start),
      selection_end(selection_end),
      composition_start(composition_start),
      composition_end(composition_end),
      can_compose_inline(can_compose_inline) {}

bool TextInputState::operator==(const TextInputState& other) const {
  return type == other.type &&
         flags == other.flags &&
         text == other.text &&
         selection_start == other.selection_start &&
         selection_end == other.selection_end &&
         composition_start == other.composition_start &&
         composition_end == other.composition_end &&
         can_compose_inline == other.can_compose_inline;
}

}  // namespace ui