OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 14 matching lines...) Expand all Loading... |
25 #define FirstLetterPseudoElement_h | 25 #define FirstLetterPseudoElement_h |
26 | 26 |
27 #include "core/dom/Document.h" | 27 #include "core/dom/Document.h" |
28 #include "core/dom/PseudoElement.h" | 28 #include "core/dom/PseudoElement.h" |
29 #include "wtf/text/WTFString.h" | 29 #include "wtf/text/WTFString.h" |
30 | 30 |
31 namespace blink { | 31 namespace blink { |
32 | 32 |
33 class Element; | 33 class Element; |
34 class RenderObject; | 34 class RenderObject; |
| 35 class RenderTextFragment; |
35 | 36 |
36 class FirstLetterPseudoElement final : public PseudoElement { | 37 class FirstLetterPseudoElement final : public PseudoElement { |
37 WTF_MAKE_NONCOPYABLE(FirstLetterPseudoElement); | 38 WTF_MAKE_NONCOPYABLE(FirstLetterPseudoElement); |
38 public: | 39 public: |
39 static PassRefPtrWillBeRawPtr<FirstLetterPseudoElement> create(Element* pare
nt); | 40 static PassRefPtrWillBeRawPtr<FirstLetterPseudoElement> create(Element* pare
nt) |
| 41 { |
| 42 return adoptRefWillBeNoop(new FirstLetterPseudoElement(parent)); |
| 43 } |
| 44 |
| 45 virtual ~FirstLetterPseudoElement(); |
| 46 virtual void trace(Visitor*) override; |
40 | 47 |
41 static RenderObject* firstLetterTextRenderer(const Element&); | 48 static RenderObject* firstLetterTextRenderer(const Element&); |
42 static unsigned firstLetterLength(const String&); | 49 static unsigned firstLetterLength(const String&); |
43 | 50 |
44 void setRemainingTextRenderer(RenderTextFragment* fragment) { m_remainingTex
tRenderer = fragment; } | 51 void setRemainingTextRenderer(RenderTextFragment* fragment) { m_remainingTex
tRenderer = fragment; } |
45 RenderTextFragment* remainingTextRenderer() const { return m_remainingTextRe
nderer; } | 52 RenderTextFragment* remainingTextRenderer() const { return m_remainingTextRe
nderer; } |
46 | 53 |
47 void setNeedsUpdate(); | 54 void setNeedsUpdate(); |
48 bool needsUpdate() const { return m_needsUpdate; } | 55 bool needsUpdate() const { return m_needsUpdate; } |
49 | 56 |
50 virtual void attach(const AttachContext& = AttachContext()) override; | 57 virtual void attach(const AttachContext& = AttachContext()) override; |
51 virtual void detach(const AttachContext& = AttachContext()) override; | 58 virtual void detach(const AttachContext& = AttachContext()) override; |
52 | 59 |
53 private: | 60 private: |
54 FirstLetterPseudoElement(Element*); | 61 explicit FirstLetterPseudoElement(Element*); |
55 | 62 |
56 virtual void didRecalcStyle(StyleRecalcChange) override; | 63 virtual void didRecalcStyle(StyleRecalcChange) override; |
57 | 64 |
58 void attachFirstLetterTextRenderers(); | 65 void attachFirstLetterTextRenderers(); |
59 RenderStyle* styleForFirstLetter(RenderObject*); | 66 RenderStyle* styleForFirstLetter(RenderObject*); |
60 | 67 |
61 RenderTextFragment* m_remainingTextRenderer; | 68 RawPtrWillBeMember<RenderTextFragment> m_remainingTextRenderer; |
62 bool m_needsUpdate; | 69 bool m_needsUpdate; |
63 }; | 70 }; |
64 | 71 |
65 DEFINE_ELEMENT_TYPE_CASTS(FirstLetterPseudoElement, isFirstLetterPseudoElement()
); | 72 DEFINE_ELEMENT_TYPE_CASTS(FirstLetterPseudoElement, isFirstLetterPseudoElement()
); |
66 | 73 |
67 } // namespace blink | 74 } // namespace blink |
68 | 75 |
69 #endif // FirstLetterPseudoElement_h | 76 #endif // FirstLetterPseudoElement_h |
OLD | NEW |