OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Apple Inc. All rights reserv
ed. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Apple Inc. All rights reserv
ed. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 bool containsOnlyWhitespace() const; | 45 bool containsOnlyWhitespace() const; |
46 | 46 |
47 StringImpl* dataImpl() { return m_data.impl(); } | 47 StringImpl* dataImpl() { return m_data.impl(); } |
48 | 48 |
49 // Like appendData, but optimized for the parser (e.g., no mutation events). | 49 // Like appendData, but optimized for the parser (e.g., no mutation events). |
50 // Returns how much could be added before length limit was met. | 50 // Returns how much could be added before length limit was met. |
51 unsigned parserAppendData(const String& string, unsigned offset, unsigned le
ngthLimit); | 51 unsigned parserAppendData(const String& string, unsigned offset, unsigned le
ngthLimit); |
52 | 52 |
53 protected: | 53 protected: |
54 CharacterData(TreeScope* treeScope, const String& text, ConstructionType typ
e) | 54 CharacterData(TreeScope& treeScope, const String& text, ConstructionType typ
e) |
55 : Node(treeScope, type) | 55 : Node(&treeScope, type) |
56 , m_data(!text.isNull() ? text : emptyString()) | 56 , m_data(!text.isNull() ? text : emptyString()) |
57 { | 57 { |
58 ASSERT(type == CreateOther || type == CreateText || type == CreateEditin
gText); | 58 ASSERT(type == CreateOther || type == CreateText || type == CreateEditin
gText); |
59 ScriptWrappable::init(this); | 59 ScriptWrappable::init(this); |
60 } | 60 } |
61 | 61 |
62 void setDataWithoutUpdate(const String& data) | 62 void setDataWithoutUpdate(const String& data) |
63 { | 63 { |
64 ASSERT(!data.isNull()); | 64 ASSERT(!data.isNull()); |
65 m_data = data; | 65 m_data = data; |
66 } | 66 } |
67 void didModifyData(const String& oldValue); | 67 void didModifyData(const String& oldValue); |
68 | 68 |
69 String m_data; | 69 String m_data; |
70 | 70 |
71 private: | 71 private: |
72 virtual String nodeValue() const OVERRIDE FINAL; | 72 virtual String nodeValue() const OVERRIDE FINAL; |
73 virtual void setNodeValue(const String&) OVERRIDE FINAL; | 73 virtual void setNodeValue(const String&) OVERRIDE FINAL; |
74 virtual bool isCharacterDataNode() const OVERRIDE FINAL { return true; } | 74 virtual bool isCharacterDataNode() const OVERRIDE FINAL { return true; } |
75 virtual int maxCharacterOffset() const OVERRIDE FINAL; | 75 virtual int maxCharacterOffset() const OVERRIDE FINAL; |
76 virtual bool offsetInCharacters() const OVERRIDE FINAL; | 76 virtual bool offsetInCharacters() const OVERRIDE FINAL; |
77 void setDataAndUpdate(const String&, unsigned offsetOfReplacedData, unsigned
oldLength, unsigned newLength, AttachBehavior = AttachLazily); | 77 void setDataAndUpdate(const String&, unsigned offsetOfReplacedData, unsigned
oldLength, unsigned newLength, AttachBehavior = AttachLazily); |
78 }; | 78 }; |
79 | 79 |
80 } // namespace WebCore | 80 } // namespace WebCore |
81 | 81 |
82 #endif // CharacterData_h | 82 #endif // CharacterData_h |
OLD | NEW |