Chromium Code Reviews| 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..ed997515bbbf1a1f27532ac0c3fd1dc8fb1a246e 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* str, |
|
rune
2017/03/15 14:58:37
I think "text" is a better name than "str" here.
emilio
2017/03/15 15:36:15
Agreed, done.
|
| + unsigned start, |
| + unsigned length) { |
| + LayoutTextFragment* fragment = |
| + new LayoutTextFragment(nullptr, str, start, length); |
| + fragment->setDocumentForAnonymous(&pseudo.document()); |
| + if (length) |
| + pseudo.document().view()->incrementVisuallyNonEmptyCharacterCount(length); |
| + return fragment; |
| +} |
| + |
| +LayoutTextFragment* LayoutTextFragment::createAnonymous(PseudoElement& pseudo, |
| + StringImpl* str) { |
| + return createAnonymous(pseudo, str, 0, str ? str->length() : 0); |
| +} |
| + |
| void LayoutTextFragment::willBeDestroyed() { |
| if (m_isRemainingTextLayoutObject && m_firstLetterPseudoElement) |
| m_firstLetterPseudoElement->setRemainingTextLayoutObject(nullptr); |