| Index: Source/core/editing/CompositeEditCommand.cpp
|
| diff --git a/Source/core/editing/CompositeEditCommand.cpp b/Source/core/editing/CompositeEditCommand.cpp
|
| index cff9e6b0839f146cab44c3f9515539ac3a7893eb..403870180004667b9e17ddea531e074e4fa16081 100644
|
| --- a/Source/core/editing/CompositeEditCommand.cpp
|
| +++ b/Source/core/editing/CompositeEditCommand.cpp
|
| @@ -356,7 +356,7 @@ void CompositeEditCommand::insertNodeAt(const Handle<Node>& insertChild, const P
|
| Handle<Node> refChild = p.deprecatedNode();
|
| int offset = p.deprecatedEditingOffset();
|
|
|
| - if (canHaveChildrenForEditing(refChild.raw())) {
|
| + if (canHaveChildrenForEditing(refChild)) {
|
| Handle<Node> child = refChild->firstChild();
|
| for (int i = 0; child && i < offset; i++)
|
| child = child->nextSibling();
|
| @@ -364,10 +364,10 @@ void CompositeEditCommand::insertNodeAt(const Handle<Node>& insertChild, const P
|
| insertNodeBefore(insertChild, child);
|
| else
|
| appendNode(insertChild, toContainerNode(refChild));
|
| - } else if (caretMinOffset(refChild.raw()) >= offset)
|
| + } else if (caretMinOffset(refChild) >= offset)
|
| insertNodeBefore(insertChild, refChild);
|
| - else if (refChild->isTextNode() && caretMaxOffset(refChild.raw()) > offset) {
|
| - splitTextNode(toText(refChild.raw()), offset);
|
| + else if (refChild->isTextNode() && caretMaxOffset(refChild) > offset) {
|
| + splitTextNode(toText(refChild), offset);
|
|
|
| // Mutation events (bug 22634) from the text node insertion may have removed the refChild
|
| if (!refChild->inDocument())
|
| @@ -379,7 +379,7 @@ void CompositeEditCommand::insertNodeAt(const Handle<Node>& insertChild, const P
|
|
|
| void CompositeEditCommand::appendNode(const Handle<Node>& node, const Handle<ContainerNode>& parent)
|
| {
|
| - ASSERT(canHaveChildrenForEditing(parent.raw()));
|
| + ASSERT(canHaveChildrenForEditing(parent));
|
| applyCommandToComposite(AppendNodeCommand::create(parent, node));
|
| }
|
|
|
| @@ -440,7 +440,7 @@ void CompositeEditCommand::moveRemainingSiblingsToNewParent(const Handle<Node>&
|
| void CompositeEditCommand::updatePositionForNodeRemovalPreservingChildren(Position& position, const Handle<Node>& node)
|
| {
|
| int offset = (position.anchorType() == Position::PositionIsOffsetInAnchor) ? position.offsetInContainerNode() : 0;
|
| - updatePositionForNodeRemoval(position, node.raw());
|
| + updatePositionForNodeRemoval(position, node);
|
| if (offset)
|
| position.moveToOffset(offset);
|
| }
|
| @@ -461,7 +461,7 @@ Result<HTMLElement> CompositeEditCommand::replaceElementWithSpanPreservingChildr
|
|
|
| void CompositeEditCommand::prune(const Handle<Node>& node)
|
| {
|
| - if (Handle<Node> highestNodeToRemove = adoptRawResult(highestNodeToRemoveInPruning(node.raw())))
|
| + if (Handle<Node> highestNodeToRemove = highestNodeToRemoveInPruning(node))
|
| removeNode(highestNodeToRemove);
|
| }
|
|
|
| @@ -521,7 +521,7 @@ Position CompositeEditCommand::replaceSelectedTextInNode(const String& text)
|
| {
|
| Position start = endingSelection().start();
|
| Position end = endingSelection().end();
|
| - if (start.containerNode() != end.containerNode() || !start.containerNode()->isTextNode() || isTabSpanTextNode(start.containerNode().handle().raw()))
|
| + if (start.containerNode() != end.containerNode() || !start.containerNode()->isTextNode() || isTabSpanTextNode(start.containerNode()))
|
| return Position();
|
|
|
| Handle<Text> textNode = start.containerText();
|
| @@ -554,7 +554,7 @@ void CompositeEditCommand::replaceTextInNodePreservingMarkers(const Handle<Text>
|
|
|
| Position CompositeEditCommand::positionOutsideTabSpan(const Position& pos)
|
| {
|
| - if (!isTabSpanTextNode(pos.anchorNode().handle().raw()))
|
| + if (!isTabSpanTextNode(pos.anchorNode()))
|
| return pos;
|
|
|
| switch (pos.anchorType()) {
|
| @@ -570,15 +570,15 @@ Position CompositeEditCommand::positionOutsideTabSpan(const Position& pos)
|
| return positionInParentAfterNode(pos.anchorNode());
|
| }
|
|
|
| - Handle<Node> tabSpan = adoptRawResult(tabSpanNode(pos.containerNode().handle().raw()));
|
| + Handle<Node> tabSpan = tabSpanNode(pos.containerNode());
|
|
|
| - if (pos.offsetInContainerNode() <= caretMinOffset(pos.containerNode().handle().raw()))
|
| + if (pos.offsetInContainerNode() <= caretMinOffset(pos.containerNode()))
|
| return positionInParentBeforeNode(tabSpan);
|
|
|
| - if (pos.offsetInContainerNode() >= caretMaxOffset(pos.containerNode().handle().raw()))
|
| + if (pos.offsetInContainerNode() >= caretMaxOffset(pos.containerNode()))
|
| return positionInParentAfterNode(tabSpan);
|
|
|
| - splitTextNodeContainingElement(toText(pos.containerNode().handle().raw()), pos.offsetInContainerNode());
|
| + splitTextNodeContainingElement(toText(pos.containerNode()), pos.offsetInContainerNode());
|
| return positionInParentBeforeNode(tabSpan);
|
| }
|
|
|
| @@ -947,7 +947,7 @@ Result<Node> CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary(co
|
| return nullptr;
|
|
|
| // Perform some checks to see if we need to perform work in this function.
|
| - if (isBlock(upstreamStart.deprecatedNode().handle().raw())) {
|
| + if (isBlock(upstreamStart.deprecatedNode())) {
|
| // If the block is the root editable element, always move content to a new block,
|
| // since it is illegal to modify attributes on the root editable element for editing.
|
| if (upstreamStart.deprecatedNode() == editableRootForPosition(upstreamStart)) {
|
| @@ -955,16 +955,16 @@ Result<Node> CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary(co
|
| // block but don't try and move content into it, since there's nothing for moveParagraphs to move.
|
| if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(upstreamStart.deprecatedNode()->renderer()))
|
| return insertNewDefaultParagraphElementAt(upstreamStart);
|
| - } else if (isBlock(upstreamEnd.deprecatedNode().handle().raw())) {
|
| + } else if (isBlock(upstreamEnd.deprecatedNode())) {
|
| if (!upstreamEnd.deprecatedNode()->isDescendantOf(upstreamStart.deprecatedNode().handle().raw())) {
|
| // If the paragraph end is a descendant of paragraph start, then we need to run
|
| // the rest of this function. If not, we can bail here.
|
| return nullptr;
|
| }
|
| - } else if (enclosingBlock(upstreamEnd.deprecatedNode().handle().raw()) != upstreamStart.deprecatedNode().handle().raw()) {
|
| + } else if (enclosingBlock(upstreamEnd.deprecatedNode()) != upstreamStart.deprecatedNode()) {
|
| // The visibleEnd. It must be an ancestor of the paragraph start.
|
| // We can bail as we have a full block to work with.
|
| - ASSERT(upstreamStart.deprecatedNode()->isDescendantOf(enclosingBlock(upstreamEnd.deprecatedNode().handle().raw()).handle().raw()));
|
| + ASSERT(upstreamStart.deprecatedNode()->isDescendantOf(enclosingBlock(upstreamEnd.deprecatedNode()).handle().raw()));
|
| return nullptr;
|
| } else if (isEndOfEditableOrNonEditableContent(visibleEnd)) {
|
| // At the end of the editable region. We can bail here as well.
|
| @@ -1010,7 +1010,7 @@ void CompositeEditCommand::cloneParagraphUnderNewElement(Position& start, Positi
|
| if (outerNode->isRootEditableElement()) {
|
| lastNode = blockElement;
|
| } else {
|
| - lastNode = outerNode->cloneNode(isTableElement(outerNode.raw()));
|
| + lastNode = outerNode->cloneNode(isTableElement(outerNode));
|
| appendNode(lastNode, blockElement);
|
| }
|
|
|
| @@ -1028,7 +1028,7 @@ void CompositeEditCommand::cloneParagraphUnderNewElement(Position& start, Positi
|
| for (size_t i = ancestors->size(); i != 0; --i) {
|
| HandleScope scope;
|
| Handle<Node> item = ancestors[i - 1];
|
| - Handle<Node> child = item->cloneNode(isTableElement(item.raw()));
|
| + Handle<Node> child = item->cloneNode(isTableElement(item));
|
| appendNode(child, Handle<Element>::cast(lastNode));
|
| lastNode = child;
|
| }
|
| @@ -1087,7 +1087,7 @@ void CompositeEditCommand::cleanupAfterDeletion(VisiblePosition destination)
|
| // doesn't require a placeholder to prop itself open (like a bordered
|
| // div or an li), remove it during the move (the list removal code
|
| // expects this behavior).
|
| - else if (isBlock(node.raw())) {
|
| + else if (isBlock(node)) {
|
| // If caret position after deletion and destination position coincides,
|
| // node should not be removed.
|
| if (!position.rendersInDifferentPosition(destination.deepEquivalent())) {
|
| @@ -1148,7 +1148,7 @@ void CompositeEditCommand::moveParagraphWithClones(const VisiblePosition& startO
|
| beforeParagraph = VisiblePosition(beforeParagraph.deepEquivalent());
|
| afterParagraph = VisiblePosition(afterParagraph.deepEquivalent());
|
|
|
| - if (beforeParagraph.isNotNull() && !isTableElement(beforeParagraph.deepEquivalent().deprecatedNode().handle().raw())
|
| + if (beforeParagraph.isNotNull() && !isTableElement(beforeParagraph.deepEquivalent().deprecatedNode())
|
| && ((!isEndOfParagraph(beforeParagraph) && !isStartOfParagraph(beforeParagraph)) || beforeParagraph == afterParagraph)) {
|
| // FIXME: Trim text between beforeParagraph and afterParagraph if they aren't equal.
|
| insertNodeAt(createBreakElement(document()), beforeParagraph.deepEquivalent());
|
| @@ -1286,7 +1286,7 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
|
| // FIXME: Send an appropriate shouldDeleteRange call.
|
| bool CompositeEditCommand::breakOutOfEmptyListItem()
|
| {
|
| - Handle<Node> emptyListItem = adoptRawResult(enclosingEmptyListItem(endingSelection().visibleStart()));
|
| + Handle<Node> emptyListItem = enclosingEmptyListItem(endingSelection().visibleStart());
|
| if (!emptyListItem)
|
| return false;
|
|
|
| @@ -1304,7 +1304,7 @@ bool CompositeEditCommand::breakOutOfEmptyListItem()
|
| Handle<Element> newBlock;
|
| if (Handle<ContainerNode> blockEnclosingList = listNode->parentNode()) {
|
| if (blockEnclosingList->hasTagName(liTag)) { // listNode is inside another list item
|
| - if (visiblePositionAfterNode(blockEnclosingList.raw()) == visiblePositionAfterNode(listNode.raw())) {
|
| + if (visiblePositionAfterNode(blockEnclosingList) == visiblePositionAfterNode(listNode)) {
|
| // If listNode appears at the end of the outer list item, then move listNode outside of this list item
|
| // e.g. <ul><li>hello <ul><li><br></li></ul> </li></ul> should become <ul><li>hello</li> <ul><li><br></li></ul> </ul> after this section
|
| // If listNode does NOT appear at the end, then we should consider it as a regular paragraph.
|
| @@ -1322,9 +1322,9 @@ bool CompositeEditCommand::breakOutOfEmptyListItem()
|
|
|
| Handle<Node> previousListNode = emptyListItem->isElementNode() ? Result<Node>(toElement(emptyListItem)->previousElementSibling()) : emptyListItem->previousSibling();
|
| Handle<Node> nextListNode = emptyListItem->isElementNode() ? Result<Node>(toElement(emptyListItem)->nextElementSibling()) : emptyListItem->nextSibling();
|
| - if (isListItem(nextListNode.raw()) || isListElement(nextListNode.raw())) {
|
| + if (isListItem(nextListNode) || isListElement(nextListNode)) {
|
| // If emptyListItem follows another list item or nested list, split the list node.
|
| - if (isListItem(previousListNode.raw()) || isListElement(previousListNode.raw()))
|
| + if (isListItem(previousListNode) || isListElement(previousListNode))
|
| splitElement(toElement(listNode), emptyListItem);
|
|
|
| // If emptyListItem is followed by other list item or nested list, then insert newBlock before the list node.
|
| @@ -1336,7 +1336,7 @@ bool CompositeEditCommand::breakOutOfEmptyListItem()
|
| // When emptyListItem does not follow any list item or nested list, insert newBlock after the enclosing list node.
|
| // Remove the enclosing node if emptyListItem is the only child; otherwise just remove emptyListItem.
|
| insertNodeAfter(newBlock, listNode);
|
| - removeNode(isListItem(previousListNode.raw()) || isListElement(previousListNode.raw()) ? emptyListItem : Handle<Node>(listNode));
|
| + removeNode(isListItem(previousListNode) || isListElement(previousListNode) ? emptyListItem : Handle<Node>(listNode));
|
| }
|
|
|
| appendBlockPlaceholder(newBlock);
|
| @@ -1357,7 +1357,7 @@ bool CompositeEditCommand::breakOutOfEmptyMailBlockquotedParagraph()
|
| return false;
|
|
|
| VisiblePosition caret(endingSelection().visibleStart());
|
| - Node* highestBlockquote = highestEnclosingNodeOfType(caret.deepEquivalent(), &isMailBlockquote);
|
| + Handle<Node> highestBlockquote = highestEnclosingNodeOfType(caret.deepEquivalent(), &isMailBlockquote);
|
| if (!highestBlockquote)
|
| return false;
|
|
|
| @@ -1372,7 +1372,7 @@ bool CompositeEditCommand::breakOutOfEmptyMailBlockquotedParagraph()
|
| Handle<Node> br = createBreakElement(document());
|
| // We want to replace this quoted paragraph with an unquoted one, so insert a br
|
| // to hold the caret before the highest blockquote.
|
| - insertNodeBefore(br, adoptRawResult(highestBlockquote));
|
| + insertNodeBefore(br, highestBlockquote);
|
| VisiblePosition atBR(positionBeforeNode(br));
|
| // If the br we inserted collapsed, for example foo<br><blockquote>...</blockquote>, insert
|
| // a second one.
|
| @@ -1413,14 +1413,14 @@ Position CompositeEditCommand::positionAvoidingSpecialElementBoundary(const Posi
|
| return original;
|
|
|
| VisiblePosition visiblePos(original);
|
| - Handle<Node> enclosingAnchor = adoptRawResult(enclosingAnchorElement(original));
|
| + Handle<Node> enclosingAnchor = enclosingAnchorElement(original);
|
| Position result = original;
|
|
|
| if (!enclosingAnchor)
|
| return result;
|
|
|
| // Don't avoid block level anchors, because that would insert content into the wrong paragraph.
|
| - if (enclosingAnchor && !isBlock(enclosingAnchor.raw())) {
|
| + if (enclosingAnchor && !isBlock(enclosingAnchor)) {
|
| VisiblePosition firstInAnchor(firstPositionInNode(enclosingAnchor));
|
| VisiblePosition lastInAnchor(lastPositionInNode(enclosingAnchor));
|
| // If visually just after the anchor, insert *inside* the anchor unless it's the last
|
| @@ -1430,7 +1430,7 @@ Position CompositeEditCommand::positionAvoidingSpecialElementBoundary(const Posi
|
| // also avoid structural elements like lists and blocks (5142012).
|
| if (original.deprecatedNode() != enclosingAnchor && original.deprecatedNode()->parentNode() != enclosingAnchor) {
|
| pushAnchorElementDown(enclosingAnchor);
|
| - enclosingAnchor = adoptRawResult(enclosingAnchorElement(original));
|
| + enclosingAnchor = enclosingAnchorElement(original);
|
| if (!enclosingAnchor)
|
| return original;
|
| }
|
| @@ -1449,7 +1449,7 @@ Position CompositeEditCommand::positionAvoidingSpecialElementBoundary(const Posi
|
| // also avoid structural elements like lists and blocks (5142012).
|
| if (original.deprecatedNode() != enclosingAnchor && original.deprecatedNode()->parentNode() != enclosingAnchor) {
|
| pushAnchorElementDown(enclosingAnchor);
|
| - enclosingAnchor = adoptRawResult(enclosingAnchorElement(original));
|
| + enclosingAnchor = enclosingAnchorElement(original);
|
| }
|
| if (!enclosingAnchor)
|
| return original;
|
| @@ -1483,7 +1483,7 @@ Result<Node> CompositeEditCommand::splitTreeToNode(const Handle<Node>& start, co
|
| break;
|
| // Do not split a node when doing so introduces an empty node.
|
| VisiblePosition positionInParent = firstPositionInNode(node->parentNode());
|
| - VisiblePosition positionInNode = firstPositionInOrBeforeNode(node.raw());
|
| + VisiblePosition positionInNode = firstPositionInOrBeforeNode(node);
|
| if (positionInParent != positionInNode)
|
| splitElement(toElement(node->parentNode()), node);
|
| }
|
|
|