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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutText.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 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 LayoutText::LayoutText(Node* node, PassRefPtr<StringImpl> str) 141 LayoutText::LayoutText(Node* node, PassRefPtr<StringImpl> str)
142 : LayoutObject(!node || node->isDocumentNode() ? 0 : node) 142 : LayoutObject(!node || node->isDocumentNode() ? 0 : node)
143 , m_hasTab(false) 143 , m_hasTab(false)
144 , m_linesDirty(false) 144 , m_linesDirty(false)
145 , m_containsReversedText(false) 145 , m_containsReversedText(false)
146 , m_knownToHaveNoOverflowAndNoFallbackFonts(false) 146 , m_knownToHaveNoOverflowAndNoFallbackFonts(false)
147 , m_minWidth(-1) 147 , m_minWidth(-1)
148 , m_maxWidth(-1) 148 , m_maxWidth(-1)
149 , m_firstLineMinWidth(0) 149 , m_firstLineMinWidth(0)
150 , m_lastLineLineMinWidth(0) 150 , m_lastLineLineMinWidth(0)
151 , m_text(str) 151 , m_text(std::move(str))
152 , m_firstTextBox(nullptr) 152 , m_firstTextBox(nullptr)
153 , m_lastTextBox(nullptr) 153 , m_lastTextBox(nullptr)
154 { 154 {
155 ASSERT(m_text); 155 ASSERT(m_text);
156 // FIXME: Some clients of LayoutText (and subclasses) pass Document as node to create anonymous layoutObject. 156 // FIXME: Some clients of LayoutText (and subclasses) pass Document as node to create anonymous layoutObject.
157 // They should be switched to passing null and using setDocumentForAnonymous . 157 // They should be switched to passing null and using setDocumentForAnonymous .
158 if (node && node->isDocumentNode()) 158 if (node && node->isDocumentNode())
159 setDocumentForAnonymous(toDocument(node)); 159 setDocumentForAnonymous(toDocument(node));
160 160
161 m_canUseSimpleFontCodePath = computeCanUseSimpleFontCodePath(); 161 m_canUseSimpleFontCodePath = computeCanUseSimpleFontCodePath();
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 curr->setLineBreakPos(clampTo<int>(curr->lineBreakPos() + delta)); 1338 curr->setLineBreakPos(clampTo<int>(curr->lineBreakPos() + delta));
1339 } 1339 }
1340 1340
1341 // If the text node is empty, dirty the line where new text will be inserted . 1341 // If the text node is empty, dirty the line where new text will be inserted .
1342 if (!firstTextBox() && parent()) { 1342 if (!firstTextBox() && parent()) {
1343 parent()->dirtyLinesFromChangedChild(this); 1343 parent()->dirtyLinesFromChangedChild(this);
1344 dirtiedLines = true; 1344 dirtiedLines = true;
1345 } 1345 }
1346 1346
1347 m_linesDirty = dirtiedLines; 1347 m_linesDirty = dirtiedLines;
1348 setText(text, force || dirtiedLines); 1348 setText(std::move(text), force || dirtiedLines);
1349 } 1349 }
1350 1350
1351 void LayoutText::transformText() 1351 void LayoutText::transformText()
1352 { 1352 {
1353 if (RefPtr<StringImpl> textToTransform = originalText()) 1353 if (RefPtr<StringImpl> textToTransform = originalText())
1354 setText(textToTransform.release(), true); 1354 setText(textToTransform.release(), true);
1355 } 1355 }
1356 1356
1357 static inline bool isInlineFlowOrEmptyText(const LayoutObject* o) 1357 static inline bool isInlineFlowOrEmptyText(const LayoutObject* o)
1358 { 1358 {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1400 break; 1400 break;
1401 case LOWERCASE: 1401 case LOWERCASE:
1402 text = text.lower(style->locale()); 1402 text = text.lower(style->locale());
1403 break; 1403 break;
1404 } 1404 }
1405 } 1405 }
1406 1406
1407 void LayoutText::setTextInternal(PassRefPtr<StringImpl> text) 1407 void LayoutText::setTextInternal(PassRefPtr<StringImpl> text)
1408 { 1408 {
1409 ASSERT(text); 1409 ASSERT(text);
1410 m_text = text; 1410 m_text = std::move(text);
1411 1411
1412 if (style()) { 1412 if (style()) {
1413 applyTextTransform(style(), m_text, previousCharacter()); 1413 applyTextTransform(style(), m_text, previousCharacter());
1414 1414
1415 // We use the same characters here as for list markers. 1415 // We use the same characters here as for list markers.
1416 // See the listMarkerText function in LayoutListMarker.cpp. 1416 // See the listMarkerText function in LayoutListMarker.cpp.
1417 switch (style()->textSecurity()) { 1417 switch (style()->textSecurity()) {
1418 case TSNONE: 1418 case TSNONE:
1419 break; 1419 break;
1420 case TSCIRCLE: 1420 case TSCIRCLE:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 } 1456 }
1457 } 1457 }
1458 1458
1459 void LayoutText::setText(PassRefPtr<StringImpl> text, bool force) 1459 void LayoutText::setText(PassRefPtr<StringImpl> text, bool force)
1460 { 1460 {
1461 ASSERT(text); 1461 ASSERT(text);
1462 1462
1463 if (!force && equal(m_text.impl(), text.get())) 1463 if (!force && equal(m_text.impl(), text.get()))
1464 return; 1464 return;
1465 1465
1466 setTextInternal(text); 1466 setTextInternal(std::move(text));
1467 // If preferredLogicalWidthsDirty() of an orphan child is true, LayoutObject ChildList:: 1467 // If preferredLogicalWidthsDirty() of an orphan child is true, LayoutObject ChildList::
1468 // insertChildNode() fails to set true to owner. To avoid that, we call 1468 // insertChildNode() fails to set true to owner. To avoid that, we call
1469 // setNeedsLayoutAndPrefWidthsRecalc() only if this LayoutText has parent. 1469 // setNeedsLayoutAndPrefWidthsRecalc() only if this LayoutText has parent.
1470 if (parent()) 1470 if (parent())
1471 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalida tionReason::TextChanged); 1471 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalida tionReason::TextChanged);
1472 m_knownToHaveNoOverflowAndNoFallbackFonts = false; 1472 m_knownToHaveNoOverflowAndNoFallbackFonts = false;
1473 1473
1474 if (AXObjectCache* cache = document().existingAXObjectCache()) 1474 if (AXObjectCache* cache = document().existingAXObjectCache())
1475 cache->textChanged(this); 1475 cache->textChanged(this);
1476 } 1476 }
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { 1757 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
1758 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason); 1758 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason);
1759 if (box->truncation() != cNoTruncation) { 1759 if (box->truncation() != cNoTruncation) {
1760 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox()) 1760 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox())
1761 paintInvalidator.invalidateDisplayItemClient(*ellipsisBox, inval idationReason); 1761 paintInvalidator.invalidateDisplayItemClient(*ellipsisBox, inval idationReason);
1762 } 1762 }
1763 } 1763 }
1764 } 1764 }
1765 1765
1766 } // namespace blink 1766 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutTextCombine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698