| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 | 70 |
| 71 bool isPositionInTextArea(const Position& position) { | 71 bool isPositionInTextArea(const Position& position) { |
| 72 TextControlElement* textControl = enclosingTextControl(position); | 72 TextControlElement* textControl = enclosingTextControl(position); |
| 73 return isHTMLTextAreaElement(textControl); | 73 return isHTMLTextAreaElement(textControl); |
| 74 } | 74 } |
| 75 | 75 |
| 76 static bool isSpellCheckingEnabledFor(const Position& position) { | 76 static bool isSpellCheckingEnabledFor(const Position& position) { |
| 77 if (position.isNull()) | 77 if (position.isNull()) |
| 78 return false; | 78 return false; |
| 79 // TODO(tkent): The following password type check should be done in | |
| 80 // HTMLElement::spellcheck(). crbug.com/371567 | |
| 81 if (TextControlElement* textControl = enclosingTextControl(position)) { | 79 if (TextControlElement* textControl = enclosingTextControl(position)) { |
| 82 if (isHTMLInputElement(textControl) && | 80 if (isHTMLInputElement(textControl)) { |
| 83 toHTMLInputElement(textControl)->type() == InputTypeNames::password) | 81 HTMLInputElement& input = toHTMLInputElement(*textControl); |
| 84 return false; | 82 // TODO(tkent): The following password type check should be done in |
| 83 // HTMLElement::spellcheck(). crbug.com/371567 |
| 84 if (input.type() == InputTypeNames::password) |
| 85 return false; |
| 86 if (!input.isFocusedElementInDocument()) |
| 87 return false; |
| 88 } |
| 85 } | 89 } |
| 86 if (HTMLElement* element = | 90 if (HTMLElement* element = |
| 87 Traversal<HTMLElement>::firstAncestorOrSelf(*position.anchorNode())) { | 91 Traversal<HTMLElement>::firstAncestorOrSelf(*position.anchorNode())) { |
| 88 if (element->isSpellCheckingEnabled()) | 92 if (element->isSpellCheckingEnabled()) |
| 89 return true; | 93 return true; |
| 90 } | 94 } |
| 91 return false; | 95 return false; |
| 92 } | 96 } |
| 93 | 97 |
| 94 static bool isSpellCheckingEnabledFor(const VisibleSelection& selection) { | 98 static bool isSpellCheckingEnabledFor(const VisibleSelection& selection) { |
| (...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1230 startOfNextParagraph(createVisiblePosition(paragraphEnd)); | 1234 startOfNextParagraph(createVisiblePosition(paragraphEnd)); |
| 1231 paragraphStart = newParagraphStart.toParentAnchoredPosition(); | 1235 paragraphStart = newParagraphStart.toParentAnchoredPosition(); |
| 1232 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); | 1236 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); |
| 1233 firstIteration = false; | 1237 firstIteration = false; |
| 1234 totalLengthProcessed += currentLength; | 1238 totalLengthProcessed += currentLength; |
| 1235 } | 1239 } |
| 1236 return std::make_pair(firstFoundItem, firstFoundOffset); | 1240 return std::make_pair(firstFoundItem, firstFoundOffset); |
| 1237 } | 1241 } |
| 1238 | 1242 |
| 1239 } // namespace blink | 1243 } // namespace blink |
| OLD | NEW |