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

Side by Side Diff: Source/core/editing/markup.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
« no previous file with comments | « Source/core/editing/TypingCommand.cpp ('k') | Source/core/html/HTMLTextFormControlElement.cpp » ('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) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved.
4 * Copyright (C) 2011 Igalia S.L. 4 * Copyright (C) 2011 Igalia S.L.
5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 bool isPlainTextMarkup(Node* node) 809 bool isPlainTextMarkup(Node* node)
810 { 810 {
811 ASSERT(node); 811 ASSERT(node);
812 if (!node->isElementNode()) 812 if (!node->isElementNode())
813 return false; 813 return false;
814 814
815 Element* element = toElement(node); 815 Element* element = toElement(node);
816 if (!isHTMLDivElement(*element) || !element->hasAttributes()) 816 if (!isHTMLDivElement(*element) || !element->hasAttributes())
817 return false; 817 return false;
818 818
819 if (element->hasOneChild() && (element->firstChild()->isTextNode() || (eleme nt->firstChild()->firstChild()))) 819 if (element->hasOneChild() && (element->firstChild()->isTextNode() || elemen t->firstChild()->hasChildren()))
820 return true; 820 return true;
821 821
822 return element->hasChildCount(2) && isTabSpanTextNode(element->firstChild()- >firstChild()) && element->lastChild()->isTextNode(); 822 return element->hasChildCount(2) && isTabSpanTextNode(element->firstChild()- >firstChild()) && element->lastChild()->isTextNode();
823 } 823 }
824 824
825 static bool shouldPreserveNewline(const Range& range) 825 static bool shouldPreserveNewline(const Range& range)
826 { 826 {
827 if (Node* node = range.firstNode()) { 827 if (Node* node = range.firstNode()) {
828 if (RenderObject* renderer = node->renderer()) 828 if (RenderObject* renderer = node->renderer())
829 return renderer->style()->preserveNewline(); 829 return renderer->style()->preserveNewline();
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 node->document().updateLayoutIgnorePendingStylesheets(); 1112 node->document().updateLayoutIgnorePendingStylesheets();
1113 1113
1114 StyledMarkupAccumulator accumulator(0, ResolveAllURLs, AnnotateForNavigation Transition, nullptr, 0); 1114 StyledMarkupAccumulator accumulator(0, ResolveAllURLs, AnnotateForNavigation Transition, nullptr, 0);
1115 accumulator.serializeNodes(node, NodeTraversal::nextSkippingChildren(*node)) ; 1115 accumulator.serializeNodes(node, NodeTraversal::nextSkippingChildren(*node)) ;
1116 1116
1117 static const char* documentMarkup = "<!DOCTYPE html><meta name=\"viewport\" content=\"width=device-width, user-scalable=0\">"; 1117 static const char* documentMarkup = "<!DOCTYPE html><meta name=\"viewport\" content=\"width=device-width, user-scalable=0\">";
1118 return documentMarkup + accumulator.takeResults(); 1118 return documentMarkup + accumulator.takeResults();
1119 } 1119 }
1120 1120
1121 } 1121 }
OLDNEW
« no previous file with comments | « Source/core/editing/TypingCommand.cpp ('k') | Source/core/html/HTMLTextFormControlElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698