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

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

Issue 2698793003: Get rid of redundant layout tree update related to selection (Closed)
Patch Set: 2017-02-17T00:37:54 FrameSelection::selectFrameElementInParentIfFullySelected() to use FS::isRange() Created 3 years, 10 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
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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 void SpellChecker::markMisspellingsAfterTypingToWord( 487 void SpellChecker::markMisspellingsAfterTypingToWord(
488 const VisiblePosition& wordStart) { 488 const VisiblePosition& wordStart) {
489 TRACE_EVENT0("blink", "SpellChecker::markMisspellingsAfterTypingToWord"); 489 TRACE_EVENT0("blink", "SpellChecker::markMisspellingsAfterTypingToWord");
490 490
491 VisibleSelection adjacentWords = 491 VisibleSelection adjacentWords =
492 createVisibleSelection(selectWord(wordStart)); 492 createVisibleSelection(selectWord(wordStart));
493 markMisspellingsInternal(adjacentWords); 493 markMisspellingsInternal(adjacentWords);
494 } 494 }
495 495
496 bool SpellChecker::isSpellCheckingEnabledInFocusedNode() const { 496 bool SpellChecker::isSpellCheckingEnabledInFocusedNode() const {
497 Node* focusedNode = frame().selection().start().anchorNode(); 497 Node* focusedNode = frame()
498 .selection()
499 .selectionInDOMTree()
500 .computeStartPosition()
501 .anchorNode();
498 if (!focusedNode) 502 if (!focusedNode)
499 return false; 503 return false;
500 const Element* focusedElement = focusedNode->isElementNode() 504 const Element* focusedElement = focusedNode->isElementNode()
501 ? toElement(focusedNode) 505 ? toElement(focusedNode)
502 : focusedNode->parentElement(); 506 : focusedNode->parentElement();
503 if (!focusedElement) 507 if (!focusedElement)
504 return false; 508 return false;
505 return focusedElement->isSpellCheckingEnabled(); 509 return focusedElement->isSpellCheckingEnabled();
506 } 510 }
507 511
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 startOfNextParagraph(createVisiblePosition(paragraphEnd)); 1181 startOfNextParagraph(createVisiblePosition(paragraphEnd));
1178 paragraphStart = newParagraphStart.toParentAnchoredPosition(); 1182 paragraphStart = newParagraphStart.toParentAnchoredPosition();
1179 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); 1183 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition();
1180 firstIteration = false; 1184 firstIteration = false;
1181 totalLengthProcessed += currentLength; 1185 totalLengthProcessed += currentLength;
1182 } 1186 }
1183 return std::make_pair(firstFoundItem, firstFoundOffset); 1187 return std::make_pair(firstFoundItem, firstFoundOffset);
1184 } 1188 }
1185 1189
1186 } // namespace blink 1190 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698