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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTextFragment.cpp

Issue 2282413002: Replaced PassRefPtr copies with moves in Source/core. (Closed)
Patch Set: rebased Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Dirk Mueller (mueller@kde.org) 3 * (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 PassRefPtr<StringImpl> LayoutTextFragment::originalText() const 78 PassRefPtr<StringImpl> LayoutTextFragment::originalText() const
79 { 79 {
80 RefPtr<StringImpl> result = completeText(); 80 RefPtr<StringImpl> result = completeText();
81 if (!result) 81 if (!result)
82 return nullptr; 82 return nullptr;
83 return result->substring(start(), fragmentLength()); 83 return result->substring(start(), fragmentLength());
84 } 84 }
85 85
86 void LayoutTextFragment::setText(PassRefPtr<StringImpl> text, bool force) 86 void LayoutTextFragment::setText(PassRefPtr<StringImpl> text, bool force)
87 { 87 {
88 LayoutText::setText(text, force); 88 LayoutText::setText(std::move(text), force);
89 89
90 m_start = 0; 90 m_start = 0;
91 m_fragmentLength = textLength(); 91 m_fragmentLength = textLength();
92 92
93 // If we're the remaining text from a first letter then we have to tell the 93 // If we're the remaining text from a first letter then we have to tell the
94 // first letter pseudo element to reattach itself so it can re-calculate the 94 // first letter pseudo element to reattach itself so it can re-calculate the
95 // correct first-letter settings. 95 // correct first-letter settings.
96 if (isRemainingTextLayoutObject()) { 96 if (isRemainingTextLayoutObject()) {
97 ASSERT(firstLetterPseudoElement()); 97 ASSERT(firstLetterPseudoElement());
98 firstLetterPseudoElement()->updateTextFragments(); 98 firstLetterPseudoElement()->updateTextFragments();
99 } 99 }
100 } 100 }
101 101
102 void LayoutTextFragment::setTextFragment(PassRefPtr<StringImpl> text, unsigned s tart, unsigned length) 102 void LayoutTextFragment::setTextFragment(PassRefPtr<StringImpl> text, unsigned s tart, unsigned length)
103 { 103 {
104 LayoutText::setText(text, false); 104 LayoutText::setText(std::move(text), false);
105 105
106 m_start = start; 106 m_start = start;
107 m_fragmentLength = length; 107 m_fragmentLength = length;
108 } 108 }
109 109
110 void LayoutTextFragment::transformText() 110 void LayoutTextFragment::transformText()
111 { 111 {
112 // Note, we have to call LayoutText::setText here because, if we use our 112 // Note, we have to call LayoutText::setText here because, if we use our
113 // version we will, potentially, screw up the first-letter settings where 113 // version we will, potentially, screw up the first-letter settings where
114 // we only use portions of the string. 114 // we only use portions of the string.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 LayoutObject::updateHitTestResult(result, point); 161 LayoutObject::updateHitTestResult(result, point);
162 162
163 // If we aren't part of a first-letter element, or if we 163 // If we aren't part of a first-letter element, or if we
164 // are part of first-letter but we're the remaining text then return. 164 // are part of first-letter but we're the remaining text then return.
165 if (m_isRemainingTextLayoutObject || !firstLetterPseudoElement()) 165 if (m_isRemainingTextLayoutObject || !firstLetterPseudoElement())
166 return; 166 return;
167 result.setInnerNode(firstLetterPseudoElement()); 167 result.setInnerNode(firstLetterPseudoElement());
168 } 168 }
169 169
170 } // namespace blink 170 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTextCombine.cpp ('k') | third_party/WebKit/Source/core/layout/api/LayoutItem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698