| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 VisiblePositionTemplate<Strategy>::VisiblePositionTemplate(const PositionWithAff
inityTemplate<Strategy>& positionWithAffinity) | 52 VisiblePositionTemplate<Strategy>::VisiblePositionTemplate(const PositionWithAff
inityTemplate<Strategy>& positionWithAffinity) |
| 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().inShadowIncludingDocument()) << posit
ionWithAffinity; | 62 DCHECK(positionWithAffinity.position().isConnected()) << positionWithAffinit
y; |
| 63 const PositionTemplate<Strategy> deepPosition = canonicalPositionOf(position
WithAffinity.position()); | 63 const PositionTemplate<Strategy> deepPosition = canonicalPositionOf(position
WithAffinity.position()); |
| 64 if (deepPosition.isNull()) | 64 if (deepPosition.isNull()) |
| 65 return VisiblePositionTemplate<Strategy>(); | 65 return VisiblePositionTemplate<Strategy>(); |
| 66 const PositionWithAffinityTemplate<Strategy> downstreamPosition(deepPosition
); | 66 const PositionWithAffinityTemplate<Strategy> downstreamPosition(deepPosition
); |
| 67 if (positionWithAffinity.affinity() == TextAffinity::Downstream) | 67 if (positionWithAffinity.affinity() == TextAffinity::Downstream) |
| 68 return VisiblePositionTemplate<Strategy>(downstreamPosition); | 68 return VisiblePositionTemplate<Strategy>(downstreamPosition); |
| 69 | 69 |
| 70 // When not at a line wrap, make sure to end up with | 70 // When not at a line wrap, make sure to end up with |
| 71 // |TextAffinity::Downstream| affinity. | 71 // |TextAffinity::Downstream| affinity. |
| 72 const PositionWithAffinityTemplate<Strategy> upstreamPosition(deepPosition,
TextAffinity::Upstream); | 72 const PositionWithAffinityTemplate<Strategy> upstreamPosition(deepPosition,
TextAffinity::Upstream); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 182 } |
| 183 DVLOG(0) << "Cannot showTree for (nil) VisiblePosition."; | 183 DVLOG(0) << "Cannot showTree for (nil) VisiblePosition."; |
| 184 } | 184 } |
| 185 | 185 |
| 186 void showTree(const blink::VisiblePosition& vpos) | 186 void showTree(const blink::VisiblePosition& vpos) |
| 187 { | 187 { |
| 188 vpos.showTreeForThis(); | 188 vpos.showTreeForThis(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 #endif | 191 #endif |
| OLD | NEW |