OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | |
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. | |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | |
7 * | |
8 * This library is free software; you can redistribute it and/or | |
9 * modify it under the terms of the GNU Library General Public | |
10 * License as published by the Free Software Foundation; either | |
11 * version 2 of the License, or (at your option) any later version. | |
12 * | |
13 * This library is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 * Library General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU Library General Public License | |
19 * along with this library; see the file COPYING.LIB. If not, write to | |
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
21 * Boston, MA 02110-1301, USA. | |
22 */ | |
23 | |
24 #ifndef FirstLetterPseudoElement_h | |
25 #define FirstLetterPseudoElement_h | |
26 | |
27 #include "core/dom/Document.h" | |
28 #include "core/dom/PseudoElement.h" | |
29 #include "wtf/text/WTFString.h" | |
30 | |
31 namespace blink { | |
32 | |
33 class Element; | |
34 class RenderObject; | |
35 class RenderTextFragment; | |
36 | |
37 class FirstLetterPseudoElement final : public PseudoElement { | |
38 WTF_MAKE_NONCOPYABLE(FirstLetterPseudoElement); | |
39 public: | |
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; | |
47 | |
48 static RenderObject* firstLetterTextRenderer(const Element&); | |
49 static unsigned firstLetterLength(const String&); | |
50 | |
51 void setRemainingTextRenderer(RenderTextFragment* fragment) { m_remainingTex
tRenderer = fragment; } | |
52 RenderTextFragment* remainingTextRenderer() const { return m_remainingTextRe
nderer; } | |
53 | |
54 void setNeedsUpdate(); | |
55 bool needsUpdate() const { return m_needsUpdate; } | |
56 | |
57 virtual void attach(const AttachContext& = AttachContext()) override; | |
58 virtual void detach(const AttachContext& = AttachContext()) override; | |
59 | |
60 private: | |
61 explicit FirstLetterPseudoElement(Element*); | |
62 | |
63 virtual void didRecalcStyle(StyleRecalcChange) override; | |
64 | |
65 void attachFirstLetterTextRenderers(); | |
66 RenderStyle* styleForFirstLetter(RenderObject*); | |
67 | |
68 RawPtrWillBeMember<RenderTextFragment> m_remainingTextRenderer; | |
69 bool m_needsUpdate; | |
70 }; | |
71 | |
72 DEFINE_ELEMENT_TYPE_CASTS(FirstLetterPseudoElement, isFirstLetterPseudoElement()
); | |
73 | |
74 } // namespace blink | |
75 | |
76 #endif // FirstLetterPseudoElement_h | |
OLD | NEW |