OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |