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

Side by Side Diff: third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp

Issue 2292023002: Audit the use of updateStyleAndLayoutIgnorePendingStylesheets in TextIterator::rangeLength (Closed)
Patch Set: 201609011431 Created 4 years, 3 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 | « no previous file | 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) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
3 * Copyright (C) 2005 Alexey Proskuryakov. 3 * Copyright (C) 2005 Alexey Proskuryakov.
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 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 1114
1115 template<typename Strategy> 1115 template<typename Strategy>
1116 PositionTemplate<Strategy> TextIteratorAlgorithm<Strategy>::endPositionInCurrent Container() const 1116 PositionTemplate<Strategy> TextIteratorAlgorithm<Strategy>::endPositionInCurrent Container() const
1117 { 1117 {
1118 return PositionTemplate<Strategy>::editingPositionOf(currentContainer(), end OffsetInCurrentContainer()); 1118 return PositionTemplate<Strategy>::editingPositionOf(currentContainer(), end OffsetInCurrentContainer());
1119 } 1119 }
1120 1120
1121 template<typename Strategy> 1121 template<typename Strategy>
1122 int TextIteratorAlgorithm<Strategy>::rangeLength(const PositionTemplate<Strategy >& start, const PositionTemplate<Strategy>& end, bool forSelectionPreservation) 1122 int TextIteratorAlgorithm<Strategy>::rangeLength(const PositionTemplate<Strategy >& start, const PositionTemplate<Strategy>& end, bool forSelectionPreservation)
1123 { 1123 {
1124 // TODO(dglazkov): The use of updateStyleAndLayoutIgnorePendingStylesheets n eeds to be audited. 1124 DCHECK(start.document());
1125 // see http://crbug.com/590369 for more details. 1125 DocumentLifecycle::DisallowTransitionScope disallowTransition(start.document ()->lifecycle());
1126 start.document()->updateStyleAndLayoutIgnorePendingStylesheets();
1127 1126
1128 int length = 0; 1127 int length = 0;
1129 TextIteratorBehaviorFlags behaviorFlags = TextIteratorEmitsObjectReplacement Character; 1128 TextIteratorBehaviorFlags behaviorFlags = TextIteratorEmitsObjectReplacement Character;
1130 if (forSelectionPreservation) 1129 if (forSelectionPreservation)
1131 behaviorFlags |= TextIteratorEmitsCharactersBetweenAllVisiblePositions; 1130 behaviorFlags |= TextIteratorEmitsCharactersBetweenAllVisiblePositions;
1132 for (TextIteratorAlgorithm<Strategy> it(start, end, behaviorFlags); !it.atEn d(); it.advance()) 1131 for (TextIteratorAlgorithm<Strategy> it(start, end, behaviorFlags); !it.atEn d(); it.advance())
1133 length += it.length(); 1132 length += it.length();
1134 1133
1135 return length; 1134 return length;
1136 } 1135 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 1210
1212 String plainText(const EphemeralRangeInFlatTree& range, TextIteratorBehaviorFlag s behavior) 1211 String plainText(const EphemeralRangeInFlatTree& range, TextIteratorBehaviorFlag s behavior)
1213 { 1212 {
1214 return createPlainText<EditingInFlatTreeStrategy>(range, behavior); 1213 return createPlainText<EditingInFlatTreeStrategy>(range, behavior);
1215 } 1214 }
1216 1215
1217 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingStrategy>; 1216 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingStrategy>;
1218 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingInFlatTreeStrat egy>; 1217 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingInFlatTreeStrat egy>;
1219 1218
1220 } // namespace blink 1219 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698