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

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

Issue 2754653002: Cleanup anonymous text objects that pass the document as a node. (Closed)
Patch Set: Cleanup anonymous text objects that pass the document as a node. 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/LayoutTextFragment.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTextFragment.cpp b/third_party/WebKit/Source/core/layout/LayoutTextFragment.cpp
index 09e5c925aed0016f4c4768a643f18b8e1f658602..3f11242b54cd0d467d3c2a522b0994f63b62be22 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTextFragment.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTextFragment.cpp
@@ -26,6 +26,7 @@
#include "core/dom/PseudoElement.h"
#include "core/dom/StyleChangeReason.h"
#include "core/dom/Text.h"
+#include "core/frame/FrameView.h"
#include "core/layout/HitTestResult.h"
namespace blink {
@@ -50,6 +51,23 @@ LayoutTextFragment::~LayoutTextFragment() {
ASSERT(!m_firstLetterPseudoElement);
}
+LayoutTextFragment* LayoutTextFragment::createAnonymous(PseudoElement& pseudo,
+ StringImpl* text,
+ unsigned start,
+ unsigned length) {
+ LayoutTextFragment* fragment =
+ new LayoutTextFragment(nullptr, text, start, length);
+ fragment->setDocumentForAnonymous(&pseudo.document());
+ if (length)
+ pseudo.document().view()->incrementVisuallyNonEmptyCharacterCount(length);
+ return fragment;
+}
+
+LayoutTextFragment* LayoutTextFragment::createAnonymous(PseudoElement& pseudo,
+ StringImpl* text) {
+ return createAnonymous(pseudo, text, 0, text ? text->length() : 0);
+}
+
void LayoutTextFragment::willBeDestroyed() {
if (m_isRemainingTextLayoutObject && m_firstLetterPseudoElement)
m_firstLetterPseudoElement->setRemainingTextLayoutObject(nullptr);
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTextFragment.h ('k') | third_party/WebKit/Source/core/style/ContentData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698