OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999 Lars Knoll (knoll@kde.org) | 2 * (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * (C) 2000 Dirk Mueller (mueller@kde.org) |
4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 // Used to represent a text substring of an element, e.g., for text runs that ar
e split because of | 30 // Used to represent a text substring of an element, e.g., for text runs that ar
e split because of |
31 // first letter and that must therefore have different styles (and positions in
the render tree). | 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 th
at we can recover | 32 // We cache offsets so that text transformations can be applied in such a way th
at we can recover |
33 // the original unaltered string from our corresponding DOM node. | 33 // the original unaltered string from our corresponding DOM node. |
34 class RenderTextFragment FINAL : public RenderText { | 34 class RenderTextFragment FINAL : public RenderText { |
35 public: | 35 public: |
36 RenderTextFragment(Node*, StringImpl*, int startOffset, int length); | 36 RenderTextFragment(Node*, StringImpl*, int startOffset, int length); |
37 RenderTextFragment(Node*, StringImpl*); | 37 RenderTextFragment(Node*, StringImpl*); |
38 virtual ~RenderTextFragment(); | 38 virtual ~RenderTextFragment(); |
39 virtual void trace(Visitor*) OVERRIDE; | |
40 | 39 |
41 virtual bool isTextFragment() const OVERRIDE { return true; } | 40 virtual bool isTextFragment() const OVERRIDE { return true; } |
42 | 41 |
43 virtual bool canBeSelectionLeaf() const OVERRIDE { return node() && node()->
hasEditableStyle(); } | 42 virtual bool canBeSelectionLeaf() const OVERRIDE { return node() && node()->
hasEditableStyle(); } |
44 | 43 |
45 unsigned start() const { return m_start; } | 44 unsigned start() const { return m_start; } |
46 unsigned end() const { return m_end; } | 45 unsigned end() const { return m_end; } |
47 virtual unsigned textStartOffset() const OVERRIDE { return start(); } | 46 virtual unsigned textStartOffset() const OVERRIDE { return start(); } |
48 | 47 |
49 RenderBoxModelObject* firstLetter() const { return m_firstLetter; } | |
50 void setFirstLetter(RenderBoxModelObject* firstLetter) { m_firstLetter = fir
stLetter; } | |
51 RenderText* firstRenderTextInFirstLetter() const; | |
52 | |
53 StringImpl* contentString() const { return m_contentString.get(); } | 48 StringImpl* contentString() const { return m_contentString.get(); } |
| 49 PassRefPtr<StringImpl> completeText() const; |
54 virtual PassRefPtr<StringImpl> originalText() const OVERRIDE; | 50 virtual PassRefPtr<StringImpl> originalText() const OVERRIDE; |
55 | 51 |
56 virtual void setText(PassRefPtr<StringImpl>, bool force = false) OVERRIDE; | 52 virtual void setText(PassRefPtr<StringImpl>, bool force = false) OVERRIDE; |
57 | 53 |
58 virtual void transformText() OVERRIDE; | 54 virtual void transformText() OVERRIDE; |
59 | 55 |
60 virtual const char* renderName() const OVERRIDE FINAL { return "RenderTextFr
agment"; } | 56 virtual const char* renderName() const OVERRIDE FINAL { return "RenderTextFr
agment"; } |
61 | 57 |
62 protected: | 58 private: |
63 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV
ERRIDE; | 59 virtual UChar previousCharacter() const OVERRIDE; |
| 60 virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) OVERRID
E; |
64 | 61 |
65 private: | 62 Text* associatedTextNode() const; |
66 virtual void willBeDestroyed() OVERRIDE; | |
67 | |
68 virtual UChar previousCharacter() const OVERRIDE; | |
69 RenderBlock* blockForAccompanyingFirstLetter() const; | |
70 virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) OVERRID
E; | |
71 | 63 |
72 unsigned m_start; | 64 unsigned m_start; |
73 unsigned m_end; | 65 unsigned m_end; |
74 RefPtr<StringImpl> m_contentString; | 66 RefPtr<StringImpl> m_contentString; |
75 RawPtrWillBeMember<RenderBoxModelObject> m_firstLetter; | |
76 }; | 67 }; |
77 | 68 |
78 DEFINE_TYPE_CASTS(RenderTextFragment, RenderObject, object, toRenderText(object)
->isTextFragment(), toRenderText(object).isTextFragment()); | 69 DEFINE_TYPE_CASTS(RenderTextFragment, RenderObject, object, toRenderText(object)
->isTextFragment(), toRenderText(object).isTextFragment()); |
79 | 70 |
80 } // namespace blink | 71 } // namespace blink |
81 | 72 |
82 #endif // RenderTextFragment_h | 73 #endif // RenderTextFragment_h |
OLD | NEW |