| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 template <typename Strategy> | 53 template <typename Strategy> |
| 54 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate( | 54 VisibleSelectionTemplate<Strategy>::VisibleSelectionTemplate( |
| 55 const SelectionTemplate<Strategy>& selection) | 55 const SelectionTemplate<Strategy>& selection) |
| 56 : m_base(selection.base()), | 56 : m_base(selection.base()), |
| 57 m_extent(selection.extent()), | 57 m_extent(selection.extent()), |
| 58 m_affinity(selection.affinity()), | 58 m_affinity(selection.affinity()), |
| 59 m_isDirectional(selection.isDirectional()), | 59 m_isDirectional(selection.isDirectional()), |
| 60 m_granularity(selection.granularity()), | 60 m_granularity(selection.granularity()), |
| 61 m_hasTrailingWhitespace(selection.hasTrailingWhitespace()) { | 61 m_hasTrailingWhitespace(selection.hasTrailingWhitespace()) { |
| 62 validate(); | 62 validate(m_granularity); |
| 63 } | 63 } |
| 64 | 64 |
| 65 template <typename Strategy> | 65 template <typename Strategy> |
| 66 VisibleSelectionTemplate<Strategy> VisibleSelectionTemplate<Strategy>::create( | 66 VisibleSelectionTemplate<Strategy> VisibleSelectionTemplate<Strategy>::create( |
| 67 const SelectionTemplate<Strategy>& selection) { | 67 const SelectionTemplate<Strategy>& selection) { |
| 68 return VisibleSelectionTemplate(selection); | 68 return VisibleSelectionTemplate(selection); |
| 69 } | 69 } |
| 70 | 70 |
| 71 VisibleSelection createVisibleSelection(const SelectionInDOMTree& selection) { | 71 VisibleSelection createVisibleSelection(const SelectionInDOMTree& selection) { |
| 72 return VisibleSelection::create(selection); | 72 return VisibleSelection::create(selection); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // beginning of the next text node, each of which has a different style. | 200 // beginning of the next text node, each of which has a different style. |
| 201 // | 201 // |
| 202 // On a treasure map, <b>X</b> marks the spot. | 202 // On a treasure map, <b>X</b> marks the spot. |
| 203 // ^ selected | 203 // ^ selected |
| 204 // | 204 // |
| 205 DCHECK(isRange()); | 205 DCHECK(isRange()); |
| 206 return normalizeRange(EphemeralRangeTemplate<Strategy>(m_start, m_end)); | 206 return normalizeRange(EphemeralRangeTemplate<Strategy>(m_start, m_end)); |
| 207 } | 207 } |
| 208 | 208 |
| 209 template <typename Strategy> | 209 template <typename Strategy> |
| 210 void VisibleSelectionTemplate<Strategy>::expandUsingGranularity( | |
| 211 TextGranularity granularity) { | |
| 212 if (isNone()) | |
| 213 return; | |
| 214 validate(granularity); | |
| 215 } | |
| 216 | |
| 217 template <typename Strategy> | |
| 218 static EphemeralRangeTemplate<Strategy> makeSearchRange( | 210 static EphemeralRangeTemplate<Strategy> makeSearchRange( |
| 219 const PositionTemplate<Strategy>& pos) { | 211 const PositionTemplate<Strategy>& pos) { |
| 220 Node* node = pos.anchorNode(); | 212 Node* node = pos.anchorNode(); |
| 221 if (!node) | 213 if (!node) |
| 222 return EphemeralRangeTemplate<Strategy>(); | 214 return EphemeralRangeTemplate<Strategy>(); |
| 223 Document& document = node->document(); | 215 Document& document = node->document(); |
| 224 if (!document.documentElement()) | 216 if (!document.documentElement()) |
| 225 return EphemeralRangeTemplate<Strategy>(); | 217 return EphemeralRangeTemplate<Strategy>(); |
| 226 Element* boundary = enclosingBlockFlowElement(*node); | 218 Element* boundary = enclosingBlockFlowElement(*node); |
| 227 if (!boundary) | 219 if (!boundary) |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 | 826 |
| 835 void showTree(const blink::VisibleSelectionInFlatTree& sel) { | 827 void showTree(const blink::VisibleSelectionInFlatTree& sel) { |
| 836 sel.showTreeForThis(); | 828 sel.showTreeForThis(); |
| 837 } | 829 } |
| 838 | 830 |
| 839 void showTree(const blink::VisibleSelectionInFlatTree* sel) { | 831 void showTree(const blink::VisibleSelectionInFlatTree* sel) { |
| 840 if (sel) | 832 if (sel) |
| 841 sel->showTreeForThis(); | 833 sel->showTreeForThis(); |
| 842 } | 834 } |
| 843 #endif | 835 #endif |
| OLD | NEW |