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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.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 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz>
3 * Copyright (C) 2006 Apple Computer Inc. 3 * Copyright (C) 2006 Apple Computer Inc.
4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
5 * Copyright (C) 2008 Rob Buis <buis@kde.org> 5 * Copyright (C) 2008 Rob Buis <buis@kde.org>
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // this. 45 // this.
46 static PassRefPtr<StringImpl> normalizeWhitespace(PassRefPtr<StringImpl> string) 46 static PassRefPtr<StringImpl> normalizeWhitespace(PassRefPtr<StringImpl> string)
47 { 47 {
48 RefPtr<StringImpl> newString = string->replace('\t', ' '); 48 RefPtr<StringImpl> newString = string->replace('\t', ' ');
49 newString = newString->replace('\n', ' '); 49 newString = newString->replace('\n', ' ');
50 newString = newString->replace('\r', ' '); 50 newString = newString->replace('\r', ' ');
51 return newString.release(); 51 return newString.release();
52 } 52 }
53 53
54 LayoutSVGInlineText::LayoutSVGInlineText(Node* n, PassRefPtr<StringImpl> string) 54 LayoutSVGInlineText::LayoutSVGInlineText(Node* n, PassRefPtr<StringImpl> string)
55 : LayoutText(n, normalizeWhitespace(string)) 55 : LayoutText(n, normalizeWhitespace(std::move(string)))
56 , m_scalingFactor(1) 56 , m_scalingFactor(1)
57 { 57 {
58 } 58 }
59 59
60 void LayoutSVGInlineText::setTextInternal(PassRefPtr<StringImpl> text) 60 void LayoutSVGInlineText::setTextInternal(PassRefPtr<StringImpl> text)
61 { 61 {
62 LayoutText::setTextInternal(text); 62 LayoutText::setTextInternal(std::move(text));
63 if (LayoutSVGText* textLayoutObject = LayoutSVGText::locateLayoutSVGTextAnce stor(this)) 63 if (LayoutSVGText* textLayoutObject = LayoutSVGText::locateLayoutSVGTextAnce stor(this))
64 textLayoutObject->subtreeTextDidChange(); 64 textLayoutObject->subtreeTextDidChange();
65 } 65 }
66 66
67 void LayoutSVGInlineText::styleDidChange(StyleDifference diff, const ComputedSty le* oldStyle) 67 void LayoutSVGInlineText::styleDidChange(StyleDifference diff, const ComputedSty le* oldStyle)
68 { 68 {
69 LayoutText::styleDidChange(diff, oldStyle); 69 LayoutText::styleDidChange(diff, oldStyle);
70 updateScaledFont(); 70 updateScaledFont();
71 71
72 bool newPreserves = style() ? style()->whiteSpace() == PRE : false; 72 bool newPreserves = style() ? style()->whiteSpace() == PRE : false;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 378
379 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const 379 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const
380 { 380 {
381 RefPtr<StringImpl> result = LayoutText::originalText(); 381 RefPtr<StringImpl> result = LayoutText::originalText();
382 if (!result) 382 if (!result)
383 return nullptr; 383 return nullptr;
384 return normalizeWhitespace(result); 384 return normalizeWhitespace(result);
385 } 385 }
386 386
387 } // namespace blink 387 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/api/LayoutTextItem.h ('k') | third_party/WebKit/Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698