summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webtextinput_impl.h
blob: c7a162bc2dbe54d2c3726a7380c850d5c411a52f (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
50
51
52
53
54
55
// 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.
//
// Class WebTextInputImpl provides implementation of WebTextInput which is
// used by TextInputController in test_shell. It only facilitates layout tests
// and should not be used by renderers.

#ifndef WEBKIT_GLUE_WEBTEXTINPUT_IMPL_H__
#define WEBKIT_GLUE_WEBTEXTINPUT_IMPL_H__

#include "webkit/glue/webtextinput.h"

class WebFrameImpl;

class WebTextInputImpl : public WebTextInput {
 public:
  WebTextInputImpl(WebFrameImpl* web_frame_impl);
  virtual ~WebTextInputImpl();

  // WebTextInput methods
  virtual void InsertText(const std::string& text);
  virtual void DoCommand(const std::string& command);
  virtual void SetMarkedText(const std::string& text,
                             int32_t location, int32_t length);
  virtual void UnMarkText();
  virtual bool HasMarkedText();
  virtual void MarkedRange(std::string* range_str);
  virtual void SelectedRange(std::string* range_str);
  virtual void ValidAttributesForMarkedText(std::string* attributes);

  // TODO(huanr): examine all layout tests involving TextInputController
  // and implement these functions if necessary.
  virtual void ConversationIdentifier();
  virtual void SubstringFromRange(int32_t location, int32_t length);
  virtual void AttributedSubstringFromRange(int32_t location,
                                            int32_t length);
  virtual void FirstRectForCharacterRange(int32_t location,
                                          int32_t length);
  virtual void CharacterIndexForPoint(double x, double y);
  virtual void MakeAttributedString(const std::string& str);

 private:
  WebCore::Frame* GetFrame();
  WebCore::Editor* GetEditor();

  void DeleteToEndOfParagraph();

  // Holding a non-owning pointer to the web frame we are associated with.
  WebFrameImpl* web_frame_impl_;

  DISALLOW_EVIL_CONSTRUCTORS(WebTextInputImpl);
};

#endif  // #ifndef WEBKIT_GLUE_WEBTEXTINPUT_IMPL_H__