Chromium Code Reviews| 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 RenderTextFragment; | |
| 36 | |
| 35 class PseudoElement FINAL : public Element { | 37 class PseudoElement FINAL : 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 pseudoId) |
| 38 { | 40 { |
| 39 return adoptRefWillBeNoop(new PseudoElement(parent, pseudoId)); | 41 return adoptRefWillBeNoop(new PseudoElement(parent, pseudoId)); |
| 40 } | 42 } |
| 41 | 43 |
| 42 virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE; | 44 virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE; |
| 43 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; | 45 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; |
| 44 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE; | 46 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE; |
| 45 | 47 |
| 46 virtual bool canStartSelection() const OVERRIDE { return false; } | 48 virtual bool canStartSelection() const OVERRIDE { return false; } |
| 47 virtual bool canContainRangeEndPoint() const OVERRIDE { return false; } | 49 virtual bool canContainRangeEndPoint() const OVERRIDE { return false; } |
| 48 virtual PseudoId pseudoId() const OVERRIDE { return m_pseudoId; } | 50 virtual PseudoId pseudoId() const OVERRIDE { return m_pseudoId; } |
| 49 | 51 |
| 50 static String pseudoElementNameForEvents(PseudoId); | 52 static String pseudoElementNameForEvents(PseudoId); |
| 51 | 53 |
| 52 void dispose(); | 54 void dispose(); |
| 53 | 55 |
| 56 void setRemainingTextRenderer(RenderTextFragment* fragment) { m_remainingTex tRenderer = fragment; } | |
| 57 RenderTextFragment* remainingTextRenderer() const { return m_remainingTextRe nderer; } | |
| 58 | |
| 54 private: | 59 private: |
| 55 PseudoElement(Element*, PseudoId); | 60 PseudoElement(Element*, PseudoId); |
| 61 void attachFirstLetterTextRenderers(); | |
| 62 RenderStyle* styleForFirstLetter(RenderObject*); | |
| 56 | 63 |
| 57 virtual void didRecalcStyle(StyleRecalcChange) OVERRIDE; | 64 virtual void didRecalcStyle(StyleRecalcChange) OVERRIDE; |
| 58 | 65 |
| 59 PseudoId m_pseudoId; | 66 PseudoId m_pseudoId; |
| 67 RenderTextFragment* m_remainingTextRenderer; | |
|
Julien - ping for review
2014/10/01 21:14:47
This screams adding a specialized class and so is
dsinclair
2014/10/04 02:01:34
Done.
| |
| 60 }; | 68 }; |
| 61 | 69 |
| 62 const QualifiedName& pseudoElementTagName(); | 70 const QualifiedName& pseudoElementTagName(); |
| 63 | 71 |
| 64 inline bool pseudoElementRendererIsNeeded(const RenderStyle* style) | 72 inline bool pseudoElementRendererIsNeeded(const RenderStyle* style) |
| 65 { | 73 { |
| 66 return style && style->display() != NONE && (style->styleType() == BACKDROP || style->contentData()); | 74 if (!style) |
| 75 return false; | |
| 76 if (style->display() == NONE) | |
| 77 return false; | |
| 78 if (style->styleType() == FIRST_LETTER) | |
| 79 return true; | |
| 80 if (style->styleType() == BACKDROP) | |
| 81 return true; | |
| 82 if (style->contentData()) | |
| 83 return true; | |
| 84 return false; | |
| 67 } | 85 } |
| 68 | 86 |
| 69 DEFINE_ELEMENT_TYPE_CASTS(PseudoElement, isPseudoElement()); | 87 DEFINE_ELEMENT_TYPE_CASTS(PseudoElement, isPseudoElement()); |
| 70 | 88 |
| 71 } // namespace | 89 } // namespace |
| 72 | 90 |
| 73 #endif | 91 #endif |
| OLD | NEW |