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 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 | 849 |
850 Node *nearestMailBlockquote(const Node *node) | 850 Node *nearestMailBlockquote(const Node *node) |
851 { | 851 { |
852 for (Node *n = const_cast<Node *>(node); n; n = n->parentNode()) { | 852 for (Node *n = const_cast<Node *>(node); n; n = n->parentNode()) { |
853 if (isMailBlockquote(n)) | 853 if (isMailBlockquote(n)) |
854 return n; | 854 return n; |
855 } | 855 } |
856 return 0; | 856 return 0; |
857 } | 857 } |
858 | 858 |
| 859 unsigned numEnclosingMailBlockquotes(const Position& p) |
| 860 { |
| 861 unsigned num = 0; |
| 862 for (Node* n = p.node(); n; n = n->parentNode()) |
| 863 if (isMailBlockquote(n)) |
| 864 num++; |
| 865 |
| 866 return num; |
| 867 } |
| 868 |
859 bool isMailBlockquote(const Node *node) | 869 bool isMailBlockquote(const Node *node) |
860 { | 870 { |
861 if (!node || !node->isElementNode() && !node->hasTagName(blockquoteTag)) | 871 if (!node || !node->isElementNode() && !node->hasTagName(blockquoteTag)) |
862 return false; | 872 return false; |
863 | 873 |
864 return static_cast<const Element *>(node)->getAttribute("type") == "cite"; | 874 return static_cast<const Element *>(node)->getAttribute("type") == "cite"; |
865 } | 875 } |
866 | 876 |
867 int caretMinOffset(const Node* n) | 877 int caretMinOffset(const Node* n) |
868 { | 878 { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 | 992 |
983 if (extent == node || extent->isDescendantOf(node)) { | 993 if (extent == node || extent->isDescendantOf(node)) { |
984 ASSERT(node->parentNode()); | 994 ASSERT(node->parentNode()); |
985 updatedSelection.setExtent(Position(node->parentNode(), node->nodeIndex(
))); | 995 updatedSelection.setExtent(Position(node->parentNode(), node->nodeIndex(
))); |
986 } | 996 } |
987 | 997 |
988 return updatedSelection; | 998 return updatedSelection; |
989 } | 999 } |
990 | 1000 |
991 } // namespace WebCore | 1001 } // namespace WebCore |
OLD | NEW |