Commit 62b16970 authored by rniwa@webkit.org's avatar rniwa@webkit.org

2011-02-17 Ryosuke Niwa <rniwa@webkit.org>

        Reviewed by Kent Tamura.

        Rename Position::node() to Position::deprecatedNode()
        https://bugs.webkit.org/show_bug.cgi?id=54622

        Done the rename. All calls to node() are replaced by calls to deprecatedNode().

        * src/WebViewImpl.cpp:
        (WebKit::WebViewImpl::setComposition): Check the nullity of startContainer() instead of startPosition()->node().
        (WebKit::WebViewImpl::confirmComposition): Ditto.
        (WebKit::WebViewImpl::textInputType):
        (WebKit::WebViewImpl::caretOrSelectionBounds):
2011-02-17  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Kent Tamura.

        Rename Position::node() to Position::deprecatedNode()
        https://bugs.webkit.org/show_bug.cgi?id=54622

        Replaced the call to node() by a call to containerNode() because the returned node is
        used to determine whether or not the selected contents are editable and such a check
        must be done against the container node.

        * WebCoreSupport/EditorClientQt.cpp:
        (WebCore::EditorClientQt::handleKeyboardEvent):
2011-02-17  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Kent Tamura.

        Rename Position::node() to Position::deprecatedNode()
        https://bugs.webkit.org/show_bug.cgi?id=54622

        Done the rename. All calls to node() are replaced by calls to deprecatedNode().

        * webkit/webkitwebview.cpp:
        (webkit_web_view_popup_menu_handler):
2011-02-17  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Kent Tamura.

        Rename Position::node() to Position::deprecatedNode()
        https://bugs.webkit.org/show_bug.cgi?id=54622

        * WebView/WebFrame.mm:
        (-[WebFrame _smartDeleteRangeForProposedRange:]):
2011-02-17  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Kent Tamura.

        Rename Position::node() to Position::deprecatedNode()
        https://bugs.webkit.org/show_bug.cgi?id=54622

        Replaced the call to node() by a call to containerNode() because the returned node is
        used to determine whether or not the selected contents are editable and such a check
        must be done against the container node.

        * WebCoreSupport/EditorClientHaiku.cpp:
        (WebCore::EditorClientHaiku::handleKeyboardEvent):
2011-02-17  Ryosuke Niwa  <rniwa@webkit.org>

        Reviewed by Kent Tamura.

        Rename Position::node() to Position::deprecatedNode()
        https://bugs.webkit.org/show_bug.cgi?id=54622

        Done the rename. All calls to node() are replaced by calls to deprecatedNode() except when
        calls were of the form node()->document() and node()->inDocument() in which case they were
        replaced by anchorNode()->document() and anchorNode()->inDocument() respectively.

        * WebCore.exp.in: Added Position::containerNode.

        The rest abbreviated for simplicity. Please see svn log.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@79196 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 27659194
