OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
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 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 firstFoundItem = misspelledWord; | 1151 firstFoundItem = misspelledWord; |
1152 break; | 1152 break; |
1153 } | 1153 } |
1154 } | 1154 } |
1155 } | 1155 } |
1156 if (lastIteration || | 1156 if (lastIteration || |
1157 totalLengthProcessed + currentLength >= totalRangeLength) | 1157 totalLengthProcessed + currentLength >= totalRangeLength) |
1158 break; | 1158 break; |
1159 VisiblePosition newParagraphStart = | 1159 VisiblePosition newParagraphStart = |
1160 startOfNextParagraph(createVisiblePosition(paragraphEnd)); | 1160 startOfNextParagraph(createVisiblePosition(paragraphEnd)); |
| 1161 if (newParagraphStart.isNull()) |
| 1162 break; |
| 1163 |
1161 paragraphStart = newParagraphStart.toParentAnchoredPosition(); | 1164 paragraphStart = newParagraphStart.toParentAnchoredPosition(); |
1162 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); | 1165 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); |
1163 firstIteration = false; | 1166 firstIteration = false; |
1164 totalLengthProcessed += currentLength; | 1167 totalLengthProcessed += currentLength; |
1165 } | 1168 } |
1166 return std::make_pair(firstFoundItem, firstFoundOffset); | 1169 return std::make_pair(firstFoundItem, firstFoundOffset); |
1167 } | 1170 } |
1168 | 1171 |
1169 // static | 1172 // static |
1170 bool SpellChecker::isSpellCheckingEnabledAt(const Position& position) { | 1173 bool SpellChecker::isSpellCheckingEnabledAt(const Position& position) { |
1171 if (position.isNull()) | 1174 if (position.isNull()) |
1172 return false; | 1175 return false; |
1173 if (TextControlElement* textControl = enclosingTextControl(position)) { | 1176 if (TextControlElement* textControl = enclosingTextControl(position)) { |
1174 if (isHTMLInputElement(textControl)) { | 1177 if (isHTMLInputElement(textControl)) { |
1175 HTMLInputElement& input = toHTMLInputElement(*textControl); | 1178 HTMLInputElement& input = toHTMLInputElement(*textControl); |
1176 // TODO(tkent): The following password type check should be done in | 1179 // TODO(tkent): The following password type check should be done in |
1177 // HTMLElement::spellcheck(). crbug.com/371567 | 1180 // HTMLElement::spellcheck(). crbug.com/371567 |
1178 if (input.type() == InputTypeNames::password) | 1181 if (input.type() == InputTypeNames::password) |
1179 return false; | 1182 return false; |
1180 if (!input.isFocusedElementInDocument()) | 1183 if (!input.isFocusedElementInDocument()) |
1181 return false; | 1184 return false; |
1182 } | 1185 } |
1183 } | 1186 } |
1184 HTMLElement* element = | 1187 HTMLElement* element = |
1185 Traversal<HTMLElement>::firstAncestorOrSelf(*position.anchorNode()); | 1188 Traversal<HTMLElement>::firstAncestorOrSelf(*position.anchorNode()); |
1186 return element && element->isSpellCheckingEnabled(); | 1189 return element && element->isSpellCheckingEnabled(); |
1187 } | 1190 } |
1188 | 1191 |
1189 } // namespace blink | 1192 } // namespace blink |
OLD | NEW |