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

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

Issue 225303002: Let Selection.collapse remember a raw Position instead of a canonicalized one. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix setSelectedRange arguments Created 6 years, 6 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 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 1396
1397 if (selectStartTarget && !selectStartTarget->dispatchEvent(Event::createCanc elableBubble(EventTypeNames::selectstart))) 1397 if (selectStartTarget && !selectStartTarget->dispatchEvent(Event::createCanc elableBubble(EventTypeNames::selectstart)))
1398 return; 1398 return;
1399 1399
1400 VisibleSelection newSelection(VisibleSelection::selectionFromContentsOfNode( root.get())); 1400 VisibleSelection newSelection(VisibleSelection::selectionFromContentsOfNode( root.get()));
1401 setSelection(newSelection); 1401 setSelection(newSelection);
1402 selectFrameElementInParentIfFullySelected(); 1402 selectFrameElementInParentIfFullySelected();
1403 notifyRendererOfSelectionChange(UserTriggered); 1403 notifyRendererOfSelectionChange(UserTriggered);
1404 } 1404 }
1405 1405
1406 bool FrameSelection::setSelectedRange(Range* range, EAffinity affinity, SetSelec tionOptions options) 1406 bool FrameSelection::setSelectedRange(Range* range, EAffinity affinity, bool isD irectional, SetSelectionOptions options)
1407 { 1407 {
1408 if (!range || !range->startContainer() || !range->endContainer()) 1408 if (!range || !range->startContainer() || !range->endContainer())
1409 return false; 1409 return false;
1410 ASSERT(range->startContainer()->document() == range->endContainer()->documen t()); 1410 ASSERT(range->startContainer()->document() == range->endContainer()->documen t());
1411 1411
1412 // Non-collapsed ranges are not allowed to start at the end of a line that i s wrapped, 1412 // Non-collapsed ranges are not allowed to start at the end of a line that i s wrapped,
1413 // they start at the beginning of the next line instead 1413 // they start at the beginning of the next line instead
1414 m_logicalRange = nullptr; 1414 m_logicalRange = nullptr;
1415 stopObservingVisibleSelectionChangeIfNecessary(); 1415 stopObservingVisibleSelectionChangeIfNecessary();
1416 1416
1417 VisibleSelection newSelection(range, affinity); 1417 VisibleSelection newSelection(range, affinity, isDirectional);
1418 setSelection(newSelection, options); 1418 setSelection(newSelection, options);
1419 1419
1420 m_logicalRange = range->cloneRange(); 1420 m_logicalRange = range->cloneRange();
1421 startObservingVisibleSelectionChange(); 1421 startObservingVisibleSelectionChange();
1422 1422
1423 return true; 1423 return true;
1424 } 1424 }
1425 1425
1426 PassRefPtrWillBeRawPtr<Range> FrameSelection::firstRange() const 1426 PassRefPtrWillBeRawPtr<Range> FrameSelection::firstRange() const
1427 { 1427 {
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1882 sel.showTreeForThis(); 1882 sel.showTreeForThis();
1883 } 1883 }
1884 1884
1885 void showTree(const WebCore::FrameSelection* sel) 1885 void showTree(const WebCore::FrameSelection* sel)
1886 { 1886 {
1887 if (sel) 1887 if (sel)
1888 sel->showTreeForThis(); 1888 sel->showTreeForThis();
1889 } 1889 }
1890 1890
1891 #endif 1891 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698