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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/PseudoElement.h
diff --git a/Source/core/dom/PseudoElement.h b/Source/core/dom/PseudoElement.h
index db6671fa6fd5cd9b3088f8f2cead7ebca09c9ec1..6bc5111ede93a3d575a4ecb5c0376c038c35896b 100644
--- a/Source/core/dom/PseudoElement.h
+++ b/Source/core/dom/PseudoElement.h
@@ -32,12 +32,11 @@
namespace blink {
-class PseudoElement final : public Element {
+class RenderTextFragment;
+
+class PseudoElement : public Element {
public:
- static PassRefPtrWillBeRawPtr<PseudoElement> create(Element* parent, PseudoId pseudoId)
- {
- return adoptRefWillBeNoop(new PseudoElement(parent, pseudoId));
- }
+ static PassRefPtrWillBeRawPtr<PseudoElement> create(Element* parent, PseudoId);
virtual PassRefPtr<RenderStyle> customStyleForRenderer() override;
virtual void attach(const AttachContext& = AttachContext()) override;
@@ -49,11 +48,12 @@ public:
static String pseudoElementNameForEvents(PseudoId);
- void dispose();
+ virtual void dispose();
-private:
+protected:
PseudoElement(Element*, PseudoId);
+private:
virtual void didRecalcStyle(StyleRecalcChange) override;
PseudoId m_pseudoId;
@@ -63,7 +63,19 @@ const QualifiedName& pseudoElementTagName();
inline bool pseudoElementRendererIsNeeded(const RenderStyle* style)
{
- return style && style->display() != NONE && (style->styleType() == BACKDROP || style->contentData());
+ if (!style)
+ return false;
+ if (style->display() == NONE)
+ return false;
+
+ switch (style->styleType()) {
+ case FIRST_LETTER:
+ return true;
+ case BACKDROP:
+ return true;
+ 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.
+ return style->contentData();
+ }
}
DEFINE_ELEMENT_TYPE_CASTS(PseudoElement, isPseudoElement());

Powered by Google App Engine
This is Rietveld 408576698