OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 return HTMLElementFactory::createHTMLElement(name, document, 0, false); | 888 return HTMLElementFactory::createHTMLElement(name, document, 0, false); |
889 } | 889 } |
890 | 890 |
891 PassRefPtr<HTMLElement> createHTMLElement(Document* document, const AtomicString
& tagName) | 891 PassRefPtr<HTMLElement> createHTMLElement(Document* document, const AtomicString
& tagName) |
892 { | 892 { |
893 return createHTMLElement(document, QualifiedName(nullAtom, tagName, xhtmlNam
espaceURI)); | 893 return createHTMLElement(document, QualifiedName(nullAtom, tagName, xhtmlNam
espaceURI)); |
894 } | 894 } |
895 | 895 |
896 bool isTabSpanNode(const Node *node) | 896 bool isTabSpanNode(const Node *node) |
897 { | 897 { |
898 return node && node->hasTagName(spanTag) && node->isElementNode() && static_
cast<const Element *>(node)->getAttribute(classAttr) == AppleTabSpanClass; | 898 return node && node->hasTagName(spanTag) && node->isElementNode() && toEleme
nt(node)->getAttribute(classAttr) == AppleTabSpanClass; |
899 } | 899 } |
900 | 900 |
901 bool isTabSpanTextNode(const Node *node) | 901 bool isTabSpanTextNode(const Node *node) |
902 { | 902 { |
903 return node && node->isTextNode() && node->parentNode() && isTabSpanNode(nod
e->parentNode()); | 903 return node && node->isTextNode() && node->parentNode() && isTabSpanNode(nod
e->parentNode()); |
904 } | 904 } |
905 | 905 |
906 Node* tabSpanNode(const Node *node) | 906 Node* tabSpanNode(const Node *node) |
907 { | 907 { |
908 return isTabSpanTextNode(node) ? node->parentNode() : 0; | 908 return isTabSpanTextNode(node) ? node->parentNode() : 0; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 position = positionInParentBeforeNode(node); | 1000 position = positionInParentBeforeNode(node); |
1001 break; | 1001 break; |
1002 } | 1002 } |
1003 } | 1003 } |
1004 | 1004 |
1005 bool isMailBlockquote(const Node *node) | 1005 bool isMailBlockquote(const Node *node) |
1006 { | 1006 { |
1007 if (!node || !node->hasTagName(blockquoteTag)) | 1007 if (!node || !node->hasTagName(blockquoteTag)) |
1008 return false; | 1008 return false; |
1009 | 1009 |
1010 return static_cast<const Element *>(node)->getAttribute("type") == "cite"; | 1010 return toElement(node)->getAttribute("type") == "cite"; |
1011 } | 1011 } |
1012 | 1012 |
1013 int caretMinOffset(const Node* n) | 1013 int caretMinOffset(const Node* n) |
1014 { | 1014 { |
1015 RenderObject* r = n->renderer(); | 1015 RenderObject* r = n->renderer(); |
1016 ASSERT(!n->isCharacterDataNode() || !r || r->isText()); // FIXME: This was a
runtime check that seemingly couldn't fail; changed it to an assertion for now. | 1016 ASSERT(!n->isCharacterDataNode() || !r || r->isText()); // FIXME: This was a
runtime check that seemingly couldn't fail; changed it to an assertion for now. |
1017 return r ? r->caretMinOffset() : 0; | 1017 return r ? r->caretMinOffset() : 0; |
1018 } | 1018 } |
1019 | 1019 |
1020 // If a node can contain candidates for VisiblePositions, return the offset of t
he last candidate, otherwise | 1020 // If a node can contain candidates for VisiblePositions, return the offset of t
he last candidate, otherwise |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 // if the selection starts just before a paragraph break, skip over it | 1198 // if the selection starts just before a paragraph break, skip over it |
1199 if (isEndOfParagraph(visiblePosition)) | 1199 if (isEndOfParagraph(visiblePosition)) |
1200 return visiblePosition.next().deepEquivalent().downstream(); | 1200 return visiblePosition.next().deepEquivalent().downstream(); |
1201 | 1201 |
1202 // otherwise, make sure to be at the start of the first selected node, | 1202 // otherwise, make sure to be at the start of the first selected node, |
1203 // instead of possibly at the end of the last node before the selection | 1203 // instead of possibly at the end of the last node before the selection |
1204 return visiblePosition.deepEquivalent().downstream(); | 1204 return visiblePosition.deepEquivalent().downstream(); |
1205 } | 1205 } |
1206 | 1206 |
1207 } // namespace WebCore | 1207 } // namespace WebCore |
OLD | NEW |