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

Side by Side Diff: Source/core/layout/line/InlineBox.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
« no previous file with comments | « Source/core/layout/line/InlineBox.h ('k') | Source/core/layout/line/InlineFlowBox.h » ('j') | 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) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 void InlineBox::dirtyLineBoxes() 171 void InlineBox::dirtyLineBoxes()
172 { 172 {
173 markDirty(); 173 markDirty();
174 for (InlineFlowBox* curr = parent(); curr && !curr->isDirty(); curr = curr-> parent()) 174 for (InlineFlowBox* curr = parent(); curr && !curr->isDirty(); curr = curr-> parent())
175 curr->markDirty(); 175 curr->markDirty();
176 } 176 }
177 177
178 void InlineBox::deleteLine() 178 void InlineBox::deleteLine()
179 { 179 {
180 if (!m_bitfields.extracted() && layoutObject().isBox()) 180 if (!m_bitfields.extracted() && layoutObject().isBox())
181 toLayoutBox(layoutObject()).setInlineBoxWrapper(0); 181 toLayoutBox(layoutObject()).setInlineBoxWrapper(nullptr);
182 destroy(); 182 destroy();
183 } 183 }
184 184
185 void InlineBox::extractLine() 185 void InlineBox::extractLine()
186 { 186 {
187 m_bitfields.setExtracted(true); 187 m_bitfields.setExtracted(true);
188 if (layoutObject().isBox()) 188 if (layoutObject().isBox())
189 toLayoutBox(layoutObject()).setInlineBoxWrapper(0); 189 toLayoutBox(layoutObject()).setInlineBoxWrapper(nullptr);
190 } 190 }
191 191
192 void InlineBox::attachLine() 192 void InlineBox::attachLine()
193 { 193 {
194 m_bitfields.setExtracted(false); 194 m_bitfields.setExtracted(false);
195 if (layoutObject().isBox()) 195 if (layoutObject().isBox())
196 toLayoutBox(layoutObject()).setInlineBoxWrapper(this); 196 toLayoutBox(layoutObject()).setInlineBoxWrapper(this);
197 } 197 }
198 198
199 void InlineBox::adjustPosition(LayoutUnit dx, LayoutUnit dy) 199 void InlineBox::adjustPosition(LayoutUnit dx, LayoutUnit dy)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 else if (nextOnLine()) 257 else if (nextOnLine())
258 m_bitfields.setNextOnLineExists(true); 258 m_bitfields.setNextOnLineExists(true);
259 else 259 else
260 m_bitfields.setNextOnLineExists(parent()->nextOnLineExists()); 260 m_bitfields.setNextOnLineExists(parent()->nextOnLineExists());
261 } 261 }
262 return m_bitfields.nextOnLineExists(); 262 return m_bitfields.nextOnLineExists();
263 } 263 }
264 264
265 InlineBox* InlineBox::nextLeafChild() const 265 InlineBox* InlineBox::nextLeafChild() const
266 { 266 {
267 InlineBox* leaf = 0; 267 InlineBox* leaf = nullptr;
268 for (InlineBox* box = nextOnLine(); box && !leaf; box = box->nextOnLine()) 268 for (InlineBox* box = nextOnLine(); box && !leaf; box = box->nextOnLine())
269 leaf = box->isLeaf() ? box : toInlineFlowBox(box)->firstLeafChild(); 269 leaf = box->isLeaf() ? box : toInlineFlowBox(box)->firstLeafChild();
270 if (!leaf && parent()) 270 if (!leaf && parent())
271 leaf = parent()->nextLeafChild(); 271 leaf = parent()->nextLeafChild();
272 return leaf; 272 return leaf;
273 } 273 }
274 274
275 InlineBox* InlineBox::prevLeafChild() const 275 InlineBox* InlineBox::prevLeafChild() const
276 { 276 {
277 InlineBox* leaf = 0; 277 InlineBox* leaf = nullptr;
278 for (InlineBox* box = prevOnLine(); box && !leaf; box = box->prevOnLine()) 278 for (InlineBox* box = prevOnLine(); box && !leaf; box = box->prevOnLine())
279 leaf = box->isLeaf() ? box : toInlineFlowBox(box)->lastLeafChild(); 279 leaf = box->isLeaf() ? box : toInlineFlowBox(box)->lastLeafChild();
280 if (!leaf && parent()) 280 if (!leaf && parent())
281 leaf = parent()->prevLeafChild(); 281 leaf = parent()->prevLeafChild();
282 return leaf; 282 return leaf;
283 } 283 }
284 284
285 InlineBox* InlineBox::nextLeafChildIgnoringLineBreak() const 285 InlineBox* InlineBox::nextLeafChildIgnoringLineBreak() const
286 { 286 {
287 InlineBox* leaf = nextLeafChild(); 287 InlineBox* leaf = nextLeafChild();
288 if (leaf && leaf->isLineBreak()) 288 return (leaf && leaf->isLineBreak()) ? nullptr : leaf;
289 return 0;
290 return leaf;
291 } 289 }
292 290
293 InlineBox* InlineBox::prevLeafChildIgnoringLineBreak() const 291 InlineBox* InlineBox::prevLeafChildIgnoringLineBreak() const
294 { 292 {
295 InlineBox* leaf = prevLeafChild(); 293 InlineBox* leaf = prevLeafChild();
296 if (leaf && leaf->isLineBreak()) 294 return (leaf && leaf->isLineBreak()) ? nullptr : leaf;
297 return 0;
298 return leaf;
299 } 295 }
300 296
301 LayoutObject::SelectionState InlineBox::selectionState() const 297 LayoutObject::SelectionState InlineBox::selectionState() const
302 { 298 {
303 return layoutObject().selectionState(); 299 return layoutObject().selectionState();
304 } 300 }
305 301
306 bool InlineBox::canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidt h) const 302 bool InlineBox::canAccommodateEllipsis(bool ltr, int blockEdge, int ellipsisWidt h) const
307 { 303 {
308 // Non-replaced elements can always accommodate an ellipsis. 304 // Non-replaced elements can always accommodate an ellipsis.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 393
398 void showLineTree(const blink::InlineBox* b) 394 void showLineTree(const blink::InlineBox* b)
399 { 395 {
400 if (b) 396 if (b)
401 b->showLineTreeForThis(); 397 b->showLineTreeForThis();
402 else 398 else
403 fprintf(stderr, "Cannot showLineTree for (nil) InlineBox.\n"); 399 fprintf(stderr, "Cannot showLineTree for (nil) InlineBox.\n");
404 } 400 }
405 401
406 #endif 402 #endif
OLDNEW
« no previous file with comments | « Source/core/layout/line/InlineBox.h ('k') | Source/core/layout/line/InlineFlowBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698