#ifndef RenderTextFragment_h
#define RenderTextFragment_h
#include "core/rendering/RenderText.h"
namespace WebCore {
class RenderTextFragment FINAL : public RenderText {
public:
RenderTextFragment(Node*, StringImpl*, int startOffset, int length);
RenderTextFragment(Node*, StringImpl*);
virtual ~RenderTextFragment();
virtual bool isTextFragment() const OVERRIDE { return true; }
virtual bool canBeSelectionLeaf() const OVERRIDE { return node() && node()->rendererIsEditable(); }
unsigned start() const { return m_start; }
unsigned end() const { return m_end; }
virtual unsigned textStartOffset() const OVERRIDE { return start(); }
RenderObject* firstLetter() const { return m_firstLetter; }
void setFirstLetter(RenderObject* firstLetter) { m_firstLetter = firstLetter; }
RenderText* firstRenderTextInFirstLetter() const;
StringImpl* contentString() const { return m_contentString.get(); }
virtual PassRefPtr<StringImpl> originalText() const OVERRIDE;
virtual void setText(PassRefPtr<StringImpl>, bool force = false) OVERRIDE;
virtual void transformText() OVERRIDE;
protected:
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
private:
virtual void willBeDestroyed() OVERRIDE;
virtual UChar previousCharacter() const OVERRIDE;
RenderBlock* blockForAccompanyingFirstLetter() const;
virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) OVERRIDE;
unsigned m_start;
unsigned m_end;
RefPtr<StringImpl> m_contentString;
RenderObject* m_firstLetter;
};
DEFINE_TYPE_CASTS(RenderTextFragment, RenderObject, object, toRenderText(object)->isTextFragment(), toRenderText(object).isTextFragment());
}
#endif