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

Side by Side Diff: Source/core/editing/InsertParagraphSeparatorCommand.cpp

Issue 428533006: Use ContainerNode::hasChildren() instead of firstChild() in conditionals (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: build fix Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 if (isFirstInBlock && !nestNewBlock) { 271 if (isFirstInBlock && !nestNewBlock) {
272 if (listChild && listChild != startBlock) { 272 if (listChild && listChild != startBlock) {
273 RefPtrWillBeRawPtr<Element> listChildToInsert = listChild->clone ElementWithoutChildren(); 273 RefPtrWillBeRawPtr<Element> listChildToInsert = listChild->clone ElementWithoutChildren();
274 appendNode(blockToInsert, listChildToInsert.get()); 274 appendNode(blockToInsert, listChildToInsert.get());
275 insertNodeBefore(listChildToInsert.get(), listChild); 275 insertNodeBefore(listChildToInsert.get(), listChild);
276 } else { 276 } else {
277 refNode = startBlock.get(); 277 refNode = startBlock.get();
278 } 278 }
279 } else if (isFirstInBlock && nestNewBlock) { 279 } else if (isFirstInBlock && nestNewBlock) {
280 // startBlock should always have children, otherwise isLastInBlock w ould be true and it's handled above. 280 // startBlock should always have children, otherwise isLastInBlock w ould be true and it's handled above.
281 ASSERT(startBlock->firstChild()); 281 ASSERT(startBlock->hasChildren());
282 refNode = startBlock->firstChild(); 282 refNode = startBlock->firstChild();
283 } 283 }
284 else if (insertionPosition.deprecatedNode() == startBlock && nestNewBloc k) { 284 else if (insertionPosition.deprecatedNode() == startBlock && nestNewBloc k) {
285 refNode = startBlock->traverseToChildAt(insertionPosition.deprecated EditingOffset()); 285 refNode = startBlock->traverseToChildAt(insertionPosition.deprecated EditingOffset());
286 ASSERT(refNode); // must be true or we'd be in the end of block case 286 ASSERT(refNode); // must be true or we'd be in the end of block case
287 } else 287 } else
288 refNode = insertionPosition.deprecatedNode(); 288 refNode = insertionPosition.deprecatedNode();
289 289
290 // find ending selection position easily before inserting the paragraph 290 // find ending selection position easily before inserting the paragraph
291 insertionPosition = insertionPosition.downstream(); 291 insertionPosition = insertionPosition.downstream();
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 } 428 }
429 429
430 void InsertParagraphSeparatorCommand::trace(Visitor *visitor) 430 void InsertParagraphSeparatorCommand::trace(Visitor *visitor)
431 { 431 {
432 visitor->trace(m_style); 432 visitor->trace(m_style);
433 CompositeEditCommand::trace(visitor); 433 CompositeEditCommand::trace(visitor);
434 } 434 }
435 435
436 436
437 } // namespace blink 437 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/DeleteSelectionCommand.cpp ('k') | Source/core/editing/ReplaceSelectionCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698