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

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

Issue 2155513002: Add null-check for LayoutTextControl::innerEditorElement() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // This matches the unitsPerEm value for MS Shell Dlg and Courier New from t he "head" font table. 232 // This matches the unitsPerEm value for MS Shell Dlg and Courier New from t he "head" font table.
233 float unitsPerEm = 2048.0f; 233 float unitsPerEm = 2048.0f;
234 return roundf(style()->font().getFontDescription().computedSize() * x / unit sPerEm); 234 return roundf(style()->font().getFontDescription().computedSize() * x / unit sPerEm);
235 } 235 }
236 236
237 void LayoutTextControl::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidt h, LayoutUnit& maxLogicalWidth) const 237 void LayoutTextControl::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidt h, LayoutUnit& maxLogicalWidth) const
238 { 238 {
239 // Use average character width. Matches IE. 239 // Use average character width. Matches IE.
240 AtomicString family = style()->font().getFontDescription().family().family() ; 240 AtomicString family = style()->font().getFontDescription().family().family() ;
241 maxLogicalWidth = preferredContentLogicalWidth(const_cast<LayoutTextControl* >(this)->getAvgCharWidth(family)); 241 maxLogicalWidth = preferredContentLogicalWidth(const_cast<LayoutTextControl* >(this)->getAvgCharWidth(family));
242 if (LayoutBox* innerEditorLayoutBox = innerEditorElement()->layoutBox()) 242 if (innerEditorElement()) {
243 maxLogicalWidth += innerEditorLayoutBox->paddingStart() + innerEditorLay outBox->paddingEnd(); 243 if (LayoutBox* innerEditorLayoutBox = innerEditorElement()->layoutBox())
244 maxLogicalWidth += innerEditorLayoutBox->paddingStart() + innerEdito rLayoutBox->paddingEnd();
245 }
244 if (!style()->logicalWidth().hasPercent()) 246 if (!style()->logicalWidth().hasPercent())
245 minLogicalWidth = maxLogicalWidth; 247 minLogicalWidth = maxLogicalWidth;
246 } 248 }
247 249
248 void LayoutTextControl::computePreferredLogicalWidths() 250 void LayoutTextControl::computePreferredLogicalWidths()
249 { 251 {
250 ASSERT(preferredLogicalWidthsDirty()); 252 ASSERT(preferredLogicalWidthsDirty());
251 253
252 m_minPreferredLogicalWidth = LayoutUnit(); 254 m_minPreferredLogicalWidth = LayoutUnit();
253 m_maxPreferredLogicalWidth = LayoutUnit(); 255 m_maxPreferredLogicalWidth = LayoutUnit();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder Element(); 288 HTMLElement* placeholder = toHTMLTextFormControlElement(node())->placeholder Element();
287 LayoutObject* placeholderLayoutObject = placeholder ? placeholder->layoutObj ect() : nullptr; 289 LayoutObject* placeholderLayoutObject = placeholder ? placeholder->layoutObj ect() : nullptr;
288 if (!placeholderLayoutObject) 290 if (!placeholderLayoutObject)
289 return nullptr; 291 return nullptr;
290 if (relayoutChildren) 292 if (relayoutChildren)
291 layoutScope.setChildNeedsLayout(placeholderLayoutObject); 293 layoutScope.setChildNeedsLayout(placeholderLayoutObject);
292 return placeholderLayoutObject; 294 return placeholderLayoutObject;
293 } 295 }
294 296
295 } // namespace blink 297 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698