OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
3 * Copyright (C) 2005 Alexey Proskuryakov. | 3 * Copyright (C) 2005 Alexey Proskuryakov. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 } | 923 } |
924 | 924 |
925 static bool shouldEmitNewlineAfterNode(Node& node) | 925 static bool shouldEmitNewlineAfterNode(Node& node) |
926 { | 926 { |
927 // FIXME: It should be better but slower to create a VisiblePosition here. | 927 // FIXME: It should be better but slower to create a VisiblePosition here. |
928 if (!shouldEmitNewlinesBeforeAndAfterNode(node)) | 928 if (!shouldEmitNewlinesBeforeAndAfterNode(node)) |
929 return false; | 929 return false; |
930 // Check if this is the very last renderer in the document. | 930 // Check if this is the very last renderer in the document. |
931 // If so, then we should not emit a newline. | 931 // If so, then we should not emit a newline. |
932 Node* next = &node; | 932 Node* next = &node; |
933 while ((next = NodeTraversal::nextSkippingChildren(*next))) { | 933 do { |
934 if (next->renderer()) | 934 next = NodeTraversal::nextSkippingChildren(*next); |
| 935 if (next && next->renderer()) |
935 return true; | 936 return true; |
936 } | 937 } while (next); |
937 return false; | 938 return false; |
938 } | 939 } |
939 | 940 |
940 static bool shouldEmitNewlineBeforeNode(Node& node) | 941 static bool shouldEmitNewlineBeforeNode(Node& node) |
941 { | 942 { |
942 return shouldEmitNewlinesBeforeAndAfterNode(node); | 943 return shouldEmitNewlinesBeforeAndAfterNode(node); |
943 } | 944 } |
944 | 945 |
945 static bool shouldEmitExtraNewlineForNode(Node* node) | 946 static bool shouldEmitExtraNewlineForNode(Node* node) |
946 { | 947 { |
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2214 resultEnd = collapseTo; | 2215 resultEnd = collapseTo; |
2215 return; | 2216 return; |
2216 } | 2217 } |
2217 } | 2218 } |
2218 | 2219 |
2219 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo
rFindPlainText); | 2220 CharacterIterator computeRangeIterator(inputStart, inputEnd, iteratorFlagsFo
rFindPlainText); |
2220 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re
sultStart, resultEnd); | 2221 calculateCharacterSubrange(computeRangeIterator, matchStart, matchLength, re
sultStart, resultEnd); |
2221 } | 2222 } |
2222 | 2223 |
2223 } | 2224 } |
OLD | NEW |