OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 } | 195 } |
196 } | 196 } |
197 | 197 |
198 template <typename Strategy> | 198 template <typename Strategy> |
199 void FrameSelection::setNonDirectionalSelectionIfNeededAlgorithm(const VisibleSe
lection& passedNewSelection, TextGranularity granularity, | 199 void FrameSelection::setNonDirectionalSelectionIfNeededAlgorithm(const VisibleSe
lection& passedNewSelection, TextGranularity granularity, |
200 EndPointsAdjustmentMode endpointsAdjustmentMode) | 200 EndPointsAdjustmentMode endpointsAdjustmentMode) |
201 { | 201 { |
202 VisibleSelection newSelection = passedNewSelection; | 202 VisibleSelection newSelection = passedNewSelection; |
203 bool isDirectional = shouldAlwaysUseDirectionalSelection(m_frame) || newSele
ction.isDirectional(); | 203 bool isDirectional = shouldAlwaysUseDirectionalSelection(m_frame) || newSele
ction.isDirectional(); |
204 | 204 |
205 VisiblePosition base = m_originalBase.isNotNull() ? m_originalBase : createV
isiblePosition(Strategy::selectionBase(newSelection)); | 205 VisiblePosition base = m_originalBase.isNotNull() ? m_originalBase : createV
isiblePositionInDOMTree(Strategy::selectionBase(newSelection)); |
206 VisiblePosition newBase = base; | 206 VisiblePosition newBase = base; |
207 VisiblePosition extent = createVisiblePosition(Strategy::selectionExtent(new
Selection)); | 207 VisiblePosition extent = createVisiblePositionInDOMTree(Strategy::selectionE
xtent(newSelection)); |
208 VisiblePosition newExtent = extent; | 208 VisiblePosition newExtent = extent; |
209 if (endpointsAdjustmentMode == AdjustEndpointsAtBidiBoundary) | 209 if (endpointsAdjustmentMode == AdjustEndpointsAtBidiBoundary) |
210 adjustEndpointsAtBidiBoundary(newBase, newExtent); | 210 adjustEndpointsAtBidiBoundary(newBase, newExtent); |
211 | 211 |
212 if (newBase.deepEquivalent() != base.deepEquivalent() || newExtent.deepEquiv
alent() != extent.deepEquivalent()) { | 212 if (newBase.deepEquivalent() != base.deepEquivalent() || newExtent.deepEquiv
alent() != extent.deepEquivalent()) { |
213 m_originalBase = base; | 213 m_originalBase = base; |
214 newSelection.setBase(newBase); | 214 newSelection.setBase(newBase); |
215 newSelection.setExtent(newExtent); | 215 newSelection.setExtent(newExtent); |
216 } else if (m_originalBase.isNotNull()) { | 216 } else if (m_originalBase.isNotNull()) { |
217 if (Strategy::selectionBase(m_selection) == Strategy::selectionBase(newS
election)) | 217 if (Strategy::selectionBase(m_selection) == Strategy::selectionBase(newS
election)) |
(...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2091 | 2091 |
2092 void showTree(const blink::FrameSelection* sel) | 2092 void showTree(const blink::FrameSelection* sel) |
2093 { | 2093 { |
2094 if (sel) | 2094 if (sel) |
2095 sel->showTreeForThis(); | 2095 sel->showTreeForThis(); |
2096 else | 2096 else |
2097 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); | 2097 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); |
2098 } | 2098 } |
2099 | 2099 |
2100 #endif | 2100 #endif |
OLD | NEW |