2011-02-17 Ryosuke Niwa <rniwa@webkit.org>
Reviewed by Kent Tamura.
Rename Position::node() to Position::deprecatedNode()
https://bugs.webkit.org/show_bug.cgi?id=54622
Done the rename. All calls to node() are replaced by calls to deprecatedNode() except when
calls were of the form node()->document() and node()->inDocument() in which case they were
replaced by anchorNode()->document() and anchorNode()->inDocument() respectively.
* WebCore.exp.in: Added Position::containerNode.
The rest abbreviated for simplicity. Please see svn log.
2011-02-20 Gavin Barraclough <barraclough@apple.com>
Build fix (remove includes).
......
......@@ -1226,6 +1226,7 @@ __ZNK7WebCore8Document6domainEv
__ZNK7WebCore8IntPointcv7CGPointEv
__ZNK7WebCore8IntPointcv8_NSPointEv
__ZNK7WebCore8Position10downstreamENS_27EditingBoundaryCrossingRuleE
__ZNK7WebCore8Position13containerNodeEv
__ZNK7WebCore8Position24parentAnchoredEquivalentEv
__ZNK7WebCore8Position25leadingWhitespacePositionENS_9EAffinityEb
__ZNK7WebCore8Position26trailingWhitespacePositionENS_9EAffinityEb
......
......@@ -578,7 +578,7 @@ VisiblePosition AXObjectCache::visiblePositionForTextMarkerData(TextMarkerData&
if (deepPos.isNull())
return VisiblePosition();
RenderObject* renderer = deepPos.node()->renderer();
RenderObject* renderer = deepPos.deprecatedNode()->renderer();
if (!renderer)
return VisiblePosition();
......@@ -586,7 +586,7 @@ VisiblePosition AXObjectCache::visiblePositionForTextMarkerData(TextMarkerData&
if (!cache->isIDinUse(textMarkerData.axID))
return VisiblePosition();
if (deepPos.node() != textMarkerData.node || deepPos.deprecatedEditingOffset() != textMarkerData.offset)
if (deepPos.deprecatedNode() != textMarkerData.node || deepPos.deprecatedEditingOffset() != textMarkerData.offset)
return VisiblePosition();
return visiblePos;
......@@ -602,7 +602,7 @@ void AXObjectCache::textMarkerDataForVisiblePosition(TextMarkerData& textMarkerD
return;
Position deepPos = visiblePos.deepEquivalent();
Node* domNode = deepPos.node();
Node* domNode = deepPos.deprecatedNode();
ASSERT(domNode);
if (!domNode)
return;
......
......@@ -222,9 +222,9 @@ static VisiblePosition updateAXLineStartForVisiblePosition(const VisiblePosition
if (tempPosition.isNull())
break;
p = tempPosition.deepEquivalent();
if (!p.node())
if (!p.deprecatedNode())
break;
renderer = p.node()->renderer();
renderer = p.deprecatedNode()->renderer();
if (!renderer || (renderer->isRenderBlock() && !p.deprecatedEditingOffset()))
break;
InlineBox* box;
......@@ -318,7 +318,7 @@ VisiblePositionRange AccessibilityObject::paragraphForPosition(const VisiblePosi
static VisiblePosition startOfStyleRange(const VisiblePosition visiblePos)
{
RenderObject* renderer = visiblePos.deepEquivalent().node()->renderer();
RenderObject* renderer = visiblePos.deepEquivalent().deprecatedNode()->renderer();
RenderObject* startRenderer = renderer;
RenderStyle* style = renderer->style();
......@@ -341,7 +341,7 @@ static VisiblePosition startOfStyleRange(const VisiblePosition visiblePos)
static VisiblePosition endOfStyleRange(const VisiblePosition& visiblePos)
{
RenderObject* renderer = visiblePos.deepEquivalent().node()->renderer();
RenderObject* renderer = visiblePos.deepEquivalent().deprecatedNode()->renderer();
RenderObject* endRenderer = renderer;
RenderStyle* style = renderer->style();
......@@ -649,7 +649,7 @@ AccessibilityObject* AccessibilityObject::accessibilityObjectForPosition(const V
if (visiblePos.isNull())
return 0;
RenderObject* obj = visiblePos.deepEquivalent().node()->renderer();
RenderObject* obj = visiblePos.deepEquivalent().deprecatedNode()->renderer();
if (!obj)
return 0;
......
......@@ -2482,13 +2482,13 @@ int AccessibilityRenderObject::indexForVisiblePosition(const VisiblePosition& po
return 0;
Position indexPosition = pos.deepEquivalent();
if (!indexPosition.node() || indexPosition.node()->rootEditableElement() != node)
if (!indexPosition.anchorNode() || indexPosition.anchorNode()->rootEditableElement() != node)
return 0;
ExceptionCode ec = 0;
RefPtr<Range> range = Range::create(m_renderer->document());
range->setStart(node, 0, ec);
range->setEnd(indexPosition.node(), indexPosition.deprecatedEditingOffset(), ec);
range->setEnd(indexPosition.anchorNode(), indexPosition.deprecatedEditingOffset(), ec);
return TextIterator::rangeLength(range.get());
}
......@@ -2621,7 +2621,7 @@ int AccessibilityRenderObject::index(const VisiblePosition& position) const
if (!isTextControl())
return -1;
Node* node = position.deepEquivalent().node();
Node* node = position.deepEquivalent().deprecatedNode();
if (!node)
return -1;
......
......@@ -1223,7 +1223,7 @@ static gint webkit_accessible_text_get_caret_offset(AtkText* text)
if (!coreObject->isAccessibilityRenderObject())
return 0;
Node* focusedNode = coreObject->selection().end().node();
Node* focusedNode = coreObject->selection().end().deprecatedNode();
if (!focusedNode)
return 0;
......
This diff is collapsed.
......@@ -105,7 +105,7 @@ public:
// FIXME: Callers should be moved off of node(), node() is not always the container for this position.
// For nodes which editingIgnoresContent(node()) returns true, positions like [ignoredNode, 0]
// will be treated as before ignoredNode (thus node() is really after the position, not containing it).
Node* node() const { return m_anchorNode.get(); }
Node* deprecatedNode() const { return m_anchorNode.get(); }
// These should only be used for PositionIsOffsetInAnchor positions, unless
// the position is a legacy editing position.
......
......@@ -134,11 +134,11 @@ void ApplyBlockElementCommand::formatSelection(const VisiblePosition& startOfSel
// indentIntoBlockquote could move more than one paragraph if the paragraph
// is in a list item or a table. As a result, endAfterSelection could refer to a position
// no longer in the document.
if (endAfterSelection.isNotNull() && !endAfterSelection.deepEquivalent().node()->inDocument())
if (endAfterSelection.isNotNull() && !endAfterSelection.deepEquivalent().anchorNode()->inDocument())
break;
// Sanity check: Make sure our moveParagraph calls didn't remove endOfNextParagraph.deepEquivalent().node()
// Sanity check: Make sure our moveParagraph calls didn't remove endOfNextParagraph.deepEquivalent().deprecatedNode()
// If somehow we did, return to prevent crashes.
if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent().node()->inDocument()) {
if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent().anchorNode()->inDocument()) {
ASSERT_NOT_REACHED();
return;
}
......@@ -182,8 +182,8 @@ void ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded(const
RenderStyle* startStyle = renderStyleOfEnclosingTextNode(start);
bool isStartAndEndOnSameNode = false;
if (startStyle) {
isStartAndEndOnSameNode = renderStyleOfEnclosingTextNode(end) && start.node() == end.node();
bool isStartAndEndOfLastParagraphOnSameNode = renderStyleOfEnclosingTextNode(m_endOfLastParagraph) && start.node() == m_endOfLastParagraph.node();
isStartAndEndOnSameNode = renderStyleOfEnclosingTextNode(end) && start.deprecatedNode() == end.deprecatedNode();
bool isStartAndEndOfLastParagraphOnSameNode = renderStyleOfEnclosingTextNode(m_endOfLastParagraph) && start.deprecatedNode() == m_endOfLastParagraph.deprecatedNode();
// Avoid obtanining the start of next paragraph for start
if (startStyle->preserveNewline() && isNewLineAtPosition(start) && !isNewLineAtPosition(start.previous()) && start.offsetInContainerNode() > 0)
......@@ -192,15 +192,15 @@ void ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded(const
// If start is in the middle of a text node, split.
if (!startStyle->collapseWhiteSpace() && start.offsetInContainerNode() > 0) {
int startOffset = start.offsetInContainerNode();
splitTextNode(static_cast<Text*>(start.node()), startOffset);
start = positionBeforeNode(start.node());
splitTextNode(static_cast<Text*>(start.deprecatedNode()), startOffset);
start = positionBeforeNode(start.deprecatedNode());
if (isStartAndEndOnSameNode) {
ASSERT(end.offsetInContainerNode() >= startOffset);
end = Position(end.node(), end.offsetInContainerNode() - startOffset, Position::PositionIsOffsetInAnchor);
end = Position(end.deprecatedNode(), end.offsetInContainerNode() - startOffset, Position::PositionIsOffsetInAnchor);
}
if (isStartAndEndOfLastParagraphOnSameNode) {
ASSERT(m_endOfLastParagraph.offsetInContainerNode() >= startOffset);
m_endOfLastParagraph = Position(m_endOfLastParagraph.node(), m_endOfLastParagraph.offsetInContainerNode() - startOffset,
m_endOfLastParagraph = Position(m_endOfLastParagraph.deprecatedNode(), m_endOfLastParagraph.offsetInContainerNode() - startOffset,
Position::PositionIsOffsetInAnchor);
}
}
......@@ -208,13 +208,13 @@ void ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded(const
RenderStyle* endStyle = renderStyleOfEnclosingTextNode(end);
if (endStyle) {
bool isEndAndEndOfLastParagraphOnSameNode = renderStyleOfEnclosingTextNode(m_endOfLastParagraph) && end.node() == m_endOfLastParagraph.node();
bool isEndAndEndOfLastParagraphOnSameNode = renderStyleOfEnclosingTextNode(m_endOfLastParagraph) && end.deprecatedNode() == m_endOfLastParagraph.deprecatedNode();
// Include \n at the end of line if we're at an empty paragraph
if (endStyle->preserveNewline() && start == end
&& end.offsetInContainerNode() < end.containerNode()->maxCharacterOffset()) {
int endOffset = end.offsetInContainerNode();
if (!isNewLineAtPosition(end.previous()) && isNewLineAtPosition(end))
end = Position(end.node(), endOffset + 1, Position::PositionIsOffsetInAnchor);
end = Position(end.deprecatedNode(), endOffset + 1, Position::PositionIsOffsetInAnchor);
if (isEndAndEndOfLastParagraphOnSameNode && end.offsetInContainerNode() >= m_endOfLastParagraph.offsetInContainerNode())
m_endOfLastParagraph = end;
}
......@@ -222,17 +222,17 @@ void ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded(const
// If end is in the middle of a text node, split.
if (!endStyle->collapseWhiteSpace() && end.offsetInContainerNode()
&& end.offsetInContainerNode() < end.containerNode()->maxCharacterOffset()) {
splitTextNode(static_cast<Text*>(end.node()), end.offsetInContainerNode());
splitTextNode(static_cast<Text*>(end.deprecatedNode()), end.offsetInContainerNode());
if (isStartAndEndOnSameNode)
start = positionBeforeNode(end.node()->previousSibling());
start = positionBeforeNode(end.deprecatedNode()->previousSibling());
if (isEndAndEndOfLastParagraphOnSameNode) {
if (m_endOfLastParagraph.offsetInContainerNode() == end.offsetInContainerNode())
m_endOfLastParagraph = lastPositionInNode(end.node()->previousSibling());
m_endOfLastParagraph = lastPositionInNode(end.deprecatedNode()->previousSibling());
else
m_endOfLastParagraph = Position(end.node(), m_endOfLastParagraph.offsetInContainerNode() - end.offsetInContainerNode(),
m_endOfLastParagraph = Position(end.deprecatedNode(), m_endOfLastParagraph.offsetInContainerNode() - end.offsetInContainerNode(),
Position::PositionIsOffsetInAnchor);
}
end = lastPositionInNode(end.node()->previousSibling());
end = lastPositionInNode(end.deprecatedNode()->previousSibling());
}
}
}
......
......@@ -67,7 +67,7 @@ void BreakBlockquoteCommand::doApply()
// Find the top-most blockquote from the start.
Element* topBlockquote = 0;
for (ContainerNode* node = pos.node()->parentNode(); node; node = node->parentNode()) {
for (ContainerNode* node = pos.deprecatedNode()->parentNode(); node; node = node->parentNode()) {
if (isMailBlockquote(node))
topBlockquote = static_cast<Element*>(node);
}
......@@ -103,11 +103,11 @@ void BreakBlockquoteCommand::doApply()
pos = pos.next();
// Adjust the position so we don't split at the beginning of a quote.
while (isFirstVisiblePositionInNode(VisiblePosition(pos), nearestMailBlockquote(pos.node())))
while (isFirstVisiblePositionInNode(VisiblePosition(pos), nearestMailBlockquote(pos.deprecatedNode())))
pos = pos.previous();
// startNode is the first node that we need to move to the new blockquote.
Node* startNode = pos.node();
Node* startNode = pos.deprecatedNode();
// Split at pos if in the middle of a text node.
if (startNode->isTextNode()) {
......
......@@ -101,7 +101,7 @@ EditingStyle::EditingStyle(const Position& position)
: m_shouldUseFixedDefaultFontSize(false)
, m_fontSizeDelta(NoFontDelta)
{
init(position.node(), OnlyInheritableProperties);
init(position.deprecatedNode(), OnlyInheritableProperties);
}
EditingStyle::EditingStyle(const CSSStyleDeclaration* style)
......@@ -346,7 +346,7 @@ void EditingStyle::prepareToApplyAt(const Position& position, ShouldPreserveWrit
PassRefPtr<EditingStyle> editingStyleIncludingTypingStyle(const Position& position)
{
RefPtr<EditingStyle> editingStyle = EditingStyle::create(position);
RefPtr<EditingStyle> typingStyle = position.node()->document()->frame()->selection()->typingStyle();
RefPtr<EditingStyle> typingStyle = position.anchorNode()->document()->frame()->selection()->typingStyle();
if (typingStyle && typingStyle->style())
editingStyle->style()->merge(copyEditingProperties(typingStyle->style()).get());
return editingStyle;
......
This diff is collapsed.
......@@ -60,8 +60,8 @@ void FormatBlockCommand::formatSelection(const VisiblePosition& startOfSelection
void FormatBlockCommand::formatRange(const Position& start, const Position& end, const Position& endOfSelection, RefPtr<Element>& blockNode)
{
Node* nodeToSplitTo = enclosingBlockToSplitTreeTo(start.node());
RefPtr<Node> outerBlock = (start.node() == nodeToSplitTo) ? start.node() : splitTreeToNode(start.node(), nodeToSplitTo);
Node* nodeToSplitTo = enclosingBlockToSplitTreeTo(start.deprecatedNode());
RefPtr<Node> outerBlock = (start.deprecatedNode() == nodeToSplitTo) ? start.deprecatedNode() : splitTreeToNode(start.deprecatedNode(), nodeToSplitTo);
RefPtr<Node> nodeAfterInsertionPosition = outerBlock;
RefPtr<Range> range = Range::create(document(), start, endOfSelection);
......
......@@ -59,7 +59,7 @@ IndentOutdentCommand::IndentOutdentCommand(Document* document, EIndentType typeO
bool IndentOutdentCommand::tryIndentingAsListItem(const Position& start, const Position& end)
{
// If our selection is not inside a list, bail out.
Node* lastNodeInSelectedParagraph = start.node();
Node* lastNodeInSelectedParagraph = start.deprecatedNode();
RefPtr<Element> listNode = enclosingList(lastNodeInSelectedParagraph);
if (!listNode)
return false;
......@@ -94,15 +94,15 @@ void IndentOutdentCommand::indentIntoBlockquote(const Position& start, const Pos
Node* nodeToSplitTo;
if (enclosingCell)
nodeToSplitTo = enclosingCell;
else if (enclosingList(start.node()))
nodeToSplitTo = enclosingBlock(start.node());
else if (enclosingList(start.deprecatedNode()))
nodeToSplitTo = enclosingBlock(start.deprecatedNode());
else
nodeToSplitTo = editableRootForPosition(start);
if (!nodeToSplitTo)
return;
RefPtr<Node> outerBlock = (start.node() == nodeToSplitTo) ? start.node() : splitTreeToNode(start.node(), nodeToSplitTo);
RefPtr<Node> outerBlock = (start.deprecatedNode() == nodeToSplitTo) ? start.deprecatedNode() : splitTreeToNode(start.deprecatedNode(), nodeToSplitTo);
if (!targetBlockquote) {
// Create a new blockquote and insert it as a child of the root editable element. We accomplish
......@@ -166,13 +166,13 @@ void IndentOutdentCommand::outdentParagraph()
return;
}
Node* enclosingBlockFlow = enclosingBlock(visibleStartOfParagraph.deepEquivalent().node());
Node* enclosingBlockFlow = enclosingBlock(visibleStartOfParagraph.deepEquivalent().deprecatedNode());
RefPtr<Node> splitBlockquoteNode = enclosingNode;
if (enclosingBlockFlow != enclosingNode)
splitBlockquoteNode = splitTreeToNode(enclosingBlockFlow, enclosingNode, true);
else {
// We split the blockquote at where we start outdenting.
splitElement(static_cast<Element*>(enclosingNode), visibleStartOfParagraph.deepEquivalent().node());
splitElement(static_cast<Element*>(enclosingNode), visibleStartOfParagraph.deepEquivalent().deprecatedNode());
}
RefPtr<Node> placeholder = createBreakElement(document());
insertNodeBefore(placeholder, splitBlockquoteNode);
......@@ -205,10 +205,10 @@ void IndentOutdentCommand::outdentRegion(const VisiblePosition& startOfSelection
// outdentParagraph could move more than one paragraph if the paragraph
// is in a list item. As a result, endAfterSelection and endOfNextParagraph
// could refer to positions no longer in the document.
if (endAfterSelection.isNotNull() && !endAfterSelection.deepEquivalent().node()->inDocument())
if (endAfterSelection.isNotNull() && !endAfterSelection.deepEquivalent().anchorNode()->inDocument())
break;
if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent().node()->inDocument()) {
if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent().anchorNode()->inDocument()) {
endOfCurrentParagraph = endingSelection().end();
endOfNextParagraph = endOfParagraph(endOfCurrentParagraph.next());
}
......
......@@ -57,11 +57,11 @@ void InsertLineBreakCommand::insertNodeAfterPosition(Node* node, const Position&
// Insert the BR after the caret position. In the case the
// position is a block, do an append. We don't want to insert
// the BR *after* the block.
Element* cb = pos.node()->enclosingBlockFlowElement();
if (cb == pos.node())
Element* cb = pos.deprecatedNode()->enclosingBlockFlowElement();
if (cb == pos.deprecatedNode())
appendNode(node, cb);
else
insertNodeAfter(node, pos.node());
insertNodeAfter(node, pos.deprecatedNode());
}
void InsertLineBreakCommand::insertNodeBeforePosition(Node* node, const Position& pos)
......@@ -69,11 +69,11 @@ void InsertLineBreakCommand::insertNodeBeforePosition(Node* node, const Position
// Insert the BR after the caret position. In the case the
// position is a block, do an append. We don't want to insert
// the BR *before* the block.
Element* cb = pos.node()->enclosingBlockFlowElement();
if (cb == pos.node())
Element* cb = pos.deprecatedNode()->enclosingBlockFlowElement();
if (cb == pos.deprecatedNode())
appendNode(node, cb);
else
insertNodeBefore(node, pos.node());
insertNodeBefore(node, pos.deprecatedNode());
}
// Whether we should insert a break element or a '\n'.
......@@ -83,7 +83,7 @@ bool InsertLineBreakCommand::shouldUseBreakElement(const Position& insertionPos)
// the input element, and in that case we need to check the input element's
// parent's renderer.
Position p(insertionPos.parentAnchoredEquivalent());
return p.node()->renderer() && !p.node()->renderer()->style()->preserveNewline();
return p.deprecatedNode()->renderer() && !p.deprecatedNode()->renderer()->style()->preserveNewline();
}
void InsertLineBreakCommand::doApply()
......@@ -114,7 +114,7 @@ void InsertLineBreakCommand::doApply()
// FIXME: Need to merge text nodes when inserting just after or before text.
if (isEndOfParagraph(caret) && !lineBreakExistsAtVisiblePosition(caret)) {
bool needExtraLineBreak = !pos.node()->hasTagName(hrTag) && !pos.node()->hasTagName(tableTag);
bool needExtraLineBreak = !pos.deprecatedNode()->hasTagName(hrTag) && !pos.deprecatedNode()->hasTagName(tableTag);
insertNodeAt(nodeToInsert.get(), pos);
......@@ -123,7 +123,7 @@ void InsertLineBreakCommand::doApply()
VisiblePosition endingPosition(positionBeforeNode(nodeToInsert.get()));
setEndingSelection(VisibleSelection(endingPosition));
} else if (pos.deprecatedEditingOffset() <= caretMinOffset(pos.node())) {
} else if (pos.deprecatedEditingOffset() <= caretMinOffset(pos.deprecatedNode())) {
insertNodeAt(nodeToInsert.get(), pos);
// Insert an extra br or '\n' if the just inserted one collapsed.
......@@ -133,12 +133,12 @@ void InsertLineBreakCommand::doApply()
setEndingSelection(VisibleSelection(positionInParentAfterNode(nodeToInsert.get()), DOWNSTREAM));
// If we're inserting after all of the rendered text in a text node, or into a non-text node,
// a simple insertion is sufficient.
} else if (pos.deprecatedEditingOffset() >= caretMaxOffset(pos.node()) || !pos.node()->isTextNode()) {
} else if (pos.deprecatedEditingOffset() >= caretMaxOffset(pos.deprecatedNode()) || !pos.deprecatedNode()->isTextNode()) {
insertNodeAt(nodeToInsert.get(), pos);
setEndingSelection(VisibleSelection(positionInParentAfterNode(nodeToInsert.get()), DOWNSTREAM));
} else if (pos.node()->isTextNode()) {
} else if (pos.deprecatedNode()->isTextNode()) {
// Split a text node
Text* textNode = static_cast<Text*>(pos.node());
Text* textNode = static_cast<Text*>(pos.deprecatedNode());
splitTextNode(textNode, pos.deprecatedEditingOffset());
insertNodeBefore(nodeToInsert, textNode);
Position endingPosition = firstPositionInNode(textNode);
......
......@@ -84,12 +84,12 @@ bool InsertListCommand::selectionHasListOfType(const VisibleSelection& selection
{
VisiblePosition start = selection.visibleStart();
if (!enclosingList(start.deepEquivalent().node()))
if (!enclosingList(start.deepEquivalent().deprecatedNode()))
return false;
VisiblePosition end = selection.visibleEnd();
while (start.isNotNull() && start != end) {
Element* listNode = enclosingList(start.deepEquivalent().node());
Element* listNode = enclosingList(start.deepEquivalent().deprecatedNode());
if (!listNode || !listNode->hasTagName(listTag))
return false;
start = startOfNextParagraph(start);
......@@ -143,7 +143,7 @@ void InsertListCommand::doApply()
// infinite loop and because there is no more work to be done.
// FIXME(<rdar://problem/5983974>): The endingSelection() may be incorrect here. Compute
// the new location of endOfSelection and use it as the end of the new selection.
if (!startOfLastParagraph.deepEquivalent().node()->inDocument())
if (!startOfLastParagraph.deepEquivalent().anchorNode()->inDocument())
return;
setEndingSelection(startOfCurrentParagraph);
......@@ -191,7 +191,7 @@ void InsertListCommand::doApplyForSingleParagraph(bool forceCreateList, const Qu
// FIXME: This will produce unexpected results for a selection that starts just before a
// table and ends inside the first cell, selectionForParagraphIteration should probably
// be renamed and deployed inside setEndingSelection().
Node* selectionNode = endingSelection().start().node();
Node* selectionNode = endingSelection().start().deprecatedNode();
Node* listChildNode = enclosingListChild(selectionNode);
bool switchListType = false;
if (listChildNode) {
......@@ -217,7 +217,7 @@ void InsertListCommand::doApplyForSingleParagraph(bool forceCreateList, const Qu
RefPtr<HTMLElement> newList = createHTMLElement(document(), listTag);
insertNodeBefore(newList, listNode);
Node* firstChildInList = enclosingListChild(VisiblePosition(firstPositionInNode(listNode.get())).deepEquivalent().node(), listNode.get());
Node* firstChildInList = enclosingListChild(VisiblePosition(firstPositionInNode(listNode.get())).deepEquivalent().deprecatedNode(), listNode.get());
Node* outerBlock = firstChildInList->isBlockFlow() ? firstChildInList : listNode.get();
moveParagraphWithClones(firstPositionInNode(listNode.get()), lastPositionInNode(listNode.get()), newList.get(), outerBlock);
......@@ -265,9 +265,9 @@ void InsertListCommand::unlistifyParagraph(const VisiblePosition& originalStart,
// A paragraph is visually a list item minus a list marker. The paragraph will be moved.
start = startOfParagraph(originalStart);
end = endOfParagraph(start);
nextListChild = enclosingListChild(end.next().deepEquivalent().node(), listNode);
nextListChild = enclosingListChild(end.next().deepEquivalent().deprecatedNode(), listNode);
ASSERT(nextListChild != listChildNode);
previousListChild = enclosingListChild(start.previous().deepEquivalent().node(), listNode);
previousListChild = enclosingListChild(start.previous().deepEquivalent().deprecatedNode(), listNode);
ASSERT(previousListChild != listChildNode);
}
// When removing a list, we must always create a placeholder to act as a point of insertion
......@@ -308,7 +308,7 @@ void InsertListCommand::unlistifyParagraph(const VisiblePosition& originalStart,
static Element* adjacentEnclosingList(const VisiblePosition& pos, const VisiblePosition& adjacentPos, const QualifiedName& listTag)
{
Element* listNode = outermostEnclosingList(adjacentPos.deepEquivalent().node());
Element* listNode = outermostEnclosingList(adjacentPos.deepEquivalent().deprecatedNode());
if (!listNode)
return 0;
......@@ -317,9 +317,9 @@ static Element* adjacentEnclosingList(const VisiblePosition& pos, const VisibleP
Node* currentCell = enclosingTableCell(adjacentPos.deepEquivalent());
if (!listNode->hasTagName(listTag)
|| listNode->contains(pos.deepEquivalent().node())
|| listNode->contains(pos.deepEquivalent().deprecatedNode())
|| previousCell != currentCell
|| enclosingList(listNode) != enclosingList(pos.deepEquivalent().node()))
|| enclosingList(listNode) != enclosingList(pos.deepEquivalent().deprecatedNode()))
return 0;
return listNode;
......@@ -351,7 +351,7 @@ PassRefPtr<HTMLElement> InsertListCommand::listifyParagraph(const VisiblePositio
listElement = createHTMLElement(document(), listTag);
appendNode(listItemElement, listElement);
if (start == end && isBlock(start.deepEquivalent().node())) {
if (start == end && isBlock(start.deepEquivalent().deprecatedNode())) {
// Inserting the list into an empty paragraph that isn't held open
// by a br or a '\n', will invalidate start and end. Insert
// a placeholder and then recompute start and end.
......@@ -367,7 +367,7 @@ PassRefPtr<HTMLElement> InsertListCommand::listifyParagraph(const VisiblePositio
// clean markup when inline elements are pushed down as far as possible.
Position insertionPos(start.deepEquivalent().upstream());
// Also avoid the containing list item.
Node* listChild = enclosingListChild(insertionPos.node());
Node* listChild = enclosingListChild(insertionPos.deprecatedNode());
if (listChild && listChild->hasTagName(liTag))
insertionPos = positionInParentBeforeNode(listChild);
......
......@@ -169,8 +169,8 @@ void InsertParagraphSeparatorCommand::doApply()
|| isTableCell(startBlock)
|| startBlock->hasTagName(formTag)
// FIXME: If the node is hidden, we don't have a canonical position so we will do the wrong thing for tables and <hr>. https://bugs.webkit.org/show_bug.cgi?id=40342
|| (!canonicalPos.isNull() && canonicalPos.node()->renderer() && canonicalPos.node()->renderer()->isTable())
|| (!canonicalPos.isNull() && canonicalPos.node()->hasTagName(hrTag))) {
|| (!canonicalPos.isNull() && canonicalPos.deprecatedNode()->renderer() && canonicalPos.deprecatedNode()->renderer()->isTable())
|| (!canonicalPos.isNull() && canonicalPos.deprecatedNode()->hasTagName(hrTag))) {
applyCommandToComposite(InsertLineBreakCommand::create(document()));
return;
}
......@@ -237,7 +237,7 @@ void InsertParagraphSeparatorCommand::doApply()
// Recreate the same structure in the new paragraph.
Vector<Element*> ancestors;
getAncestorsInsideBlock(insertionPosition.node(), startBlock, ancestors);
getAncestorsInsideBlock(insertionPosition.deprecatedNode(), startBlock, ancestors);
RefPtr<Element> parent = cloneHierarchyUnderNewBlock(ancestors, blockToInsert);
appendBlockPlaceholder(parent);
......@@ -254,11 +254,11 @@ void InsertParagraphSeparatorCommand::doApply()
Node *refNode;
if (isFirstInBlock && !nestNewBlock)
refNode = startBlock;
else if (insertionPosition.node() == startBlock && nestNewBlock) {
else if (insertionPosition.deprecatedNode() == startBlock && nestNewBlock) {
refNode = startBlock->childNode(insertionPosition.deprecatedEditingOffset());
ASSERT(refNode); // must be true or we'd be in the end of block case
} else
refNode = insertionPosition.node();
refNode = insertionPosition.deprecatedNode();
// find ending selection position easily before inserting the paragraph
insertionPosition = insertionPosition.downstream();
......@@ -268,7 +268,7 @@ void InsertParagraphSeparatorCommand::doApply()
// Recreate the same structure in the new paragraph.
Vector<Element*> ancestors;
getAncestorsInsideBlock(positionAvoidingSpecialElementBoundary(insertionPosition).node(), startBlock, ancestors);
getAncestorsInsideBlock(positionAvoidingSpecialElementBoundary(insertionPosition).deprecatedNode(), startBlock, ancestors);
appendBlockPlaceholder(cloneHierarchyUnderNewBlock(ancestors, blockToInsert));
......@@ -301,22 +301,22 @@ void InsertParagraphSeparatorCommand::doApply()
// Build up list of ancestors in between the start node and the start block.
Vector<Element*> ancestors;
getAncestorsInsideBlock(insertionPosition.node(), startBlock, ancestors);
getAncestorsInsideBlock(insertionPosition.deprecatedNode(), startBlock, ancestors);
// Make sure we do not cause a rendered space to become unrendered.
// FIXME: We need the affinity for pos, but pos.downstream() does not give it
Position leadingWhitespace = insertionPosition.leadingWhitespacePosition(VP_DEFAULT_AFFINITY);
// FIXME: leadingWhitespacePosition is returning the position before preserved newlines for positions
// after the preserved newline, causing the newline to be turned into a nbsp.
if (leadingWhitespace.isNotNull() && leadingWhitespace.node()->isTextNode()) {
Text* textNode = static_cast<Text*>(leadingWhitespace.node());
if (leadingWhitespace.isNotNull() && leadingWhitespace.deprecatedNode()->isTextNode()) {
Text* textNode = static_cast<Text*>(leadingWhitespace.deprecatedNode());
ASSERT(!textNode->renderer() || textNode->renderer()->style()->collapseWhiteSpace());
replaceTextInNode(textNode, leadingWhitespace.deprecatedEditingOffset(), 1, nonBreakingSpaceString());
}
// Split at pos if in the middle of a text node.
if (insertionPosition.node()->isTextNode()) {
Text* textNode = static_cast<Text*>(insertionPosition.node());
if (insertionPosition.deprecatedNode()->isTextNode()) {
Text* textNode = static_cast<Text*>(insertionPosition.deprecatedNode());
bool atEnd = (unsigned)insertionPosition.deprecatedEditingOffset() >= textNode->length();
if (insertionPosition.deprecatedEditingOffset() > 0 && !atEnd) {
splitTextNode(textNode, insertionPosition.deprecatedEditingOffset());
......@@ -344,8 +344,8 @@ void InsertParagraphSeparatorCommand::doApply()
appendNode(createBreakElement(document()).get(), blockToInsert.get());
// Move the start node and the siblings of the start node.
if (insertionPosition.node() != startBlock) {
Node* n = insertionPosition.node();
if (insertionPosition.deprecatedNode() != startBlock) {
Node* n = insertionPosition.deprecatedNode();
if (insertionPosition.deprecatedEditingOffset() >= caretMaxOffset(n))
n = n->nextSibling();