Home | History | Annotate | Download | only in editing

Lines Matching full:node

70 static inline bool shouldSelfClose(const Node *node);
216 static String stringValueForRange(const Node* node, const Range* range)
219 return node->nodeValue();
221 String str = node->nodeValue();
223 if (node == range->endContainer(ec))
225 if (node == range->startContainer(ec))
230 static inline pair<const UChar*, size_t> ucharRange(const Node *node, const Range *range)
232 String str = node->nodeValue();
238 if (node == range->endContainer(ec))
240 if (node == range->startContainer(ec)) {
255 static String renderedText(const Node* node, const Range* range)
257 if (!node->isTextNode())
261 const Text* textNode = static_cast<const Text*>(node);
265 if (range && node == range->startContainer(ec))
267 if (range && node == range->endContainer(ec))
270 Position start(const_cast<Node*>(node), startOffset);
271 Position end(const_cast<Node*>(node), endOffset);
272 return plainText(Range::create(node->document(), start, end).get());
291 static void removeEnclosingMailBlockquoteStyle(CSSMutableStyleDeclaration* style, Node* node)
293 Node* blockquote = nearestMailBlockquote(node);
396 static void appendStartMarkup(Vector<UChar>& result, const Node* node, const Range* range, EAnnotateForInterchange annotate, bool convertBlocksToInlines = false, HashMap<AtomicStringImpl*, AtomicStringImpl*>* namespaces = 0, RangeFullySelectsNode rangeFullySelectsNode = DoesFullySelectNode)
401 bool documentIsHTML = node->document()->isHTMLDocument();
402 switch (node->nodeType()) {
403 case Node::TEXT_NODE: {
404 if (Node* parent = node->parentNode()) {
409 appendUCharRange(result, ucharRange(node, range));
414 appendEscapedContent(result, ucharRange(node, range), documentIsHTML);
418 bool useRenderedText = !enclosingNodeWithTag(Position(const_cast<Node*>(node), 0), selectTag);
419 String markup = escapeContentText(useRenderedText ? renderedText(node, range) : stringValueForRange(node, range), false);
420 markup = convertHTMLTextToInterchangeFormat(markup, static_cast<const Text*>(node));
424 case Node::COMMENT_NODE:
427 append(result, static_cast<const Comment*>(node)->data());
430 case Node::DOCUMENT_NODE:
431 case Node::DOCUMENT_FRAGMENT_NODE:
433 case Node::DOCUMENT_TYPE_NODE:
434 appendDocumentType(result, static_cast<const DocumentType*>(node));
436 case Node::PROCESSING_INSTRUCTION_NODE: {
438 const ProcessingInstruction* n = static_cast<const ProcessingInstruction*>(node);
446 case Node::ELEMENT_NODE: {
448 const Element* el = static_cast<const Element*>(node);
449 bool convert = convertBlocksToInlines && isBlock(const_cast<Node*>(node));
514 // If the node is not fully selected by the range, then we don't want to keep styles that affect its relationship to the nodes around it
534 case Node::CDATA_SECTION_NODE: {
536 const CDATASection* n = static_cast<const CDATASection*>(node);
542 case Node::ATTRIBUTE_NODE:
543 case Node::ENTITY_NODE:
544 case Node::ENTITY_REFERENCE_NODE:
545 case Node::NOTATION_NODE:
546 case Node::XPATH_NAMESPACE_NODE:
552 static String getStartMarkup(const Node* node, const Range* range, EAnnotateForInterchange annotate, bool convertBlocksToInlines = false, HashMap<AtomicStringImpl*, AtomicStringImpl*>* namespaces = 0, RangeFullySelectsNode rangeFullySelectsNode = DoesFullySelectNode)
555 appendStartMarkup(result, node, range, annotate, convertBlocksToInlines, namespaces, rangeFullySelectsNode);
559 static inline bool doesHTMLForbidEndTag(const Node *node)
561 if (node->isHTMLElement()) {
562 const HTMLElement* htmlElt = static_cast<const HTMLElement*>(node);
573 static inline bool shouldSelfClose(const Node *node)
575 if (node->document()->isHTMLDocument())
577 if (node->hasChildNodes())
579 if (node->isHTMLElement() && !doesHTMLForbidEndTag(node))
584 static void appendEndMarkup(Vector<UChar>& result, const Node* node)
586 if (!node->isElementNode() || shouldSelfClose(node) || (!node->hasChildNodes() && doesHTMLForbidEndTag(node)))
591 append(result, static_cast<const Element*>(node)->nodeNamePreservingCase());
595 static String getEndMarkup(const Node *node)
598 appendEndMarkup(result, node);
604 MarkupAccumulator(Node* nodeToSkip, Vector<Node*>* nodes)
610 void appendMarkup(Node* startNode, EChildrenOnly, const HashMap<AtomicStringImpl*, AtomicStringImpl*>* namespaces = 0);
616 Node* m_nodeToSkip;
617 Vector<Node*>* m_nodes;
621 void MarkupAccumulator::appendMarkup(Node* startNode, EChildrenOnly childrenOnly, const HashMap<AtomicStringImpl*, AtomicStringImpl*>* namespaces)
639 for (Node* current = startNode->firstChild(); current; current = current->nextSibling())
648 static void completeURLs(Node* node, const String& baseURL)
654 Node* end = node->traverseNextSibling();
655 for (Node* n = node; n != end; n = n->traverseNextNode()) {
676 Node* upstreamNode = next.deepEquivalent().upstream().node();
677 Node* downstreamNode = v.deepEquivalent().downstream().node();
682 static PassRefPtr<CSSMutableStyleDeclaration> styleFromMatchedRulesAndInlineDecl(const Node* node)
684 if (!node->isHTMLElement())
689 HTMLElement* element = const_cast<HTMLElement*>(static_cast<const HTMLElement*>(node));
708 static bool isElementPresentational(const Node* node)
710 if (node->hasTagName(uTag) || node->hasTagName(sTag) || node->hasTagName(strikeTag) ||
711 node->hasTagName(iTag) || node->hasTagName(emTag) || node->hasTagName(bTag) || node->hasTagName(strongTag))
713 RefPtr<CSSMutableStyleDeclaration> style = styleFromMatchedRulesAndInlineDecl(node);
743 static bool isSpecialAncestorBlock(Node* node)
745 if (!node || !isBlock(node))
748 return node->hasTagName(listingTag) ||
749 node->hasTagName(olTag) ||
750 node->hasTagName(preTag) ||
751 node->hasTagName(tableTag) ||
752 node->hasTagName(ulTag) ||
753 node->hasTagName(xmpTag) ||
754 node->hasTagName(h1Tag) ||
755 node->hasTagName(h2Tag) ||
756 node->hasTagName(h3Tag) ||
757 node->hasTagName(h4Tag) ||
758 node->hasTagName(h5Tag);
761 static bool shouldIncludeWrapperForFullySelectedRoot(Node* fullySelectedRoot, CSSMutableStyleDeclaration* style)
791 String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterchange annotate, bool convertBlocksToInlines)
818 Node* commonAncestor = updatedRange->commonAncestorContainer(ec);
827 Node* pastEnd = updatedRange->pastLastNode();
828 Node* lastClosed = 0;
829 Vector<Node*> ancestorsToClose;
831 Node* startNode = updatedRange->firstNode();
842 startNode = visibleStart.next().deepEquivalent().node();
851 Node* next;
852 for (Node* n = startNode; n != pastEnd; n = next) {
878 // Add the node to the markup.
886 // Node has no children, or we are skipping it's descendants, add its close tag now.
892 // Check if the node is the last leaf of a tree.
897 Node *ancestor = ancestorsToClose.last();
900 // Not at the end of the range, close ancestors up to sibling of next node.
908 Node* nextParent = next ? next->parentNode() : 0;
910 Node* lastAncestorClosedOrSelf = n->isDescendantOf(lastClosed) ? lastClosed : n;
911 for (Node *parent = lastAncestorClosedOrSelf->parent(); parent != 0 && parent != nextParent; parent = parent->parentNode()) {
926 // We added markup for this node, and we're descending into it. Set it to close eventually.
932 Node* specialCommonAncestor = 0;
933 Node* commonAncestorBlock = commonAncestor ? enclosingBlock(commonAncestor) : 0;
936 Node* table = commonAncestorBlock->parentNode();
947 for (Node *ancestor = lastClosed->parentNode(); ancestor; ancestor = ancestor->parentNode())
952 Node* checkAncestor = specialCommonAncestor ? specialCommonAncestor : commonAncestor;
954 Node* newSpecialCommonAncestor = highestEnclosingNodeOfType(Position(checkAncestor, 0), &isElementPresentational);
959 // If a single tab is selected, commonAncestor will be a text node inside a tab span.
968 if (Node *enclosingAnchor = enclosingNodeWithTag(Position(specialCommonAncestor ? specialCommonAncestor : commonAncestor, 0), aTag))
971 Node* body = enclosingNodeWithTag(Position(commonAncestor, 0), bodyTag);
973 Node* fullySelectedRoot = body && *VisibleSelection::selectionFromContentsOfNode(body).toNormalizedRange() == *updatedRange ? body : 0;
982 for (Node* ancestor = lastClosed->parentNode(); ancestor; ancestor = ancestor->parentNode()) {
1001 // Since this node and all the other ancestors are not in the selection we want to set RangeFullySelectsNode to DoesNotFullySelectNode
1002 // so that styles that affect the exterior of the node are not included.
1017 Node* parentOfLastClosed = lastClosed ? lastClosed->parentNode() : 0;
1073 String createMarkup(const Node* node, EChildrenOnly childrenOnly, Vector<Node*>* nodes)
1075 if (!node)
1079 if (Frame* frame = node->document()->frame()) {
1081 if (node->isDescendantOf(deleteButtonContainerElement))
1086 accumulator.appendMarkup(const_cast<Node*>(node), childrenOnly);
1118 RefPtr<Node> textNode = document->createTextNode(stringWithRebalancedWhitespace(s, first, i + 1 == numEntries));
1136 bool isPlainTextMarkup(Node *node)
1138 if (!node->isElementNode() || !node->hasTagName(divTag) || static_cast<Element*>(node)->attributes()->length())
1141 if (node->childNodeCount() == 1 && (node->firstChild()->isTextNode() || (node->firstChild()->firstChild())))
1144 return (node->childNodeCount() == 2 && isTabSpanTextNode(node->firstChild()->firstChild()) && node->firstChild()->nextSibling()->isTextNode());
1152 Node* styleNode = context->firstNode();
1154 styleNode = context->startPosition().node();
1190 Node* blockNode = enclosingBlock(context->firstNode());
1222 PassRefPtr<DocumentFragment> createFragmentFromNodes(Document *document, const Vector<Node*>& nodes)
1249 String createFullMarkup(const Node* node)
1251 if (!node)
1254 Document* document = node->document();
1263 String markupString = createMarkup(node, IncludeNode, 0);
1264 Node::NodeType nodeType = node->nodeType();
1265 if (nodeType != Node::DOCUMENT_NODE && nodeType != Node::DOCUMENT_TYPE_NODE)
1276 Node* node = range->startContainer();
1277 if (!node)
1280 Document* document = node->document();