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

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

Issue 2705113003: Add clean layout DCHECK to mostBackwardCaretPosition() (Closed)
Patch Set: 2017-02-21T17:42:08 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/VisibleUnits.cpp » ('j') | 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 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 template <typename Strategy> 187 template <typename Strategy>
188 EphemeralRangeTemplate<Strategy> 188 EphemeralRangeTemplate<Strategy>
189 VisibleSelectionTemplate<Strategy>::toNormalizedEphemeralRange() const { 189 VisibleSelectionTemplate<Strategy>::toNormalizedEphemeralRange() const {
190 if (isNone()) 190 if (isNone())
191 return EphemeralRangeTemplate<Strategy>(); 191 return EphemeralRangeTemplate<Strategy>();
192 192
193 // Make sure we have an updated layout since this function is called 193 // Make sure we have an updated layout since this function is called
194 // in the course of running edit commands which modify the DOM. 194 // in the course of running edit commands which modify the DOM.
195 // Failing to ensure this can result in equivalentXXXPosition calls returning 195 // Failing to ensure this can result in equivalentXXXPosition calls returning
196 // incorrect results. 196 // incorrect results.
197 DCHECK(!m_start.document()->needsLayoutTreeUpdate()); 197 DCHECK(!needsLayoutTreeUpdate(m_start)) << *this;
198 198
199 if (isCaret()) { 199 if (isCaret()) {
200 // If the selection is a caret, move the range start upstream. This 200 // If the selection is a caret, move the range start upstream. This
201 // helps us match the conventions of text editors tested, which make 201 // helps us match the conventions of text editors tested, which make
202 // style determinations based on the character before the caret, if any. 202 // style determinations based on the character before the caret, if any.
203 const PositionTemplate<Strategy> start = 203 const PositionTemplate<Strategy> start =
204 mostBackwardCaretPosition(m_start).parentAnchoredEquivalent(); 204 mostBackwardCaretPosition(m_start).parentAnchoredEquivalent();
205 return EphemeralRangeTemplate<Strategy>(start, start); 205 return EphemeralRangeTemplate<Strategy>(start, start);
206 } 206 }
207 // If the selection is a range, select the minimum range that encompasses 207 // If the selection is a range, select the minimum range that encompasses
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 857
858 void showTree(const blink::VisibleSelectionInFlatTree& sel) { 858 void showTree(const blink::VisibleSelectionInFlatTree& sel) {
859 sel.showTreeForThis(); 859 sel.showTreeForThis();
860 } 860 }
861 861
862 void showTree(const blink::VisibleSelectionInFlatTree* sel) { 862 void showTree(const blink::VisibleSelectionInFlatTree* sel) {
863 if (sel) 863 if (sel)
864 sel->showTreeForThis(); 864 sel->showTreeForThis();
865 } 865 }
866 #endif 866 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698