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

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

Issue 1162383003: C++11: Replace 0 with nullptr where applicable in layout code. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add one more file. Created 5 years, 6 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. (http://www.torchmo bile.com/) 3 * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 "#PilGi", 198 "#PilGi",
199 }; 199 };
200 200
201 // For font families where any of the fonts don't have a valid entry in the OS/2 table 201 // For font families where any of the fonts don't have a valid entry in the OS/2 table
202 // for avgCharWidth, fallback to the legacy webkit behavior of getting the avgCh arWidth 202 // for avgCharWidth, fallback to the legacy webkit behavior of getting the avgCh arWidth
203 // from the width of a '0'. This only seems to apply to a fixed number of Mac fo nts, 203 // from the width of a '0'. This only seems to apply to a fixed number of Mac fo nts,
204 // but, in order to get similar rendering across platforms, we do this check for 204 // but, in order to get similar rendering across platforms, we do this check for
205 // all platforms. 205 // all platforms.
206 bool LayoutTextControl::hasValidAvgCharWidth(AtomicString family) 206 bool LayoutTextControl::hasValidAvgCharWidth(AtomicString family)
207 { 207 {
208 static HashSet<AtomicString>* fontFamiliesWithInvalidCharWidthMap = 0; 208 static HashSet<AtomicString>* fontFamiliesWithInvalidCharWidthMap = nullptr;
209 209
210 if (family.isEmpty()) 210 if (family.isEmpty())
211 return false; 211 return false;
212 212
213 if (!fontFamiliesWithInvalidCharWidthMap) { 213 if (!fontFamiliesWithInvalidCharWidthMap) {
214 fontFamiliesWithInvalidCharWidthMap = new HashSet<AtomicString>; 214 fontFamiliesWithInvalidCharWidthMap = new HashSet<AtomicString>;
215 215
216 for (size_t i = 0; i < WTF_ARRAY_LENGTH(fontFamiliesWithInvalidCharWidth ); ++i) 216 for (size_t i = 0; i < WTF_ARRAY_LENGTH(fontFamiliesWithInvalidCharWidth ); ++i)
217 fontFamiliesWithInvalidCharWidthMap->add(AtomicString(fontFamiliesWi thInvalidCharWidth[i])); 217 fontFamiliesWithInvalidCharWidthMap->add(AtomicString(fontFamiliesWi thInvalidCharWidth[i]));
218 } 218 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 283
284 void LayoutTextControl::addFocusRingRects(Vector<LayoutRect>& rects, const Layou tPoint& additionalOffset) const 284 void LayoutTextControl::addFocusRingRects(Vector<LayoutRect>& rects, const Layou tPoint& additionalOffset) const
285 { 285 {
286 if (!size().isEmpty()) 286 if (!size().isEmpty())
287 rects.append(LayoutRect(additionalOffset, size())); 287 rects.append(LayoutRect(additionalOffset, size()));
288 } 288 }
289 289
290 LayoutObject* LayoutTextControl::layoutSpecialExcludedChild(bool relayoutChildre n, SubtreeLayoutScope& layoutScope) 290 LayoutObject* LayoutTextControl::layoutSpecialExcludedChild(bool relayoutChildre n, SubtreeLayoutScope& layoutScope)
291 { 291 {
292 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder Element(); 292 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder Element();
293 LayoutObject* placeholderLayoutObject = placeholder ? placeholder->layoutObj ect() : 0; 293 LayoutObject* placeholderLayoutObject = placeholder ? placeholder->layoutObj ect() : nullptr;
294 if (!placeholderLayoutObject) 294 if (!placeholderLayoutObject)
295 return 0; 295 return nullptr;
296 if (relayoutChildren) 296 if (relayoutChildren)
297 layoutScope.setChildNeedsLayout(placeholderLayoutObject); 297 layoutScope.setChildNeedsLayout(placeholderLayoutObject);
298 return placeholderLayoutObject; 298 return placeholderLayoutObject;
299 } 299 }
300 300
301 } // namespace blink 301 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutTextControl.h ('k') | Source/core/layout/LayoutTextControlMultiLine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698