diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/dom/CharacterData.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/dom/CharacterData.h')
-rw-r--r-- | Source/WebCore/dom/CharacterData.h | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/Source/WebCore/dom/CharacterData.h b/Source/WebCore/dom/CharacterData.h index 681c63b99..e4ad221ed 100644 --- a/Source/WebCore/dom/CharacterData.h +++ b/Source/WebCore/dom/CharacterData.h @@ -20,36 +20,34 @@ * */ -#ifndef CharacterData_h -#define CharacterData_h +#pragma once -#include "Node.h" -#include <wtf/text/WTFString.h> +#include "ContainerNode.h" namespace WebCore { class CharacterData : public Node { public: - String data() const { return m_data; } - void setData(const String&, ExceptionCode&); + const String& data() const { return m_data; } + static ptrdiff_t dataMemoryOffset() { return OBJECT_OFFSETOF(CharacterData, m_data); } + + WEBCORE_EXPORT void setData(const String&); unsigned length() const { return m_data.length(); } - String substringData(unsigned offset, unsigned count, ExceptionCode&); - void appendData(const String&, ExceptionCode&); - void insertData(unsigned offset, const String&, ExceptionCode&); - void deleteData(unsigned offset, unsigned count, ExceptionCode&); - void replaceData(unsigned offset, unsigned count, const String&, ExceptionCode&); + WEBCORE_EXPORT ExceptionOr<String> substringData(unsigned offset, unsigned count); + WEBCORE_EXPORT void appendData(const String&); + WEBCORE_EXPORT ExceptionOr<void> insertData(unsigned offset, const String&); + WEBCORE_EXPORT ExceptionOr<void> deleteData(unsigned offset, unsigned count); + WEBCORE_EXPORT ExceptionOr<void> replaceData(unsigned offset, unsigned count, const String&); bool containsOnlyWhitespace() const; - StringImpl* dataImpl() { return m_data.impl(); } - // Like appendData, but optimized for the parser (e.g., no mutation events). // Returns how much could be added before length limit was met. unsigned parserAppendData(const String& string, unsigned offset, unsigned lengthLimit); protected: CharacterData(Document& document, const String& text, ConstructionType type) - : Node(&document, type) + : Node(document, type) , m_data(!text.isNull() ? text : emptyString()) { ASSERT(type == CreateOther || type == CreateText || type == CreateEditingText); @@ -63,23 +61,19 @@ protected: void dispatchModifiedEvent(const String& oldValue); private: - virtual String nodeValue() const override final; - virtual void setNodeValue(const String&, ExceptionCode&) override final; - virtual bool isCharacterDataNode() const override final { return true; } - virtual int maxCharacterOffset() const override final; - virtual bool offsetInCharacters() const override final; + String nodeValue() const final; + ExceptionOr<void> setNodeValue(const String&) final; + bool isCharacterDataNode() const final { return true; } + int maxCharacterOffset() const final; + bool offsetInCharacters() const final; void setDataAndUpdate(const String&, unsigned offsetOfReplacedData, unsigned oldLength, unsigned newLength); - void checkCharDataOperation(unsigned offset, ExceptionCode&); + void notifyParentAfterChange(ContainerNode::ChildChangeSource); String m_data; }; -inline bool isCharacterData(const Node& node) { return node.isCharacterDataNode(); } -void isCharacterData(const CharacterData&); // Catch unnecessary runtime check of type known at compile time. -void isCharacterData(const ContainerNode&); // Catch unnecessary runtime check of type known at compile time. - -NODE_TYPE_CASTS(CharacterData) - } // namespace WebCore -#endif // CharacterData_h +SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::CharacterData) + static bool isType(const WebCore::Node& node) { return node.isCharacterDataNode(); } +SPECIALIZE_TYPE_TRAITS_END() |