| 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 PseudoElement : public Element { |
| 36 public: | 36 public: |
| 37 static PassRefPtrWillBeRawPtr<PseudoElement> create(Element* parent, PseudoI
d pseudoId) | 37 static PassRefPtrWillBeRawPtr<PseudoElement> create(Element* parent, PseudoI
d); |
| 38 { | |
| 39 return adoptRefWillBeNoop(new PseudoElement(parent, pseudoId)); | |
| 40 } | |
| 41 | 38 |
| 42 virtual PassRefPtr<RenderStyle> customStyleForRenderer() override; | 39 virtual PassRefPtr<RenderStyle> customStyleForRenderer() override; |
| 43 virtual void attach(const AttachContext& = AttachContext()) override; | 40 virtual void attach(const AttachContext& = AttachContext()) override; |
| 44 virtual bool rendererIsNeeded(const RenderStyle&) override; | 41 virtual bool rendererIsNeeded(const RenderStyle&) override; |
| 45 | 42 |
| 46 virtual bool canStartSelection() const override { return false; } | 43 virtual bool canStartSelection() const override { return false; } |
| 47 virtual bool canContainRangeEndPoint() const override { return false; } | 44 virtual bool canContainRangeEndPoint() const override { return false; } |
| 48 virtual PseudoId pseudoId() const override { return m_pseudoId; } | 45 virtual PseudoId pseudoId() const override { return m_pseudoId; } |
| 49 | 46 |
| 50 static String pseudoElementNameForEvents(PseudoId); | 47 static String pseudoElementNameForEvents(PseudoId); |
| 51 | 48 |
| 52 void dispose(); | 49 virtual void dispose(); |
| 50 |
| 51 protected: |
| 52 PseudoElement(Element*, PseudoId); |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 PseudoElement(Element*, PseudoId); | |
| 56 | |
| 57 virtual void didRecalcStyle(StyleRecalcChange) override; | 55 virtual void didRecalcStyle(StyleRecalcChange) override; |
| 58 | 56 |
| 59 PseudoId m_pseudoId; | 57 PseudoId m_pseudoId; |
| 60 }; | 58 }; |
| 61 | 59 |
| 62 const QualifiedName& pseudoElementTagName(); | 60 const QualifiedName& pseudoElementTagName(); |
| 63 | 61 |
| 64 inline bool pseudoElementRendererIsNeeded(const RenderStyle* style) | 62 inline bool pseudoElementRendererIsNeeded(const RenderStyle* style) |
| 65 { | 63 { |
| 66 return style && style->display() != NONE && (style->styleType() == BACKDROP
|| style->contentData()); | 64 if (!style) |
| 65 return false; |
| 66 if (style->display() == NONE) |
| 67 return false; |
| 68 if (style->styleType() == FIRST_LETTER || style->styleType() == BACKDROP) |
| 69 return true; |
| 70 return style->contentData(); |
| 67 } | 71 } |
| 68 | 72 |
| 69 DEFINE_ELEMENT_TYPE_CASTS(PseudoElement, isPseudoElement()); | 73 DEFINE_ELEMENT_TYPE_CASTS(PseudoElement, isPseudoElement()); |
| 70 | 74 |
| 71 } // namespace | 75 } // namespace |
| 72 | 76 |
| 73 #endif | 77 #endif |
| OLD | NEW |