| Index: Source/core/editing/ApplyStyleCommand.cpp
|
| diff --git a/Source/core/editing/ApplyStyleCommand.cpp b/Source/core/editing/ApplyStyleCommand.cpp
|
| index 206fd80fac38ce14db5e76f7b4f570de3c172e99..37d26a9fcc420208313b6e240e4ddc2c394d5a35 100644
|
| --- a/Source/core/editing/ApplyStyleCommand.cpp
|
| +++ b/Source/core/editing/ApplyStyleCommand.cpp
|
| @@ -265,7 +265,7 @@ void ApplyStyleCommand::applyBlockStyle(EditingStyle *style)
|
| HandleScope scope;
|
| StyleChange styleChange(style, paragraphStart.deepEquivalent());
|
| if (styleChange.cssStyle().length() || m_removeOnly) {
|
| - Handle<Node> block = enclosingBlock(paragraphStart.deepEquivalent().deprecatedNode().handle().raw());
|
| + Handle<Node> block = enclosingBlock(paragraphStart.deepEquivalent().deprecatedNode());
|
| if (!m_removeOnly) {
|
| Handle<Node> newBlock = moveParagraphContentsToNewBlockIfNecessary(paragraphStart.deepEquivalent());
|
| if (newBlock)
|
| @@ -357,7 +357,7 @@ void ApplyStyleCommand::applyRelativeFontStyleChange(EditingStyle* style)
|
|
|
| start = start.upstream(); // Move upstream to ensure we do not add redundant spans.
|
| Handle<Node> startNode = start.deprecatedNode();
|
| - if (startNode->isTextNode() && start.deprecatedEditingOffset() >= caretMaxOffset(startNode.raw())) // Move out of text node if range does not include its characters.
|
| + if (startNode->isTextNode() && start.deprecatedEditingOffset() >= caretMaxOffset(startNode)) // Move out of text node if range does not include its characters.
|
| startNode = NodeTraversal::next(startNode);
|
|
|
| // Store away font size before making any changes to the document.
|
| @@ -452,7 +452,7 @@ Result<HTMLElement> ApplyStyleCommand::splitAncestorsWithUnicodeBidi(const Handl
|
| {
|
| // We are allowed to leave the highest ancestor with unicode-bidi unsplit if it is unicode-bidi: embed and direction: allowedDirection.
|
| // In that case, we return the unsplit ancestor. Otherwise, we return 0.
|
| - Handle<Node> block = enclosingBlock(node.raw());
|
| + Handle<Node> block = enclosingBlock(node);
|
| if (!block)
|
| return nullptr;
|
|
|
| @@ -504,7 +504,7 @@ Result<HTMLElement> ApplyStyleCommand::splitAncestorsWithUnicodeBidi(const Handl
|
|
|
| void ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock(const Handle<Node>& node, const Handle<Node>& unsplitAncestor)
|
| {
|
| - Handle<Node> block = enclosingBlock(node.raw());
|
| + Handle<Node> block = enclosingBlock(node);
|
| if (!block)
|
| return;
|
|
|
| @@ -659,8 +659,8 @@ void ApplyStyleCommand::applyInlineStyle(EditingStyle* style)
|
| RefPtr<EditingStyle> styleToApply = style;
|
| if (hasTextDirection) {
|
| // Avoid applying the unicode-bidi and direction properties beneath ancestors that already have them.
|
| - Handle<Node> embeddingStartNode = highestEmbeddingAncestor(start.deprecatedNode(), enclosingBlock(start.deprecatedNode().handle().raw()));
|
| - Handle<Node> embeddingEndNode = highestEmbeddingAncestor(end.deprecatedNode(), enclosingBlock(end.deprecatedNode().handle().raw()));
|
| + Handle<Node> embeddingStartNode = highestEmbeddingAncestor(start.deprecatedNode(), enclosingBlock(start.deprecatedNode()));
|
| + Handle<Node> embeddingEndNode = highestEmbeddingAncestor(end.deprecatedNode(), enclosingBlock(end.deprecatedNode()));
|
|
|
| if (embeddingStartNode || embeddingEndNode) {
|
| Position embeddingApplyStart = embeddingStartNode ? positionInParentAfterNode(embeddingStartNode) : start;
|
| @@ -689,14 +689,14 @@ void ApplyStyleCommand::fixRangeAndApplyInlineStyle(EditingStyle* style, const P
|
| {
|
| Handle<Node> startNode = start.deprecatedNode();
|
|
|
| - if (start.deprecatedEditingOffset() >= caretMaxOffset(start.deprecatedNode().handle().raw())) {
|
| + if (start.deprecatedEditingOffset() >= caretMaxOffset(start.deprecatedNode())) {
|
| startNode = NodeTraversal::next(startNode);
|
| - if (!startNode || comparePositions(end, firstPositionInOrBeforeNode(startNode.raw())) < 0)
|
| + if (!startNode || comparePositions(end, firstPositionInOrBeforeNode(startNode)) < 0)
|
| return;
|
| }
|
|
|
| Handle<Node> pastEndNode = end.deprecatedNode();
|
| - if (end.deprecatedEditingOffset() >= caretMaxOffset(end.deprecatedNode().handle().raw()))
|
| + if (end.deprecatedEditingOffset() >= caretMaxOffset(end.deprecatedNode()))
|
| pastEndNode = NodeTraversal::nextSkippingChildren(end.deprecatedNode());
|
|
|
| // FIXME: Callers should perform this operation on a Range that includes the br
|
| @@ -712,7 +712,7 @@ void ApplyStyleCommand::fixRangeAndApplyInlineStyle(EditingStyle* style, const P
|
| if (startNode != editableRoot) {
|
| while (1) {
|
| HandleScope scope;
|
| - if (!editableRoot || startNode->parentNode() == editableRoot || !isNodeVisiblyContainedWithin(startNode->parentNode().handle().raw(), range))
|
| + if (!editableRoot || startNode->parentNode() == editableRoot || !isNodeVisiblyContainedWithin(startNode->parentNode(), range))
|
| break;
|
| startNode = startNode->parentNode();
|
| }
|
| @@ -789,13 +789,13 @@ void ApplyStyleCommand::applyInlineStyleToNodeRange(EditingStyle* style, const H
|
| continue;
|
| }
|
|
|
| - if (isBlock(node.raw()))
|
| + if (isBlock(node))
|
| continue;
|
|
|
| if (node->childNodeCount()) {
|
| if (node->contains(pastEndNode) || containsNonEditableRegion(node) || !node->parentNode()->rendererIsEditable())
|
| continue;
|
| - if (editingIgnoresContent(node.raw())) {
|
| + if (editingIgnoresContent(node)) {
|
| next = NodeTraversal::nextSkippingChildren(node);
|
| continue;
|
| }
|
| @@ -807,7 +807,7 @@ void ApplyStyleCommand::applyInlineStyleToNodeRange(EditingStyle* style, const H
|
| while (1) {
|
| HandleScope scope;
|
| if (!sibling || sibling == pastEndNode || sibling->contains(pastEndNode)
|
| - || (isBlock(sibling.raw()) && !sibling->hasTagName(brTag))
|
| + || (isBlock(sibling) && !sibling->hasTagName(brTag))
|
| || containsNonEditableRegion(sibling))
|
| break;
|
| runEnd = sibling;
|
| @@ -874,7 +874,7 @@ void ApplyStyleCommand::removeConflictingInlineStyleFromRun(EditingStyle* style,
|
| Handle<Node> next = runStart;
|
| for (Handle<Node> node = next; node && node->inDocument() && node != pastEndNode; node = next) {
|
| HandleScope scope;
|
| - if (editingIgnoresContent(node.raw())) {
|
| + if (editingIgnoresContent(node)) {
|
| ASSERT(!node->contains(pastEndNode));
|
| next = NodeTraversal::nextSkippingChildren(node);
|
| } else
|
| @@ -998,7 +998,7 @@ Result<HTMLElement> ApplyStyleCommand::highestAncestorWithConflictingInlineStyle
|
| return nullptr;
|
|
|
| Handle<HTMLElement> result;
|
| - Handle<Node> unsplittableElement = unsplittableElementForPosition(firstPositionInOrBeforeNode(node.raw()));
|
| + Handle<Node> unsplittableElement = unsplittableElementForPosition(firstPositionInOrBeforeNode(node));
|
|
|
| for (Handle<Node> n = node; n; n = n->parentNode()) {
|
| HandleScope scope;
|
| @@ -1136,7 +1136,7 @@ void ApplyStyleCommand::removeInlineStyle(EditingStyle* style, const Position &s
|
| while (node) {
|
| HandleScope scope;
|
| Handle<Node> next;
|
| - if (editingIgnoresContent(node.raw())) {
|
| + if (editingIgnoresContent(node)) {
|
| ASSERT(node == end.deprecatedNode() || !node->contains(end.deprecatedNode()));
|
| next = NodeTraversal::nextSkippingChildren(node);
|
| } else
|
| @@ -1158,14 +1158,14 @@ void ApplyStyleCommand::removeInlineStyle(EditingStyle* style, const Position &s
|
| // Since elem must have been fully selected, and it is at the start
|
| // of the selection, it is clear we can set the new s offset to 0.
|
| ASSERT(s.anchorType() == Position::PositionIsBeforeAnchor || s.offsetInContainerNode() <= 0);
|
| - s = firstPositionInOrBeforeNode(nextNode.raw());
|
| + s = firstPositionInOrBeforeNode(nextNode);
|
| }
|
| if (e.deprecatedNode() == elem) {
|
| // Since elem must have been fully selected, and it is at the end
|
| // of the selection, it is clear we can set the new e offset to
|
| // the max range offset of prevNode.
|
| ASSERT(s.anchorType() == Position::PositionIsAfterAnchor || !offsetIsBeforeLastNodeOffset(s.offsetInContainerNode(), s.containerNode()));
|
| - e = lastPositionInOrAfterNode(prevNode.raw());
|
| + e = lastPositionInOrAfterNode(prevNode);
|
| }
|
| }
|
|
|
| @@ -1190,8 +1190,8 @@ bool ApplyStyleCommand::nodeFullySelected(const Handle<Node>& node, const Positi
|
| // The tree may have changed and Position::upstream() relies on an up-to-date layout.
|
| node->document()->updateLayoutIgnorePendingStylesheets();
|
|
|
| - return comparePositions(firstPositionInOrBeforeNode(node.raw()), start) >= 0
|
| - && comparePositions(lastPositionInOrAfterNode(node.raw()).upstream(), end) <= 0;
|
| + return comparePositions(firstPositionInOrBeforeNode(node), start) >= 0
|
| + && comparePositions(lastPositionInOrAfterNode(node).upstream(), end) <= 0;
|
| }
|
|
|
| bool ApplyStyleCommand::nodeFullyUnselected(const Handle<Node>& node, const Position &start, const Position &end) const
|
| @@ -1199,8 +1199,8 @@ bool ApplyStyleCommand::nodeFullyUnselected(const Handle<Node>& node, const Posi
|
| ASSERT(node);
|
| ASSERT(node->isElementNode());
|
|
|
| - bool isFullyBeforeStart = comparePositions(lastPositionInOrAfterNode(node.raw()).upstream(), start) < 0;
|
| - bool isFullyAfterEnd = comparePositions(firstPositionInOrBeforeNode(node.raw()), end) > 0;
|
| + bool isFullyBeforeStart = comparePositions(lastPositionInOrAfterNode(node).upstream(), start) < 0;
|
| + bool isFullyAfterEnd = comparePositions(firstPositionInOrBeforeNode(node), end) > 0;
|
|
|
| return isFullyBeforeStart || isFullyAfterEnd;
|
| }
|
| @@ -1278,7 +1278,7 @@ bool ApplyStyleCommand::shouldSplitTextElement(const Handle<Element>& element, E
|
|
|
| bool ApplyStyleCommand::isValidCaretPositionInTextNode(const Position& position)
|
| {
|
| - Node* node = position.containerNode().handle().raw();
|
| + Handle<Node> node = position.containerNode();
|
| if (position.anchorType() != Position::PositionIsOffsetInAnchor || !node->isTextNode())
|
| return false;
|
| int offsetInText = position.offsetInContainerNode();
|
| @@ -1287,7 +1287,7 @@ bool ApplyStyleCommand::isValidCaretPositionInTextNode(const Position& position)
|
|
|
| bool ApplyStyleCommand::mergeStartWithPreviousIfIdentical(const Position& start, const Position& end)
|
| {
|
| - Node* startNode = start.containerNode().handle().raw();
|
| + Handle<Node> startNode = start.containerNode();
|
| int startOffset = start.computeOffsetInContainerNode();
|
| if (startOffset)
|
| return false;
|
| @@ -1298,7 +1298,7 @@ bool ApplyStyleCommand::mergeStartWithPreviousIfIdentical(const Position& start,
|
| if (startNode->previousSibling())
|
| return false;
|
|
|
| - startNode = startNode->parentNode().handle().raw();
|
| + startNode = startNode->parentNode();
|
| startOffset = 0;
|
| }
|
|
|
| @@ -1307,16 +1307,16 @@ bool ApplyStyleCommand::mergeStartWithPreviousIfIdentical(const Position& start,
|
|
|
| Handle<Node> previousSibling = startNode->previousSibling();
|
|
|
| - if (previousSibling && areIdenticalElements(startNode, previousSibling.raw())) {
|
| + if (previousSibling && areIdenticalElements(startNode, previousSibling)) {
|
| Handle<Element> previousElement = toElement(previousSibling);
|
| - Handle<Element> element = adoptRawResult(toElement(startNode));
|
| + Handle<Element> element = toElement(startNode);
|
| Handle<Node> startChild = element->firstChild();
|
| ASSERT(startChild);
|
| mergeIdenticalElements(previousElement, element);
|
|
|
| int startOffsetAdjustment = startChild->nodeIndex();
|
| int endOffsetAdjustment = startNode == end.deprecatedNode() ? startOffsetAdjustment : 0;
|
| - updateStartEnd(Position(adoptRawResult(startNode), startOffsetAdjustment, Position::PositionIsOffsetInAnchor),
|
| + updateStartEnd(Position(startNode, startOffsetAdjustment, Position::PositionIsOffsetInAnchor),
|
| Position(end.deprecatedNode(), end.deprecatedEditingOffset() + endOffsetAdjustment, Position::PositionIsOffsetInAnchor));
|
| return true;
|
| }
|
| @@ -1329,7 +1329,7 @@ bool ApplyStyleCommand::mergeEndWithNextIfIdentical(const Position& start, const
|
| Handle<Node> endNode = end.containerNode();
|
| int endOffset = end.computeOffsetInContainerNode();
|
|
|
| - if (isAtomicNode(endNode.raw())) {
|
| + if (isAtomicNode(endNode)) {
|
| if (offsetIsBeforeLastNodeOffset(endOffset, endNode))
|
| return false;
|
|
|
| @@ -1345,9 +1345,9 @@ bool ApplyStyleCommand::mergeEndWithNextIfIdentical(const Position& start, const
|
| return false;
|
|
|
| Handle<Node> nextSibling = endNode->nextSibling();
|
| - if (nextSibling && areIdenticalElements(endNode.raw(), nextSibling.raw())) {
|
| + if (nextSibling && areIdenticalElements(endNode, nextSibling)) {
|
| Handle<Element> nextElement = toElement(nextSibling);
|
| - Handle<Element> element = adoptRawResult(toElement(endNode.raw()));
|
| + Handle<Element> element = toElement(endNode);
|
| Handle<Node> nextChild = nextElement->firstChild();
|
|
|
| mergeIdenticalElements(element, nextElement);
|
| @@ -1387,13 +1387,13 @@ void ApplyStyleCommand::surroundNodeRangeWithElement(const Handle<Node>& passedS
|
| Handle<Node> nextSibling = element->nextSibling();
|
| Handle<Node> previousSibling = element->previousSibling();
|
| if (nextSibling && nextSibling->isElementNode() && nextSibling->rendererIsEditable()
|
| - && areIdenticalElements(element.raw(), toElement(nextSibling).handle().raw()))
|
| + && areIdenticalElements(element, toElement(nextSibling)))
|
| mergeIdenticalElements(element, toElement(nextSibling));
|
|
|
| if (previousSibling && previousSibling->isElementNode() && previousSibling->rendererIsEditable()) {
|
| Handle<Node> mergedElement = previousSibling->nextSibling();
|
| if (mergedElement->isElementNode() && mergedElement->rendererIsEditable()
|
| - && areIdenticalElements(toElement(previousSibling).handle().raw(), toElement(mergedElement).handle().raw()))
|
| + && areIdenticalElements(toElement(previousSibling), toElement(mergedElement)))
|
| mergeIdenticalElements(toElement(previousSibling), toElement(mergedElement));
|
| }
|
|
|
| @@ -1445,7 +1445,7 @@ Position ApplyStyleCommand::positionToComputeInlineStyleChange(const Handle<Node
|
| return positionBeforeNode(dummyElement);
|
| }
|
|
|
| - return firstPositionInOrBeforeNode(startNode.raw());
|
| + return firstPositionInOrBeforeNode(startNode);
|
| }
|
|
|
| void ApplyStyleCommand::applyInlineStyleChange(const Handle<Node>& passedStart, const Handle<Node>& passedEnd, StyleChange& styleChange, EAddStyledElement addStyledElement)
|
|
|