Diff
Modified: trunk/Source/WebCore/ChangeLog (173664 => 173665)
--- trunk/Source/WebCore/ChangeLog 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/ChangeLog 2014-09-16 18:28:57 UTC (rev 173665)
@@ -1,3 +1,79 @@
+2014-09-16 Chris Dumez <[email protected]>
+
+ Rename Node::nodeIndex() to computeNodeIndex() for clarity
+ https://bugs.webkit.org/show_bug.cgi?id=136826
+
+ Reviewed by Benjamin Poulain.
+
+ Rename Node::nodeIndex() to computeNodeIndex() to make it clear that
+ index is being computed and that calling this method is potentially
+ expensive.
+
+ No new tests, no behavior change.
+
+ * WebCore.exp.in:
+ * WebCore.order:
+ Rename exported symbol for Node::nodeIndex() as well.
+
+ * dom/Document.cpp:
+ (WebCore::Document::caretRangeFromPoint):
+ * dom/Node.cpp:
+ (WebCore::Node::computeNodeIndex):
+ (WebCore::Node::nodeIndex): Deleted.
+ * dom/Node.h:
+ * dom/NodeWithIndex.h:
+ (WebCore::NodeWithIndex::index):
+ Clean up implementation to reduce the scope of the Node variable and
+ to follow coding style (variable naming, spacing, star placement).
+
+ * dom/Position.cpp:
+ (WebCore::Position::computeOffsetInContainerNode):
+ (WebCore::Position::previous):
+ (WebCore::Position::next):
+ (WebCore::Position::upstream):
+ (WebCore::Position::downstream):
+ * dom/Position.h:
+ (WebCore::positionInParentBeforeNode):
+ (WebCore::positionInParentAfterNode):
+ * dom/Range.cpp:
+ (WebCore::Range::compareNode):
+ (WebCore::Range::intersectsNode):
+ (WebCore::Range::processContents):
+ (WebCore::Range::insertNode):
+ (WebCore::Range::setStartAfter):
+ (WebCore::Range::setEndBefore):
+ (WebCore::Range::setEndAfter):
+ (WebCore::Range::setStartBefore):
+ * dom/RangeBoundaryPoint.h:
+ (WebCore::RangeBoundaryPoint::ensureOffsetIsValid):
+ * editing/ApplyStyleCommand.cpp:
+ (WebCore::ApplyStyleCommand::mergeStartWithPreviousIfIdentical):
+ (WebCore::ApplyStyleCommand::mergeEndWithNextIfIdentical):
+ * editing/DeleteSelectionCommand.cpp:
+ (WebCore::DeleteSelectionCommand::handleGeneralDelete):
+ * editing/Editor.cpp:
+ (WebCore::Editor::avoidIntersectionWithDeleteButtonController):
+ * editing/FrameSelection.cpp:
+ (WebCore::FrameSelection::selectFrameElementInParentIfFullySelected):
+ * editing/ReplaceSelectionCommand.cpp:
+ (WebCore::ReplaceSelectionCommand::doApply):
+ * editing/TextIterator.cpp:
+ (WebCore::TextIterator::range):
+ (WebCore::SimplifiedBackwardsTextIterator::handleReplacedElement):
+ (WebCore::SimplifiedBackwardsTextIterator::handleNonTextNode):
+ * editing/htmlediting.cpp:
+ (WebCore::updatePositionForNodeRemoval):
+ * html/HTMLTextFormControlElement.cpp:
+ (WebCore::setContainerAndOffsetForRange):
+ * page/DOMSelection.cpp:
+ (WebCore::DOMSelection::getRangeAt):
+ (WebCore::DOMSelection::containsNode):
+ (WebCore::DOMSelection::shadowAdjustedOffset):
+ * rendering/RenderBlock.cpp:
+ (WebCore::positionForPointRespectingEditingBoundaries):
+ * rendering/RenderTreeAsText.cpp:
+ (WebCore::nodePosition):
+
2014-09-16 Jer Noble <[email protected]>
Videos with controls enabled never receive 'dragstart' events.
Modified: trunk/Source/WebCore/WebCore.exp.in (173664 => 173665)
--- trunk/Source/WebCore/WebCore.exp.in 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-09-16 18:28:57 UTC (rev 173665)
@@ -1887,8 +1887,8 @@
__ZNK7WebCore4Node11textContentEb
__ZNK7WebCore4Node13ownerDocumentEv
__ZNK7WebCore4Node14isDescendantOfEPKS0_
+__ZNK7WebCore4Node16computeNodeIndexEv
__ZNK7WebCore4Node28deprecatedShadowAncestorNodeEv
-__ZNK7WebCore4Node9nodeIndexEv
__ZNK7WebCore4Node9textRectsERN3WTF6VectorINS_7IntRectELm0ENS1_15CrashOnOverflowEEE
__ZNK7WebCore4Page10pluginDataEv
__ZNK7WebCore4Page14renderTreeSizeEv
Modified: trunk/Source/WebCore/WebCore.order (173664 => 173665)
--- trunk/Source/WebCore/WebCore.order 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/WebCore.order 2014-09-16 18:28:57 UTC (rev 173665)
@@ -8131,7 +8131,7 @@
__ZN3WTF9HashTableIPN7WebCore5RangeES3_NS_17IdentityExtractorENS_7PtrHashIS3_EENS_10HashTraitsIS3_EES8_E6rehashEi
__ZN7WebCore5Range10selectNodeEPNS_4NodeERi
__ZN7WebCore5Range14setStartBeforeEPNS_4NodeERi
-__ZNK7WebCore4Node9nodeIndexEv
+__ZNK7WebCore4Node16computeNodeIndexEv
__ZN7WebCore5Range8setStartEN3WTF10PassRefPtrINS_4NodeEEEiRi
__ZNK7WebCore13ContainerNode9childNodeEj
__ZN7WebCoreL30checkForDifferentRootContainerERKNS_18RangeBoundaryPointES2_
Modified: trunk/Source/WebCore/dom/Document.cpp (173664 => 173665)
--- trunk/Source/WebCore/dom/Document.cpp 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/dom/Document.cpp 2014-09-16 18:28:57 UTC (rev 173665)
@@ -1396,7 +1396,7 @@
Node* shadowAncestorNode = ancestorInThisScope(node);
if (shadowAncestorNode != node) {
- unsigned offset = shadowAncestorNode->nodeIndex();
+ unsigned offset = shadowAncestorNode->computeNodeIndex();
ContainerNode* container = shadowAncestorNode->parentNode();
return Range::create(*this, container, offset, container, offset);
}
Modified: trunk/Source/WebCore/dom/Node.cpp (173664 => 173665)
--- trunk/Source/WebCore/dom/Node.cpp 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/dom/Node.cpp 2014-09-16 18:28:57 UTC (rev 173665)
@@ -691,12 +691,11 @@
markAncestorsWithChildNeedsStyleRecalc(*this);
}
-unsigned Node::nodeIndex() const
+unsigned Node::computeNodeIndex() const
{
- Node *_tempNode = previousSibling();
- unsigned count=0;
- for ( count=0; _tempNode; count++ )
- _tempNode = _tempNode->previousSibling();
+ unsigned count = 0;
+ for (Node* sibling = previousSibling(); sibling; sibling = sibling->previousSibling())
+ ++count;
return count;
}
Modified: trunk/Source/WebCore/dom/Node.h (173664 => 173665)
--- trunk/Source/WebCore/dom/Node.h 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/dom/Node.h 2014-09-16 18:28:57 UTC (rev 173665)
@@ -383,7 +383,7 @@
WEBCORE_EXPORT LayoutRect renderRect(bool* isReplaced);
IntRect pixelSnappedRenderRect(bool* isReplaced) { return snappedIntRect(renderRect(isReplaced)); }
- WEBCORE_EXPORT unsigned nodeIndex() const;
+ WEBCORE_EXPORT unsigned computeNodeIndex() const;
// Returns the DOM ownerDocument attribute. This method never returns null, except in the case
// of a Document node.
Modified: trunk/Source/WebCore/dom/NodeWithIndex.h (173664 => 173665)
--- trunk/Source/WebCore/dom/NodeWithIndex.h 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/dom/NodeWithIndex.h 2014-09-16 18:28:57 UTC (rev 173665)
@@ -46,10 +46,10 @@
int index() const
{
if (!m_haveIndex) {
- m_index = m_node->nodeIndex();
+ m_index = m_node->computeNodeIndex();
m_haveIndex = true;
}
- ASSERT(m_index == static_cast<int>(m_node->nodeIndex()));
+ ASSERT(m_index == static_cast<int>(m_node->computeNodeIndex()));
return m_index;
}
Modified: trunk/Source/WebCore/dom/Position.cpp (173664 => 173665)
--- trunk/Source/WebCore/dom/Position.cpp 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/dom/Position.cpp 2014-09-16 18:28:57 UTC (rev 173665)
@@ -196,9 +196,9 @@
case PositionIsOffsetInAnchor:
return minOffsetForNode(m_anchorNode.get(), m_offset);
case PositionIsBeforeAnchor:
- return m_anchorNode->nodeIndex();
+ return m_anchorNode->computeNodeIndex();
case PositionIsAfterAnchor:
- return m_anchorNode->nodeIndex() + 1;
+ return m_anchorNode->computeNodeIndex() + 1;
}
ASSERT_NOT_REACHED();
return 0;
@@ -330,7 +330,7 @@
if (!parent)
return *this;
- return createLegacyEditingPosition(parent, n->nodeIndex());
+ return createLegacyEditingPosition(parent, n->computeNodeIndex());
}
Position Position::next(PositionMoveType moveType) const
@@ -362,7 +362,7 @@
if (!parent)
return *this;
- return createLegacyEditingPosition(parent, n->nodeIndex() + 1);
+ return createLegacyEditingPosition(parent, n->computeNodeIndex() + 1);
}
int Position::uncheckedPreviousOffset(const Node* n, int current)
@@ -614,7 +614,7 @@
lastVisible = currentPos;
// Don't move past a position that is visually distinct. We could rely on code above to terminate and
- // return lastVisible on the next iteration, but we terminate early to avoid doing a nodeIndex() call.
+ // return lastVisible on the next iteration, but we terminate early to avoid doing a computeNodeIndex() call.
if (endsOfNodeAreVisuallyDistinctPositions(currentNode) && currentPos.atStartOfNode())
return lastVisible;
@@ -732,7 +732,7 @@
return lastVisible;
// Do not move past a visually disinct position.
// Note: The first position after the last in a node whose ends are visually distinct
- // positions will be [boundary->parentNode(), originalBlock->nodeIndex() + 1].
+ // positions will be [boundary->parentNode(), originalBlock->computeNodeIndex() + 1].
if (boundary && boundary->parentNode() == currentNode)
return lastVisible;
Modified: trunk/Source/WebCore/dom/Position.h (173664 => 173665)
--- trunk/Source/WebCore/dom/Position.h 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/dom/Position.h 2014-09-16 18:28:57 UTC (rev 173665)
@@ -95,7 +95,7 @@
void clear() { m_anchorNode.clear(); m_offset = 0; m_anchorType = PositionIsOffsetInAnchor; m_isLegacyEditingPosition = false; }
// These are always DOM compliant values. Editing positions like [img, 0] (aka [img, before])
- // will return img->parentNode() and img->nodeIndex() from these functions.
+ // will return img->parentNode() and img->computeNodeIndex() from these functions.
WEBCORE_EXPORT Node* containerNode() const; // null for a before/after position anchored to a node with no parent
Text* containerText() const;
@@ -273,13 +273,13 @@
inline Position positionInParentBeforeNode(const Node* node)
{
ASSERT(node->parentNode());
- return Position(node->parentNode(), node->nodeIndex(), Position::PositionIsOffsetInAnchor);
+ return Position(node->parentNode(), node->computeNodeIndex(), Position::PositionIsOffsetInAnchor);
}
inline Position positionInParentAfterNode(const Node* node)
{
ASSERT(node->parentNode());
- return Position(node->parentNode(), node->nodeIndex() + 1, Position::PositionIsOffsetInAnchor);
+ return Position(node->parentNode(), node->computeNodeIndex() + 1, Position::PositionIsOffsetInAnchor);
}
// positionBeforeNode and positionAfterNode return neighbor-anchored positions, construction is O(1)
Modified: trunk/Source/WebCore/dom/Range.cpp (173664 => 173665)
--- trunk/Source/WebCore/dom/Range.cpp 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/dom/Range.cpp 2014-09-16 18:28:57 UTC (rev 173665)
@@ -395,7 +395,7 @@
}
ContainerNode* parentNode = refNode->parentNode();
- int nodeIndex = refNode->nodeIndex();
+ unsigned nodeIndex = refNode->computeNodeIndex();
if (!parentNode) {
// if the node is the top document we should return NODE_BEFORE_AND_AFTER
@@ -600,7 +600,7 @@
}
ContainerNode* parentNode = refNode->parentNode();
- int nodeIndex = refNode->nodeIndex();
+ unsigned nodeIndex = refNode->computeNodeIndex();
if (!parentNode) {
// if the node is the top document we should return NODE_BEFORE_AND_AFTER
@@ -751,9 +751,9 @@
// Collapse the range, making sure that the result is not within a node that was partially selected.
if (action == Extract || action == Delete) {
if (partialStart && commonRoot->contains(partialStart.get()))
- setStart(partialStart->parentNode(), partialStart->nodeIndex() + 1, ec);
+ setStart(partialStart->parentNode(), partialStart->computeNodeIndex() + 1, ec);
else if (partialEnd && commonRoot->contains(partialEnd.get()))
- setStart(partialEnd->parentNode(), partialEnd->nodeIndex(), ec);
+ setStart(partialEnd->parentNode(), partialEnd->computeNodeIndex(), ec);
if (ec)
return 0;
m_end = m_start;
@@ -1065,7 +1065,7 @@
if (firstInsertedChild->parentNode() == container)
m_start.setToBeforeChild(firstInsertedChild.get());
if (lastInsertedChild->parentNode() == container)
- m_end.set(container, lastInsertedChild->nodeIndex() + 1, lastInsertedChild.get());
+ m_end.set(container, lastInsertedChild->computeNodeIndex() + 1, lastInsertedChild.get());
}
}
}
@@ -1257,7 +1257,7 @@
if (ec)
return;
- setStart(refNode->parentNode(), refNode->nodeIndex() + 1, ec);
+ setStart(refNode->parentNode(), refNode->computeNodeIndex() + 1, ec);
}
void Range::setEndBefore(Node* refNode, ExceptionCode& ec)
@@ -1277,7 +1277,7 @@
if (ec)
return;
- setEnd(refNode->parentNode(), refNode->nodeIndex(), ec);
+ setEnd(refNode->parentNode(), refNode->computeNodeIndex(), ec);
}
void Range::setEndAfter(Node* refNode, ExceptionCode& ec)
@@ -1297,7 +1297,7 @@
if (ec)
return;
- setEnd(refNode->parentNode(), refNode->nodeIndex() + 1, ec);
+ setEnd(refNode->parentNode(), refNode->computeNodeIndex() + 1, ec);
}
void Range::selectNode(Node* refNode, ExceptionCode& ec)
@@ -1517,7 +1517,7 @@
if (ec)
return;
- setStart(refNode->parentNode(), refNode->nodeIndex(), ec);
+ setStart(refNode->parentNode(), refNode->computeNodeIndex(), ec);
}
void Range::checkDeleteExtract(ExceptionCode& ec)
Modified: trunk/Source/WebCore/dom/RangeBoundaryPoint.h (173664 => 173665)
--- trunk/Source/WebCore/dom/RangeBoundaryPoint.h 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/dom/RangeBoundaryPoint.h 2014-09-16 18:28:57 UTC (rev 173665)
@@ -95,7 +95,7 @@
return;
ASSERT(m_childBeforeBoundary);
- m_offsetInContainer = m_childBeforeBoundary->nodeIndex() + 1;
+ m_offsetInContainer = m_childBeforeBoundary->computeNodeIndex() + 1;
}
inline const Position RangeBoundaryPoint::toPosition() const
Modified: trunk/Source/WebCore/editing/ApplyStyleCommand.cpp (173664 => 173665)
--- trunk/Source/WebCore/editing/ApplyStyleCommand.cpp 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/editing/ApplyStyleCommand.cpp 2014-09-16 18:28:57 UTC (rev 173665)
@@ -1291,8 +1291,8 @@
ASSERT(startChild);
mergeIdenticalElements(previousElement, element);
- int startOffsetAdjustment = startChild->nodeIndex();
- int endOffsetAdjustment = startNode == end.deprecatedNode() ? startOffsetAdjustment : 0;
+ unsigned startOffsetAdjustment = startChild->computeNodeIndex();
+ unsigned endOffsetAdjustment = startNode == end.deprecatedNode() ? startOffsetAdjustment : 0;
updateStartEnd(Position(startNode, startOffsetAdjustment, Position::PositionIsOffsetInAnchor),
Position(end.deprecatedNode(), end.deprecatedEditingOffset() + endOffsetAdjustment, Position::PositionIsOffsetInAnchor));
return true;
@@ -1325,7 +1325,7 @@
mergeIdenticalElements(element, nextElement);
bool shouldUpdateStart = start.containerNode() == endNode;
- int endOffset = nextChild ? nextChild->nodeIndex() : nextElement->countChildNodes();
+ unsigned endOffset = nextChild ? nextChild->computeNodeIndex() : nextElement->countChildNodes();
updateStartEnd(shouldUpdateStart ? Position(nextElement, start.offsetInContainerNode(), Position::PositionIsOffsetInAnchor) : start,
Position(nextElement, endOffset, Position::PositionIsOffsetInAnchor));
return true;
Modified: trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp (173664 => 173665)
--- trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp 2014-09-16 18:28:57 UTC (rev 173665)
@@ -554,13 +554,13 @@
// FIXME: Make m_upstreamStart a position we update as we remove content, then we can
// always know which children to remove.
} else if (!(startNodeWasDescendantOfEndNode && !m_upstreamStart.anchorNode()->inDocument())) {
- int offset = 0;
+ unsigned offset = 0;
if (m_upstreamStart.deprecatedNode()->isDescendantOf(m_downstreamEnd.deprecatedNode())) {
Node* n = m_upstreamStart.deprecatedNode();
while (n && n->parentNode() != m_downstreamEnd.deprecatedNode())
n = n->parentNode();
if (n)
- offset = n->nodeIndex() + 1;
+ offset = n->computeNodeIndex() + 1;
}
removeChildrenInRange(m_downstreamEnd.deprecatedNode(), offset, m_downstreamEnd.deprecatedEditingOffset());
m_downstreamEnd = createLegacyEditingPosition(m_downstreamEnd.deprecatedNode(), offset);
Modified: trunk/Source/WebCore/editing/Editor.cpp (173664 => 173665)
--- trunk/Source/WebCore/editing/Editor.cpp 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/editing/Editor.cpp 2014-09-16 18:28:57 UTC (rev 173665)
@@ -163,12 +163,12 @@
if (startContainer == element || startContainer->isDescendantOf(element)) {
ASSERT(element->parentNode());
startContainer = element->parentNode();
- startOffset = element->nodeIndex();
+ startOffset = element->computeNodeIndex();
}
if (endContainer == element || endContainer->isDescendantOf(element)) {
ASSERT(element->parentNode());
endContainer = element->parentNode();
- endOffset = element->nodeIndex();
+ endOffset = element->computeNodeIndex();
}
return Range::create(range->ownerDocument(), startContainer, startOffset, endContainer, endOffset);
Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (173664 => 173665)
--- trunk/Source/WebCore/editing/FrameSelection.cpp 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp 2014-09-16 18:28:57 UTC (rev 173665)
@@ -1654,7 +1654,7 @@
return;
// Create compute positions before and after the element.
- unsigned ownerElementNodeIndex = ownerElement->nodeIndex();
+ unsigned ownerElementNodeIndex = ownerElement->computeNodeIndex();
VisiblePosition beforeOwnerElement(VisiblePosition(Position(ownerElementParent, ownerElementNodeIndex, Position::PositionIsOffsetInAnchor)));
VisiblePosition afterOwnerElement(VisiblePosition(Position(ownerElementParent, ownerElementNodeIndex + 1, Position::PositionIsOffsetInAnchor), VP_UPSTREAM_IF_POSSIBLE));
Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (173664 => 173665)
--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp 2014-09-16 18:28:57 UTC (rev 173665)
@@ -1140,7 +1140,7 @@
// We inserted before the insertionBlock to prevent nesting, and the content before the insertionBlock wasn't in its own block and
// didn't have a br after it, so the inserted content ended up in the same paragraph.
- if (insertionBlock && insertionPos.deprecatedNode() == insertionBlock->parentNode() && (unsigned)insertionPos.deprecatedEditingOffset() < insertionBlock->nodeIndex() && !isStartOfParagraph(startOfInsertedContent))
+ if (insertionBlock && insertionPos.deprecatedNode() == insertionBlock->parentNode() && (unsigned)insertionPos.deprecatedEditingOffset() < insertionBlock->computeNodeIndex() && !isStartOfParagraph(startOfInsertedContent))
insertNodeAt(createBreakElement(document()), startOfInsertedContent.deepEquivalent());
if (endBR && (plainTextFragment || shouldRemoveEndBR(endBR.get(), originalVisPosBeforeEndBR))) {
Modified: trunk/Source/WebCore/editing/TextIterator.cpp (173664 => 173665)
--- trunk/Source/WebCore/editing/TextIterator.cpp 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/editing/TextIterator.cpp 2014-09-16 18:28:57 UTC (rev 173665)
@@ -1095,7 +1095,7 @@
// use the current run information, if we have it
if (m_positionOffsetBaseNode) {
- int index = m_positionOffsetBaseNode->nodeIndex();
+ unsigned index = m_positionOffsetBaseNode->computeNodeIndex();
m_positionStartOffset += index;
m_positionEndOffset += index;
m_positionOffsetBaseNode = nullptr;
@@ -1327,7 +1327,7 @@
bool SimplifiedBackwardsTextIterator::handleReplacedElement()
{
- unsigned index = m_node->nodeIndex();
+ unsigned index = m_node->computeNodeIndex();
// We want replaced elements to behave like punctuation for boundary
// finding, and to simply take up space for the selection preservation
// code in moveParagraphs, so we use a comma. Unconditionally emit
@@ -1341,7 +1341,7 @@
// We can use a linefeed in place of a tab because this simple iterator is only used to
// find boundaries, not actual content. A linefeed breaks words, sentences, and paragraphs.
if (shouldEmitNewlineForNode(m_node, m_behavior & TextIteratorEmitsOriginalText) || shouldEmitNewlineAfterNode(*m_node) || shouldEmitTabBeforeNode(*m_node)) {
- unsigned index = m_node->nodeIndex();
+ unsigned index = m_node->computeNodeIndex();
// The start of this emitted range is wrong. Ensuring correctness would require
// VisiblePositions and so would be slow. previousBoundary expects this.
emitCharacter('\n', *m_node->parentNode(), index + 1, index + 1);
Modified: trunk/Source/WebCore/editing/htmlediting.cpp (173664 => 173665)
--- trunk/Source/WebCore/editing/htmlediting.cpp 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/editing/htmlediting.cpp 2014-09-16 18:28:57 UTC (rev 173665)
@@ -997,7 +997,7 @@
position = positionInParentBeforeNode(node);
break;
case Position::PositionIsOffsetInAnchor:
- if (position.containerNode() == node->parentNode() && static_cast<unsigned>(position.offsetInContainerNode()) > node->nodeIndex())
+ if (position.containerNode() == node->parentNode() && static_cast<unsigned>(position.offsetInContainerNode()) > node->computeNodeIndex())
position.moveToOffset(position.offsetInContainerNode() - 1);
else if (node->containsIncludingShadowDOM(position.containerNode()))
position = positionInParentBeforeNode(node);
Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp (173664 => 173665)
--- trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp 2014-09-16 18:28:57 UTC (rev 173665)
@@ -424,7 +424,7 @@
offsetInContainer = offset;
} else {
containerNode = node->parentNode();
- offsetInContainer = node->nodeIndex() + offset;
+ offsetInContainer = node->computeNodeIndex() + offset;
}
}
Modified: trunk/Source/WebCore/page/DOMSelection.cpp (173664 => 173665)
--- trunk/Source/WebCore/page/DOMSelection.cpp 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/page/DOMSelection.cpp 2014-09-16 18:28:57 UTC (rev 173665)
@@ -364,7 +364,7 @@
if (Node* shadowAncestor = selectionShadowAncestor(m_frame)) {
ContainerNode* container = shadowAncestor->parentNodeGuaranteedHostFree();
- int offset = shadowAncestor->nodeIndex();
+ unsigned offset = shadowAncestor->computeNodeIndex();
return Range::create(shadowAncestor->document(), container, offset, container, offset);
}
@@ -457,7 +457,7 @@
ContainerNode* parentNode = node->parentNode();
if (!parentNode || !parentNode->inDocument())
return false;
- unsigned nodeIndex = node->nodeIndex();
+ unsigned nodeIndex = node->computeNodeIndex();
ExceptionCode ec = 0;
bool nodeFullySelected = Range::compareBoundaryPoints(parentNode, nodeIndex, selectedRange->startContainer(), selectedRange->startOffset(), ec) >= 0 && !ec
@@ -523,7 +523,7 @@
if (containerNode == adjustedNode)
return position.computeOffsetInContainerNode();
- return adjustedNode->nodeIndex();
+ return adjustedNode->computeNodeIndex();
}
bool DOMSelection::isValidForPosition(Node* node) const
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (173664 => 173665)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2014-09-16 18:28:57 UTC (rev 173665)
@@ -2660,8 +2660,8 @@
LayoutUnit childMiddle = parent.logicalWidthForChild(child) / 2;
LayoutUnit logicalLeft = parent.isHorizontalWritingMode() ? pointInChildCoordinates.x() : pointInChildCoordinates.y();
if (logicalLeft < childMiddle)
- return ancestor->createVisiblePosition(childElement->nodeIndex(), DOWNSTREAM);
- return ancestor->createVisiblePosition(childElement->nodeIndex() + 1, UPSTREAM);
+ return ancestor->createVisiblePosition(childElement->computeNodeIndex(), DOWNSTREAM);
+ return ancestor->createVisiblePosition(childElement->computeNodeIndex() + 1, UPSTREAM);
}
VisiblePosition RenderBlock::positionForPointWithInlineChildren(const LayoutPoint&, const RenderRegion*)
Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (173664 => 173665)
--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2014-09-16 18:09:21 UTC (rev 173664)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2014-09-16 18:28:57 UTC (rev 173665)
@@ -828,7 +828,7 @@
result.append('}');
} else {
result.appendLiteral("child ");
- result.appendNumber(n->nodeIndex());
+ result.appendNumber(n->computeNodeIndex());
result.appendLiteral(" {");
result.append(getTagName(n));
result.append('}');