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 : visible
PositionOf(Strategy::selectionBase(newSelection)); | 205 VisiblePosition base = m_originalBase.isNotNull() ? m_originalBase : createV
isiblePosition(Strategy::selectionBase(newSelection)); |
206 VisiblePosition newBase = base; | 206 VisiblePosition newBase = base; |
207 VisiblePosition extent = visiblePositionOf(Strategy::selectionExtent(newSele
ction)); | 207 VisiblePosition extent = createVisiblePosition(Strategy::selectionExtent(new
Selection)); |
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 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 if (!document->layoutView()) | 1357 if (!document->layoutView()) |
1358 return false; | 1358 return false; |
1359 | 1359 |
1360 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active); | 1360 HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active); |
1361 HitTestResult result(request, point); | 1361 HitTestResult result(request, point); |
1362 document->layoutView()->hitTest(result); | 1362 document->layoutView()->hitTest(result); |
1363 Node* innerNode = result.innerNode(); | 1363 Node* innerNode = result.innerNode(); |
1364 if (!innerNode || !innerNode->layoutObject()) | 1364 if (!innerNode || !innerNode->layoutObject()) |
1365 return false; | 1365 return false; |
1366 | 1366 |
1367 VisiblePosition visiblePos = visiblePositionOf(innerNode->layoutObject()->po
sitionForPoint(result.localPoint())); | 1367 VisiblePosition visiblePos = createVisiblePosition(innerNode->layoutObject()
->positionForPoint(result.localPoint())); |
1368 if (visiblePos.isNull()) | 1368 if (visiblePos.isNull()) |
1369 return false; | 1369 return false; |
1370 | 1370 |
1371 VisiblePosition visibleStart = Strategy::selectionVisibleStart(m_selection); | 1371 VisiblePosition visibleStart = Strategy::selectionVisibleStart(m_selection); |
1372 VisiblePosition visibleEnd = Strategy::selectionVisibleEnd(m_selection); | 1372 VisiblePosition visibleEnd = Strategy::selectionVisibleEnd(m_selection); |
1373 if (visibleStart.isNull() || visibleEnd.isNull()) | 1373 if (visibleStart.isNull() || visibleEnd.isNull()) |
1374 return false; | 1374 return false; |
1375 | 1375 |
1376 PositionType start(Strategy::toPositionType(visibleStart.deepEquivalent())); | 1376 PositionType start(Strategy::toPositionType(visibleStart.deepEquivalent())); |
1377 PositionType end(Strategy::toPositionType(visibleEnd.deepEquivalent())); | 1377 PositionType end(Strategy::toPositionType(visibleEnd.deepEquivalent())); |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2069 | 2069 |
2070 void showTree(const blink::FrameSelection* sel) | 2070 void showTree(const blink::FrameSelection* sel) |
2071 { | 2071 { |
2072 if (sel) | 2072 if (sel) |
2073 sel->showTreeForThis(); | 2073 sel->showTreeForThis(); |
2074 else | 2074 else |
2075 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); | 2075 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); |
2076 } | 2076 } |
2077 | 2077 |
2078 #endif | 2078 #endif |
OLD | NEW |