]> git.saurik.com Git - iphone-api.git/blame - WebCore/CharacterData.h
Add support for new WinterBoard Settings features.
[iphone-api.git] / WebCore / CharacterData.h
CommitLineData
a90939db
JF
1/*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 *
21 */
22
23#ifndef CharacterData_h
24#define CharacterData_h
25
26#include "EventTargetNode.h"
27
28namespace WebCore {
29
30class CharacterData : public EventTargetNode {
31public:
32 CharacterData(Document*, const String& text, bool isText = false);
33 CharacterData(Document*, bool isText = false);
34 virtual ~CharacterData();
35
36 // DOM methods & attributes for CharacterData
37
38 String data() const { return m_data; }
39 void setData(const String&, ExceptionCode&);
40 unsigned length() const { return m_data->length(); }
41 String substringData(unsigned offset, unsigned count, ExceptionCode&);
42 void appendData(const String&, ExceptionCode&);
43 void insertData(unsigned offset, const String&, ExceptionCode&);
44 void deleteData(unsigned offset, unsigned count, ExceptionCode&);
45 void replaceData(unsigned offset, unsigned count, const String &arg, ExceptionCode&);
46
47 bool containsOnlyWhitespace() const;
48
49 // DOM methods overridden from parent classes
50
51 virtual String nodeValue() const;
52 virtual void setNodeValue(const String&, ExceptionCode&);
53
54 // Other methods (not part of DOM)
55
56 virtual bool isCharacterDataNode() const { return true; }
57 virtual int maxCharacterOffset() const;
58 StringImpl* string() { return m_data.get(); }
59
60 virtual bool offsetInCharacters() const;
61 virtual bool rendererIsNeeded(RenderStyle*);
62
63protected:
64 RefPtr<StringImpl> m_data;
65
66 void dispatchModifiedEvent(StringImpl* oldValue);
67
68private:
69 void checkCharDataOperation(unsigned offset, ExceptionCode&);
70};
71
72} // namespace WebCore
73
74#endif // CharacterData_h
75