| Index: third_party/WebKit/Source/core/dom/Range.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/Range.cpp b/third_party/WebKit/Source/core/dom/Range.cpp
|
| index f5fe97c56f6e67bd6ff1a8d461fec986bdfd8e90..60ddc576072db4e9b545b0c43124ad326f4d6bb1 100644
|
| --- a/third_party/WebKit/Source/core/dom/Range.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/Range.cpp
|
| @@ -76,9 +76,9 @@ inline Range::Range(Document& ownerDocument)
|
| m_ownerDocument->attachRange(this);
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<Range> Range::create(Document& ownerDocument)
|
| +RawPtr<Range> Range::create(Document& ownerDocument)
|
| {
|
| - return adoptRefWillBeNoop(new Range(ownerDocument));
|
| + return new Range(ownerDocument);
|
| }
|
|
|
| inline Range::Range(Document& ownerDocument, Node* startContainer, int startOffset, Node* endContainer, int endOffset)
|
| @@ -98,19 +98,19 @@ inline Range::Range(Document& ownerDocument, Node* startContainer, int startOffs
|
| setEnd(endContainer, endOffset);
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<Range> Range::create(Document& ownerDocument, Node* startContainer, int startOffset, Node* endContainer, int endOffset)
|
| +RawPtr<Range> Range::create(Document& ownerDocument, Node* startContainer, int startOffset, Node* endContainer, int endOffset)
|
| {
|
| - return adoptRefWillBeNoop(new Range(ownerDocument, startContainer, startOffset, endContainer, endOffset));
|
| + return new Range(ownerDocument, startContainer, startOffset, endContainer, endOffset);
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<Range> Range::create(Document& ownerDocument, const Position& start, const Position& end)
|
| +RawPtr<Range> Range::create(Document& ownerDocument, const Position& start, const Position& end)
|
| {
|
| - return adoptRefWillBeNoop(new Range(ownerDocument, start.computeContainerNode(), start.computeOffsetInContainerNode(), end.computeContainerNode(), end.computeOffsetInContainerNode()));
|
| + return new Range(ownerDocument, start.computeContainerNode(), start.computeOffsetInContainerNode(), end.computeContainerNode(), end.computeOffsetInContainerNode());
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<Range> Range::createAdjustedToTreeScope(const TreeScope& treeScope, const Position& position)
|
| +RawPtr<Range> Range::createAdjustedToTreeScope(const TreeScope& treeScope, const Position& position)
|
| {
|
| - RefPtrWillBeRawPtr<Range> range = create(treeScope.document(), position, position);
|
| + RawPtr<Range> range = create(treeScope.document(), position, position);
|
|
|
| // Make sure the range is in this scope.
|
| Node* firstNode = range->firstNode();
|
| @@ -190,7 +190,7 @@ static inline bool checkForDifferentRootContainer(const RangeBoundaryPoint& star
|
| return startRootContainer != endRootContainer || (Range::compareBoundaryPoints(start, end, ASSERT_NO_EXCEPTION) > 0);
|
| }
|
|
|
| -void Range::setStart(PassRefPtrWillBeRawPtr<Node> refNode, int offset, ExceptionState& exceptionState)
|
| +void Range::setStart(RawPtr<Node> refNode, int offset, ExceptionState& exceptionState)
|
| {
|
| if (!refNode) {
|
| // FIXME: Generated bindings code never calls with null, and neither should other callers!
|
| @@ -214,7 +214,7 @@ void Range::setStart(PassRefPtrWillBeRawPtr<Node> refNode, int offset, Exception
|
| collapse(true);
|
| }
|
|
|
| -void Range::setEnd(PassRefPtrWillBeRawPtr<Node> refNode, int offset, ExceptionState& exceptionState)
|
| +void Range::setEnd(RawPtr<Node> refNode, int offset, ExceptionState& exceptionState)
|
| {
|
| if (!refNode) {
|
| // FIXME: Generated bindings code never calls with null, and neither should other callers!
|
| @@ -502,18 +502,18 @@ static inline Node* childOfCommonRootBeforeOffset(Node* container, unsigned offs
|
| return container;
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<DocumentFragment> Range::processContents(ActionType action, ExceptionState& exceptionState)
|
| +RawPtr<DocumentFragment> Range::processContents(ActionType action, ExceptionState& exceptionState)
|
| {
|
| - typedef WillBeHeapVector<RefPtrWillBeMember<Node>> NodeVector;
|
| + typedef HeapVector<Member<Node>> NodeVector;
|
|
|
| - RefPtrWillBeRawPtr<DocumentFragment> fragment = nullptr;
|
| + RawPtr<DocumentFragment> fragment = nullptr;
|
| if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS)
|
| fragment = DocumentFragment::create(*m_ownerDocument.get());
|
|
|
| if (collapsed())
|
| return fragment.release();
|
|
|
| - RefPtrWillBeRawPtr<Node> commonRoot = commonAncestorContainer();
|
| + RawPtr<Node> commonRoot = commonAncestorContainer();
|
| ASSERT(commonRoot);
|
|
|
| if (m_start.container() == m_end.container()) {
|
| @@ -526,8 +526,8 @@ PassRefPtrWillBeRawPtr<DocumentFragment> Range::processContents(ActionType actio
|
| RangeBoundaryPoint originalEnd(m_end);
|
|
|
| // what is the highest node that partially selects the start / end of the range?
|
| - RefPtrWillBeRawPtr<Node> partialStart = highestAncestorUnderCommonRoot(originalStart.container(), commonRoot.get());
|
| - RefPtrWillBeRawPtr<Node> partialEnd = highestAncestorUnderCommonRoot(originalEnd.container(), commonRoot.get());
|
| + RawPtr<Node> partialStart = highestAncestorUnderCommonRoot(originalStart.container(), commonRoot.get());
|
| + RawPtr<Node> partialEnd = highestAncestorUnderCommonRoot(originalEnd.container(), commonRoot.get());
|
|
|
| // Start and end containers are different.
|
| // There are three possibilities here:
|
| @@ -549,23 +549,23 @@ PassRefPtrWillBeRawPtr<DocumentFragment> Range::processContents(ActionType actio
|
| // Note that we are verifying that our common root hierarchy is still intact
|
| // after any DOM mutation event, at various stages below. See webkit bug 60350.
|
|
|
| - RefPtrWillBeRawPtr<Node> leftContents = nullptr;
|
| + RawPtr<Node> leftContents = nullptr;
|
| if (originalStart.container() != commonRoot && commonRoot->contains(originalStart.container())) {
|
| leftContents = processContentsBetweenOffsets(action, nullptr, originalStart.container(), originalStart.offset(), originalStart.container()->lengthOfContents(), exceptionState);
|
| leftContents = processAncestorsAndTheirSiblings(action, originalStart.container(), ProcessContentsForward, leftContents, commonRoot.get(), exceptionState);
|
| }
|
|
|
| - RefPtrWillBeRawPtr<Node> rightContents = nullptr;
|
| + RawPtr<Node> rightContents = nullptr;
|
| if (m_end.container() != commonRoot && commonRoot->contains(originalEnd.container())) {
|
| rightContents = processContentsBetweenOffsets(action, nullptr, originalEnd.container(), 0, originalEnd.offset(), exceptionState);
|
| rightContents = processAncestorsAndTheirSiblings(action, originalEnd.container(), ProcessContentsBackward, rightContents, commonRoot.get(), exceptionState);
|
| }
|
|
|
| // delete all children of commonRoot between the start and end container
|
| - RefPtrWillBeRawPtr<Node> processStart = childOfCommonRootBeforeOffset(originalStart.container(), originalStart.offset(), commonRoot.get());
|
| + RawPtr<Node> processStart = childOfCommonRootBeforeOffset(originalStart.container(), originalStart.offset(), commonRoot.get());
|
| if (processStart && originalStart.container() != commonRoot) // processStart contains nodes before m_start.
|
| processStart = processStart->nextSibling();
|
| - RefPtrWillBeRawPtr<Node> processEnd = childOfCommonRootBeforeOffset(originalEnd.container(), originalEnd.offset(), commonRoot.get());
|
| + RawPtr<Node> processEnd = childOfCommonRootBeforeOffset(originalEnd.container(), originalEnd.offset(), commonRoot.get());
|
|
|
| // Collapse the range, making sure that the result is not within a node that was partially selected.
|
| if (action == EXTRACT_CONTENTS || action == DELETE_CONTENTS) {
|
| @@ -605,7 +605,7 @@ PassRefPtrWillBeRawPtr<DocumentFragment> Range::processContents(ActionType actio
|
| return fragment.release();
|
| }
|
|
|
| -static inline void deleteCharacterData(PassRefPtrWillBeRawPtr<CharacterData> data, unsigned startOffset, unsigned endOffset, ExceptionState& exceptionState)
|
| +static inline void deleteCharacterData(RawPtr<CharacterData> data, unsigned startOffset, unsigned endOffset, ExceptionState& exceptionState)
|
| {
|
| if (data->length() - endOffset)
|
| data->deleteData(endOffset, data->length() - endOffset, exceptionState);
|
| @@ -613,14 +613,14 @@ static inline void deleteCharacterData(PassRefPtrWillBeRawPtr<CharacterData> dat
|
| data->deleteData(0, startOffset, exceptionState);
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<Node> Range::processContentsBetweenOffsets(ActionType action, PassRefPtrWillBeRawPtr<DocumentFragment> fragment,
|
| +RawPtr<Node> Range::processContentsBetweenOffsets(ActionType action, RawPtr<DocumentFragment> fragment,
|
| Node* container, unsigned startOffset, unsigned endOffset, ExceptionState& exceptionState)
|
| {
|
| ASSERT(container);
|
| ASSERT(startOffset <= endOffset);
|
|
|
| // This switch statement must be consistent with that of Node::lengthOfContents.
|
| - RefPtrWillBeRawPtr<Node> result = nullptr;
|
| + RawPtr<Node> result = nullptr;
|
| switch (container->getNodeType()) {
|
| case Node::TEXT_NODE:
|
| case Node::CDATA_SECTION_NODE:
|
| @@ -628,7 +628,7 @@ PassRefPtrWillBeRawPtr<Node> Range::processContentsBetweenOffsets(ActionType act
|
| case Node::PROCESSING_INSTRUCTION_NODE:
|
| endOffset = std::min(endOffset, toCharacterData(container)->length());
|
| if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) {
|
| - RefPtrWillBeRawPtr<CharacterData> c = static_pointer_cast<CharacterData>(container->cloneNode(true));
|
| + RawPtr<CharacterData> c = static_pointer_cast<CharacterData>(container->cloneNode(true));
|
| deleteCharacterData(c, startOffset, endOffset, exceptionState);
|
| if (fragment) {
|
| result = fragment;
|
| @@ -654,7 +654,7 @@ PassRefPtrWillBeRawPtr<Node> Range::processContentsBetweenOffsets(ActionType act
|
| }
|
|
|
| Node* n = container->firstChild();
|
| - WillBeHeapVector<RefPtrWillBeMember<Node>> nodes;
|
| + HeapVector<Member<Node>> nodes;
|
| for (unsigned i = startOffset; n && i; i--)
|
| n = n->nextSibling();
|
| for (unsigned i = startOffset; n && i < endOffset; i++, n = n->nextSibling())
|
| @@ -667,7 +667,7 @@ PassRefPtrWillBeRawPtr<Node> Range::processContentsBetweenOffsets(ActionType act
|
| return result.release();
|
| }
|
|
|
| -void Range::processNodes(ActionType action, WillBeHeapVector<RefPtrWillBeMember<Node>>& nodes, PassRefPtrWillBeRawPtr<Node> oldContainer, PassRefPtrWillBeRawPtr<Node> newContainer, ExceptionState& exceptionState)
|
| +void Range::processNodes(ActionType action, HeapVector<Member<Node>>& nodes, RawPtr<Node> oldContainer, RawPtr<Node> newContainer, ExceptionState& exceptionState)
|
| {
|
| for (auto& node : nodes) {
|
| switch (action) {
|
| @@ -684,19 +684,19 @@ void Range::processNodes(ActionType action, WillBeHeapVector<RefPtrWillBeMember<
|
| }
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<Node> Range::processAncestorsAndTheirSiblings(ActionType action, Node* container, ContentsProcessDirection direction, PassRefPtrWillBeRawPtr<Node> passedClonedContainer, Node* commonRoot, ExceptionState& exceptionState)
|
| +RawPtr<Node> Range::processAncestorsAndTheirSiblings(ActionType action, Node* container, ContentsProcessDirection direction, RawPtr<Node> passedClonedContainer, Node* commonRoot, ExceptionState& exceptionState)
|
| {
|
| - typedef WillBeHeapVector<RefPtrWillBeMember<Node>> NodeVector;
|
| + typedef HeapVector<Member<Node>> NodeVector;
|
|
|
| - RefPtrWillBeRawPtr<Node> clonedContainer = passedClonedContainer;
|
| + RawPtr<Node> clonedContainer = passedClonedContainer;
|
| NodeVector ancestors;
|
| for (ContainerNode* n = container->parentNode(); n && n != commonRoot; n = n->parentNode())
|
| ancestors.append(n);
|
|
|
| - RefPtrWillBeRawPtr<Node> firstChildInAncestorToProcess = direction == ProcessContentsForward ? container->nextSibling() : container->previousSibling();
|
| - for (const RefPtrWillBeRawPtr<Node>& ancestor : ancestors) {
|
| + RawPtr<Node> firstChildInAncestorToProcess = direction == ProcessContentsForward ? container->nextSibling() : container->previousSibling();
|
| + for (const RawPtr<Node>& ancestor : ancestors) {
|
| if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) {
|
| - if (RefPtrWillBeRawPtr<Node> clonedAncestor = ancestor->cloneNode(false)) { // Might have been removed already during mutation event.
|
| + if (RawPtr<Node> clonedAncestor = ancestor->cloneNode(false)) { // Might have been removed already during mutation event.
|
| clonedAncestor->appendChild(clonedContainer, exceptionState);
|
| clonedContainer = clonedAncestor;
|
| }
|
| @@ -712,7 +712,7 @@ PassRefPtrWillBeRawPtr<Node> Range::processAncestorsAndTheirSiblings(ActionType
|
| child = (direction == ProcessContentsForward) ? child->nextSibling() : child->previousSibling())
|
| nodes.append(child);
|
|
|
| - for (const RefPtrWillBeRawPtr<Node>& node : nodes) {
|
| + for (const RawPtr<Node>& node : nodes) {
|
| Node* child = node.get();
|
| switch (action) {
|
| case DELETE_CONTENTS:
|
| @@ -741,7 +741,7 @@ PassRefPtrWillBeRawPtr<Node> Range::processAncestorsAndTheirSiblings(ActionType
|
| return clonedContainer.release();
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<DocumentFragment> Range::extractContents(ExceptionState& exceptionState)
|
| +RawPtr<DocumentFragment> Range::extractContents(ExceptionState& exceptionState)
|
| {
|
| checkExtractPrecondition(exceptionState);
|
| if (exceptionState.hadException())
|
| @@ -750,14 +750,14 @@ PassRefPtrWillBeRawPtr<DocumentFragment> Range::extractContents(ExceptionState&
|
| return processContents(EXTRACT_CONTENTS, exceptionState);
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<DocumentFragment> Range::cloneContents(ExceptionState& exceptionState)
|
| +RawPtr<DocumentFragment> Range::cloneContents(ExceptionState& exceptionState)
|
| {
|
| return processContents(CLONE_CONTENTS, exceptionState);
|
| }
|
|
|
| -void Range::insertNode(PassRefPtrWillBeRawPtr<Node> prpNewNode, ExceptionState& exceptionState)
|
| +void Range::insertNode(RawPtr<Node> prpNewNode, ExceptionState& exceptionState)
|
| {
|
| - RefPtrWillBeRawPtr<Node> newNode = prpNewNode;
|
| + RawPtr<Node> newNode = prpNewNode;
|
|
|
| if (!newNode) {
|
| // FIXME: Generated bindings code never calls with null, and neither should other callers!
|
| @@ -826,10 +826,10 @@ void Range::insertNode(PassRefPtrWillBeRawPtr<Node> prpNewNode, ExceptionState&
|
|
|
| EventQueueScope scope;
|
| bool collapsed = m_start == m_end;
|
| - RefPtrWillBeRawPtr<Node> container = nullptr;
|
| + RawPtr<Node> container = nullptr;
|
| if (startIsText) {
|
| container = m_start.container();
|
| - RefPtrWillBeRawPtr<Text> newText = toText(container)->splitText(m_start.offset(), exceptionState);
|
| + RawPtr<Text> newText = toText(container)->splitText(m_start.offset(), exceptionState);
|
| if (exceptionState.hadException())
|
| return;
|
|
|
| @@ -849,7 +849,7 @@ void Range::insertNode(PassRefPtrWillBeRawPtr<Node> prpNewNode, ExceptionState&
|
| m_end.setToBeforeChild(*newText);
|
| }
|
| } else {
|
| - RefPtrWillBeRawPtr<Node> lastChild = (newNodeType == Node::DOCUMENT_FRAGMENT_NODE) ? toDocumentFragment(newNode)->lastChild() : newNode.get();
|
| + RawPtr<Node> lastChild = (newNodeType == Node::DOCUMENT_FRAGMENT_NODE) ? toDocumentFragment(newNode)->lastChild() : newNode.get();
|
| if (lastChild && lastChild == m_start.childBefore()) {
|
| // The insertion will do nothing, but we need to extend the range to include
|
| // the inserted nodes.
|
| @@ -895,14 +895,14 @@ String Range::text() const
|
| return plainText(EphemeralRange(this), TextIteratorEmitsObjectReplacementCharacter);
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<DocumentFragment> Range::createContextualFragment(const String& markup, ExceptionState& exceptionState)
|
| +RawPtr<DocumentFragment> Range::createContextualFragment(const String& markup, ExceptionState& exceptionState)
|
| {
|
| // Algorithm: http://domparsing.spec.whatwg.org/#extensions-to-the-range-interface
|
|
|
| Node* node = m_start.container();
|
|
|
| // Step 1.
|
| - RefPtrWillBeRawPtr<Element> element;
|
| + RawPtr<Element> element;
|
| if (!m_start.offset() && (node->isDocumentNode() || node->isDocumentFragment()))
|
| element = nullptr;
|
| else if (node->isElementNode())
|
| @@ -932,7 +932,7 @@ PassRefPtrWillBeRawPtr<DocumentFragment> Range::createContextualFragment(const S
|
| }
|
|
|
| // Steps 3, 4, 5.
|
| - RefPtrWillBeRawPtr<DocumentFragment> fragment = blink::createContextualFragment(markup, element.get(), AllowScriptingContentAndDoNotMarkAlreadyStarted, exceptionState);
|
| + RawPtr<DocumentFragment> fragment = blink::createContextualFragment(markup, element.get(), AllowScriptingContentAndDoNotMarkAlreadyStarted, exceptionState);
|
| if (!fragment)
|
| return nullptr;
|
|
|
| @@ -1029,7 +1029,7 @@ void Range::checkNodeBA(Node* n, ExceptionState& exceptionState) const
|
| }
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<Range> Range::cloneRange() const
|
| +RawPtr<Range> Range::cloneRange() const
|
| {
|
| return Range::create(*m_ownerDocument.get(), m_start.container(), m_start.offset(), m_end.container(), m_end.offset());
|
| }
|
| @@ -1161,9 +1161,9 @@ bool Range::selectNodeContents(Node* refNode, Position& start, Position& end)
|
| return true;
|
| }
|
|
|
| -void Range::surroundContents(PassRefPtrWillBeRawPtr<Node> passNewParent, ExceptionState& exceptionState)
|
| +void Range::surroundContents(RawPtr<Node> passNewParent, ExceptionState& exceptionState)
|
| {
|
| - RefPtrWillBeRawPtr<Node> newParent = passNewParent;
|
| + RawPtr<Node> newParent = passNewParent;
|
| if (!newParent) {
|
| // FIXME: Generated bindings code never calls with null, and neither should other callers!
|
| exceptionState.throwTypeError("The node provided is null.");
|
| @@ -1231,7 +1231,7 @@ void Range::surroundContents(PassRefPtrWillBeRawPtr<Node> passNewParent, Excepti
|
| if (exceptionState.hadException())
|
| return;
|
| }
|
| - RefPtrWillBeRawPtr<DocumentFragment> fragment = extractContents(exceptionState);
|
| + RawPtr<DocumentFragment> fragment = extractContents(exceptionState);
|
| if (exceptionState.hadException())
|
| return;
|
| insertNode(newParent, exceptionState);
|
| @@ -1577,7 +1577,7 @@ void Range::getBorderAndTextQuads(Vector<FloatQuad>& quads) const
|
| Node* endContainer = m_end.container();
|
| Node* stopNode = pastLastNode();
|
|
|
| - WillBeHeapHashSet<RawPtrWillBeMember<Node>> nodeSet;
|
| + HeapHashSet<Member<Node>> nodeSet;
|
| for (Node* node = firstNode(); node != stopNode; node = NodeTraversal::next(*node)) {
|
| if (node->isElementNode())
|
| nodeSet.add(node);
|
|
|