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

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

Issue 2332723002: Audit the use of updateStyleAndLayoutIgnorePendingStylesheets in canonicalPosition (Closed)
Patch Set: Change if to DCHECK 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 | 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, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
3 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved. 3 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved.
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 : m_positionWithAffinity(positionWithAffinity) 53 : m_positionWithAffinity(positionWithAffinity)
54 { 54 {
55 } 55 }
56 56
57 template<typename Strategy> 57 template<typename Strategy>
58 VisiblePositionTemplate<Strategy> VisiblePositionTemplate<Strategy>::create(cons t PositionWithAffinityTemplate<Strategy>& positionWithAffinity) 58 VisiblePositionTemplate<Strategy> VisiblePositionTemplate<Strategy>::create(cons t PositionWithAffinityTemplate<Strategy>& positionWithAffinity)
59 { 59 {
60 if (positionWithAffinity.isNull()) 60 if (positionWithAffinity.isNull())
61 return VisiblePositionTemplate<Strategy>(); 61 return VisiblePositionTemplate<Strategy>();
62 DCHECK(positionWithAffinity.position().isConnected()) << positionWithAffinit y; 62 DCHECK(positionWithAffinity.position().isConnected()) << positionWithAffinit y;
63
64 Document& document = *positionWithAffinity.position().document();
65
66 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
67 // needs to be audited. See http://crbug.com/590369 for more details.
68 document.updateStyleAndLayoutIgnorePendingStylesheets();
69
70 DocumentLifecycle::DisallowTransitionScope disallowTransition(document.lifec ycle());
71
63 const PositionTemplate<Strategy> deepPosition = canonicalPositionOf(position WithAffinity.position()); 72 const PositionTemplate<Strategy> deepPosition = canonicalPositionOf(position WithAffinity.position());
64 if (deepPosition.isNull()) 73 if (deepPosition.isNull())
65 return VisiblePositionTemplate<Strategy>(); 74 return VisiblePositionTemplate<Strategy>();
66 const PositionWithAffinityTemplate<Strategy> downstreamPosition(deepPosition ); 75 const PositionWithAffinityTemplate<Strategy> downstreamPosition(deepPosition );
67 if (positionWithAffinity.affinity() == TextAffinity::Downstream) 76 if (positionWithAffinity.affinity() == TextAffinity::Downstream)
68 return VisiblePositionTemplate<Strategy>(downstreamPosition); 77 return VisiblePositionTemplate<Strategy>(downstreamPosition);
69 78
70 // When not at a line wrap, make sure to end up with 79 // When not at a line wrap, make sure to end up with
71 // |TextAffinity::Downstream| affinity. 80 // |TextAffinity::Downstream| affinity.
72 const PositionWithAffinityTemplate<Strategy> upstreamPosition(deepPosition, TextAffinity::Upstream); 81 const PositionWithAffinityTemplate<Strategy> upstreamPosition(deepPosition, TextAffinity::Upstream);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 175 }
167 DVLOG(0) << "Cannot showTree for (nil) VisiblePosition."; 176 DVLOG(0) << "Cannot showTree for (nil) VisiblePosition.";
168 } 177 }
169 178
170 void showTree(const blink::VisiblePosition& vpos) 179 void showTree(const blink::VisiblePosition& vpos)
171 { 180 {
172 vpos.showTreeForThis(); 181 vpos.showTreeForThis();
173 } 182 }
174 183
175 #endif 184 #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