| Index: Source/core/dom/Range.cpp
|
| diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
|
| index f0c46597a7d6793d45f9b7ad4119ad98228fe059..33d2ea6da5be4ca01c8da5693fbf126de3fcfee9 100644
|
| --- a/Source/core/dom/Range.cpp
|
| +++ b/Source/core/dom/Range.cpp
|
| @@ -322,7 +322,7 @@ bool Range::isPointInRange(Node* refNode, int offset, ExceptionCode& ec)
|
| short Range::comparePoint(Node* refNode, int offset, ExceptionCode& ec) const
|
| {
|
| // http://developer.mozilla.org/en/docs/DOM:range.comparePoint
|
| - // This method returns -1, 0 or 1 depending on if the point described by the
|
| + // This method returns -1, 0 or 1 depending on if the point described by the
|
| // refNode node and an offset within the node is before, same as, or after the range respectively.
|
|
|
| if (!m_start.container()) {
|
| @@ -370,7 +370,7 @@ Range::CompareResults Range::compareNode(Node* refNode, ExceptionCode& ec) const
|
| ec = NotFoundError;
|
| return NODE_BEFORE;
|
| }
|
| -
|
| +
|
| if (!m_start.container() && refNode->attached()) {
|
| ec = InvalidStateError;
|
| return NODE_BEFORE;
|
| @@ -388,7 +388,7 @@ Range::CompareResults Range::compareNode(Node* refNode, ExceptionCode& ec) const
|
|
|
| ContainerNode* parentNode = refNode->parentNode();
|
| int nodeIndex = refNode->nodeIndex();
|
| -
|
| +
|
| if (!parentNode) {
|
| // if the node is the top document we should return NODE_BEFORE_AND_AFTER
|
| // but we throw to match firefox behavior
|
| @@ -593,7 +593,7 @@ bool Range::intersectsNode(Node* refNode, ExceptionCode& ec)
|
|
|
| ContainerNode* parentNode = refNode->parentNode();
|
| int nodeIndex = refNode->nodeIndex();
|
| -
|
| +
|
| if (!parentNode) {
|
| // if the node is the top document we should return NODE_BEFORE_AND_AFTER
|
| // but we throw to match firefox behavior
|
| @@ -608,7 +608,7 @@ bool Range::intersectsNode(Node* refNode, ExceptionCode& ec)
|
| comparePoint(parentNode, nodeIndex + 1, ec) > 0) { // ends after end
|
| return false;
|
| }
|
| -
|
| +
|
| return true; // all other cases
|
| }
|
|
|
| @@ -629,7 +629,7 @@ static inline Node* childOfCommonRootBeforeOffset(Node* container, unsigned offs
|
| {
|
| ASSERT(container);
|
| ASSERT(commonRoot);
|
| -
|
| +
|
| if (!commonRoot->contains(container))
|
| return 0;
|
|
|
| @@ -787,7 +787,7 @@ PassRefPtr<Node> Range::processContentsBetweenOffsets(ActionType action, PassRef
|
| ASSERT(startOffset <= endOffset);
|
|
|
| // This switch statement must be consistent with that of lengthOfContentsInNode.
|
| - RefPtr<Node> result;
|
| + RefPtr<Node> result;
|
| switch (container->nodeType()) {
|
| case Node::TEXT_NODE:
|
| case Node::CDATA_SECTION_NODE:
|
| @@ -893,7 +893,7 @@ PassRefPtr<Node> Range::processAncestorsAndTheirSiblings(ActionType action, Node
|
| // FIXME: This assertion may fail if DOM is modified during mutation event
|
| // FIXME: Share code with Range::processNodes
|
| ASSERT(!firstChildInAncestorToProcess || firstChildInAncestorToProcess->parentNode() == ancestor);
|
| -
|
| +
|
| NodeVector nodes;
|
| for (Node* child = firstChildInAncestorToProcess.get(); child;
|
| child = (direction == ProcessContentsForward) ? child->nextSibling() : child->previousSibling())
|
| @@ -1029,7 +1029,7 @@ void Range::insertNode(PassRefPtr<Node> prpNewNode, ExceptionCode& ec)
|
| RefPtr<Text> newText = toText(container.get())->splitText(m_start.offset(), ec);
|
| if (ec)
|
| return;
|
| -
|
| +
|
| container = m_start.container();
|
| container->parentNode()->insertBefore(newNode.release(), newText.get(), ec);
|
| if (ec)
|
| @@ -1421,7 +1421,7 @@ void Range::surroundContents(PassRefPtr<Node> passNewParent, ExceptionCode& ec)
|
| // Raise a HierarchyRequestError if m_start.container() doesn't accept children like newParent.
|
| Node* parentOfNewParent = m_start.container();
|
|
|
| - // If m_start.container() is a character data node, it will be split and it will be its parent that will
|
| + // If m_start.container() is a character data node, it will be split and it will be its parent that will
|
| // need to accept newParent (or in the case of a comment, it logically "would" be inserted into the parent,
|
| // although this will fail below for another reason).
|
| if (parentOfNewParent->isCharacterDataNode())
|
| @@ -1430,7 +1430,7 @@ void Range::surroundContents(PassRefPtr<Node> passNewParent, ExceptionCode& ec)
|
| ec = HierarchyRequestError;
|
| return;
|
| }
|
| -
|
| +
|
| if (newParent->contains(m_start.container())) {
|
| ec = HierarchyRequestError;
|
| return;
|
| @@ -1499,7 +1499,7 @@ void Range::checkDeleteExtract(ExceptionCode& ec)
|
| ec = 0;
|
| if (!commonAncestorContainer(ec) || ec)
|
| return;
|
| -
|
| +
|
| Node* pastLast = pastLastNode();
|
| for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(n)) {
|
| if (n->nodeType() == Node::DOCUMENT_TYPE_NODE) {
|
| @@ -1576,7 +1576,7 @@ void Range::textRects(Vector<IntRect>& rects, bool useSelectionHeight, RangeInFi
|
| allFixed &= isFixed;
|
| someFixed |= isFixed;
|
| }
|
| -
|
| +
|
| if (inFixed)
|
| *inFixed = allFixed ? EntirelyFixedPosition : (someFixed ? PartiallyFixedPosition : NotFixedPosition);
|
| }
|
| @@ -1892,7 +1892,7 @@ void Range::getBorderAndTextQuads(Vector<FloatQuad>& quads) const
|
| RenderText* renderText = toRenderText(renderer);
|
| int startOffset = (node == startContainer) ? m_start.offset() : 0;
|
| int endOffset = (node == endContainer) ? m_end.offset() : INT_MAX;
|
| -
|
| +
|
| Vector<FloatQuad> textQuads;
|
| renderText->absoluteQuadsForRange(textQuads, startOffset, endOffset);
|
| m_ownerDocument->adjustFloatQuadsForScrollAndAbsoluteZoom(textQuads, renderText);
|
|
|