diff options
Diffstat (limited to 'Source/WebCore/dom/Text.h')
-rw-r--r-- | Source/WebCore/dom/Text.h | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/Source/WebCore/dom/Text.h b/Source/WebCore/dom/Text.h index 186ae6425..187b56f79 100644 --- a/Source/WebCore/dom/Text.h +++ b/Source/WebCore/dom/Text.h @@ -20,8 +20,7 @@ * */ -#ifndef Text_h -#define Text_h +#pragma once #include "CharacterData.h" #include "RenderPtr.h" @@ -29,32 +28,32 @@ namespace WebCore { class RenderText; -class ScriptExecutionContext; class Text : public CharacterData { public: static const unsigned defaultLengthLimit = 1 << 16; - static PassRefPtr<Text> create(Document&, const String&); - static PassRefPtr<Text> create(ScriptExecutionContext&, const String&); - static PassRefPtr<Text> createWithLengthLimit(Document&, const String&, unsigned positionInString, unsigned lengthLimit = defaultLengthLimit); - static PassRefPtr<Text> createEditingText(Document&, const String&); + static Ref<Text> create(Document&, const String&); + static Ref<Text> createWithLengthLimit(Document&, const String&, unsigned positionInString, unsigned lengthLimit = defaultLengthLimit); + static Ref<Text> createEditingText(Document&, const String&); virtual ~Text(); - PassRefPtr<Text> splitText(unsigned offset, ExceptionCode&); + WEBCORE_EXPORT ExceptionOr<Ref<Text>> splitText(unsigned offset); // DOM Level 3: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1312295772 - String wholeText() const; - PassRefPtr<Text> replaceWholeText(const String&, ExceptionCode&); + WEBCORE_EXPORT String wholeText() const; + WEBCORE_EXPORT RefPtr<Text> replaceWholeText(const String&); RenderPtr<RenderText> createTextRenderer(const RenderStyle&); - virtual bool canContainRangeEndPoint() const override final { return true; } + bool canContainRangeEndPoint() const final { return true; } RenderText* renderer() const; + void updateRendererAfterContentChange(unsigned offsetOfReplacedData, unsigned lengthOfReplacedData); + protected: Text(Document& document, const String& data, ConstructionType type) : CharacterData(document, data, type) @@ -62,24 +61,20 @@ protected: } private: - virtual String nodeName() const override; - virtual NodeType nodeType() const override; - virtual PassRefPtr<Node> cloneNode(bool deep) override; - virtual bool childTypeAllowed(NodeType) const override; + String nodeName() const override; + NodeType nodeType() const override; + Ref<Node> cloneNodeInternal(Document&, CloningOperation) override; + bool childTypeAllowed(NodeType) const override; - virtual PassRefPtr<Text> virtualCreate(const String&); + virtual Ref<Text> virtualCreate(const String&); -#ifndef NDEBUG - virtual void formatForDebugger(char* buffer, unsigned length) const override; +#if ENABLE(TREE_DEBUGGING) + void formatForDebugger(char* buffer, unsigned length) const override; #endif }; -inline bool isText(const Node& node) { return node.isTextNode(); } -void isText(const Text&); // Catch unnecessary runtime check of type known at compile time. -void isText(const ContainerNode&); // Catch unnecessary runtime check of type known at compile time. - -NODE_TYPE_CASTS(Text) - } // namespace WebCore -#endif // Text_h +SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::Text) + static bool isType(const WebCore::Node& node) { return node.isTextNode(); } +SPECIALIZE_TYPE_TRAITS_END() |