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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutText.cpp

Issue 2727853002: [css-display] Support display: contents pseudo-elements.
Patch Set: Add missing nullcheck (whoops). Created 3 years, 9 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: third_party/WebKit/Source/core/layout/LayoutText.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.cpp b/third_party/WebKit/Source/core/layout/LayoutText.cpp
index 14174575961fc7206f750c4432cc5ba811aef590..f006b3599c546c7bbaed5fb9e3eb3af2c2365211 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp
@@ -150,7 +150,7 @@ static void makeCapitalized(String* string, UChar previous) {
}
LayoutText::LayoutText(Node* node, PassRefPtr<StringImpl> str)
- : LayoutObject(!node || node->isDocumentNode() ? 0 : node),
+ : LayoutObject(node),
m_hasTab(false),
m_linesDirty(false),
m_containsReversedText(false),
@@ -163,15 +163,11 @@ LayoutText::LayoutText(Node* node, PassRefPtr<StringImpl> str)
m_firstTextBox(nullptr),
m_lastTextBox(nullptr) {
ASSERT(m_text);
- // FIXME: Some clients of LayoutText (and subclasses) pass Document as node to
- // create anonymous layoutObject.
- // They should be switched to passing null and using setDocumentForAnonymous.
- if (node && node->isDocumentNode())
- setDocumentForAnonymous(toDocument(node));
-
setIsText();
- view()->frameView()->incrementVisuallyNonEmptyCharacterCount(m_text.length());
+ DCHECK(!node || !node->isDocumentNode());
+ if (node)
+ frameView()->incrementVisuallyNonEmptyCharacterCount(m_text.length());
}
#if DCHECK_IS_ON()
@@ -2031,6 +2027,12 @@ PassRefPtr<AbstractInlineTextBox> LayoutText::firstAbstractInlineTextBox() {
m_firstTextBox);
}
+LayoutText* LayoutText::createEmptyAnonymous(Document& doc) {
+ LayoutText* text = new LayoutText(nullptr, StringImpl::empty);
+ text->setDocumentForAnonymous(&doc);
+ return text;
+}
+
void LayoutText::invalidateDisplayItemClients(
PaintInvalidationReason invalidationReason) const {
ObjectPaintInvalidator paintInvalidator(*this);

Powered by Google App Engine
This is Rietveld 408576698