<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[173606] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/173606">173606</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2014-09-14 14:18:27 -0700 (Sun, 14 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Rename Node::childNodeCount() to countChildNodes() and avoid inefficient uses
https://bugs.webkit.org/show_bug.cgi?id=136789

Reviewed by Darin Adler.

Source/WebCore:

Rename Node::childNodeCount() to countChildNodes() to make it clearer
that the method actually computes the result rather than returning a
cached value.

This patch also introduces a new Node::hasOneChild() method that is
used to check if a Node has a single child. This is much more efficient
than calling countChildNodes() == 1.

The patch also leverages Node::hasChildNodes() in a lot of places
instead of calling countChildNodes().

Finally, in a couple of places, we now use childrenOfType() to iterate
over children more efficient than using countChildNodes() and
childNode(index).

No new tests, no behavior change.

* WebCore.exp.in:
* WebCore.order:
Update the name of the exposed symbol for countChildNodes().

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::removeChildren):
(WebCore::ContainerNode::countChildNodes):
(WebCore::ContainerNode::childNodeCount): Deleted.
Rename childNodeCount() to countChildNodes() to make it obvious it is
computing the result rather than returning a cached value.

* dom/ContainerNode.h:
(WebCore::ContainerNode::hasOneChild):
Introduce an efficient way to check in a ContainerNode has a single
child as &quot;countChildNodes() == 1&quot; calls were frequent and inefficient.

(WebCore::Node::countChildNodes):
(WebCore::Node::childNodeCount): Deleted.
* dom/Node.h:
Rename childNodeCount() to countChildNodes().

* dom/Position.cpp:
(WebCore::Position::parentAnchoredEquivalent):
* dom/Position.h:
(WebCore::lastOffsetInNode):
* dom/Range.cpp:
Mechanical renaming.

(WebCore::lengthOfContentsInNode):
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
(WebCore::ApplyStyleCommand::shouldApplyInlineStyleToRun):
(WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
(WebCore::ApplyStyleCommand::mergeEndWithNextIfIdentical):
(WebCore::ApplyStyleCommand::applyInlineStyleChange):
Call hasChildNodes() rather than countChildNodes() as it is a lot more
efficient.

* editing/Editor.cpp:
(WebCore::Editor::setTextAsChildOfElement):
(WebCore::Editor::rangeOfString):
(WebCore::Editor::countMatchesForText):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::elementRangeContainingCaretSelection):
Mechanical renaming.

* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::insertAsListItems):
Call hasOneChild() instead of countChildNodes() == 1. Also remove
redundant listElement-&gt;hasChildNodes() check as hasOneChild() takes
care of this already.

* editing/TextIterator.cpp:
(WebCore::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
* editing/VisibleUnits.cpp:
(WebCore::endOfDocument):
* editing/htmlediting.cpp:
(WebCore::lastOffsetForEditing):
Mechanical renaming.

(WebCore::visiblePositionBeforeNode):
(WebCore::visiblePositionAfterNode):
Call hasChildNodes() instead of converting countChildNodes() to a
boolean.

* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
Call !hasChildNodes() instead of !countChildNodes().

(WebCore::isPlainTextMarkup):
- Drop !node-&gt;isElementNode() check as !node-&gt;hasTagName(divTag) takes
  care of discarding non-Element Nodes already.
- Cast the Node to an HTMLDivElement as soon as possible to avoid
  calling calling the slower Node APIs in several cases.
- Call hasOneChild() instead of countChildNodes() == 1.

* html/HTMLDivElement.h:
* html/HTMLTagNames.in:
Generate casting helpers as I use them in WebCore::isPlainTextMarkup().

* html/HTMLScriptElement.cpp:
(WebCore::HTMLScriptElement::setText):
* html/HTMLTitleElement.cpp:
(WebCore::HTMLTitleElement::setText):
Call hasOneChild() / hasChildNodes() instead of countChildNodes().

* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTimelineContainerElement::setTimeDisplaysHidden):
(WebCore::MediaControlTextTrackContainerElement::updateDisplay):
Use childrenOfType&lt;Element&gt;() to iterate of child Elements instead of
slower childNodeCount() + childNode(index) + isElementNode(). Also,
childNodeCount() was not even cached before the loop.

* html/track/VTTRegion.cpp:
(WebCore::VTTRegion::displayLastTextTrackCueBox):
Use childrenOfType&lt;Element&gt;() to iterate of child Elements, thus
avoiding calling childNodeCount() + childNode(index).

* page/DOMSelection.cpp:
(WebCore::DOMSelection::extend):
(WebCore::DOMSelection::selectAllChildren):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::caretMaxOffset):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::isSelected):
* rendering/RenderView.cpp:
(WebCore::RenderView::splitSelectionBetweenSubtrees):
Mechanical renaming.

Source/WebKit/mac:

Rename childNodeCount() to countChildNodes().

* WebView/WebHTMLView.mm:
(-[WebHTMLView attributedString]):

Source/WebKit2:

Avoid calling slow Node::countChildNodes().

* WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp:
(WebKit::WebPage::findZoomableAreaForPoint):
Replace call to &quot;node-&gt;parentNode()-&gt;childNodeCount() != 1&quot; by
&quot;!node-&gt;parentNode()-&gt;hasOneChild()&quot; which is equivalent but more
efficient.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreWebCoreorder">trunk/Source/WebCore/WebCore.order</a></li>
<li><a href="#trunkSourceWebCoredomContainerNodecpp">trunk/Source/WebCore/dom/ContainerNode.cpp</a></li>
<li><a href="#trunkSourceWebCoredomContainerNodeh">trunk/Source/WebCore/dom/ContainerNode.h</a></li>
<li><a href="#trunkSourceWebCoredomNodeh">trunk/Source/WebCore/dom/Node.h</a></li>
<li><a href="#trunkSourceWebCoredomPositioncpp">trunk/Source/WebCore/dom/Position.cpp</a></li>
<li><a href="#trunkSourceWebCoredomPositionh">trunk/Source/WebCore/dom/Position.h</a></li>
<li><a href="#trunkSourceWebCoredomRangecpp">trunk/Source/WebCore/dom/Range.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingApplyStyleCommandcpp">trunk/Source/WebCore/editing/ApplyStyleCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorcpp">trunk/Source/WebCore/editing/Editor.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingFrameSelectioncpp">trunk/Source/WebCore/editing/FrameSelection.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingReplaceSelectionCommandcpp">trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingTextIteratorcpp">trunk/Source/WebCore/editing/TextIterator.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingVisibleUnitscpp">trunk/Source/WebCore/editing/VisibleUnits.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditinghtmleditingcpp">trunk/Source/WebCore/editing/htmlediting.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingmarkupcpp">trunk/Source/WebCore/editing/markup.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLDivElementh">trunk/Source/WebCore/html/HTMLDivElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLScriptElementcpp">trunk/Source/WebCore/html/HTMLScriptElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTagNamesin">trunk/Source/WebCore/html/HTMLTagNames.in</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTitleElementcpp">trunk/Source/WebCore/html/HTMLTitleElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlshadowMediaControlElementscpp">trunk/Source/WebCore/html/shadow/MediaControlElements.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmltrackVTTRegioncpp">trunk/Source/WebCore/html/track/VTTRegion.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDOMSelectioncpp">trunk/Source/WebCore/page/DOMSelection.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderObjectcpp">trunk/Source/WebCore/rendering/RenderObject.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderReplacedcpp">trunk/Source/WebCore/rendering/RenderReplaced.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderViewcpp">trunk/Source/WebCore/rendering/RenderView.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebHTMLViewmm">trunk/Source/WebKit/mac/WebView/WebHTMLView.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageCoordinatedGraphicsWebPageCoordinatedGraphicscpp">trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/ChangeLog        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -1,3 +1,136 @@
</span><ins>+2014-09-14  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Rename Node::childNodeCount() to countChildNodes() and avoid inefficient uses
+        https://bugs.webkit.org/show_bug.cgi?id=136789
+
+        Reviewed by Darin Adler.
+
+        Rename Node::childNodeCount() to countChildNodes() to make it clearer
+        that the method actually computes the result rather than returning a
+        cached value.
+
+        This patch also introduces a new Node::hasOneChild() method that is
+        used to check if a Node has a single child. This is much more efficient
+        than calling countChildNodes() == 1.
+
+        The patch also leverages Node::hasChildNodes() in a lot of places
+        instead of calling countChildNodes().
+
+        Finally, in a couple of places, we now use childrenOfType() to iterate
+        over children more efficient than using countChildNodes() and
+        childNode(index).
+
+        No new tests, no behavior change.
+
+        * WebCore.exp.in:
+        * WebCore.order:
+        Update the name of the exposed symbol for countChildNodes().
+
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::removeChildren):
+        (WebCore::ContainerNode::countChildNodes):
+        (WebCore::ContainerNode::childNodeCount): Deleted.
+        Rename childNodeCount() to countChildNodes() to make it obvious it is
+        computing the result rather than returning a cached value.
+
+        * dom/ContainerNode.h:
+        (WebCore::ContainerNode::hasOneChild):
+        Introduce an efficient way to check in a ContainerNode has a single
+        child as &quot;countChildNodes() == 1&quot; calls were frequent and inefficient.
+
+        (WebCore::Node::countChildNodes):
+        (WebCore::Node::childNodeCount): Deleted.
+        * dom/Node.h:
+        Rename childNodeCount() to countChildNodes().
+
+        * dom/Position.cpp:
+        (WebCore::Position::parentAnchoredEquivalent):
+        * dom/Position.h:
+        (WebCore::lastOffsetInNode):
+        * dom/Range.cpp:
+        Mechanical renaming.
+
+        (WebCore::lengthOfContentsInNode):
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
+        (WebCore::ApplyStyleCommand::shouldApplyInlineStyleToRun):
+        (WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
+        (WebCore::ApplyStyleCommand::mergeEndWithNextIfIdentical):
+        (WebCore::ApplyStyleCommand::applyInlineStyleChange):
+        Call hasChildNodes() rather than countChildNodes() as it is a lot more
+        efficient.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::setTextAsChildOfElement):
+        (WebCore::Editor::rangeOfString):
+        (WebCore::Editor::countMatchesForText):
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::elementRangeContainingCaretSelection):
+        Mechanical renaming.
+
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplaceSelectionCommand::insertAsListItems):
+        Call hasOneChild() instead of countChildNodes() == 1. Also remove
+        redundant listElement-&gt;hasChildNodes() check as hasOneChild() takes
+        care of this already.
+
+        * editing/TextIterator.cpp:
+        (WebCore::SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator):
+        * editing/VisibleUnits.cpp:
+        (WebCore::endOfDocument):
+        * editing/htmlediting.cpp:
+        (WebCore::lastOffsetForEditing):
+        Mechanical renaming.
+
+        (WebCore::visiblePositionBeforeNode):
+        (WebCore::visiblePositionAfterNode):
+        Call hasChildNodes() instead of converting countChildNodes() to a
+        boolean.
+
+        * editing/markup.cpp:
+        (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
+        Call !hasChildNodes() instead of !countChildNodes().
+
+        (WebCore::isPlainTextMarkup):
+        - Drop !node-&gt;isElementNode() check as !node-&gt;hasTagName(divTag) takes
+          care of discarding non-Element Nodes already.
+        - Cast the Node to an HTMLDivElement as soon as possible to avoid
+          calling calling the slower Node APIs in several cases.
+        - Call hasOneChild() instead of countChildNodes() == 1.
+
+        * html/HTMLDivElement.h:
+        * html/HTMLTagNames.in:
+        Generate casting helpers as I use them in WebCore::isPlainTextMarkup().
+
+        * html/HTMLScriptElement.cpp:
+        (WebCore::HTMLScriptElement::setText):
+        * html/HTMLTitleElement.cpp:
+        (WebCore::HTMLTitleElement::setText):
+        Call hasOneChild() / hasChildNodes() instead of countChildNodes().
+
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlTimelineContainerElement::setTimeDisplaysHidden):
+        (WebCore::MediaControlTextTrackContainerElement::updateDisplay):
+        Use childrenOfType&lt;Element&gt;() to iterate of child Elements instead of
+        slower childNodeCount() + childNode(index) + isElementNode(). Also,
+        childNodeCount() was not even cached before the loop.
+
+        * html/track/VTTRegion.cpp:
+        (WebCore::VTTRegion::displayLastTextTrackCueBox):
+        Use childrenOfType&lt;Element&gt;() to iterate of child Elements, thus
+        avoiding calling childNodeCount() + childNode(index).
+
+        * page/DOMSelection.cpp:
+        (WebCore::DOMSelection::extend):
+        (WebCore::DOMSelection::selectAllChildren):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::caretMaxOffset):
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::isSelected):
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::splitSelectionBetweenSubtrees):
+        Mechanical renaming.
+
</ins><span class="cx"> 2014-09-13  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Un-inline Element constructor
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -1625,7 +1625,7 @@
</span><span class="cx"> __ZNK7WebCore12TextEncoding6decodeEPKcmbRb
</span><span class="cx"> __ZNK7WebCore12TextIterator4nodeEv
</span><span class="cx"> __ZNK7WebCore12TextIterator5rangeEv
</span><del>-__ZNK7WebCore13ContainerNode14childNodeCountEv
</del><ins>+__ZNK7WebCore13ContainerNode15countChildNodesEv
</ins><span class="cx"> __ZNK7WebCore13ContainerNode9childNodeEj
</span><span class="cx"> __ZNK7WebCore13GraphicsLayer18accumulatedOpacityEv
</span><span class="cx"> __ZNK7WebCore13GraphicsLayer18getDebugBorderInfoERNS_5ColorERf
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreorder"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.order (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.order        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/WebCore.order        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -11622,7 +11622,7 @@
</span><span class="cx"> __ZN7WebCore24jsHTMLMetaElementContentEPN3JSC9ExecStateENS0_7JSValueENS0_12PropertyNameE
</span><span class="cx"> __ZN7WebCore26setJSHTMLScriptElementTextEPN3JSC9ExecStateEPNS0_8JSObjectENS0_7JSValueE
</span><span class="cx"> __ZN7WebCore17HTMLScriptElement7setTextERKN3WTF6StringE
</span><del>-__ZNK7WebCore13ContainerNode14childNodeCountEv
</del><ins>+__ZNK7WebCore13ContainerNode15countChildNodesEv
</ins><span class="cx"> __ZN7WebCore20jsHTMLLinkElementRelEPN3JSC9ExecStateENS0_7JSValueENS0_12PropertyNameE
</span><span class="cx"> __ZN7WebCore21jsHTMLLinkElementHrefEPN3JSC9ExecStateENS0_7JSValueENS0_12PropertyNameE
</span><span class="cx"> __ZN7WebCore13NodeTraversal35nextIncludingPseudoSkippingChildrenEPKNS_4NodeES3_
</span></span></pre></div>
<a id="trunkSourceWebCoredomContainerNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ContainerNode.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -653,7 +653,7 @@
</span><span class="cx">         WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
</span><span class="cx">         {
</span><span class="cx">             NoEventDispatchAssertion assertNoEventDispatch;
</span><del>-            removedChildren.reserveInitialCapacity(childNodeCount());
</del><ins>+            removedChildren.reserveInitialCapacity(countChildNodes());
</ins><span class="cx">             while (RefPtr&lt;Node&gt; n = m_firstChild) {
</span><span class="cx">                 removedChildren.append(*m_firstChild);
</span><span class="cx">                 removeBetween(0, m_firstChild-&gt;nextSibling(), *m_firstChild);
</span><span class="lines">@@ -931,12 +931,11 @@
</span><span class="cx">     return enclosingLayoutRect(FloatRect(upperLeft, lowerRight.expandedTo(upperLeft) - upperLeft));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-unsigned ContainerNode::childNodeCount() const
</del><ins>+unsigned ContainerNode::countChildNodes() const
</ins><span class="cx"> {
</span><span class="cx">     unsigned count = 0;
</span><del>-    Node *n;
-    for (n = firstChild(); n; n = n-&gt;nextSibling())
-        count++;
</del><ins>+    for (Node* child = firstChild(); child; child = child-&gt;nextSibling())
+        ++count;
</ins><span class="cx">     return count;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomContainerNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ContainerNode.h (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ContainerNode.h        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/dom/ContainerNode.h        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -87,11 +87,12 @@
</span><span class="cx">     static ptrdiff_t firstChildMemoryOffset() { return OBJECT_OFFSETOF(ContainerNode, m_firstChild); }
</span><span class="cx">     Node* lastChild() const { return m_lastChild; }
</span><span class="cx">     bool hasChildNodes() const { return m_firstChild; }
</span><ins>+    bool hasOneChild() const { return m_firstChild &amp;&amp; !m_firstChild-&gt;nextSibling(); }
</ins><span class="cx"> 
</span><span class="cx">     bool directChildNeedsStyleRecalc() const { return getFlag(DirectChildNeedsStyleRecalcFlag); }
</span><span class="cx">     void setDirectChildNeedsStyleRecalc() { setFlag(DirectChildNeedsStyleRecalcFlag); }
</span><span class="cx"> 
</span><del>-    WEBCORE_EXPORT unsigned childNodeCount() const;
</del><ins>+    WEBCORE_EXPORT unsigned countChildNodes() const;
</ins><span class="cx">     WEBCORE_EXPORT Node* childNode(unsigned index) const;
</span><span class="cx"> 
</span><span class="cx">     bool insertBefore(PassRefPtr&lt;Node&gt; newChild, Node* refChild, ExceptionCode&amp; = ASSERT_NO_EXCEPTION);
</span><span class="lines">@@ -184,11 +185,11 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline unsigned Node::childNodeCount() const
</del><ins>+inline unsigned Node::countChildNodes() const
</ins><span class="cx"> {
</span><span class="cx">     if (!isContainerNode())
</span><span class="cx">         return 0;
</span><del>-    return toContainerNode(this)-&gt;childNodeCount();
</del><ins>+    return toContainerNode(this)-&gt;countChildNodes();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline Node* Node::childNode(unsigned index) const
</span></span></pre></div>
<a id="trunkSourceWebCoredomNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Node.h (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Node.h        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/dom/Node.h        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -416,7 +416,7 @@
</span><span class="cx">     bool isReadOnlyNode() const { return nodeType() == ENTITY_REFERENCE_NODE; }
</span><span class="cx">     bool isDocumentTypeNode() const { return nodeType() == DOCUMENT_TYPE_NODE; }
</span><span class="cx">     virtual bool childTypeAllowed(NodeType) const { return false; }
</span><del>-    unsigned childNodeCount() const;
</del><ins>+    unsigned countChildNodes() const;
</ins><span class="cx">     Node* childNode(unsigned index) const;
</span><span class="cx"> 
</span><span class="cx">     void checkSetPrefix(const AtomicString&amp; prefix, ExceptionCode&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoredomPositioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Position.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Position.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/dom/Position.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -226,7 +226,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!m_anchorNode-&gt;offsetInCharacters()
</span><del>-        &amp;&amp; (m_anchorType == PositionIsAfterAnchor || m_anchorType == PositionIsAfterChildren || static_cast&lt;unsigned&gt;(m_offset) == m_anchorNode-&gt;childNodeCount())
</del><ins>+        &amp;&amp; (m_anchorType == PositionIsAfterAnchor || m_anchorType == PositionIsAfterChildren || static_cast&lt;unsigned&gt;(m_offset) == m_anchorNode-&gt;countChildNodes())
</ins><span class="cx">         &amp;&amp; (editingIgnoresContent(m_anchorNode.get()) || isRenderedTable(m_anchorNode.get()))
</span><span class="cx">         &amp;&amp; containerNode()) {
</span><span class="cx">         return positionInParentAfterNode(m_anchorNode.get());
</span></span></pre></div>
<a id="trunkSourceWebCoredomPositionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Position.h (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Position.h        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/dom/Position.h        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -297,10 +297,10 @@
</span><span class="cx"> 
</span><span class="cx"> inline int lastOffsetInNode(Node* node)
</span><span class="cx"> {
</span><del>-    return node-&gt;offsetInCharacters() ? node-&gt;maxCharacterOffset() : static_cast&lt;int&gt;(node-&gt;childNodeCount());
</del><ins>+    return node-&gt;offsetInCharacters() ? node-&gt;maxCharacterOffset() : static_cast&lt;int&gt;(node-&gt;countChildNodes());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-// firstPositionInNode and lastPositionInNode return parent-anchored positions, lastPositionInNode construction is O(n) due to childNodeCount()
</del><ins>+// firstPositionInNode and lastPositionInNode return parent-anchored positions, lastPositionInNode construction is O(n) due to countChildNodes()
</ins><span class="cx"> inline Position firstPositionInNode(Node* anchorNode)
</span><span class="cx"> {
</span><span class="cx">     if (anchorNode-&gt;isTextNode())
</span></span></pre></div>
<a id="trunkSourceWebCoredomRangecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Range.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Range.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/dom/Range.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -672,7 +672,7 @@
</span><span class="cx">     case Node::DOCUMENT_FRAGMENT_NODE:
</span><span class="cx">     case Node::NOTATION_NODE:
</span><span class="cx">     case Node::XPATH_NAMESPACE_NODE:
</span><del>-        return node-&gt;childNodeCount();
</del><ins>+        return node-&gt;countChildNodes();
</ins><span class="cx">     }
</span><span class="cx">     ASSERT_NOT_REACHED();
</span><span class="cx">     return 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingApplyStyleCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ApplyStyleCommand.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ApplyStyleCommand.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/editing/ApplyStyleCommand.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -777,7 +777,7 @@
</span><span class="cx">         if (isBlock(node.get()))
</span><span class="cx">             continue;
</span><span class="cx">         
</span><del>-        if (node-&gt;childNodeCount()) {
</del><ins>+        if (node-&gt;hasChildNodes()) {
</ins><span class="cx">             if (node-&gt;contains(pastEndNode.get()) || containsNonEditableRegion(node.get()) || !node-&gt;parentNode()-&gt;hasEditableStyle())
</span><span class="cx">                 continue;
</span><span class="cx">             if (editingIgnoresContent(node.get())) {
</span><span class="lines">@@ -835,7 +835,7 @@
</span><span class="cx">     ASSERT(style &amp;&amp; runStart);
</span><span class="cx"> 
</span><span class="cx">     for (Node* node = runStart; node &amp;&amp; node != pastEndNode; node = NodeTraversal::next(node)) {
</span><del>-        if (node-&gt;childNodeCount())
</del><ins>+        if (node-&gt;hasChildNodes())
</ins><span class="cx">             continue;
</span><span class="cx">         // We don't consider m_isInlineElementToRemoveFunction here because we never apply style when m_isInlineElementToRemoveFunction is specified
</span><span class="cx">         if (!style-&gt;styleIsPresentInComputedStyleOfNode(node))
</span><span class="lines">@@ -1007,7 +1007,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Since addInlineStyleIfNeeded can't add styles to block-flow render objects, add style attribute instead.
</span><span class="cx">     // FIXME: applyInlineStyleToRange should be used here instead.
</span><del>-    if ((node-&gt;renderer()-&gt;isRenderBlockFlow() || node-&gt;childNodeCount()) &amp;&amp; node-&gt;isHTMLElement()) {
</del><ins>+    if ((node-&gt;renderer()-&gt;isRenderBlockFlow() || node-&gt;hasChildNodes()) &amp;&amp; node-&gt;isHTMLElement()) {
</ins><span class="cx">         setNodeAttribute(toHTMLElement(node), styleAttr, newInlineStyle-&gt;style()-&gt;asText());
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -1325,7 +1325,7 @@
</span><span class="cx">         mergeIdenticalElements(element, nextElement);
</span><span class="cx"> 
</span><span class="cx">         bool shouldUpdateStart = start.containerNode() == endNode;
</span><del>-        int endOffset = nextChild ? nextChild-&gt;nodeIndex() : nextElement-&gt;childNodeCount();
</del><ins>+        int endOffset = nextChild ? nextChild-&gt;nodeIndex() : nextElement-&gt;countChildNodes();
</ins><span class="cx">         updateStartEnd(shouldUpdateStart ? Position(nextElement, start.offsetInContainerNode(), Position::PositionIsOffsetInAnchor) : start,
</span><span class="cx">                        Position(nextElement, endOffset, Position::PositionIsOffsetInAnchor));
</span><span class="cx">         return true;
</span><span class="lines">@@ -1433,7 +1433,7 @@
</span><span class="cx">         if (container-&gt;isHTMLElement() &amp;&amp; container-&gt;hasTagName(fontTag))
</span><span class="cx">             fontContainer = toHTMLElement(container);
</span><span class="cx">         bool styleContainerIsNotSpan = !styleContainer || !styleContainer-&gt;hasTagName(spanTag);
</span><del>-        if (container-&gt;isHTMLElement() &amp;&amp; (container-&gt;hasTagName(spanTag) || (styleContainerIsNotSpan &amp;&amp; container-&gt;childNodeCount())))
</del><ins>+        if (container-&gt;isHTMLElement() &amp;&amp; (container-&gt;hasTagName(spanTag) || (styleContainerIsNotSpan &amp;&amp; container-&gt;hasChildNodes())))
</ins><span class="cx">             styleContainer = toHTMLElement(container);
</span><span class="cx">         if (!container-&gt;firstChild())
</span><span class="cx">             break;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/editing/Editor.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -704,7 +704,7 @@
</span><span class="cx">     // set the selection to the end
</span><span class="cx">     VisibleSelection selection;
</span><span class="cx"> 
</span><del>-    Position pos = createLegacyEditingPosition(elem, elem-&gt;childNodeCount());
</del><ins>+    Position pos = createLegacyEditingPosition(elem, elem-&gt;countChildNodes());
</ins><span class="cx"> 
</span><span class="cx">     VisiblePosition visiblePos(pos, VP_DEFAULT_AFFINITY);
</span><span class="cx">     if (visiblePos.isNull())
</span><span class="lines">@@ -3168,7 +3168,7 @@
</span><span class="cx">     RefPtr&lt;Node&gt; shadowTreeRoot = referenceRange &amp;&amp; referenceRange-&gt;startContainer() ? referenceRange-&gt;startContainer()-&gt;nonBoundaryShadowTreeRootNode() : 0;
</span><span class="cx">     if (shadowTreeRoot) {
</span><span class="cx">         if (forward)
</span><del>-            searchRange-&gt;setEnd(shadowTreeRoot.get(), shadowTreeRoot-&gt;childNodeCount());
</del><ins>+            searchRange-&gt;setEnd(shadowTreeRoot.get(), shadowTreeRoot-&gt;countChildNodes());
</ins><span class="cx">         else
</span><span class="cx">             searchRange-&gt;setStart(shadowTreeRoot.get(), 0);
</span><span class="cx">     }
</span><span class="lines">@@ -3186,7 +3186,7 @@
</span><span class="cx"> 
</span><span class="cx">         if (shadowTreeRoot) {
</span><span class="cx">             if (forward)
</span><del>-                searchRange-&gt;setEnd(shadowTreeRoot.get(), shadowTreeRoot-&gt;childNodeCount());
</del><ins>+                searchRange-&gt;setEnd(shadowTreeRoot.get(), shadowTreeRoot-&gt;countChildNodes());
</ins><span class="cx">             else
</span><span class="cx">                 searchRange-&gt;setStart(shadowTreeRoot.get(), 0);
</span><span class="cx">         }
</span><span class="lines">@@ -3279,7 +3279,7 @@
</span><span class="cx"> 
</span><span class="cx">         Node* shadowTreeRoot = searchRange-&gt;shadowRoot();
</span><span class="cx">         if (searchRange-&gt;collapsed(IGNORE_EXCEPTION) &amp;&amp; shadowTreeRoot)
</span><del>-            searchRange-&gt;setEnd(shadowTreeRoot, shadowTreeRoot-&gt;childNodeCount(), IGNORE_EXCEPTION);
</del><ins>+            searchRange-&gt;setEnd(shadowTreeRoot, shadowTreeRoot-&gt;countChildNodes(), IGNORE_EXCEPTION);
</ins><span class="cx">     } while (true);
</span><span class="cx"> 
</span><span class="cx">     if (markMatches || matches) {
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingFrameSelectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/FrameSelection.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -2196,7 +2196,7 @@
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="cx">     Position startPos = createLegacyEditingPosition(element, 0);
</span><del>-    Position endPos = createLegacyEditingPosition(element, element-&gt;childNodeCount());
</del><ins>+    Position endPos = createLegacyEditingPosition(element, element-&gt;countChildNodes());
</ins><span class="cx">     
</span><span class="cx">     VisiblePosition startVisiblePos(startPos, VP_DEFAULT_AFFINITY);
</span><span class="cx">     VisiblePosition endVisiblePos(endPos, VP_DEFAULT_AFFINITY);
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingReplaceSelectionCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -1437,7 +1437,7 @@
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;HTMLElement&gt; listElement = prpListElement;
</span><span class="cx"> 
</span><del>-    while (listElement-&gt;hasChildNodes() &amp;&amp; isListElement(listElement-&gt;firstChild()) &amp;&amp; listElement-&gt;childNodeCount() == 1)
</del><ins>+    while (listElement-&gt;hasOneChild() &amp;&amp; isListElement(listElement-&gt;firstChild()))
</ins><span class="cx">         listElement = toHTMLElement(listElement-&gt;firstChild());
</span><span class="cx"> 
</span><span class="cx">     bool isStart = isStartOfParagraph(insertPos);
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingTextIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/TextIterator.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/TextIterator.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/editing/TextIterator.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -1146,13 +1146,13 @@
</span><span class="cx">     int endOffset = range.endOffset();
</span><span class="cx"> 
</span><span class="cx">     if (!startNode-&gt;offsetInCharacters()) {
</span><del>-        if (startOffset &gt;= 0 &amp;&amp; startOffset &lt; static_cast&lt;int&gt;(startNode-&gt;childNodeCount())) {
</del><ins>+        if (startOffset &gt;= 0 &amp;&amp; startOffset &lt; static_cast&lt;int&gt;(startNode-&gt;countChildNodes())) {
</ins><span class="cx">             startNode = startNode-&gt;childNode(startOffset);
</span><span class="cx">             startOffset = 0;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     if (!endNode-&gt;offsetInCharacters()) {
</span><del>-        if (endOffset &gt; 0 &amp;&amp; endOffset &lt;= static_cast&lt;int&gt;(endNode-&gt;childNodeCount())) {
</del><ins>+        if (endOffset &gt; 0 &amp;&amp; endOffset &lt;= static_cast&lt;int&gt;(endNode-&gt;countChildNodes())) {
</ins><span class="cx">             endNode = endNode-&gt;childNode(endOffset - 1);
</span><span class="cx">             endOffset = lastOffsetInNode(endNode);
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingVisibleUnitscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/VisibleUnits.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/VisibleUnits.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/editing/VisibleUnits.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -1364,7 +1364,7 @@
</span><span class="cx">     // (As above, in startOfDocument.)  The canonicalization can reject valid visible positions
</span><span class="cx">     // when descending from the root element, so we construct the visible position directly from a
</span><span class="cx">     // valid candidate.
</span><del>-    Position lastPosition = createLegacyEditingPosition(node-&gt;document().documentElement(), node-&gt;document().documentElement()-&gt;childNodeCount());
</del><ins>+    Position lastPosition = createLegacyEditingPosition(node-&gt;document().documentElement(), node-&gt;document().documentElement()-&gt;countChildNodes());
</ins><span class="cx">     Position lastCandidate = previousCandidate(lastPosition);
</span><span class="cx">     if (lastCandidate.isNull())
</span><span class="cx">         return VisiblePosition();
</span></span></pre></div>
<a id="trunkSourceWebCoreeditinghtmleditingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/htmlediting.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/htmlediting.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/editing/htmlediting.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -343,7 +343,7 @@
</span><span class="cx">         return node-&gt;maxCharacterOffset();
</span><span class="cx"> 
</span><span class="cx">     if (node-&gt;hasChildNodes())
</span><del>-        return node-&gt;childNodeCount();
</del><ins>+        return node-&gt;countChildNodes();
</ins><span class="cx"> 
</span><span class="cx">     // NOTE: This should preempt the childNodeCount for, e.g., select nodes
</span><span class="cx">     if (editingIgnoresContent(node))
</span><span class="lines">@@ -513,7 +513,7 @@
</span><span class="cx"> VisiblePosition visiblePositionBeforeNode(Node* node)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(node);
</span><del>-    if (node-&gt;childNodeCount())
</del><ins>+    if (node-&gt;hasChildNodes())
</ins><span class="cx">         return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM);
</span><span class="cx">     ASSERT(node-&gt;parentNode());
</span><span class="cx">     ASSERT(!node-&gt;parentNode()-&gt;isShadowRoot());
</span><span class="lines">@@ -524,7 +524,7 @@
</span><span class="cx"> VisiblePosition visiblePositionAfterNode(Node* node)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(node);
</span><del>-    if (node-&gt;childNodeCount())
</del><ins>+    if (node-&gt;hasChildNodes())
</ins><span class="cx">         return VisiblePosition(lastPositionInOrAfterNode(node), DOWNSTREAM);
</span><span class="cx">     ASSERT(node-&gt;parentNode());
</span><span class="cx">     ASSERT(!node-&gt;parentNode()-&gt;isShadowRoot());
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingmarkupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/markup.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/markup.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/editing/markup.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> #include &quot;ExceptionCodePlaceholder.h&quot;
</span><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="cx"> #include &quot;HTMLBodyElement.h&quot;
</span><ins>+#include &quot;HTMLDivElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLElement.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;HTMLTableElement.h&quot;
</span><span class="lines">@@ -398,7 +399,7 @@
</span><span class="cx">                 appendStartTag(*n);
</span><span class="cx"> 
</span><span class="cx">             // If node has no children, close the tag now.
</span><del>-            if (!n-&gt;childNodeCount()) {
</del><ins>+            if (!n-&gt;hasChildNodes()) {
</ins><span class="cx">                 if (shouldEmit)
</span><span class="cx">                     appendEndTag(*n);
</span><span class="cx">                 lastClosed = n;
</span><span class="lines">@@ -740,15 +741,27 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isPlainTextMarkup(Node *node)
</del><ins>+bool isPlainTextMarkup(Node* node)
</ins><span class="cx"> {
</span><del>-    if (!node-&gt;isElementNode() || !node-&gt;hasTagName(divTag) || toElement(node)-&gt;hasAttributes())
</del><ins>+    if (!isHTMLDivElement(node))
</ins><span class="cx">         return false;
</span><ins>+
+    HTMLDivElement&amp; element = toHTMLDivElement(*node);
+    if (element.hasAttributes())
+        return false;
+
+    Node* firstChild = element.firstChild();
+    if (!firstChild)
+        return false;
+
+    Node* secondChild = firstChild-&gt;nextSibling();
+    if (!secondChild)
+        return firstChild-&gt;isTextNode() || firstChild-&gt;firstChild();
</ins><span class="cx">     
</span><del>-    if (node-&gt;childNodeCount() == 1 &amp;&amp; (node-&gt;firstChild()-&gt;isTextNode() || (node-&gt;firstChild()-&gt;firstChild())))
-        return true;
</del><ins>+    if (secondChild-&gt;nextSibling())
+        return false;
</ins><span class="cx">     
</span><del>-    return (node-&gt;childNodeCount() == 2 &amp;&amp; isTabSpanTextNode(node-&gt;firstChild()-&gt;firstChild()) &amp;&amp; node-&gt;firstChild()-&gt;nextSibling()-&gt;isTextNode());
</del><ins>+    return isTabSpanTextNode(firstChild-&gt;firstChild()) &amp;&amp; secondChild-&gt;isTextNode();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool contextPreservesNewline(const Range&amp; context)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLDivElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLDivElement.h (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLDivElement.h        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/html/HTMLDivElement.h        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -40,6 +40,8 @@
</span><span class="cx">     virtual void collectStyleForPresentationAttribute(const QualifiedName&amp;, const AtomicString&amp;, MutableStyleProperties&amp;) override;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+NODE_TYPE_CASTS(HTMLDivElement)
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // HTMLDivElement_h
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLScriptElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLScriptElement.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLScriptElement.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/html/HTMLScriptElement.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -81,14 +81,12 @@
</span><span class="cx"> {
</span><span class="cx">     Ref&lt;HTMLScriptElement&gt; protectFromMutationEvents(*this);
</span><span class="cx"> 
</span><del>-    int numChildren = childNodeCount();
-
-    if (numChildren == 1 &amp;&amp; firstChild()-&gt;isTextNode()) {
</del><ins>+    if (hasOneChild() &amp;&amp; firstChild()-&gt;isTextNode()) {
</ins><span class="cx">         toText(firstChild())-&gt;setData(value, IGNORE_EXCEPTION);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (numChildren &gt; 0)
</del><ins>+    if (hasChildNodes())
</ins><span class="cx">         removeChildren();
</span><span class="cx"> 
</span><span class="cx">     appendChild(document().createTextNode(value.impl()), IGNORE_EXCEPTION);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTagNamesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTagNames.in (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTagNames.in        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/html/HTMLTagNames.in        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx"> details conditional=DETAILS_ELEMENT, generateTypeHelpers 
</span><span class="cx"> dfn interfaceName=HTMLElement
</span><span class="cx"> dir interfaceName=HTMLDirectoryElement
</span><del>-div
</del><ins>+div generateTypeHelpers
</ins><span class="cx"> dl interfaceName=HTMLDListElement
</span><span class="cx"> dt interfaceName=HTMLElement
</span><span class="cx"> em interfaceName=HTMLElement
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTitleElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTitleElement.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTitleElement.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/html/HTMLTitleElement.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -96,10 +96,8 @@
</span><span class="cx"> void HTMLTitleElement::setText(const String &amp;value)
</span><span class="cx"> {
</span><span class="cx">     Ref&lt;HTMLTitleElement&gt; protectFromMutationEvents(*this);
</span><del>-
-    int numChildren = childNodeCount();
</del><span class="cx">     
</span><del>-    if (numChildren == 1 &amp;&amp; firstChild()-&gt;isTextNode())
</del><ins>+    if (hasOneChild() &amp;&amp; firstChild()-&gt;isTextNode())
</ins><span class="cx">         toText(firstChild())-&gt;setData(value, IGNORE_EXCEPTION);
</span><span class="cx">     else {
</span><span class="cx">         // We make a copy here because entity of &quot;value&quot; argument can be Document::m_title,
</span><span class="lines">@@ -107,7 +105,7 @@
</span><span class="cx">         // which causes HTMLTitleElement::childrenChanged(), which ends up Document::setTitle().
</span><span class="cx">         String valueCopy(value);
</span><span class="cx"> 
</span><del>-        if (numChildren &gt; 0)
</del><ins>+        if (hasChildNodes())
</ins><span class="cx">             removeChildren();
</span><span class="cx"> 
</span><span class="cx">         appendChild(document().createTextNode(valueCopy.impl()), IGNORE_EXCEPTION);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlshadowMediaControlElementscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include &quot;MediaControlElements.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;DOMTokenList.h&quot;
</span><ins>+#include &quot;ElementChildIterator.h&quot;
</ins><span class="cx"> #include &quot;EventHandler.h&quot;
</span><span class="cx"> #include &quot;EventNames.h&quot;
</span><span class="cx"> #include &quot;ExceptionCodePlaceholder.h&quot;
</span><span class="lines">@@ -296,20 +297,16 @@
</span><span class="cx"> 
</span><span class="cx"> void MediaControlTimelineContainerElement::setTimeDisplaysHidden(bool hidden)
</span><span class="cx"> {
</span><del>-    for (unsigned i = 0; i &lt; childNodeCount(); ++i) {
-        Node* child = childNode(i);
-        if (!child || !child-&gt;isElementNode())
</del><ins>+    for (auto&amp; element : childrenOfType&lt;Element&gt;(*this)) {
+        if (element.shadowPseudoId() != getMediaControlTimeRemainingDisplayElementShadowPseudoId()
+            &amp;&amp; element.shadowPseudoId() != getMediaControlCurrentTimeDisplayElementShadowPseudoId())
</ins><span class="cx">             continue;
</span><del>-        Element* element = toElement(child);
-        if (element-&gt;shadowPseudoId() != getMediaControlTimeRemainingDisplayElementShadowPseudoId()
-            &amp;&amp; element-&gt;shadowPseudoId() != getMediaControlCurrentTimeDisplayElementShadowPseudoId())
-            continue;
</del><span class="cx"> 
</span><del>-        MediaControlTimeDisplayElement* timeDisplay = static_cast&lt;MediaControlTimeDisplayElement*&gt;(element);
</del><ins>+        MediaControlTimeDisplayElement&amp; timeDisplay = static_cast&lt;MediaControlTimeDisplayElement&amp;&gt;(element);
</ins><span class="cx">         if (hidden)
</span><del>-            timeDisplay-&gt;hide();
</del><ins>+            timeDisplay.hide();
</ins><span class="cx">         else
</span><del>-            timeDisplay-&gt;show();
</del><ins>+            timeDisplay.show();
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1152,7 +1149,9 @@
</span><span class="cx">     // we wish to render (e.g., we are adding another cue in a set of roll-up
</span><span class="cx">     // cues), remove all the existing CSS boxes representing the cues and re-add
</span><span class="cx">     // them so that the new cue is at the bottom.
</span><del>-    if (childNodeCount() &lt; activeCues.size())
</del><ins>+    // FIXME: Calling countChildNodes() here is inefficient. We don't need to
+    // traverse all children just to check if there are less children than cues.
+    if (countChildNodes() &lt; activeCues.size())
</ins><span class="cx">         removeChildren();
</span><span class="cx"> 
</span><span class="cx">     // Sort the active cues for the appropriate display order. For example, for roll-up
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackVTTRegioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/VTTRegion.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/VTTRegion.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/html/track/VTTRegion.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ClientRect.h&quot;
</span><span class="cx"> #include &quot;DOMTokenList.h&quot;
</span><ins>+#include &quot;ElementChildIterator.h&quot;
</ins><span class="cx"> #include &quot;ExceptionCodePlaceholder.h&quot;
</span><span class="cx"> #include &quot;HTMLDivElement.h&quot;
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="lines">@@ -361,7 +362,7 @@
</span><span class="cx">     ASSERT(m_cueContainer);
</span><span class="cx"> 
</span><span class="cx">     // The container needs to be rendered, if it is not empty and the region is not currently scrolling.
</span><del>-    if (!m_cueContainer-&gt;renderer() || !m_cueContainer-&gt;childNodeCount() || m_scrollTimer.isActive())
</del><ins>+    if (!m_cueContainer-&gt;renderer() || !m_cueContainer-&gt;hasChildNodes() || m_scrollTimer.isActive())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // If it's a scrolling region, add the scrolling class.
</span><span class="lines">@@ -371,9 +372,10 @@
</span><span class="cx">     float regionBottom = m_regionDisplayTree-&gt;getBoundingClientRect()-&gt;bottom();
</span><span class="cx"> 
</span><span class="cx">     // Find first cue that is not entirely displayed and scroll it upwards.
</span><del>-    for (size_t i = 0; i &lt; m_cueContainer-&gt;childNodeCount() &amp;&amp; !m_scrollTimer.isActive(); ++i) {
-        float childTop = static_cast&lt;HTMLDivElement*&gt;(m_cueContainer-&gt;childNode(i))-&gt;getBoundingClientRect()-&gt;top();
-        float childBottom = static_cast&lt;HTMLDivElement*&gt;(m_cueContainer-&gt;childNode(i))-&gt;getBoundingClientRect()-&gt;bottom();
</del><ins>+    for (auto&amp; child : childrenOfType&lt;Element&gt;(*m_cueContainer)) {
+        RefPtr&lt;ClientRect&gt; rect = child.getBoundingClientRect();
+        float childTop = rect-&gt;top();
+        float childBottom = rect-&gt;bottom();
</ins><span class="cx"> 
</span><span class="cx">         if (regionBottom &gt;= childBottom)
</span><span class="cx">             continue;
</span><span class="lines">@@ -384,6 +386,7 @@
</span><span class="cx">         m_cueContainer-&gt;setInlineStyleProperty(CSSPropertyTop, m_currentTop, CSSPrimitiveValue::CSS_PX);
</span><span class="cx"> 
</span><span class="cx">         startTimer();
</span><ins>+        break;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMSelectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMSelection.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMSelection.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/page/DOMSelection.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -337,7 +337,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (offset &lt; 0 || offset &gt; (node-&gt;offsetInCharacters() ? caretMaxOffset(node) : (int)node-&gt;childNodeCount())) {
</del><ins>+    if (offset &lt; 0 || offset &gt; (node-&gt;offsetInCharacters() ? caretMaxOffset(node) : static_cast&lt;int&gt;(node-&gt;countChildNodes()))) {
</ins><span class="cx">         ec = INDEX_SIZE_ERR;
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -481,7 +481,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // This doesn't (and shouldn't) select text node characters.
</span><del>-    setBaseAndExtent(n, 0, n, n-&gt;childNodeCount(), ec);
</del><ins>+    setBaseAndExtent(n, 0, n, n-&gt;countChildNodes(), ec);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String DOMSelection::toString()
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderObject.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -2380,7 +2380,7 @@
</span><span class="cx"> int RenderObject::caretMaxOffset() const
</span><span class="cx"> {
</span><span class="cx">     if (isReplaced())
</span><del>-        return node() ? std::max(1U, node()-&gt;childNodeCount()) : 1;
</del><ins>+        return node() ? std::max(1U, node()-&gt;countChildNodes()) : 1;
</ins><span class="cx">     if (isHR())
</span><span class="cx">         return 1;
</span><span class="cx">     return 0;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderReplacedcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderReplaced.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -585,7 +585,7 @@
</span><span class="cx">     if (s == SelectionStart)
</span><span class="cx">         return selectionStart == 0;
</span><span class="cx">         
</span><del>-    int end = element()-&gt;hasChildNodes() ? element()-&gt;childNodeCount() : 1;
</del><ins>+    int end = element()-&gt;hasChildNodes() ? element()-&gt;countChildNodes() : 1;
</ins><span class="cx">     if (s == SelectionEnd)
</span><span class="cx">         return selectionEnd == end;
</span><span class="cx">     if (s == SelectionBoth)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderView.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderView.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebCore/rendering/RenderView.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -905,7 +905,7 @@
</span><span class="cx">             if (node == endNode)
</span><span class="cx">                 selectionData.setSelectionEndPos(endPos);
</span><span class="cx">             else
</span><del>-                selectionData.setSelectionEndPos(node-&gt;offsetInCharacters() ? node-&gt;maxCharacterOffset() : node-&gt;childNodeCount());
</del><ins>+                selectionData.setSelectionEndPos(node-&gt;offsetInCharacters() ? node-&gt;maxCharacterOffset() : node-&gt;countChildNodes());
</ins><span class="cx"> 
</span><span class="cx">             renderSubtreesMap.set(&amp;root, selectionData);
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-09-14  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Rename Node::childNodeCount() to countChildNodes() and avoid inefficient uses
+        https://bugs.webkit.org/show_bug.cgi?id=136789
+
+        Reviewed by Darin Adler.
+
+        Rename childNodeCount() to countChildNodes().
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView attributedString]):
+
</ins><span class="cx"> 2014-09-10  Jon Honeycutt  &lt;jhoneycutt@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Re-add the request autocomplete feature
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebHTMLViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -6686,7 +6686,7 @@
</span><span class="cx">     NSAttributedString *attributedString = [self _attributeStringFromDOMRange:[document _documentRange]];
</span><span class="cx">     if (!attributedString) {
</span><span class="cx">         Document* coreDocument = core(document);
</span><del>-        attributedString = editingAttributedStringFromRange(*Range::create(*coreDocument, coreDocument, 0, coreDocument, coreDocument-&gt;childNodeCount()));
</del><ins>+        attributedString = editingAttributedStringFromRange(*Range::create(*coreDocument, coreDocument, 0, coreDocument, coreDocument-&gt;countChildNodes()));
</ins><span class="cx">     }
</span><span class="cx">     return attributedString;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebKit2/ChangeLog        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-09-14  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Rename Node::childNodeCount() to countChildNodes() and avoid inefficient uses
+        https://bugs.webkit.org/show_bug.cgi?id=136789
+
+        Reviewed by Darin Adler.
+
+        Avoid calling slow Node::countChildNodes().
+
+        * WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp:
+        (WebKit::WebPage::findZoomableAreaForPoint):
+        Replace call to &quot;node-&gt;parentNode()-&gt;childNodeCount() != 1&quot; by
+        &quot;!node-&gt;parentNode()-&gt;hasOneChild()&quot; which is equivalent but more
+        efficient.
+
</ins><span class="cx"> 2014-09-10  Jon Honeycutt  &lt;jhoneycutt@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Re-add the request autocomplete feature
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageCoordinatedGraphicsWebPageCoordinatedGraphicscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp (173605 => 173606)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp        2014-09-13 23:21:28 UTC (rev 173605)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp        2014-09-14 21:18:27 UTC (rev 173606)
</span><span class="lines">@@ -64,9 +64,9 @@
</span><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         // Candidate found, and it is a better candidate than its parent.
</span><del>-        // NB: A parent is considered a better candidate iff the node is
</del><ins>+        // NB: A parent is considered a better candidate if the node is
</ins><span class="cx">         // contained by it and it is the only child.
</span><del>-        if (found &amp;&amp; (!node-&gt;parentNode() || node-&gt;parentNode()-&gt;childNodeCount() != 1))
</del><ins>+        if (found &amp;&amp; (!node-&gt;parentNode() || !node-&gt;parentNode()-&gt;hasOneChild()))
</ins><span class="cx">             break;
</span><span class="cx"> 
</span><span class="cx">         node = node-&gt;parentNode();
</span></span></pre>
</div>
</div>

</body>
</html>