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

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: 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 25761531be3d1da66b308d000187aaa62bfb1690..a90344d51082305fd2ba27b51c6e9f9fcb3b1638 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,9 +48,11 @@ public:
static String pseudoElementNameForEvents(PseudoId);
- void dispose();
+ virtual void dispose();
private:
+ 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.
+
PseudoElement(Element*, PseudoId);
virtual void didRecalcStyle(StyleRecalcChange) OVERRIDE;
@@ -63,7 +64,17 @@ 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;
+ if (style->styleType() == FIRST_LETTER)
+ return true;
+ 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.
+ return true;
+ if (style->contentData())
+ return true;
+ 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.
}
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.
DEFINE_ELEMENT_TYPE_CASTS(PseudoElement, isPseudoElement());

Powered by Google App Engine
This is Rietveld 408576698