summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell/text_input_controller.h
blob: 4e9470888a998d2cd42f772d69efb4546dfd1d68 (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
47
48
49
// Copyright (c) 2006-2008 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.

// TextInputController is bound to window.textInputController in Javascript
// when test_shell is running in layout test mode.  Layout tests use it to
// exercise various corners of text input.
//
// Mac equivalent: WebKit/WebKitTools/DumpRenderTree/TextInputController.{h,m}

#ifndef WEBKIT_TOOLS_TEST_SHELL_TEXT_INPUT_CONTROLLER_H__
#define WEBKIT_TOOLS_TEST_SHELL_TEXT_INPUT_CONTROLLER_H__

#include "webkit/glue/cpp_bound_class.h"

class TestShell;

namespace WebKit {
class WebFrame;
}

class TextInputController : public CppBoundClass {
 public:
  TextInputController(TestShell* shell);

  void insertText(const CppArgumentList& args, CppVariant* result);
  void doCommand(const CppArgumentList& args, CppVariant* result);
  void setMarkedText(const CppArgumentList& args, CppVariant* result);
  void unmarkText(const CppArgumentList& args, CppVariant* result);
  void hasMarkedText(const CppArgumentList& args, CppVariant* result);
  void conversationIdentifier(const CppArgumentList& args, CppVariant* result);
  void substringFromRange(const CppArgumentList& args, CppVariant* result);
  void attributedSubstringFromRange(const CppArgumentList& args, CppVariant* result);
  void markedRange(const CppArgumentList& args, CppVariant* result);
  void selectedRange(const CppArgumentList& args, CppVariant* result);
  void firstRectForCharacterRange(const CppArgumentList& args, CppVariant* result);
  void characterIndexForPoint(const CppArgumentList& args, CppVariant* result);
  void validAttributesForMarkedText(const CppArgumentList& args, CppVariant* result);
  void makeAttributedString(const CppArgumentList& args, CppVariant* result);

 private:
  // Returns the test shell's main WebFrame.
  static WebKit::WebFrame* GetMainFrame();

  // Non-owning pointer.  The LayoutTestController is owned by the host.
  static TestShell* shell_;
};

#endif // WEBKIT_TOOLS_TEST_SHELL_TEXT_INPUT_CONTROLLER_H__