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

Side by Side Diff: Source/core/dom/PseudoElement.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
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 14 matching lines...) Expand all
25 */ 25 */
26 26
27 #ifndef PseudoElement_h 27 #ifndef PseudoElement_h
28 #define PseudoElement_h 28 #define PseudoElement_h
29 29
30 #include "core/dom/Element.h" 30 #include "core/dom/Element.h"
31 #include "core/rendering/style/RenderStyle.h" 31 #include "core/rendering/style/RenderStyle.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 class PseudoElement final : public Element { 35 class RenderTextFragment;
36
37 class PseudoElement : public Element {
36 public: 38 public:
37 static PassRefPtrWillBeRawPtr<PseudoElement> create(Element* parent, PseudoI d pseudoId) 39 static PassRefPtrWillBeRawPtr<PseudoElement> create(Element* parent, PseudoI d);
38 {
39 return adoptRefWillBeNoop(new PseudoElement(parent, pseudoId));
40 }
41 40
42 virtual PassRefPtr<RenderStyle> customStyleForRenderer() override; 41 virtual PassRefPtr<RenderStyle> customStyleForRenderer() override;
43 virtual void attach(const AttachContext& = AttachContext()) override; 42 virtual void attach(const AttachContext& = AttachContext()) override;
44 virtual bool rendererIsNeeded(const RenderStyle&) override; 43 virtual bool rendererIsNeeded(const RenderStyle&) override;
45 44
46 virtual bool canStartSelection() const override { return false; } 45 virtual bool canStartSelection() const override { return false; }
47 virtual bool canContainRangeEndPoint() const override { return false; } 46 virtual bool canContainRangeEndPoint() const override { return false; }
48 virtual PseudoId pseudoId() const override { return m_pseudoId; } 47 virtual PseudoId pseudoId() const override { return m_pseudoId; }
49 48
50 static String pseudoElementNameForEvents(PseudoId); 49 static String pseudoElementNameForEvents(PseudoId);
51 50
52 void dispose(); 51 virtual void dispose();
52
53 protected:
54 PseudoElement(Element*, PseudoId);
53 55
54 private: 56 private:
55 PseudoElement(Element*, PseudoId);
56
57 virtual void didRecalcStyle(StyleRecalcChange) override; 57 virtual void didRecalcStyle(StyleRecalcChange) override;
58 58
59 PseudoId m_pseudoId; 59 PseudoId m_pseudoId;
60 }; 60 };
61 61
62 const QualifiedName& pseudoElementTagName(); 62 const QualifiedName& pseudoElementTagName();
63 63
64 inline bool pseudoElementRendererIsNeeded(const RenderStyle* style) 64 inline bool pseudoElementRendererIsNeeded(const RenderStyle* style)
65 { 65 {
66 return style && style->display() != NONE && (style->styleType() == BACKDROP || style->contentData()); 66 if (!style)
67 return false;
68 if (style->display() == NONE)
69 return false;
70
71 switch (style->styleType()) {
72 case FIRST_LETTER:
73 return true;
74 case BACKDROP:
75 return true;
76 default:
Julien - ping for review 2014/10/09 18:24:48 Let's avoid having a default case as it would allo
dsinclair 2014/10/09 21:14:22 There are a lot of these we don't actually care ab
Julien - ping for review 2014/10/10 14:47:07 We looked at this with Dan and having a default wi
dsinclair 2014/10/10 18:06:52 Done.
77 return style->contentData();
78 }
67 } 79 }
68 80
69 DEFINE_ELEMENT_TYPE_CASTS(PseudoElement, isPseudoElement()); 81 DEFINE_ELEMENT_TYPE_CASTS(PseudoElement, isPseudoElement());
70 82
71 } // namespace 83 } // namespace
72 84
73 #endif 85 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698