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

Side by Side Diff: Source/core/editing/ApplyStyleCommand.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/dom/TreeWalker.cpp ('k') | Source/core/editing/DeleteSelectionCommand.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) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008, 2009 Apple 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 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 HTMLElement* styleContainer = 0; 1441 HTMLElement* styleContainer = 0;
1442 for (Node* container = startNode.get(); container && startNode == endNode; c ontainer = container->firstChild()) { 1442 for (Node* container = startNode.get(); container && startNode == endNode; c ontainer = container->firstChild()) {
1443 if (isHTMLFontElement(*container)) 1443 if (isHTMLFontElement(*container))
1444 fontContainer = toHTMLFontElement(container); 1444 fontContainer = toHTMLFontElement(container);
1445 bool styleContainerIsNotSpan = !isHTMLSpanElement(styleContainer); 1445 bool styleContainerIsNotSpan = !isHTMLSpanElement(styleContainer);
1446 if (container->isHTMLElement()) { 1446 if (container->isHTMLElement()) {
1447 HTMLElement* containerElement = toHTMLElement(container); 1447 HTMLElement* containerElement = toHTMLElement(container);
1448 if (isHTMLSpanElement(*containerElement) || (styleContainerIsNotSpan && containerElement->hasChildren())) 1448 if (isHTMLSpanElement(*containerElement) || (styleContainerIsNotSpan && containerElement->hasChildren()))
1449 styleContainer = toHTMLElement(container); 1449 styleContainer = toHTMLElement(container);
1450 } 1450 }
1451 if (!container->firstChild()) 1451 if (!container->hasChildren())
1452 break; 1452 break;
1453 startNode = container->firstChild(); 1453 startNode = container->firstChild();
1454 endNode = container->lastChild(); 1454 endNode = container->lastChild();
1455 } 1455 }
1456 1456
1457 // Font tags need to go outside of CSS so that CSS font sizes override leagc y font sizes. 1457 // Font tags need to go outside of CSS so that CSS font sizes override leagc y font sizes.
1458 if (styleChange.applyFontColor() || styleChange.applyFontFace() || styleChan ge.applyFontSize()) { 1458 if (styleChange.applyFontColor() || styleChange.applyFontFace() || styleChan ge.applyFontSize()) {
1459 if (fontContainer) { 1459 if (fontContainer) {
1460 if (styleChange.applyFontColor()) 1460 if (styleChange.applyFontColor())
1461 setNodeAttribute(fontContainer, colorAttr, AtomicString(styleCha nge.fontColor())); 1461 setNodeAttribute(fontContainer, colorAttr, AtomicString(styleCha nge.fontColor()));
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 void ApplyStyleCommand::trace(Visitor* visitor) 1571 void ApplyStyleCommand::trace(Visitor* visitor)
1572 { 1572 {
1573 visitor->trace(m_style); 1573 visitor->trace(m_style);
1574 visitor->trace(m_start); 1574 visitor->trace(m_start);
1575 visitor->trace(m_end); 1575 visitor->trace(m_end);
1576 visitor->trace(m_styledInlineElement); 1576 visitor->trace(m_styledInlineElement);
1577 CompositeEditCommand::trace(visitor); 1577 CompositeEditCommand::trace(visitor);
1578 } 1578 }
1579 1579
1580 } 1580 }
OLDNEW
« no previous file with comments | « Source/core/dom/TreeWalker.cpp ('k') | Source/core/editing/DeleteSelectionCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698