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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/ScriptRunIterator.cpp

Issue 2766723002: Migrate WTF::Vector::prepend() to ::push_front() (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ScriptRunIterator.h" 5 #include "ScriptRunIterator.h"
6 6
7 #include "platform/text/ICUError.h" 7 #include "platform/text/ICUError.h"
8 #include "wtf/Threading.h" 8 #include "wtf/Threading.h"
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 if (it == dst.end()) { 61 if (it == dst.end()) {
62 dst.push_back(primaryScript); 62 dst.push_back(primaryScript);
63 } 63 }
64 std::swap(*dst.begin(), *it); 64 std::swap(*dst.begin(), *it);
65 return; 65 return;
66 } 66 }
67 67
68 if (primaryScript == USCRIPT_COMMON) { 68 if (primaryScript == USCRIPT_COMMON) {
69 if (count == 1) { 69 if (count == 1) {
70 // Common with a preferred script. Keep common at head. 70 // Common with a preferred script. Keep common at head.
71 dst.prepend(primaryScript); 71 dst.push_front(primaryScript);
72 return; 72 return;
73 } 73 }
74 74
75 // Ignore common. Find the preferred script of the multiple scripts that 75 // Ignore common. Find the preferred script of the multiple scripts that
76 // remain, and ensure it is at the head. Just keep swapping them in, 76 // remain, and ensure it is at the head. Just keep swapping them in,
77 // there aren't likely to be many. 77 // there aren't likely to be many.
78 for (size_t i = 1; i < dst.size(); ++i) { 78 for (size_t i = 1; i < dst.size(); ++i) {
79 if (dst.at(0) == USCRIPT_LATIN || dst.at(i) < dst.at(0)) { 79 if (dst.at(0) == USCRIPT_LATIN || dst.at(i) < dst.at(0)) {
80 std::swap(dst.at(0), dst.at(i)); 80 std::swap(dst.at(0), dst.at(i));
81 } 81 }
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 } 355 }
356 return true; 356 return true;
357 } 357 }
358 358
359 UScriptCode ScriptRunIterator::resolveCurrentScript() const { 359 UScriptCode ScriptRunIterator::resolveCurrentScript() const {
360 UScriptCode result = m_currentSet.at(0); 360 UScriptCode result = m_currentSet.at(0);
361 return result == USCRIPT_COMMON ? m_commonPreferred : result; 361 return result == USCRIPT_COMMON ? m_commonPreferred : result;
362 } 362 }
363 363
364 } // namespace blink 364 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698