Lines Matching refs:node

66 // Atomic means that the node has no children, or has children which are ignored for the
68 bool isAtomicNode(const Node *node)
70 return node && (!node->hasChildren() || editingIgnoresContent(node));
129 ContainerNode* node = highestRoot->parentNode();
130 while (node) {
131 if (node->hasEditableStyle(editableType))
132 highestRoot = node;
133 if (isHTMLBodyElement(*node))
135 node = node->parentNode();
141 Element* lowestEditableAncestor(Node* node)
143 while (node) {
144 if (node->hasEditableStyle())
145 return node->rootEditableElement();
146 if (isHTMLBodyElement(*node))
148 node = node->parentNode();
156 Node* node = p.parentAnchoredEquivalent().anchorNode();
157 if (!node)
160 node->document().updateLayoutIgnorePendingStylesheets();
164 if (isRenderedHTMLTableElement(node))
165 node = node->parentNode();
167 return node->hasEditableStyle(editableType);
172 Node* node = pos.deprecatedNode();
173 return (node == editableRootForPosition(pos) || node == enclosingNodeOfType(pos, &isTableCell));
179 Node* node = p.deprecatedNode();
180 if (!node)
183 if (isRenderedHTMLTableElement(node))
184 node = node->parentNode();
186 return node->rendererIsRichlyEditable(editableType);
191 Node* node = p.containerNode();
192 if (!node)
195 if (isRenderedHTMLTableElement(node))
196 node = node->parentNode();
198 return node->rootEditableElement(editableType);
206 // Since enclosingNodeOfType won't search beyond the highest root editable node,
207 // this code works even if the closest table cell was outside of the root editable node.
316 // Whether or not content before and after this node will collapse onto the same line as it.
317 bool isBlock(const Node* node)
319 return node && node->renderer() && !node->renderer()->isInline() && !node->renderer()->isRubyText();
322 bool isInline(const Node* node)
324 return node && node->renderer() && node->renderer()->isInline();
331 Element* enclosingBlock(Node* node, EditingBoundaryCrossingRule rule)
333 Node* enclosingNode = enclosingNodeOfType(firstPositionInOrBeforeNode(node), isBlock, rule);
337 Element* enclosingBlockFlowElement(Node& node)
339 if (isBlockFlowElement(node))
340 return &toElement(node);
342 for (Node* n = node.parentNode(); n; n = n->parentNode()) {
364 // in a node. It returns 1 for some elements even though they do not have children, which
367 int lastOffsetForEditing(const Node* node)
369 ASSERT(node);
370 if (!node)
372 if (node->offsetInCharacters())
373 return node->maxCharacterOffset();
375 if (node->hasChildren())
376 return node->countChildren();
379 if (editingIgnoresContent(node))
415 bool isTableStructureNode(const Node *node)
417 RenderObject* renderer = node->renderer();
530 // Returns the visible position at the beginning of a node
531 VisiblePosition visiblePositionBeforeNode(Node& node)
533 if (node.hasChildren())
534 return VisiblePosition(firstPositionInOrBeforeNode(&node), DOWNSTREAM);
535 ASSERT(node.parentNode());
536 ASSERT(!node.parentNode()->isShadowRoot());
537 return VisiblePosition(positionInParentBeforeNode(node));
540 // Returns the visible position at the ending of a node
541 VisiblePosition visiblePositionAfterNode(Node& node)
543 if (node.hasChildren())
544 return VisiblePosition(lastPositionInOrAfterNode(&node), DOWNSTREAM);
545 ASSERT(node.parentNode());
546 ASSERT(!node.parentNode()->isShadowRoot());
547 return VisiblePosition(positionInParentAfterNode(node));
600 // Don't return a non-editable node if the input position was editable, since
601 // the callers from editing will no doubt want to perform editing inside the returned node.
629 static bool hasARenderedDescendant(Node* node, Node* excludedNode)
631 for (Node* n = node->firstChild(); n;) {
633 n = NodeTraversal::nextSkippingChildren(*n, node);
638 n = NodeTraversal::next(*n, node);
643 Node* highestNodeToRemoveInPruning(Node* node, Node* excludeNode)
646 Element* rootEditableElement = node ? node->rootEditableElement() : 0;
647 for (; node; node = node->parentNode()) {
648 if (RenderObject* renderer = node->renderer()) {
649 if (!renderer->canHaveChildren() || hasARenderedDescendant(node, previousNode) || rootEditableElement == node || excludeNode == node)
652 previousNode = node;
674 HTMLElement* enclosingList(Node* node)
676 if (!node)
679 ContainerNode* root = highestEditableRoot(firstPositionInOrBeforeNode(node));
681 for (ContainerNode* n = node->parentNode(); n; n = n->parentNode()) {
691 Node* enclosingListChild(Node *node)
693 if (!node)
695 // Check for a list item element, or for a node whose parent is a list element. Such a node
697 ContainerNode* root = highestEditableRoot(firstPositionInOrBeforeNode(node));
699 // FIXME: This function is inappropriately named if it starts with node instead of node->parentNode()
700 for (Node* n = node; n && n->parentNode(); n = n->parentNode()) {
727 HTMLElement* outermostEnclosingList(Node* node, HTMLElement* rootList)
729 HTMLElement* list = enclosingList(node);
754 bool isRenderedHTMLTableElement(const Node* node)
756 return isHTMLTableElement(*node) && node->renderer();
759 bool isRenderedTableElement(const Node* node)
761 if (!node || !node->isElementNode())
764 RenderObject* renderer = node->renderer();
768 bool isTableCell(const Node* node)
770 ASSERT(node);
771 RenderObject* r = node->renderer();
772 return r ? r->isTableCell() : isHTMLTableCellElement(*node);
775 bool isEmptyTableCell(const Node* node)
777 // Returns true IFF the passed in node is one of:
782 // Find rendered node
783 while (node && !node->renderer())
784 node = node->parentNode();
785 if (!node)
788 // Make sure the rendered node is a table cell or <br>.
789 // If it's a <br>, then the parent node has to be a table cell.
790 RenderObject* renderer = node->renderer();
851 bool isTabHTMLSpanElement(const Node* node)
853 if (!isHTMLSpanElement(node) || toHTMLSpanElement(node)->getAttribute(classAttr) != AppleTabSpanClass)
855 UseCounter::count(node->document(), UseCounter::EditingAppleTabSpanClass);
859 bool isTabHTMLSpanElementTextNode(const Node* node)
861 return node && node->isTextNode() && node->parentNode() && isTabHTMLSpanElement(node->parentNode());
864 HTMLSpanElement* tabSpanElement(const Node* node)
866 return isTabHTMLSpanElementTextNode(node) ? toHTMLSpanElement(node->parentNode()) : 0;
902 bool isNodeRendered(const Node *node)
904 if (!node)
907 RenderObject* renderer = node->renderer();
991 void updatePositionForNodeRemoval(Position& position, Node& node)
997 if (position.containerNode() == node)
998 position = positionInParentBeforeNode(node);
1001 if (position.containerNode() == node)
1002 position = positionInParentAfterNode(node);
1005 if (position.containerNode() == node.parentNode() && static_cast<unsigned>(position.offsetInContainerNode()) > node.nodeIndex())
1007 else if (node.containsIncludingShadowDOM(position.containerNode()))
1008 position = positionInParentBeforeNode(node);
1011 if (node.containsIncludingShadowDOM(position.anchorNode()))
1012 position = positionInParentAfterNode(node);
1015 if (node.containsIncludingShadowDOM(position.anchorNode()))
1016 position = positionInParentBeforeNode(node);
1021 bool isMailHTMLBlockquoteElement(const Node* node)
1023 if (!node || !node->isHTMLElement())
1026 const HTMLElement& element = toHTMLElement(*node);
1037 // If a node can contain candidates for VisiblePositions, return the offset of the last candidate, otherwise
1144 // Determines whether a node is inside a range or visibly starts and ends at the boundaries of the range.
1145 // Call this function to determine whether a node is visibly fit inside selectedRange
1146 bool isNodeVisiblyContainedWithin(Node& node, const Range& selectedRange)
1148 // If the node is inside the range, then it surely is contained within
1149 if (selectedRange.compareNode(&node, IGNORE_EXCEPTION) == Range::NODE_INSIDE)
1152 bool startIsVisuallySame = visiblePositionBeforeNode(node) == VisiblePosition(selectedRange.startPosition());
1153 if (startIsVisuallySame && comparePositions(positionInParentAfterNode(node), selectedRange.endPosition()) < 0)
1156 bool endIsVisuallySame = visiblePositionAfterNode(node) == VisiblePosition(selectedRange.endPosition());
1157 if (endIsVisuallySame && comparePositions(selectedRange.startPosition(), positionInParentBeforeNode(node)) < 0)
1163 bool isRenderedAsNonInlineTableImageOrHR(const Node* node)
1165 if (!node)
1167 RenderObject* renderer = node->renderer();
1184 bool isNonTableCellHTMLBlockElement(const Node* node)
1186 if (!node->isHTMLElement())
1189 const HTMLElement& element = toHTMLElement(*node);
1203 bool isBlockFlowElement(const Node& node)
1205 RenderObject* renderer = node.renderer();
1206 return node.isElementNode() && renderer && renderer->isRenderBlockFlow();
1229 // otherwise, make sure to be at the start of the first selected node,
1230 // instead of possibly at the end of the last node before the selection