Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: Source/core/editing/FrameSelection.cpp

Issue 1326563002: Introduce visiblePositionOf() with PositionWithAffinity as replacement of VisiblePosition constructo (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-09-01T10:55:04 Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(innerNode->layoutObject()->positionForPoint(resul t.localPoint())); 1367 VisiblePosition visiblePos = visiblePositionOf(innerNode->layoutObject()->po sitionForPoint(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
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
OLDNEW
« no previous file with comments | « Source/core/editing/DragCaretController.cpp ('k') | Source/core/editing/SelectionController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698