Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp

Issue 2952983002: Make Position::FirstPositionInNode() to take const Node& instead of Node* (Closed)
Patch Set: 2017-06-23T10:37:43 Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/editing/spellcheck/ColdModeSpellCheckRequester.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // synchronous layout caused by spell checking (see crbug.com/517298). 205 // synchronous layout caused by spell checking (see crbug.com/517298).
206 GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); 206 GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
207 207
208 DocumentLifecycle::DisallowTransitionScope disallow_transition( 208 DocumentLifecycle::DisallowTransitionScope disallow_transition(
209 GetFrame().GetDocument()->Lifecycle()); 209 GetFrame().GetDocument()->Lifecycle());
210 210
211 bool is_text_field = false; 211 bool is_text_field = false;
212 TextControlElement* enclosing_text_control_element = nullptr; 212 TextControlElement* enclosing_text_control_element = nullptr;
213 if (!IsTextControlElement(*element)) { 213 if (!IsTextControlElement(*element)) {
214 enclosing_text_control_element = 214 enclosing_text_control_element =
215 EnclosingTextControl(Position::FirstPositionInNode(element)); 215 EnclosingTextControl(Position::FirstPositionInNode(*element));
216 } 216 }
217 element = 217 element =
218 enclosing_text_control_element ? enclosing_text_control_element : element; 218 enclosing_text_control_element ? enclosing_text_control_element : element;
219 Element* parent = element; 219 Element* parent = element;
220 if (IsTextControlElement(*element)) { 220 if (IsTextControlElement(*element)) {
221 TextControlElement* text_control = ToTextControlElement(element); 221 TextControlElement* text_control = ToTextControlElement(element);
222 parent = text_control; 222 parent = text_control;
223 element = text_control->InnerEditorElement(); 223 element = text_control->InnerEditorElement();
224 if (!element) 224 if (!element)
225 return; 225 return;
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 "SpellChecker::markMisspellingsAfterReplaceSelectionCommand"); 530 "SpellChecker::markMisspellingsAfterReplaceSelectionCommand");
531 531
532 const EphemeralRange& inserted_range = cmd.InsertedRange(); 532 const EphemeralRange& inserted_range = cmd.InsertedRange();
533 if (inserted_range.IsNull()) 533 if (inserted_range.IsNull())
534 return; 534 return;
535 535
536 Node* node = cmd.EndingSelection().RootEditableElement(); 536 Node* node = cmd.EndingSelection().RootEditableElement();
537 if (!node) 537 if (!node)
538 return; 538 return;
539 539
540 EphemeralRange paragraph_range(Position::FirstPositionInNode(node), 540 EphemeralRange paragraph_range(Position::FirstPositionInNode(*node),
541 Position::LastPositionInNode(node)); 541 Position::LastPositionInNode(node));
542 TextCheckingParagraph text_to_check(inserted_range, paragraph_range); 542 TextCheckingParagraph text_to_check(inserted_range, paragraph_range);
543 ChunkAndMarkAllMisspellings(text_to_check); 543 ChunkAndMarkAllMisspellings(text_to_check);
544 } 544 }
545 545
546 void SpellChecker::ChunkAndMarkAllMisspellings( 546 void SpellChecker::ChunkAndMarkAllMisspellings(
547 const TextCheckingParagraph& full_paragraph_to_check) { 547 const TextCheckingParagraph& full_paragraph_to_check) {
548 if (full_paragraph_to_check.IsEmpty()) 548 if (full_paragraph_to_check.IsEmpty())
549 return; 549 return;
550 const EphemeralRange& paragraph_range = 550 const EphemeralRange& paragraph_range =
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 if (!input.IsFocusedElementInDocument()) 1301 if (!input.IsFocusedElementInDocument())
1302 return false; 1302 return false;
1303 } 1303 }
1304 } 1304 }
1305 HTMLElement* element = 1305 HTMLElement* element =
1306 Traversal<HTMLElement>::FirstAncestorOrSelf(*position.AnchorNode()); 1306 Traversal<HTMLElement>::FirstAncestorOrSelf(*position.AnchorNode());
1307 return element && element->IsSpellCheckingEnabled(); 1307 return element && element->IsSpellCheckingEnabled();
1308 } 1308 }
1309 1309
1310 } // namespace blink 1310 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/spellcheck/ColdModeSpellCheckRequester.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698