OLD | NEW |
---|---|
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 Loading... | |
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(); |
53 | 52 |
54 private: | 53 private: |
54 friend class FirstLetterPseudoElement; // For constructor. | |
Julien - ping for review
2014/10/06 17:47:33
Let's make the constructor protected instead of a
dsinclair
2014/10/07 19:36:21
Done.
| |
55 | |
55 PseudoElement(Element*, PseudoId); | 56 PseudoElement(Element*, PseudoId); |
56 | 57 |
57 virtual void didRecalcStyle(StyleRecalcChange) OVERRIDE; | 58 virtual void didRecalcStyle(StyleRecalcChange) OVERRIDE; |
58 | 59 |
59 PseudoId m_pseudoId; | 60 PseudoId m_pseudoId; |
60 }; | 61 }; |
61 | 62 |
62 const QualifiedName& pseudoElementTagName(); | 63 const QualifiedName& pseudoElementTagName(); |
63 | 64 |
64 inline bool pseudoElementRendererIsNeeded(const RenderStyle* style) | 65 inline bool pseudoElementRendererIsNeeded(const RenderStyle* style) |
65 { | 66 { |
66 return style && style->display() != NONE && (style->styleType() == BACKDROP || style->contentData()); | 67 if (!style) |
68 return false; | |
69 if (style->display() == NONE) | |
70 return false; | |
71 if (style->styleType() == FIRST_LETTER) | |
72 return true; | |
73 if (style->styleType() == BACKDROP) | |
esprehn
2014/10/07 00:17:40
I would just || the two style types together.
dsinclair
2014/10/07 19:36:21
Went with the switch route.
| |
74 return true; | |
75 if (style->contentData()) | |
76 return true; | |
77 return false; | |
Julien - ping for review
2014/10/06 17:47:33
This past 3 lines can be simplified to:
return st
dsinclair
2014/10/07 19:36:21
Done.
| |
67 } | 78 } |
Julien - ping for review
2014/10/06 17:47:33
It seems like a switch on styleType() would make t
dsinclair
2014/10/07 19:36:21
Done.
| |
68 | 79 |
69 DEFINE_ELEMENT_TYPE_CASTS(PseudoElement, isPseudoElement()); | 80 DEFINE_ELEMENT_TYPE_CASTS(PseudoElement, isPseudoElement()); |
70 | 81 |
71 } // namespace | 82 } // namespace |
72 | 83 |
73 #endif | 84 #endif |
OLD | NEW |