Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 // tested, which make style determinations based on the first character of | 262 // tested, which make style determinations based on the first character of |
| 263 // the selection. For instance, this operation helps to make sure that the | 263 // the selection. For instance, this operation helps to make sure that the |
| 264 // "X" selected below is the only thing selected. The range should not be | 264 // "X" selected below is the only thing selected. The range should not be |
| 265 // allowed to "leak" out to the end of the previous text node, or to the | 265 // allowed to "leak" out to the end of the previous text node, or to the |
| 266 // beginning of the next text node, each of which has a different style. | 266 // beginning of the next text node, each of which has a different style. |
| 267 // | 267 // |
| 268 // On a treasure map, <b>X</b> marks the spot. | 268 // On a treasure map, <b>X</b> marks the spot. |
| 269 // ^ selected | 269 // ^ selected |
| 270 // | 270 // |
| 271 ASSERT(isRange()); | 271 ASSERT(isRange()); |
| 272 return normalizeRange(EphemeralRange(m_start, m_end)); | 272 const EphemeralRange range(m_start, m_end); |
| 273 return range.isNotNull() ? normalizeRange(range) : range; | |
|
yosin_UTC9
2015/10/01 06:29:09
Why do you check |range.isNotNull()|?
If |isRange(
kotenkov
2015/10/02 08:28:07
Yes, you are right. Now I understand that I should
| |
| 273 } | 274 } |
| 274 | 275 |
| 275 bool VisibleSelection::expandUsingGranularity(TextGranularity granularity) | 276 bool VisibleSelection::expandUsingGranularity(TextGranularity granularity) |
| 276 { | 277 { |
| 277 if (isNone()) | 278 if (isNone()) |
| 278 return false; | 279 return false; |
| 279 | 280 |
| 280 // FIXME: Do we need to check all of them? | 281 // FIXME: Do we need to check all of them? |
| 281 Position oldBase = m_base; | 282 Position oldBase = m_base; |
| 282 Position oldExtent = m_extent; | 283 Position oldExtent = m_extent; |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1165 } | 1166 } |
| 1166 | 1167 |
| 1167 template <typename Strategy> | 1168 template <typename Strategy> |
| 1168 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate() | 1169 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate() |
| 1169 { | 1170 { |
| 1170 } | 1171 } |
| 1171 | 1172 |
| 1172 template <typename Strategy> | 1173 template <typename Strategy> |
| 1173 EphemeralRangeTemplate<Strategy> VisibleSelectionTemplate<Strategy>::toNormalize dEphemeralRange() const | 1174 EphemeralRangeTemplate<Strategy> VisibleSelectionTemplate<Strategy>::toNormalize dEphemeralRange() const |
| 1174 { | 1175 { |
| 1175 return normalizeRange(EphemeralRangeTemplate<Strategy>(start(), end())); | 1176 const EphemeralRangeTemplate<Strategy> range(start(), end()); |
|
yosin_UTC9
2015/10/01 06:29:09
Do you have a case we call |toNormalizedEphemeralR
kotenkov
2015/10/02 08:28:07
No, it seems, that we should only call |toNormaliz
| |
| 1177 return range.isNotNull() ? normalizeRange(range) : range; | |
| 1176 } | 1178 } |
| 1177 | 1179 |
| 1178 template <typename Strategy> | 1180 template <typename Strategy> |
| 1179 void VisibleSelectionTemplate<Strategy>::setBase(const VisiblePositionTemplate<S trategy>& newBase) | 1181 void VisibleSelectionTemplate<Strategy>::setBase(const VisiblePositionTemplate<S trategy>& newBase) |
| 1180 { | 1182 { |
| 1181 return setBase(newBase.deepEquivalent()); | 1183 return setBase(newBase.deepEquivalent()); |
| 1182 } | 1184 } |
| 1183 | 1185 |
| 1184 template <typename Strategy> | 1186 template <typename Strategy> |
| 1185 void VisibleSelectionTemplate<Strategy>::setExtent(const VisiblePositionTemplate <Strategy>& newExtent) | 1187 void VisibleSelectionTemplate<Strategy>::setExtent(const VisiblePositionTemplate <Strategy>& newExtent) |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1405 sel.showTreeForThis(); | 1407 sel.showTreeForThis(); |
| 1406 } | 1408 } |
| 1407 | 1409 |
| 1408 void showTree(const blink::VisibleSelection* sel) | 1410 void showTree(const blink::VisibleSelection* sel) |
| 1409 { | 1411 { |
| 1410 if (sel) | 1412 if (sel) |
| 1411 sel->showTreeForThis(); | 1413 sel->showTreeForThis(); |
| 1412 } | 1414 } |
| 1413 | 1415 |
| 1414 #endif | 1416 #endif |
| OLD | NEW |