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

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

Issue 2657443005: Migrate WTF::HashSet::add() to ::insert() [part 1 of N] (Closed)
Patch Set: Created 3 years, 10 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, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * (C) 2008 Torch Mobile Inc. All rights reserved. 3 * (C) 2008 Torch Mobile Inc. All rights reserved.
4 * (http://www.torchmobile.com/) 4 * (http://www.torchmobile.com/)
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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 static HashSet<AtomicString>* fontFamiliesWithInvalidCharWidthMap = nullptr; 217 static HashSet<AtomicString>* fontFamiliesWithInvalidCharWidthMap = nullptr;
218 218
219 if (family.isEmpty()) 219 if (family.isEmpty())
220 return false; 220 return false;
221 221
222 if (!fontFamiliesWithInvalidCharWidthMap) { 222 if (!fontFamiliesWithInvalidCharWidthMap) {
223 fontFamiliesWithInvalidCharWidthMap = new HashSet<AtomicString>; 223 fontFamiliesWithInvalidCharWidthMap = new HashSet<AtomicString>;
224 224
225 for (size_t i = 0; i < WTF_ARRAY_LENGTH(fontFamiliesWithInvalidCharWidth); 225 for (size_t i = 0; i < WTF_ARRAY_LENGTH(fontFamiliesWithInvalidCharWidth);
226 ++i) 226 ++i)
227 fontFamiliesWithInvalidCharWidthMap->add( 227 fontFamiliesWithInvalidCharWidthMap->insert(
228 AtomicString(fontFamiliesWithInvalidCharWidth[i])); 228 AtomicString(fontFamiliesWithInvalidCharWidth[i]));
229 } 229 }
230 230
231 return !fontFamiliesWithInvalidCharWidthMap->contains(family); 231 return !fontFamiliesWithInvalidCharWidthMap->contains(family);
232 } 232 }
233 233
234 float LayoutTextControl::getAvgCharWidth(const AtomicString& family) const { 234 float LayoutTextControl::getAvgCharWidth(const AtomicString& family) const {
235 const Font& font = style()->font(); 235 const Font& font = style()->font();
236 236
237 const SimpleFontData* primaryFont = font.primaryFont(); 237 const SimpleFontData* primaryFont = font.primaryFont();
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 LayoutUnit baseline(fontData->getFontMetrics().ascent(AlphabeticBaseline)); 353 LayoutUnit baseline(fontData->getFontMetrics().ascent(AlphabeticBaseline));
354 for (LayoutObject* box = innerEditorLayoutObject; box && box != this; 354 for (LayoutObject* box = innerEditorLayoutObject; box && box != this;
355 box = box->parent()) { 355 box = box->parent()) {
356 if (box->isBox()) 356 if (box->isBox())
357 baseline += toLayoutBox(box)->logicalTop(); 357 baseline += toLayoutBox(box)->logicalTop();
358 } 358 }
359 return baseline.toInt(); 359 return baseline.toInt();
360 } 360 }
361 361
362 } // namespace blink 362 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTableSection.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698