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

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

Issue 1740173003: TextIteratorAlgorithm should not force layout update in constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed my WIP comment. Created 4 years, 9 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) 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 size_t docTextPosition = 0; 75 size_t docTextPosition = 0;
76 bool startRangeFound = false; 76 bool startRangeFound = false;
77 77
78 Position textRunStartPosition; 78 Position textRunStartPosition;
79 Position textRunEndPosition; 79 Position textRunEndPosition;
80 80
81 TextIteratorBehaviorFlags behaviorFlags = TextIteratorEmitsObjectReplacement Character; 81 TextIteratorBehaviorFlags behaviorFlags = TextIteratorEmitsObjectReplacement Character;
82 if (getRangeFor == ForSelection) 82 if (getRangeFor == ForSelection)
83 behaviorFlags |= TextIteratorEmitsCharactersBetweenAllVisiblePositions; 83 behaviorFlags |= TextIteratorEmitsCharactersBetweenAllVisiblePositions;
84 auto range = EphemeralRange::rangeOfContents(scope); 84 auto range = EphemeralRange::rangeOfContents(scope);
85
86 // TODO(dglazkov): The use of updateLayoutIgnorePendingStylesheets needs to be audited.
87 // see http://crbug.com/590369 for more details.
88 scope.document().updateLayoutIgnorePendingStylesheets();
89
85 TextIterator it(range.startPosition(), range.endPosition(), behaviorFlags); 90 TextIterator it(range.startPosition(), range.endPosition(), behaviorFlags);
86 91
87 // FIXME: the atEnd() check shouldn't be necessary, workaround for 92 // FIXME: the atEnd() check shouldn't be necessary, workaround for
88 // <http://bugs.webkit.org/show_bug.cgi?id=6289>. 93 // <http://bugs.webkit.org/show_bug.cgi?id=6289>.
89 if (!start() && !length() && it.atEnd()) 94 if (!start() && !length() && it.atEnd())
90 return EphemeralRange(Position(it.currentContainer(), 0)); 95 return EphemeralRange(Position(it.currentContainer(), 0));
91 96
92 Position resultStart = Position(&scope.document(), 0); 97 Position resultStart = Position(&scope.document(), 0);
93 Position resultEnd = resultStart; 98 Position resultEnd = resultStart;
94 99
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 185
181 return PlainTextRange(start, end); 186 return PlainTextRange(start, end);
182 } 187 }
183 188
184 PlainTextRange PlainTextRange::create(const ContainerNode& scope, const Range& r ange) 189 PlainTextRange PlainTextRange::create(const ContainerNode& scope, const Range& r ange)
185 { 190 {
186 return create(scope, EphemeralRange(&range)); 191 return create(scope, EphemeralRange(&range));
187 } 192 }
188 193
189 } // namespace blink 194 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698