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

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

Issue 2702403004: Expand FrameSeleciton::start() to increase chances of hoisting update layout (Closed)
Patch Set: 2017-02-22T12:32:36 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 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 node = node->nextSibling(); 1042 node = node->nextSibling();
1043 } 1043 }
1044 1044
1045 return 0; 1045 return 0;
1046 } 1046 }
1047 1047
1048 bool SpellChecker::selectionStartHasMarkerFor( 1048 bool SpellChecker::selectionStartHasMarkerFor(
1049 DocumentMarker::MarkerType markerType, 1049 DocumentMarker::MarkerType markerType,
1050 int from, 1050 int from,
1051 int length) const { 1051 int length) const {
1052 Node* node = findFirstMarkable(frame().selection().start().anchorNode()); 1052 Node* node =
1053 findFirstMarkable(frame()
1054 .selection()
1055 .computeVisibleSelectionInDOMTreeDeprecated()
1056 .start()
1057 .anchorNode());
1053 if (!node) 1058 if (!node)
1054 return false; 1059 return false;
1055 1060
1056 unsigned startOffset = static_cast<unsigned>(from); 1061 unsigned startOffset = static_cast<unsigned>(from);
1057 unsigned endOffset = static_cast<unsigned>(from + length); 1062 unsigned endOffset = static_cast<unsigned>(from + length);
1058 DocumentMarkerVector markers = frame().document()->markers().markersFor(node); 1063 DocumentMarkerVector markers = frame().document()->markers().markersFor(node);
1059 for (size_t i = 0; i < markers.size(); ++i) { 1064 for (size_t i = 0; i < markers.size(); ++i) {
1060 DocumentMarker* marker = markers[i]; 1065 DocumentMarker* marker = markers[i];
1061 if (marker->startOffset() <= startOffset && 1066 if (marker->startOffset() <= startOffset &&
1062 endOffset <= marker->endOffset() && marker->type() == markerType) 1067 endOffset <= marker->endOffset() && marker->type() == markerType)
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 startOfNextParagraph(createVisiblePosition(paragraphEnd)); 1218 startOfNextParagraph(createVisiblePosition(paragraphEnd));
1214 paragraphStart = newParagraphStart.toParentAnchoredPosition(); 1219 paragraphStart = newParagraphStart.toParentAnchoredPosition();
1215 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); 1220 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition();
1216 firstIteration = false; 1221 firstIteration = false;
1217 totalLengthProcessed += currentLength; 1222 totalLengthProcessed += currentLength;
1218 } 1223 }
1219 return std::make_pair(firstFoundItem, firstFoundOffset); 1224 return std::make_pair(firstFoundItem, firstFoundOffset);
1220 } 1225 }
1221 1226
1222 } // namespace blink 1227 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698