]>
git.saurik.com Git - iphone-api.git/blob - WebCore/RenderTextFragment.h
2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
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.
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.
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.
23 #ifndef RenderTextFragment_h
24 #define RenderTextFragment_h
26 #include "RenderText.h"
30 // Used to represent a text substring of an element, e.g., for text runs that are split because of
31 // first letter and that must therefore have different styles (and positions in the render tree).
32 // We cache offsets so that text transformations can be applied in such a way that we can recover
33 // the original unaltered string from our corresponding DOM node.
34 class RenderTextFragment
: public RenderText
{
36 RenderTextFragment(Node
*, StringImpl
*, int startOffset
, int length
);
37 RenderTextFragment(Node
*, StringImpl
*);
39 virtual bool isTextFragment() const { return true; }
41 virtual void destroy();
43 unsigned start() const { return m_start
; }
44 unsigned end() const { return m_end
; }
46 RenderObject
* firstLetter() const { return m_firstLetter
; }
47 void setFirstLetter(RenderObject
* firstLetter
) { m_firstLetter
= firstLetter
; }
49 StringImpl
* contentString() const { return m_contentString
.get(); }
50 virtual PassRefPtr
<StringImpl
> originalText() const;
53 virtual void setTextInternal(PassRefPtr
<StringImpl
>);
54 virtual UChar
previousCharacter();
58 RefPtr
<StringImpl
> m_contentString
;
59 RenderObject
* m_firstLetter
;
62 } // namespace WebCore
64 #endif // RenderTextFragment_h