Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: Source/core/dom/FirstLetterPseudoElement.h

Issue 571603003: Convert first letter into a pseudo element. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase to master Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef FirstLetterPseudoElement_h
6 #define FirstLetterPseudoElement_h
7
8 #include "core/dom/Document.h"
9 #include "core/dom/PseudoElement.h"
10 #include "wtf/text/WTFString.h"
11
12 namespace blink {
13
14 class Element;
15 class RenderObject;
16
17 class FirstLetterPseudoElement FINAL : public PseudoElement {
18 WTF_MAKE_NONCOPYABLE(FirstLetterPseudoElement);
19 public:
20 static RenderObject* firstLetterTextRenderer(const Element&);
21 static unsigned firstLetterLength(const String&);
22
23 void setRemainingTextRenderer(RenderTextFragment* fragment) { m_remainingTex tRenderer = fragment; }
24 RenderTextFragment* remainingTextRenderer() const { return m_remainingTextRe nderer; }
25
26 void setNeedsUpdate()
27 {
28 m_needsUpdate = true;
29 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::creat e(StyleChangeReason::PseudoClass));
30 }
31
32 bool needsUpdate() const {return m_needsUpdate; }
33
34 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
35 virtual void detach(const AttachContext& = AttachContext()) OVERRIDE;
36
37 private:
38 friend class PseudoElement; // For constructor.
39
40 FirstLetterPseudoElement(Element*);
41
42 virtual void didRecalcStyle(StyleRecalcChange) OVERRIDE;
43
44 void attachFirstLetterTextRenderers();
45 RenderStyle* styleForFirstLetter(RenderObject*);
46
47 RenderTextFragment* m_remainingTextRenderer;
48 bool m_needsUpdate;
49 };
50
51 DEFINE_ELEMENT_TYPE_CASTS(FirstLetterPseudoElement, isFirstLetterPseudoElement() );
52
53 } // namespace blink
54
55 #endif // FirstLetterPseudoElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698